@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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var ft=Object.defineProperty;var Ia=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Ca=Object.prototype.hasOwnProperty;var Pa=(e,t)=>{for(var o in t)ft(e,o,{get:t[o],enumerable:!0})},La=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of _a(t))!Ca.call(e,l)&&l!==o&&ft(e,l,{get:()=>t[l],enumerable:!(c=Ia(t,l))||c.enumerable});return e};var $a=e=>La(ft({},"__esModule",{value:!0}),e);var $s={};Pa($s,{CHUNK_SOURCE_LABELS:()=>ca,DegradedSearchBanner:()=>xt,DocumentIngestConsole:()=>Ba,EnrichmentStrategyBoard:()=>Ua,FLOW_FOCUS_RING:()=>Te,FLOW_GEOMETRY:()=>ia,FLOW_NODE_TEXT:()=>Me,FinishedInstant:()=>Xe,GATE_POLICY_LABELS:()=>Ot,GATE_STATE_PRESENTATION:()=>Mt,InfrastructureHealthMonitor:()=>Va,MetadataSearchWorkbench:()=>Qa,ModelComparisonWorkbench:()=>Xa,NOTHING_TO_READ_LABELS:()=>jt,OntologyStatusCard:()=>Za,PHASE_LABELS:()=>Tt,PIPELINE_RUN_STATUS_PRESENTATION:()=>De,PIPELINE_STEP_STATUS_PRESENTATION:()=>ot,PIPELINE_TRIGGER_LABELS:()=>rt,PipelineFlowViewer:()=>ds,PipelineRunInspector:()=>vs,QdrantStorageCard:()=>Cs,REASON_LABELS:()=>Ut,RecordedInstant:()=>ge,SCORE_DISPLAY_DECIMALS:()=>Pt,SEARCH_MODE_LABELS:()=>It,SEARCH_PRESETS:()=>oa,STEP_CARDS_OPEN_LIMIT:()=>ba,SyncStatusMonitor:()=>Ls,UNFINISHED_LABEL:()=>vt,formatComparisonScore:()=>Ct,gateCaption:()=>ua,gateState:()=>Ft,gateStateOf:()=>wt,ingestRowAction:()=>Yt,layoutFlow:()=>$t,pipelineRunPresentationKey:()=>Le,rankAgreement:()=>ra,skipReasonLabel:()=>ht,stepGatePolicy:()=>At,stepGateState:()=>pa});module.exports=$a($s);var Re=require("react/jsx-runtime"),Ut={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 xt({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let c=(e.degradation_reason??"").split(",").map(l=>l.trim()).filter(l=>l.length>0);return(0,Re.jsx)("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:(0,Re.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("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"]}),c.length>0&&(0,Re.jsx)("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:c.map(l=>(0,Re.jsx)("li",{"data-testid":`degraded-reason-${l}`,children:Ut[l]??l},l))})]}),t&&(0,Re.jsx)("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"})]})})}var Ee=require("@aiquants/enrichment-core"),V=require("react");var qt=require("@aiquants/console-ui/core");function Ae(e,t,o){try{(0,qt.formatCount)(e,o)}catch(c){throw new RangeError(`${t}: ${c.message}`,{cause:c})}return e}var Ht=1024,Ta=[{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 st(e,t,o){Ae(e,t,o);let[c,...l]=Ta,p=c,b=Gt(e,p);for(let m of l){if(b<Ht)break;p=m,b=Gt(e,p)}return`${new Intl.NumberFormat(o,{minimumFractionDigits:p.fractionDigits,maximumFractionDigits:p.fractionDigits,useGrouping:!0}).format(b)} ${p.name}`}var qe=require("@aiquants/console-ui"),yt=require("react");var We="ja-JP";function te(){let e=(0,qe.useConsoleUi)();if(e.locale!=="ja"||e.formatLocale!==We)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${We}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function q(e){return te(),(0,yt.createElement)(qe.Measured,e)}function zt(e){return te(),(0,yt.createElement)(qe.RowButton,e)}var je=require("react/jsx-runtime"),Je=/[^\s\x1c-\x1f\x85\ufeff]/,Aa={fontVariantNumeric:"tabular-nums"},Da={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Wt({text:e,testId:t,slot:o}){if(te(),e===null)return(0,je.jsx)(q,{value:null,testId:t});if(!Je.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(0,je.jsx)("span",{"data-measured":"true","data-testid":t,style:o,children:e})}function Qe({text:e,testId:t}){return(0,je.jsx)(Wt,{text:e,testId:t,slot:Aa})}function Se({text:e,testId:t}){return(0,je.jsx)(Wt,{text:e,testId:t,slot:Da})}var nt=require("@aiquants/enrichment-core"),De={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"}},ot={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"}},rt={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},vt="\u672A\u5B8C\u4E86";function Le(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var jt={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 ht(e){let t=(0,nt.parseSkipReason)(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`${nt.PIPELINE_STEPS[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return jt[t.token]}}var Jt=require("@aiquants/console-ui/core");function Qt(e,t){return(0,Jt.formatInstant)(e,We,t)}var Nt=require("react/jsx-runtime");function ge({iso:e,testId:t}){let{timeZone:o}=te();return(0,Nt.jsx)(Se,{text:e===null?null:Qt(e,o),testId:t})}function Xe({iso:e,testId:t}){return te(),e===null?vt:(0,Nt.jsx)(ge,{iso:e,testId:t})}var s=require("react/jsx-runtime"),Ma=new Set(Ee.EnrichmentSyncStatusSchema.options.filter(e=>e.startsWith("FAILED"))),Oa=new Set(Ee.EnrichmentSyncStatusSchema.options);function Yt(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Ma.has(e.syncStatus)?{kind:"retry"}:Oa.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Xt(e,t,o){let c=e?.find(l=>l.confidentialityLevel===t&&l.capability===o);return c?c.isEnabled:null}var Fa={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"},Ka=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function St({field:e}){return(0,s.jsx)("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Ba({policies:e,tenantId:t,domainOptions:o,recentItems:c=[],inspectionResult:l=null,isSubmitting:p=!1,isInspecting:b=!1,onInspectUri:m,onIngestDocument:y,onRetryItem:N,onShowHistory:h}){let{formatLocale:C}=te(),E=(0,V.useId)(),J=(0,V.useId)(),ae=(0,V.useId)(),K=(0,V.useId)(),I=(0,V.useId)(),Q=(0,V.useId)(),R=(0,V.useId)(),O=(0,V.useId)(),[A,L]=(0,V.useState)("gdrive://"),[G,g]=(0,V.useState)(""),[$,B]=(0,V.useState)(""),[D,re]=(0,V.useState)("CONFIDENTIAL"),[Z,be]=(0,V.useState)(null),[fe,_]=(0,V.useState)(""),[ie,H]=(0,V.useState)(""),[X,U]=(0,V.useState)([]),[xe,ne]=(0,V.useState)(""),[he,Ie]=(0,V.useState)("user"),[le,ye]=(0,V.useState)(1),[u,T]=(0,V.useState)(!1),ee=Z!==null&&o.some(r=>r.key===Z)?Z:o.length>0?o[0].key:null,z=(0,V.useMemo)(()=>({vectorEnabled:Xt(e,D,"vector_indexing"),graphEnabled:Xt(e,D,"graph_indexing")}),[e,D]),se=(0,V.useMemo)(()=>{let r=$.trim();if(!r)return{valid:!1,error:null};if(!(r.startsWith("file://")||r.startsWith("gdrive://")||r.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 W=r.replace(/^(file|gdrive|gcs):\/\//,"");return!W.trim()||W.trim()==="<id>"||W.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:r.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}},[$]),Fe=r=>{let k=r.trim(),W=k.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(W)return W[1];let ve=k.match(/[?&]id=([a-zA-Z0-9_-]+)/);return ve?ve[1]:null},_e=r=>{if(L(r),G.trim()){let k=G.trim().replace(/^(file|gdrive|gcs):\/\//,"");B(`${r}${k}`)}else B("")},Ke=r=>{let k=r.trim();if(!k){g(""),B("");return}let W=Fe(k);if(W){L("gdrive://"),g(W),B(`gdrive://${W}`);return}if(k.startsWith("gdrive://")){L("gdrive://");let ve=k.replace(/^gdrive:\/\//,"");g(ve),B(k);return}if(k.startsWith("file://")){L("file://");let ve=k.replace(/^file:\/\//,"");g(ve),B(k);return}if(k.startsWith("gcs://")){L("gcs://");let ve=k.replace(/^gcs:\/\//,"");g(ve),B(k);return}if(k.includes("://")){g(r),B(k);return}g(r),B(`${A}${k}`)},we=r=>{switch(r){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)"}},M=()=>{let r=xe.trim();r&&(X.some(k=>k.labelKey===r)||(U(k=>[...k,{labelKey:r,category:he,confidenceScore:Number(le.toFixed(2))}]),ne("")))},Be=r=>{X.some(k=>k.labelKey===r)||U(k=>[...k,{labelKey:r,category:"domain",confidenceScore:1}])},Ne=r=>{U(k=>k.filter(W=>W.labelKey!==r))},at=r=>{if(r.preventDefault(),!se.valid||ee===null)return;let k={fileUri:$.trim(),confidentialityLevel:D,targetDomainKey:ee,departmentId:fe.trim()?Number(fe):null,titleOverride:ie.trim()?ie.trim():null,labels:X};y?.(k)},Ue=r=>{let k=Yt(r);if(k.kind==="blocked")return(0,s.jsx)("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${r.id}`,"data-reason":k.reason,children:k.reason});let W=k.kind==="retry";return(0,s.jsx)("button",{type:"button",onClick:()=>N?.(r.id),"aria-label":`${r.fileName} \u3092${W?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:W?"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-${k.kind}-button-${r.id}`,children:W?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},bt=r=>{switch(r){case"SYNCED":return(0,s.jsx)("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(0,s.jsx)("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(0,s.jsx)("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(0,s.jsx)("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(0,s.jsx)("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 r.startsWith("FAILED")?(0,s.jsxs)("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: ",r]}):(0,s.jsx)("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:r})}};return(0,s.jsxs)("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,s.jsxs)("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("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"}),(0,s.jsx)("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"})]}),(0,s.jsxs)("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: ",(0,s.jsx)("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),(0,s.jsxs)("form",{onSubmit:at,className:"mt-6 space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("label",{htmlFor:E,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",(0,s.jsx)(St,{field:"uri"})]}),(0,s.jsxs)("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",(0,s.jsx)("strong",{className:"font-semibold text-indigo-600",children:A})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),(0,s.jsx)("button",{type:"button",onClick:()=>_e("gdrive://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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)"}),(0,s.jsx)("button",{type:"button",onClick:()=>_e("file://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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)"}),(0,s.jsx)("button",{type:"button",onClick:()=>_e("gcs://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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)"})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[(0,s.jsxs)("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:[(0,s.jsx)("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:A}),(0,s.jsx)("input",{id:E,type:"text",value:G,onChange:r=>Ke(r.target.value),placeholder:we(A),"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})]}),(0,s.jsx)("button",{type:"button",onClick:()=>m?.($.trim()),disabled:!se.valid||b,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:b?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[(0,s.jsxs)("p",{className:"text-slate-500",children:[A==="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",A==="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",A==="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"]}),$&&(0,s.jsxs)("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[(0,s.jsx)("span",{children:"\u89E3\u6C7A URI:"}),(0,s.jsx)("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:$})]})]})]}),se.error&&(0,s.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:se.error})]}),l&&l.fileUri===$.trim()&&(0,s.jsxs)("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 ${l.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:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold",children:l.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)"}),(0,s.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:l.fileUri})]}),l.exists&&(0,s.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.fileName})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:(0,s.jsx)(Se,{text:st(l.fileSize,"fileSize",C),testId:"inspection-file-size-value"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"MIME:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.mimeType})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.revisionId?.slice(0,8)??"N/A"})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:J,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,s.jsx)(St,{field:"confidentiality"})]}),(0,s.jsx)("select",{id:J,value:D,onChange:r=>re(r.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:Ee.ConfidentialityLevelSchema.options.map(r=>(0,s.jsxs)("option",{value:r,children:[r," (",Fa[r],")"]},r))})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:ae,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,s.jsx)(St,{field:"domain"})]}),(0,s.jsx)("select",{id:ae,value:ee===null?"":ee,onChange:r=>be(r.target.value),disabled:o.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:o.map(r=>(0,s.jsx)("option",{value:r.key,children:r.label},r.key))}),o.length===0&&(0,s.jsx)("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"})]})]}),D===Ee.QUARANTINED_CONFIDENTIALITY_LEVEL&&(0,s.jsxs)("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:[(0,s.jsx)("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Ee.QUARANTINED_CONFIDENTIALITY_LEVEL," \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",(0,s.jsx)("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"})]}),(0,s.jsxs)("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:[(0,s.jsx)("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)"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,s.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),(0,s.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":z.vectorEnabled===null?"unknown":String(z.vectorEnabled),children:z.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":z.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${D} \u306E\u8A2D\u5B9A)`})]}),(0,s.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,s.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),(0,s.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":z.graphEnabled===null?"unknown":String(z.graphEnabled),children:z.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":z.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${D} \u306E\u8A2D\u5B9A)`})]})]}),(0,s.jsxs)("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 (",(0,s.jsx)("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"]})]}),(0,s.jsxs)("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),(0,s.jsxs)("span",{className:"text-slate-500 text-xs",children:[X.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),Ka.map(r=>(0,s.jsxs)("button",{type:"button",onClick:()=>Be(r),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-${r}`,children:["+ ",r]},r))]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[(0,s.jsxs)("div",{className:"space-y-1 sm:col-span-2",children:[(0,s.jsx)("label",{htmlFor:Q,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,s.jsx)("input",{id:Q,type:"text",value:xe,onChange:r=>ne(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),M())},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"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:R,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,s.jsxs)("select",{id:R,value:he,onChange:r=>Ie(r.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:[(0,s.jsx)("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),(0,s.jsx)("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),(0,s.jsx)("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:O,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",le.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)"]}),(0,s.jsx)("input",{id:O,type:"range",min:"0.0",max:"1.0",step:"0.05",value:le,"aria-valuenow":le,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(le*100)}%`,onChange:r=>ye(Number.parseFloat(r.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),(0,s.jsx)("div",{children:(0,s.jsx)("button",{type:"button",onClick:M,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"})})]}),X.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:X.map(r=>(0,s.jsxs)("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-${r.labelKey}`,children:[(0,s.jsx)("span",{className:"font-semibold",children:r.labelKey}),(0,s.jsxs)("span",{className:"text-indigo-400",children:["(",r.category,")"]}),(0,s.jsx)("button",{type:"button",onClick:()=>Ne(r.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${r.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${r.labelKey}`,children:"\xD7"})]},r.labelKey))})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":u,"aria-controls":"advanced-settings-panel",onClick:()=>T(r=>!r),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:(0,s.jsxs)("span",{children:[u?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),u&&(0,s.jsxs)("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:[(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:I,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),(0,s.jsx)("input",{id:I,type:"text",value:ie,onChange:r=>H(r.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"})]})}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:K,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,s.jsx)("input",{id:K,type:"number",value:fe,onChange:r=>_(r.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"})]})})]})]}),(0,s.jsx)("div",{className:"flex justify-end pt-2",children:(0,s.jsx)("button",{type:"submit",disabled:!se.valid||ee===null||p||b,"aria-busy":p,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:p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),(0,s.jsx)("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):(0,s.jsx)("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),(0,s.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,s.jsx)("div",{className:"flex items-center justify-between",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),(0,s.jsx)("p",{className:"text-slate-500 text-xs",children:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C"})]})}),c.length===0?(0,s.jsx)("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"}):(0,s.jsx)("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:(0,s.jsxs)("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:[(0,s.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:c.map(r=>(0,s.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${r.id}`,children:[(0,s.jsx)("td",{className:"px-3 py-2 font-bold",children:r.id}),(0,s.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:r.fileUri,children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:r.fileName}),(0,s.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:r.fileUri})]}),(0,s.jsx)("td",{className:"px-3 py-2",children:(0,s.jsx)("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:r.confidentialityLevel})}),(0,s.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",r.revision,r.isCurrent===!1&&(0,s.jsx)("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-${r.id}`,children:"\u65E7\u7248"})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans",children:[bt(r.syncStatus),r.errorMessage!==null&&r.errorMessage!==void 0&&r.errorMessage!==""&&(0,s.jsx)("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${r.id}`,title:r.errorMessage,children:r.errorMessage})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${r.id}`,children:[r.lastRun===null?(0,s.jsx)("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${r.id}`,children:"\u8A18\u9332\u306A\u3057"}):(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${De[Le(r.lastRun)].className}`,"data-testid":`ingest-last-run-status-${r.id}`,"data-status":r.lastRun.status,"data-presentation":Le(r.lastRun),children:De[Le(r.lastRun)].label}),r.lastRun.failedStepKey!==null&&(0,s.jsx)("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${r.id}`,children:Ee.PIPELINE_STEPS[r.lastRun.failedStepKey].label}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${r.id}`,children:(0,s.jsx)(Xe,{iso:r.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${r.id}`})})]}),h!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>h(r.id),"aria-label":`${r.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-${r.id}`,children:"\u5C65\u6B74"})]}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${r.id}`,children:(0,s.jsx)(ge,{iso:r.createdAt,testId:`ingest-created-at-value-${r.id}`})}),(0,s.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:Ue(r)})]},r.id))})]})})]})]})}var dt=require("@aiquants/enrichment-core"),F=require("react/jsx-runtime"),Zt={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 wt(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Ua({strategies:e,featureFlags:t,onToggleStage:o,isUpdating:c=!1}){let l=o===void 0;return(0,F.jsxs)("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:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,F.jsxs)("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",(0,F.jsx)("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 ",dt.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),l&&(0,F.jsx)("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?(0,F.jsx)("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"}):(0,F.jsx)("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:(0,F.jsxs)("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:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("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"}),dt.ENRICHMENT_STAGES.map(p=>{let b=wt(p.featureFlagKey,t);return(0,F.jsxs)("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[(0,F.jsx)("div",{children:p.label}),(0,F.jsx)("div",{"data-testid":`strategy-gate-${p.key}`,"data-gate":b,className:"mt-0.5 font-normal text-[10px]",style:{color:Zt[b].color},children:Zt[b].label})]},p.key)})]})}),(0,F.jsx)("tbody",{children:e.map(p=>(0,F.jsxs)("tr",{"data-testid":`strategy-row-${p.domainKey}`,"data-provenance":p.provenance,"data-active":String(p.isActive),children:[(0,F.jsxs)("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[(0,F.jsx)("div",{className:"font-semibold text-slate-900",children:p.domainLabel}),(0,F.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,F.jsx)("code",{children:p.domainKey})," / ",p.strategyName]}),(0,F.jsx)("div",{"data-testid":`strategy-provenance-${p.domainKey}`,className:"text-[10px] text-slate-500",children:p.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!p.isActive&&(0,F.jsx)("div",{"data-testid":`strategy-inactive-${p.domainKey}`,className:"text-[10px] text-amber-700",children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]}),dt.ENRICHMENT_STAGES.map(b=>{let m=p.stages[b.key],y=wt(b.featureFlagKey,t);return(0,F.jsxs)("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[(0,F.jsx)("button",{type:"button",role:"switch","aria-checked":m,"aria-label":`${p.domainLabel} \u306E ${b.label}`,"data-testid":`strategy-stage-${p.domainKey}-${b.key}`,"data-enabled":String(m),"data-effective":String(m&&(y==="open"||y==="absent")),disabled:l||c,onClick:()=>o?.(p,b.key,!m),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${m?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${l||c?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:m?"\u958B":"\u9589"}),m&&y==="unmeasured"&&(0,F.jsx)("div",{"data-testid":`strategy-unmeasured-${p.domainKey}-${b.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"}),m&&y==="closed"&&(0,F.jsx)("div",{"data-testid":`strategy-blocked-${p.domainKey}-${b.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"})]},b.key)})]},`${p.domainKey}:${p.strategyName}`))})]})})]})}var Ge={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},He={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};var f=require("react/jsx-runtime"),qa={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"},ea=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],Ga=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),it={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 ta(e){return e.kind==="text"?"anywhere":"atomic"}function sa(e,t){return t===null?{kind:"unmeasured"}:Ga.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 Ha(e){let t=ea.filter(c=>c in e),o=Object.keys(e).filter(c=>!ea.includes(c)).sort();return[...t,...o].map(c=>({key:c,label:qa[c]??c,value:sa(c,e[c])}))}function aa(e,t){switch(e.kind){case"count":return(0,f.jsx)(q,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return(0,f.jsx)(Se,{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(0,f.jsx)(Se,{text:String(e.value),testId:t});case"word":return(0,f.jsx)(Se,{text:e.text,testId:t});case"text":return(0,f.jsx)(Qe,{text:e.text,testId:t})}}function Va({health:e,isRefreshing:t=!1,onRefresh:o,className:c=""}){let{services:l,allHealthy:p,checkedAt:b}=e;te();let m=[{key:"qdrant",data:l.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:l.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:l.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:l.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:l.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return(0,f.jsxs)("section",{className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${c}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(p),children:[(0,f.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[(0,f.jsxs)("div",{className:"flex items-center gap-3",children:[(0,f.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,f.jsxs)("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:[(0,f.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,f.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,f.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,f.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,f.jsxs)("div",{children:[(0,f.jsx)("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,f.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",(0,f.jsx)("span",{"data-testid":"health-checked-at",children:(0,f.jsx)(ge,{iso:b,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"]})]})]}),(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,f.jsx)("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...He[p?"connected":"error"],"data-testid":"health-overall-status-badge",children:p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("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:[(0,f.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,f.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,f.jsxs)("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ge.connected]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("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:[(0,f.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,f.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,f.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,f.jsxs)("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ge.error]})]})}),o&&(0,f.jsxs)("button",{type:"button",onClick:o,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:[(0,f.jsxs)("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:[(0,f.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,f.jsx)("path",{d:"M3 3v5h5"}),(0,f.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,f.jsx)("path",{d:"M16 21h5v-5"})]}),(0,f.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,f.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:m.map(({key:y,data:N,title:h,subtitle:C})=>{let E=sa("version",N.version),J=it[ta(E)],ae=aa(E,`service-version-value-${y}`);return(0,f.jsxs)("div",{"data-testid":`service-card-${y}`,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:[(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[(0,f.jsx)("span",{className:"font-semibold text-sm",children:h}),(0,f.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...He[N.status],"data-testid":`service-status-${y}`,children:[(0,f.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${y}`}),Ge[N.status]]})]}),(0,f.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:C}),(0,f.jsxs)("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${y}`,children:[(0,f.jsx)("span",{className:J.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,f.jsx)("span",{className:`${J.slot} font-medium text-[11px]`,"data-testid":`service-version-${y}`,children:E.kind==="text"?(0,f.jsx)("code",{className:"font-mono font-semibold",children:ae}):ae})]}),(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${y}`,children:[(0,f.jsx)("span",{className:it.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),(0,f.jsx)("span",{className:`${it.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${y}`,children:(0,f.jsx)(q,{value:N.latencyMs,unit:"ms",testId:`health-latency-value-${y}`})})]}),Ha(N.details).map(K=>{let I=it[ta(K.value)];return(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${y}-${K.key}`,children:[(0,f.jsxs)("span",{className:I.label,children:[K.label,":"]}),(0,f.jsx)("span",{className:`${I.slot} font-medium text-[11px]`,"data-testid":`health-detail-${y}-${K.key}`,children:aa(K.value,`health-detail-value-${y}-${K.key}`)})]},K.key)})]})]}),(0,f.jsxs)("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[(0,f.jsx)("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${y}`,children:N.endpoint}),N.errorMessage!==void 0&&Je.test(N.errorMessage)&&(0,f.jsx)("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...He.error,"data-testid":`service-error-${y}`,children:N.errorMessage})]})]},y)})})]})}var oe=require("@aiquants/enrichment-core"),P=require("react");var a=require("react/jsx-runtime"),It={KEYWORD:{label:"SQL",description:"SQL Server \u306E\u8A9E\u53E5\u4E00\u81F4\u306E\u307F\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306A\u3069\u306E\u5B8C\u5168\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB\u306E\u610F\u5473\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u4E00\u81F4\u3092\u9806\u4F4D\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u691C\u7D22\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u691C\u7D22\u3057\u307E\u3059\u3002\u6587\u66F8\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u8EF8\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Ve="\u672A\u5B9F\u884C",za=(oe.SEARCH_PARAM_LIMITS.threshold.min+oe.SEARCH_PARAM_LIMITS.threshold.max)/2,Wa=2e3;function ja(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 Et={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"}},oa=[{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 na(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function Ja(e,t){let o=t.trim();if(!(o&&e))return e;let c=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`(${c})`,"gi");return e.split(l).map((m,y)=>({id:`chunk-${y}-${m.slice(0,8)}`,part:m,isMatch:m.toLowerCase()===o.toLowerCase()})).map(m=>m.isMatch?(0,a.jsx)("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:m.part},m.id):m.part)}function kt(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 Rt(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function Qa({tenantId:e,onSearch:t,initialParams:o,initialResult:c=null,circuitBreakerStatus:l={},isLoading:p=!1}){let b=(0,P.useId)(),m=(0,P.useId)(),y=(0,P.useId)(),N=(0,P.useId)(),h=(0,P.useId)(),C=(0,P.useId)(),E=(0,P.useId)(),J=(0,P.useId)(),ae=(0,P.useId)(),K=(0,P.useId)(),[I,Q]=(0,P.useState)(o?.q??""),[R,O]=(0,P.useState)(o?.mode??"HYBRID"),[A,L]=(0,P.useState)(o?.limit??oe.SEARCH_PARAM_LIMITS.limit.default),[G,g]=(0,P.useState)(o?.threshold??za),[$,B]=(0,P.useState)(o?.fusion??"rrf"),[D,re]=(0,P.useState)(o?.rrf_k??oe.SEARCH_PARAM_LIMITS.rrfK.default),[Z,be]=(0,P.useState)(o?.alpha??oe.SEARCH_PARAM_LIMITS.alpha.default),[fe,_]=(0,P.useState)(o?.confidentiality_level??"ALL"),[ie,H]=(0,P.useState)(o?.department_id?String(o.department_id):""),[X,U]=(0,P.useState)(o?.mime_type??""),[xe,ne]=(0,P.useState)(o?.tag??""),he=(0,P.useRef)(0),[Ie,le]=(0,P.useState)(!1),[ye,u]=(0,P.useState)(!1),[T,ee]=(0,P.useState)("request"),[z,se]=(0,P.useState)(null),[Fe,_e]=(0,P.useState)(new Set),[Ke,we]=(0,P.useState)(!1),[M,Be]=(0,P.useState)(c),[Ne,at]=(0,P.useState)(null),[Ue,bt]=(0,P.useState)(null),r=p||Ke,k=oe.MODE_TIERS[R],W=[k.dense,k.sparse,k.graph,k.lexical].filter(Boolean).length>1,ve=k.dense&&!k.sparse,ke=M?.search_metadata.circuit_breaker_status??l,ce=M?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},gt=Ue??{};(0,P.useEffect)(()=>{if(!ye)return;let n=Y=>{Y.key==="Escape"&&u(!1)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[ye]);let Sa=n=>{O(n.params.mode),L(n.params.limit),n.params.threshold!==void 0&&g(n.params.threshold),n.params.fusion!==void 0&&B(n.params.fusion),n.params.rrf_k!==void 0&&re(n.params.rrf_k)},wa=async()=>{if(r)return;let n=ie.trim()?Number.parseInt(ie.trim(),10):void 0,Y={q:I.trim(),mode:R,limit:A,threshold:ve?G:void 0,fusion:W?$:void 0,rrf_k:W&&$==="rrf"?D:void 0,alpha:W&&$==="linear"?Z:void 0,department_id:n,confidentiality_level:fe==="ALL"?void 0:fe,mime_type:X.trim()||void 0,tag:xe.trim()||void 0},pe=he.current+1;he.current=pe,at(null),we(!0);try{let Ce=await t(Y);if(pe!==he.current)return;Be(Ce),bt(Y)}catch(Ce){if(pe!==he.current)return;at(Ce instanceof Error?Ce.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{pe===he.current&&we(!1)}},ze=(0,P.useRef)(void 0);(0,P.useEffect)(()=>()=>{ze.current!==void 0&&clearTimeout(ze.current)},[]);let Ea=async(n,Y)=>{try{await navigator.clipboard.writeText(n),se(Y),ze.current!==void 0&&clearTimeout(ze.current),ze.current=setTimeout(()=>se(null),Wa)}catch{}},ka=n=>{_e(Y=>{let pe=new Set(Y);return pe.has(n)?pe.delete(n):pe.add(n),pe})};return(0,a.jsxs)("div",{"data-testid":"metadata-search-workbench","data-mode":R,"data-loading":String(r),className:"space-y-6",children:[(0,a.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("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"}),(0,a.jsxs)("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]})]}),(0,a.jsx)("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"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":ye,"aria-controls":K,onClick:()=>u(n=>!n),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:[(0,a.jsx)("span",{className:"font-mono text-xs",children:"{ }"}),(0,a.jsx)("span",{children:ye?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),(0,a.jsxs)("div",{className:"mt-5 border-slate-100 border-t border-solid pt-4",children:[(0,a.jsx)("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:oa.map(n=>(0,a.jsx)("button",{type:"button","data-testid":`preset-button-${n.id}`,onClick:()=>Sa(n),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:(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-slate-800",children:n.title}),(0,a.jsxs)("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",n.description,")"]})]})},n.id))})]})]}),(0,a.jsx)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:(0,a.jsxs)("form",{onSubmit:n=>{n.preventDefault(),wa()},className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)("label",{htmlFor:b,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),(0,a.jsx)("input",{id:b,type:"text","data-testid":"search-query-input",value:I,onChange:n=>Q(n.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&&(0,a.jsx)("button",{type:"button","data-testid":"clear-query-button",onClick:()=>Q(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),(0,a.jsx)("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:oe.SEARCH_MODES.map(n=>{let Y=R===n;return(0,a.jsx)("button",{type:"button","aria-pressed":Y,title:It[n].description,"data-testid":`search-mode-${n}`,"data-active":String(Y),onClick:()=>O(n),className:`shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 font-medium text-xs transition-all ${Y?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:It[n].label},n)})}),(0,a.jsx)("button",{type:"submit","data-testid":"execute-search-button",disabled:r,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:r?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:m,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),(0,a.jsx)("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:A})]}),(0,a.jsx)("input",{id:m,type:"range","data-testid":"limit-slider",min:oe.SEARCH_PARAM_LIMITS.limit.min,max:oe.SEARCH_PARAM_LIMITS.limit.max,step:1,value:A,onChange:n=>L(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:y,className:"font-medium text-slate-700 text-xs",title:ve?"\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):"}),(0,a.jsx)("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:G.toFixed(2)})]}),(0,a.jsx)("input",{id:y,type:"range","data-testid":"threshold-slider",min:oe.SEARCH_PARAM_LIMITS.threshold.min,max:oe.SEARCH_PARAM_LIMITS.threshold.max,step:.01,value:G,disabled:!ve,onChange:n=>g(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),(0,a.jsx)("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:$.toUpperCase()})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>B("rrf"),disabled:!W,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"}),(0,a.jsx)("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>B("linear"),disabled:!W,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)"})]})]}),(0,a.jsx)("div",{className:"space-y-1.5",children:$==="rrf"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:N,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),(0,a.jsx)("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:D})]}),(0,a.jsx)("input",{id:N,type:"range","data-testid":"rrf-k-slider",min:oe.SEARCH_PARAM_LIMITS.rrfK.min,max:oe.SEARCH_PARAM_LIMITS.rrfK.max,step:1,value:D,disabled:!W,onChange:n=>re(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:h,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),(0,a.jsx)("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Z.toFixed(2)})]}),(0,a.jsx)("input",{id:h,type:"range","data-testid":"alpha-slider",min:oe.SEARCH_PARAM_LIMITS.alpha.min,max:oe.SEARCH_PARAM_LIMITS.alpha.max,step:.05,value:Z,disabled:!W,onChange:n=>be(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>le(n=>!n),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,a.jsx)("span",{children:Ie?"\u25BC":"\u25B6"}),(0,a.jsxs)("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",Ie?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),Ie&&(0,a.jsxs)("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:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:E,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),(0,a.jsxs)("select",{id:E,"data-testid":"filter-confidentiality",value:fe,onChange:n=>_(n.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:[(0,a.jsx)("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),(0,a.jsx)("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),(0,a.jsx)("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),(0,a.jsx)("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),(0,a.jsx)("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:C,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),(0,a.jsx)("input",{id:C,type:"number","data-testid":"filter-department-id",value:ie,onChange:n=>H(n.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"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:J,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),(0,a.jsx)("input",{id:J,type:"text","data-testid":"filter-mime-type",value:X,onChange:n=>U(n.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"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:ae,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),(0,a.jsx)("input",{id:ae,type:"text","data-testid":"filter-tag",value:xe,onChange:n=>ne(n.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"})]})]})]})]})}),Ne&&(0,a.jsx)("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:Ne}),M?.search_metadata&&(0,a.jsx)(xt,{metadata:M.search_metadata}),M&&(0,a.jsxs)("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:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",(0,a.jsx)("span",{className:"font-bold text-indigo-600",children:M.count})," \u4EF6"]}),M.search_metadata.execution_time_ms!==void 0&&(0,a.jsxs)("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",(0,a.jsxs)("span",{className:"font-mono font-semibold text-slate-700",children:[M.search_metadata.execution_time_ms," ms"]})]}),(0,a.jsxs)("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: ",M.search_metadata.quality_tier]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),(0,a.jsxs)("span",{"data-testid":"tier-badge-sql","data-active":String(ce.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",ce.sql?"\u2713":"-"]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-sparse","data-active":String(ce.sparse),"data-breaker":ke.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.sparse?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",ce.sparse?"\u2713":Rt(ke.vector)]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-dense","data-active":String(ce.dense),"data-breaker":ke.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.dense?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",ce.dense?"\u2713":Rt(ke.vector)]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-graph","data-active":String(ce.graph),"data-breaker":ke.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.graph?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.graph)}`,children:["\u30B0\u30E9\u30D5 ",ce.graph?"\u2713":Rt(ke.graph)]})]})]}),(0,a.jsxs)("div",{"data-testid":"search-results-container",className:"space-y-4",children:[M&&M.hits.length===0&&(0,a.jsxs)("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 border-solid bg-white p-12 text-center",children:[(0,a.jsx)("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"}),(0,a.jsx)("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"})]}),M?.hits.map((n,Y)=>{let pe=Fe.has(n.id),Ce=n.scores?.fused;return(0,a.jsxs)("div",{"data-testid":`search-hit-card-${n.id}`,"data-hit-id":n.id,"data-rank":Y+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:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("span",{"data-testid":`hit-rank-${n.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",Y+1]}),(0,a.jsx)("h3",{"data-testid":`hit-filename-${n.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:n.file_name}),(0,a.jsx)("span",{"data-testid":`hit-confidentiality-${n.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${n.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":n.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":n.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:n.confidentiality_level}),n.department_id!==null&&(0,a.jsxs)("span",{"data-testid":`hit-department-${n.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",n.department_id]}),(0,a.jsx)("span",{"data-testid":`hit-mimetype-${n.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:n.mime_type})]}),(0,a.jsx)("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:n.file_uri})]}),Ce!==void 0&&(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:text-right",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),(0,a.jsx)("div",{"data-testid":`hit-fused-score-${n.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:Ce.toFixed(3)})]}),(0,a.jsx)("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:(0,a.jsx)("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,Ce*100))}%`}})})]})]}),n.ai_summary&&(0,a.jsx)("div",{"data-testid":`hit-summary-${n.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:Ja(n.ai_summary,Ue?.q??I)}),n.scores&&(0,a.jsxs)("div",{"data-testid":`hit-score-breakdown-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),n.scores.vector!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-vector-${n.id}`,"data-score-kind":n.scores.vector.kind,title:Et[n.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Et[n.scores.vector.kind].label,": ",Et[n.scores.vector.kind].format(n.scores.vector.value)]}),n.scores.lexicalRank!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-lexical-${n.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: ",na(n.scores.lexicalRank)]}),n.scores.graphRank!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-graph-${n.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: ",na(n.scores.graphRank)]})]}),n.tags&&n.tags.length>0&&(0,a.jsx)("div",{"data-testid":`hit-tags-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:n.tags.map(Pe=>(0,a.jsxs)("span",{"data-testid":`hit-tag-${n.id}-${Pe}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",Pe]},`tag-${n.id}-${Pe}`))}),n.graph_relations&&n.graph_relations.length>0&&(0,a.jsxs)("div",{"data-testid":`hit-graph-relations-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),n.graph_relations.map((Pe,Ra)=>(0,a.jsxs)("span",{"data-testid":`hit-relation-${n.id}-${Ra}`,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:["-[:",Pe.relation,"]-> ",Pe.target_name]},`rel-${n.id}-${Pe.relation}-${Pe.target_name}`))]}),n.structured_data!==null&&n.structured_data!==void 0&&(0,a.jsxs)("div",{className:"mt-3 border-slate-100 border-t border-solid pt-2",children:[(0,a.jsxs)("button",{type:"button","data-testid":`toggle-structured-data-${n.id}`,onClick:()=>ka(n.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,a.jsx)("span",{children:pe?"\u25BC":"\u25B6"}),(0,a.jsxs)("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",pe?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),pe&&(0,a.jsx)("pre",{"data-testid":`structured-data-json-${n.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(n.structured_data,null,2)})]})]},n.id)})]}),ye&&(0,a.jsxs)("section",{id:K,"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:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-slate-800 border-b border-solid pb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),(0,a.jsx)("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let n=JSON.stringify(T==="request"?Ue??{}:M??{},null,2);Ea(n,"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:z==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),(0,a.jsx)("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>u(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),(0,a.jsx)("div",{className:"mt-3 flex gap-2 border-slate-800 border-b border-solid pb-2",children:["request","response","pipeline","graph-trace"].map(n=>{let Y={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},pe=T===n;return(0,a.jsx)("button",{type:"button","data-testid":`inspector-tab-${n}`,"data-active":String(pe),onClick:()=>ee(n),className:`rounded-sm px-3 py-1 font-medium text-xs ${pe?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:Y[n]},n)})}),(0,a.jsxs)("div",{className:"mt-4",children:[T==="request"&&(0,a.jsx)("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(Ue??{},null,2)}),T==="response"&&(0,a.jsx)("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(M??{},null,2)}),T==="pipeline"&&(0,a.jsxs)("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),(0,a.jsx)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-query-analysis",children:M?(0,a.jsxs)(a.Fragment,{children:["mode: ",gt.mode,' | q: "',gt.q,'"']}):Ve}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),(0,a.jsx)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-tier-retrieval",children:M?(0,a.jsxs)(a.Fragment,{children:["SQL SoT: ",ce.sql?"ACTIVE":"SKIPPED"," | Sparse: ",ce.sparse?"ACTIVE":"OFFLINE"," | Dense: ",ce.dense?"ACTIVE":"OFFLINE"," | Graph: ",ce.graph?"ACTIVE":"OFFLINE"]}):Ve}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),(0,a.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,a.jsxs)("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",M?ja(gt):Ve]})," | ",(0,a.jsxs)("span",{"data-testid":"inspector-output-count",children:["Output count: ",M?M.count:Ve]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),(0,a.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,a.jsxs)("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",M?M.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":Ve]})," | ",(0,a.jsxs)("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",M?M.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":Ve]})," | ","tenant: ",e]})]}),T==="graph-trace"&&(0,a.jsxs)("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[(0,a.jsx)("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),M?.hits.some(n=>n.graph_relations&&n.graph_relations.length>0)?(0,a.jsx)("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:M.hits.map(n=>n.graph_relations?.map(Y=>(0,a.jsxs)("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",n.id,', file: "',n.file_name,'"}) -[:',Y.relation,']-> (:Entity {name: "',Y.target_name,'"})']},`gtrace-${n.id}-${Y.relation}-${Y.target_name}`)))}):(0,a.jsx)("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"})]})]})]})]})}var lt=require("@aiquants/enrichment-core"),me=require("react"),S=require("react/jsx-runtime"),Pt=4;function Ct(e){return e.toFixed(Pt)}function ra(e,t){let o=N=>{let h=new Map;return N.forEach((C,E)=>{h.has(C)||h.set(C,E+1)}),h},c=o(e),l=o(t),p=[...c.keys()].filter(N=>l.has(N)),b=new Set([...c.keys(),...l.keys()]).size,m=b===0?null:p.length/b,y=p.length===0?null:p.reduce((N,h)=>N+Math.abs(c.get(h)-l.get(h)),0)/p.length;return{sharedCount:p.length,overlapRatio:m,meanAbsoluteRankDifference:y}}function _t(e){return`${e.label} (${e.embeddingModel})`}function Xa({variants:e,onCompare:t}){let o=(0,me.useId)(),c=(0,me.useId)(),l=(0,me.useId)(),p=(0,me.useId)(),b=(0,me.useId)(),[m,y]=(0,me.useState)(null),[N,h]=(0,me.useState)(null),[C,E]=(0,me.useState)(""),[J,ae]=(0,me.useState)(lt.SEARCH_PARAM_LIMITS.limit.default),[K,I]=(0,me.useState)(!1),[Q,R]=(0,me.useState)(null),[O,A]=(0,me.useState)(null),L=e.length>=2,G=e.map(_=>_.strategyId),g=m!==null&&G.includes(m)?m:L?G[0]:null,$=N!==null&&G.includes(N)?N:L?G[1]:null,B=g!==null&&g===$,D=C.trim(),re=L&&!B&&D!==""&&!K,Z=async _=>{if(_.preventDefault(),!re||g===null||$===null)return;let ie={query:D,strategyIds:[g,$],limit:J};I(!0),R(null);try{let H=await t(ie);if(!H.ok){A(null),R(H.reason);return}let X=H.results.find(xe=>xe.strategyId===g),U=H.results.find(xe=>xe.strategyId===$);if(X===void 0||U===void 0){A(null),R(`\u5FDC\u7B54\u306B\u6226\u7565 #${X===void 0?g:$} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}A({input:ie,left:X,right:U})}catch(H){A(null),R(`\u6BD4\u8F03\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${H instanceof Error?H.message:String(H)}`)}finally{I(!1)}},be=O===null?null:ra(O.left.hits.map(_=>_.id),O.right.hits.map(_=>_.id)),fe=_=>{let ie=e.find(H=>H.strategyId===_.strategyId);return(0,S.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${_.strategyId}`,children:[(0,S.jsx)("h3",{className:"font-bold text-base text-slate-900",children:ie===void 0?`\u6226\u7565 #${_.strategyId}`:_t(ie)}),(0,S.jsx)("p",{className:"mt-1 text-[11px] text-slate-500",children:(0,S.jsxs)("span",{"data-testid":`compare-execution-ms-${_.strategyId}`,children:[_.executionMs," ms"]})}),_.hits.length===0?(0,S.jsx)("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${_.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):(0,S.jsx)("ol",{className:"mt-3 space-y-2",children:_.hits.map((H,X)=>(0,S.jsxs)("li",{"aria-label":`${X+1} \u4F4D ${H.title} (\u30B9\u30B3\u30A2 ${Ct(H.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${_.strategyId}-${X+1}`,"data-hit-id":H.id,"data-score":String(H.score),children:[(0,S.jsx)("span",{className:"w-6 text-right font-mono text-slate-500",children:X+1}),(0,S.jsx)("span",{title:H.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${_.strategyId}-${X+1}`,children:H.title}),(0,S.jsx)("span",{title:String(H.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${_.strategyId}-${X+1}`,children:Ct(H.score)})]},X))})]})};return(0,S.jsxs)("section",{className:"space-y-6","aria-labelledby":o,"data-testid":"model-comparison-workbench","data-running":K,children:[(0,S.jsxs)("form",{onSubmit:Z,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,S.jsx)("h2",{id:o,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),(0,S.jsxs)("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 ",Pt," \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"]}),!L&&(0,S.jsxs)("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"]}),(0,S.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:p,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),(0,S.jsx)("select",{id:p,value:g===null?"":String(g),onChange:_=>y(Number(_.target.value)),disabled:!L,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(_=>(0,S.jsx)("option",{value:String(_.strategyId),children:_t(_)},_.strategyId))})]}),(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:b,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),(0,S.jsx)("select",{id:b,value:$===null?"":String($),onChange:_=>h(Number(_.target.value)),disabled:!L,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(_=>(0,S.jsx)("option",{value:String(_.strategyId),children:_t(_)},_.strategyId))})]})]}),B&&(0,S.jsx)("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"}),(0,S.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:c,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),(0,S.jsx)("input",{id:c,type:"text",value:C,onChange:_=>E(_.target.value),disabled:!L,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"})]}),(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:l,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),(0,S.jsx)("input",{id:l,type:"number",min:lt.SEARCH_PARAM_LIMITS.limit.min,max:lt.SEARCH_PARAM_LIMITS.limit.max,step:1,value:J,onChange:_=>ae(Number(_.target.value)),disabled:!L,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"})]})]}),(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)("button",{type:"submit",disabled:!re,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:K?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),Q!==null&&(0,S.jsx)("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:Q}),O!==null&&be!==null&&(0,S.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[(0,S.jsxs)("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),(0,S.jsxs)("dd",{"data-testid":"compare-shared-count",children:[be.sharedCount," \u4EF6 (A ",O.left.hits.length," \u4EF6 / B ",O.right.hits.length," \u4EF6)"]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),(0,S.jsx)("dd",{"data-testid":"compare-overlap-ratio",children:be.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(be.overlapRatio*100).toFixed(1)}%`})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),(0,S.jsx)("dd",{"data-testid":"compare-rank-difference",children:be.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":be.meanAbsoluteRankDifference.toFixed(2)})]})]}),(0,S.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[fe(O.left),fe(O.right)]})]})]})}var x=require("react/jsx-runtime");function da(e){return e===null?Ze:`${e.length} \u7A2E`}var Ze="\u672A\u8A2D\u5B9A";function Ye(e,t=""){return e===null?Ze:`${e}${t}`}function ct(e){return e===null?Ze:`${e} \u4EF6`}function Ya(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?Ze:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??Ze})`}function Za({tenantId:e,ontologyStatus:t}){let o=t.classes,c=t.predicates;return(0,x.jsxs)("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)("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"}),(0,x.jsx)("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"}),(0,x.jsx)("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:Ya(t)})]}),(0,x.jsx)("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"})]}),(0,x.jsxs)("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:"," ",(0,x.jsx)("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),(0,x.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:ct(t.totalConstraints)})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:ct(t.searchIndexes)}),(0,x.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",ct(t.totalIndexes)]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),(0,x.jsxs)("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[Ye(t.promotionThresholds.confidence)," / ",Ye(t.promotionThresholds.cooccurrence," \u56DE")]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:ct(t.unresolvedCandidatesCount)})]})]})]}),(0,x.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("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)"}),(0,x.jsx)("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"})]}),(0,x.jsx)("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:da(o)})]}),(0,x.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[o===null&&(0,x.jsx)("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"}),o?.map(l=>(0,x.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${l.name}`,children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:l.name}),(0,x.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),typeof l.count=="number"&&(0,x.jsx)("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:l.count.toLocaleString()})]},l.name))]})]}),(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),(0,x.jsx)("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"})]}),(0,x.jsx)("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:da(c)})]}),(0,x.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[c===null&&(0,x.jsx)("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"}),c?.map(l=>(0,x.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${l.name}`,children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:l.name}),(0,x.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),(0,x.jsx)("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:l.direction})]},l.name))]})]})]}),(0,x.jsxs)("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:[(0,x.jsx)("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"}),(0,x.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[(0,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),(0,x.jsxs)("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",Ye(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",Ye(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",Ye(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),(0,x.jsx)("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"})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),(0,x.jsxs)("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",(0,x.jsx)("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"]})]})]})]})]})}var j=require("@aiquants/enrichment-core"),de=require("react");var pt=require("@aiquants/console-ui/core"),ut=require("@aiquants/enrichment-core"),Me={inset:12,labelFontSize:13,captionFontSize:11},Te={offset:3,stroke:2},ia={node:{width:(0,pt.ceil8)(Math.max(...Object.values(ut.PIPELINE_STEPS).map(e=>(0,pt.textWidthEm)(e.label)))*Me.labelFontSize+2*Me.inset),height:56},gap:{column:48,row:24},padding:24};function $e(e){return Math.round(e*1e3)/1e3}function es(e){let t=new Map;for(let o of e){let c=o.dependsOn.reduce((l,p)=>Math.max(l,t.get(p)),-1);t.set(o.step,c+1)}return t}function Lt(e,t){return`${e}->${t}`}function ts(e,t){let o=[],c=new Map;return{slots:[...e.map(p=>{let b=t.get(p.step),m=p.dependsOn.map(y=>{let N=[],h=y;for(let C=t.get(y)+1;C<b;C+=1){let E=`${Lt(y,p.step)}@${C}`;o.push({id:E,rank:C,predecessors:[h]}),N.push(E),h=E}return c.set(Lt(y,p.step),N),h});return{id:p.step,rank:b,predecessors:m}}),...o],chains:c}}function as(e){let t=new Map,o=Math.max(...e.map(c=>c.rank));for(let c=0;c<=o;c+=1){let p=e.filter(b=>b.rank===c).map((b,m)=>{let y=c===0?m:b.predecessors.reduce((N,h)=>N+t.get(h),0)/b.predecessors.length;return{slot:b,barycenter:y}});p.sort((b,m)=>b.barycenter-m.barycenter),p.forEach(({slot:b},m)=>{t.set(b.id,m)})}return t}function $t(e,t=ia){let o=(0,ut.orderedSteps)(e),c=es(o),{slots:l,chains:p}=ts(o,c),b=as(l),{node:m,gap:y,padding:N}=t,h=R=>({x:$e(N+R.rank*(m.width+y.column)),y:$e(N+b.get(R.id)*(m.height+y.row))}),C=new Map(l.map(R=>[R.id,h(R)])),E=o.map(R=>{let O=C.get(R.step);return{key:R.step,x:O.x,y:O.y,rank:c.get(R.step),order:b.get(R.step),width:m.width,height:m.height}}),J=R=>$e(R+m.height/2),ae=o.flatMap(R=>R.dependsOn.map(O=>{let A=C.get(O),L=C.get(R.step),G=$e(A.x+m.width),g=J(A.y),$=`M ${G} ${g}`,B=(D,re)=>{let Z=$e((G+D)/2);$+=` C ${Z} ${g}, ${Z} ${re}, ${D} ${re}`};for(let D of p.get(Lt(O,R.step))){let re=C.get(D),Z=J(re.y);B(re.x,Z),G=$e(re.x+m.width),g=Z,$+=` L ${G} ${g}`}return B(L.x,J(L.y)),{from:O,to:R.step,path:$}})),K=[...C.values()],I=$e(Math.max(...K.map(R=>R.x+m.width))+N),Q=$e(Math.max(...K.map(R=>R.y+m.height))+N);return{width:I,height:Q,steps:E,edges:ae}}var i=require("react/jsx-runtime"),la="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Tt={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},ca={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},Mt={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"}},Ot={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"},ss={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},et="rgb(248 250 252)",ns={backgroundColor:et,backgroundImage:`linear-gradient(to right, ${et}, ${et}), linear-gradient(to right, ${et}, ${et}), 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 Ft(e,t){let o=t[e.featureFlagKey];return o===void 0?"unmeasured":o?"open":"closed"}function pa(e,t){let o=e.map(c=>({gate:c,state:Ft(c,t)}));return o.some(({gate:c,state:l})=>l==="closed"&&c.whenClosed==="fail")?"closed-fail":o.some(({state:c})=>c==="closed")?"closed-skip":o.some(({state:c})=>c==="unmeasured")?"unmeasured":"open"}function At(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function ua(e,t){let{badge:o}=Mt[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?o:`${o}\u30FB${Ot[t]}`}function os(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=>j.PIPELINE_STEPS[t].label).join("\u3001")}function rs(e){return e.dependsOn.length===0?la:`\u4F9D\u5B58: ${Dt(e.dependsOn)}`}function ds({featureFlags:e,metrics:t,metricSampleWindow:o,selectedKind:c,onSelectKind:l,selectedStepKey:p,onSelectStep:b}){if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${o}.`);let m=(0,de.useId)(),y=(0,de.useId)(),N=(0,de.useId)(),h=(0,de.useId)(),C=(0,de.useId)(),[E,J]=(0,de.useState)(j.DOCUMENT_KINDS[0]),[ae,K]=(0,de.useState)(null),[I,Q]=(0,de.useState)(null),R=(0,de.useRef)(new Map),O=(0,de.useRef)(new Map),A=(0,de.useRef)(null),L=(0,de.useRef)(null),{labels:G}=te(),g=c!==void 0?c:E,$=p!==void 0?p:ae,B=(0,j.flowFor)(g),D=$t(B),re=new Map(B.steps.map(u=>[u.step,u])),Z=u=>{K(u),b?.(u)},be=u=>{J(u),l?.(u),Z(null)},fe=(u,T)=>{let ee=j.DOCUMENT_KINDS.length-1,z;switch(u.key){case"ArrowRight":z=T===ee?0:T+1;break;case"ArrowLeft":z=T===0?ee:T-1;break;case"Home":z=0;break;case"End":z=ee;break;default:return}u.preventDefault();let se=j.DOCUMENT_KINDS[z];be(se),R.current.get(se)?.focus()},_=u=>{let T=L.current;if(Z(null),T?.isConnected){T.focus();return}O.current.get(u)?.focus()},ie=u=>{Z(u===$?null:u)},H=(u,T)=>{u.currentTarget.focus(),ie(T)},X=(u,T)=>{u.key==="Enter"||u.key===" "?(u.preventDefault(),ie(T)):u.key==="Escape"&&Z(null)},U=$===null?void 0:re.get($),xe=U===void 0?null:U.step;(0,de.useEffect)(()=>{if(xe===null){L.current=null;return}let u=document.activeElement;(u instanceof HTMLElement||u instanceof SVGElement)&&u!==document.body&&A.current?.contains(u)===!1&&(L.current=u)},[xe]);let ne=U===void 0?void 0:j.PIPELINE_STEPS[U.step],he=U===void 0?[]:(0,j.flowStepGates)(U),Ie=U===void 0?[]:B.steps.filter(u=>u.dependsOn.includes(U.step)).map(u=>u.step),le=ne===void 0?void 0:t.find(u=>u.documentKind===g&&u.stepKey===ne.key),ye=j.DOCUMENT_KIND_LABELS[g];return(0,i.jsxs)("section",{className:"space-y-6","aria-labelledby":m,"data-testid":"pipeline-flow-viewer","data-kind":g,children:[(0,i.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,i.jsx)("h2",{id:m,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),(0,i.jsx)("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"}),(0,i.jsx)("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:j.DOCUMENT_KINDS.map((u,T)=>{let ee=u===g;return(0,i.jsx)("button",{ref:z=>{z===null?R.current.delete(u):R.current.set(u,z)},type:"button",role:"tab","aria-selected":ee,"aria-controls":y,tabIndex:ee?0:-1,onClick:()=>be(u),onKeyDown:z=>fe(z,T),className:ee?"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-${u}`,children:j.DOCUMENT_KIND_LABELS[u]},u)})}),(0,i.jsx)("div",{id:y,role:"tabpanel","aria-label":`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u6D41\u308C`,"aria-describedby":N,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:ns,"data-testid":"flow-scroll",children:(0,i.jsxs)("svg",{viewBox:`0 0 ${D.width} ${D.height}`,width:D.width,height:D.height,role:"group","aria-label":`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[(0,i.jsx)("title",{children:`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),(0,i.jsx)("defs",{children:(0,i.jsx)("marker",{id:`${y}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:(0,i.jsx)("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),D.edges.map(u=>(0,i.jsx)("path",{d:u.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${y}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${u.from}-${u.to}`},`${u.from}-${u.to}`)),D.steps.map(u=>{let T=j.PIPELINE_STEPS[u.key],ee=re.get(u.key),z=(0,j.flowStepGates)(ee),se=pa(z,e),Fe=At(z),_e=Mt[se],Ke=ua(se,Fe),we=u.key===$,M=u.key===I,Be=`${y}-depends-${u.key}`;return(0,i.jsxs)("g",{ref:Ne=>{Ne===null?O.current.delete(u.key):O.current.set(u.key,Ne)},transform:`translate(${u.x} ${u.y})`,role:"button",tabIndex:0,"aria-label":`${T.label} (${Ke})`,"aria-describedby":Be,"aria-expanded":we,"aria-controls":we?C:void 0,onClick:Ne=>H(Ne,u.key),onKeyDown:Ne=>X(Ne,u.key),onFocus:()=>Q(u.key),onBlur:()=>Q(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${u.key}`,"data-step-key":u.key,"data-gate-state":se,"data-gate-policy":Fe,"data-selected":we,"data-focused":M,children:[(0,i.jsx)("desc",{id:Be,"data-testid":`flow-node-dependencies-${u.key}`,children:rs(ee)}),M&&(0,i.jsx)("rect",{x:-Te.offset,y:-Te.offset,width:u.width+2*Te.offset,height:u.height+2*Te.offset,rx:8+Te.offset,fill:"none",strokeWidth:Te.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${u.key}`}),(0,i.jsx)("rect",{width:u.width,height:u.height,rx:8,strokeWidth:we?3:1.5,strokeDasharray:_e.dash,className:`${_e.stroke} ${we?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${u.key}`}),(0,i.jsx)("text",{x:Me.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${u.key}`,children:T.label}),(0,i.jsx)("text",{x:Me.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${u.key}`,children:Tt[T.phase]}),(0,i.jsx)("text",{x:Me.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${u.key}`,"data-gate-state":se,children:Ke})]},u.key)})]})}),(0,i.jsxs)("p",{id:N,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",D.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"]})]}),ne!==void 0&&U!==void 0&&(0,i.jsxs)("section",{id:C,ref:A,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":h,"data-testid":"flow-step-detail","data-step-key":ne.key,children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{id:h,className:"font-bold text-base text-slate-900",children:ne.label}),(0,i.jsx)("p",{className:"mt-1 text-[13px] text-slate-600",children:ne.description})]}),(0,i.jsx)("button",{type:"button",onClick:()=>_(ne.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"})]}),(0,i.jsxs)("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),(0,i.jsx)("dd",{children:(0,i.jsx)("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:ne.endpoint})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),(0,i.jsxs)("dd",{"data-testid":"flow-step-phase",children:[Tt[ne.phase]," (",ne.phase,")"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),(0,i.jsx)("dd",{"data-testid":"flow-step-capability",children:ne.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":ne.capability})]}),U.chunkSource!==void 0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),(0,i.jsxs)("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":U.chunkSource,children:[ca[U.chunkSource]," (",U.chunkSource,")"]})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),(0,i.jsx)("dd",{"data-testid":"flow-step-depends-on",children:U.dependsOn.length===0?la:Dt(U.dependsOn)})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),(0,i.jsx)("dd",{"data-testid":"flow-step-dependents",children:Ie.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Dt(Ie)})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),(0,i.jsx)("dd",{children:he.length===0?(0,i.jsx)("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:"space-y-1",children:he.map(u=>{let T=Ft(u,e);return(0,i.jsxs)("li",{"data-testid":`flow-gate-${u.featureFlagKey}`,"data-gate-state":T,"data-when-closed":u.whenClosed,children:[(0,i.jsx)("code",{className:"font-mono",children:u.featureFlagKey}),": ",ss[T]," \u2014 ",os(u)]},u.featureFlagKey)})}),U.gatePolicy!==void 0&&(0,i.jsxs)("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[ye," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",Ot[At(ne.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"]})]})})]})]}),(0,i.jsxs)("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":g,children:[(0,i.jsxs)("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",ye,"\u30FB\u76F4\u8FD1 ",o," \u4EF6)"]}),(0,i.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[ye," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",o," \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"]}),le===void 0?(0,i.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[G.unmeasured," (",ye," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-sample-count",children:(0,i.jsx)(q,{value:le.sampleCount,testId:"flow-metric-sample-count-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6210\u529F"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-succeeded",children:(0,i.jsx)(q,{value:le.succeeded,testId:"flow-metric-succeeded-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u5931\u6557"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-failed",children:(0,i.jsx)(q,{value:le.failed,testId:"flow-metric-failed-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u7701\u7565"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-skipped",children:(0,i.jsx)(q,{value:le.skipped,testId:"flow-metric-skipped-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"p50"}),(0,i.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:(0,i.jsx)(q,{value:le.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"p95"}),(0,i.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:(0,i.jsx)(q,{value:le.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),(0,i.jsxs)("div",{className:"col-span-2",children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-last-started-at",children:(0,i.jsx)(ge,{iso:le.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),(0,i.jsxs)("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 ",G.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"]})]})]})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,i.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),(0,i.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",(0,i.jsx)("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",j.DOCUMENT_KIND_LABELS.other,"\u300D\u3067\u3059\u3002"]}),(0,i.jsx)("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:(0,i.jsxs)("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[(0,i.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),(0,i.jsx)("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),(0,i.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100",children:j.MIME_KIND_RULES.map(([u,T],ee)=>(0,i.jsxs)("tr",{className:T===g?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${ee}`,"data-kind":T,"data-selected":T===g,children:[(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{className:"font-mono",children:u})}),(0,i.jsx)("td",{className:"px-3 py-2",children:j.DOCUMENT_KIND_LABELS[T]})]},u))})]})})]})]})}var Oe=require("@aiquants/enrichment-core"),ue=require("react");var d=require("react/jsx-runtime"),ba=8,is={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},ls={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"},ga={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},cs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],ps=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],us={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function fa(e){return Object.hasOwn(ga,e)}function tt(e,t){return`run-step-provenance-value-${e}-${t}`}function ms(e,t,o){if(fa(t)){let l=e[t];return l===null?null:(0,d.jsx)(q,{value:l,unit:ga[t],testId:tt(o,t)})}let c=e[t];return c===null?null:(0,d.jsx)(Qe,{text:String(c),testId:tt(o,t)})}function bs(e,t){let o=cs.map(p=>({key:p,label:ls[p],value:ms(e,p,t),breaks:fa(p)?"atomic":"anywhere"})),c=e.pages_read!==null||e.pages_total!==null,l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(q,{value:e.pages_read,testId:tt(t,"pages_read")})," / ",(0,d.jsx)(q,{value:e.pages_total,testId:tt(t,"pages_total")})]});return[...o,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:c?l:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:(0,d.jsx)(Qe,{text:is[e.body_source],testId:tt(t,"body_source")}),breaks:"anywhere"}]}function gs(e){let t=[],o=new Map;for(let c of[...e.steps].sort((l,p)=>l.sequence-p.sequence)){if(Oe.PIPELINE_STEPS[c.stepKey].fanOut!=="children"||c.targetMetadataId===e.metadataId){t.push({kind:"step",step:c});continue}let l=o.get(c.stepKey);if(l!==void 0){l.push(c);continue}let p=[c];o.set(c.stepKey,p),t.push({kind:"fan_out",stepKey:c.stepKey,steps:p})}return t}function fs(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 xs({step:e}){let{labels:t}=te();if(e.status==="SKIPPED")return(0,d.jsxs)("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",ht(fs(e))]});if(e.provenance===null)return(0,d.jsx)("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 o=e.provenance,c=bs(o,e.sequence),l=c.filter(b=>b.value!==null),p=c.filter(b=>b.value===null);return(0,d.jsxs)(d.Fragment,{children:[l.length>0&&(0,d.jsx)("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:l.map(b=>(0,d.jsxs)("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:b.label}),(0,d.jsx)("dd",{className:`text-slate-800 ${us[b.breaks]}`,"data-provenance-key":b.key,children:b.value})]},b.key))}),p.length>0&&(0,d.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",p.map(b=>b.label).join("\u3001")]}),Object.keys(o.detail).length>0&&(0,d.jsxs)("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[(0,d.jsx)("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),(0,d.jsx)("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(o.detail,null,2)})]})]})}function ma(e,t,o,c){let l=ot[e.status];return(0,d.jsx)("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:(0,d.jsxs)("details",{open:c,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),(0,d.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&(0,d.jsxs)("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]}),(0,d.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${l.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:l.label}),(0,d.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:(0,d.jsx)(q,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),(0,d.jsxs)("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&o>0&&(0,d.jsx)("div",{className:"h-2 rounded-full bg-slate-100",children:(0,d.jsx)("div",{className:`h-2 rounded-full ${l.bar}`,style:{width:`${e.durationMs/o*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&(0,d.jsxs)("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})`]}),(0,d.jsx)(xs,{step:e})]})]})},e.id)}function ys(e,t,o){let c=Le(e),l=De[c],p=e.steps.reduce((m,y)=>y.durationMs===null?m:Math.max(m,y.durationMs),0),b=e.steps.length<=ba;return(0,d.jsxs)("section",{className:"space-y-4","aria-labelledby":t,"data-testid":"run-detail","data-run-id":e.id,children:[(0,d.jsxs)("h3",{ref:o,id:t,tabIndex:-1,className:"font-bold text-base text-slate-900 focus:outline-none","data-testid":"run-detail-heading",children:[Oe.DOCUMENT_KIND_LABELS[e.documentKind]," \u306E\u5B9F\u884C #",e.id]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u304D\u3063\u304B\u3051"}),(0,d.jsx)("dd",{"data-testid":"run-trigger","data-trigger":e.trigger,children:rt[e.trigger]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u8A66\u884C"}),(0,d.jsx)("dd",{"data-testid":"run-attempt",children:e.attempt})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u72B6\u614B"}),(0,d.jsx)("dd",{children:(0,d.jsx)("span",{className:`inline-flex rounded-full px-2.5 py-0.5 font-semibold text-[11px] ${l.className}`,"data-testid":"run-status","data-status":e.status,"data-presentation":c,children:l.label})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u8981\u6C42\u8005"}),(0,d.jsx)("dd",{className:"wrap-anywhere","data-testid":"run-requested-by",children:e.requestedBy})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u958B\u59CB"}),(0,d.jsx)("dd",{"data-testid":"run-started-at",children:(0,d.jsx)(ge,{iso:e.startedAt,testId:"run-started-at-value"})})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7D42\u4E86"}),(0,d.jsx)("dd",{"data-testid":"run-finished-at",children:(0,d.jsx)(Xe,{iso:e.finishedAt,testId:"run-finished-at-value"})})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u30B8\u30E7\u30D6"}),(0,d.jsx)("dd",{children:(0,d.jsx)("code",{className:"wrap-anywhere font-mono","data-testid":"run-job-id",children:e.jobId})})]})]}),e.errorMessage!==null&&(0,d.jsx)("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}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-bold text-[13px] text-slate-900",children:"\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3"}),(0,d.jsx)("ol",{className:"mt-3 space-y-3","data-testid":"run-steps",children:gs(e).map(m=>{if(m.kind==="step"){let h=m.step,C=(0,d.jsxs)(d.Fragment,{children:[Oe.PIPELINE_STEPS[h.stepKey].label,h.targetMetadataId!==e.metadataId&&(0,d.jsxs)("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-${h.sequence}`,children:["\u5BFE\u8C61 #",h.targetMetadataId]})]});return ma(h,C,p,h.status==="FAILED"||b)}let y=m.steps.some(h=>h.status==="FAILED"),N=ps.map(h=>({status:h,count:m.steps.filter(C=>C.status===h).length})).filter(({count:h})=>h>0);return(0,d.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${m.stepKey}`,"data-count":m.steps.length,children:(0,d.jsxs)("details",{open:y||b,className:"group/fanout","data-testid":`run-step-group-card-${m.stepKey}`,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),(0,d.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:Oe.PIPELINE_STEPS[m.stepKey].label}),(0,d.jsxs)("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${m.stepKey}`,children:["\u5BFE\u8C61 ",m.steps.length," \u4EF6"]}),(0,d.jsx)("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${m.stepKey}`,children:N.map(({status:h,count:C})=>`${ot[h].label} ${C}`).join(" \xB7 ")})]}),(0,d.jsx)("ol",{className:"space-y-3 px-4 pb-4",children:m.steps.map(h=>ma(h,(0,d.jsxs)("span",{"data-testid":`run-step-target-${h.sequence}`,children:["\u5BFE\u8C61 #",h.targetMetadataId]}),p,h.status==="FAILED"||b))})]})},`group-${m.stepKey}`)})})]})]})}function vs({metadataId:e,runs:t,selectedRunId:o,onSelectRun:c,isLoading:l,failure:p,onClose:b,openRequest:m,returnFocusFallback:y}){let N=(0,ue.useId)(),h=(0,ue.useId)(),C=(0,ue.useId)(),E=(0,ue.useRef)(null),J=(0,ue.useRef)(null),ae=(0,ue.useRef)(null),K=(0,ue.useRef)(null),I=(0,ue.useRef)(null),Q=(0,ue.useRef)(null),R=(0,ue.useRef)(y);te(),(0,ue.useEffect)(()=>{R.current=y},[y]),(0,ue.useEffect)(()=>{if(I.current!==m){I.current=m,Q.current=null;let g=document.activeElement;E.current?.contains(g)!==!0&&(K.current=(g instanceof HTMLElement||g instanceof SVGElement)&&g!==document.body?g:null),J.current?.focus();return}o!==null&&o===Q.current&&(Q.current=null,ae.current?.focus())},[m,o]),(0,ue.useEffect)(()=>()=>{I.current=null;let g=K.current;if(g?.isConnected){g.focus();return}R.current()?.focus()},[]);let O=g=>{Q.current=g===o?null:g,c(g)},A=g=>{g.key==="Escape"&&(g.stopPropagation(),b())},L=o===null?void 0:t.find(g=>g.id===o),G=()=>t.length===0?(0,d.jsx)("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"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("section",{"aria-labelledby":h,"data-testid":"run-history",children:[(0,d.jsxs)("h3",{id:h,className:"font-bold text-base text-slate-900",children:["\u5B9F\u884C\u306E\u5C65\u6B74 (",t.length," \u4EF6\u3001\u65B0\u3057\u3044\u9806)"]}),(0,d.jsx)("ol",{className:"mt-3 space-y-1","data-testid":"run-history-list",children:t.map(g=>{let $=g.id===o,B=Le(g),D=De[B];return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onClick:()=>O(g.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-${g.id}`,"data-selected":$,children:[(0,d.jsxs)("span",{className:"font-mono font-semibold text-slate-900",children:["#",g.id]}),(0,d.jsx)("span",{className:"text-slate-700","data-testid":`run-history-trigger-${g.id}`,"data-trigger":g.trigger,children:rt[g.trigger]}),(0,d.jsxs)("span",{className:"text-slate-600","data-testid":`run-history-attempt-${g.id}`,children:["\u8A66\u884C ",g.attempt]}),(0,d.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${D.className}`,"data-testid":`run-history-status-${g.id}`,"data-status":g.status,"data-presentation":B,children:D.label}),(0,d.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-history-started-at-${g.id}`,children:(0,d.jsx)(ge,{iso:g.startedAt,testId:`run-history-started-at-value-${g.id}`})})]})},g.id)})})]}),L!==void 0?ys(L,C,ae):o===null?(0,d.jsx)("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"}):(0,d.jsxs)("p",{role:"status",className:"text-[13px] text-slate-600","data-testid":"run-inspector-selection-missing",children:["\u5B9F\u884C #",o," \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(0,d.jsxs)("section",{ref:E,role:"dialog","aria-labelledby":N,onKeyDown:A,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:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("h2",{ref:J,id:N,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",L===void 0?"":` (\u5B9F\u884C #${L.id})`]}),(0,d.jsx)("button",{type:"button",onClick:b,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"})]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-document",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u6587\u66F8"}),(0,d.jsxs)("dd",{"data-testid":"run-document-id",children:["#",e]})]}),L!==void 0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7248"}),(0,d.jsx)("dd",{"data-testid":"run-document-revision",children:L.revision})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7A2E\u985E"}),(0,d.jsx)("dd",{"data-testid":"run-document-kind","data-kind":L.documentKind,children:Oe.DOCUMENT_KIND_LABELS[L.documentKind]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u6D41\u308C"}),(0,d.jsx)("dd",{children:(0,d.jsx)("code",{className:"font-mono","data-testid":"run-document-flow",children:L.flowKey})})]})]})]}),p!==null?(0,d.jsx)("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:p}):l?(0,d.jsx)("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"}):G()]})}var mt=require("@aiquants/console-ui/core"),Na=require("react");var v=require("react/jsx-runtime");function hs(e,t){return e==null?null:Ae(e,"segment_count",t)}function xa(e,t,o){return e==null?null:st(e,t,o)}function Ns(e){let t=e.probe_failure;if(t===null)return null;if(!Je.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 ya(e,t,o){return e.reduce((c,l)=>c+Ae(l[t],`${t} of collection ${l.collection_name}`,o),0)}var Ss=(0,mt.cssVar)("space-1"),ws={padding:0,height:"1px",color:"#1e293b"},Es={display:"flex",height:"100%"},ks={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},Rs={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},Is={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Kt={whiteSpace:"nowrap"},va=(0,mt.cssVar)("space-3"),_s=(0,mt.cssVar)("info-tint"),Bt={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function ha(e,t){return`vectors_config.${e}.size of collection ${t}`}function Cs({overview:e,health:t,resources:o,onRefresh:c,isRefreshing:l=!1,selection:p}){let{formatLocale:b}=te(),m=(0,Na.useId)(),{collections:y}=e,N=Ns(e),h=N===null,C=h?ya(y,"points_count",b):null,E=h?ya(y,"vectors_count",b):null,J=xa(o?.ram_bytes,"ram_bytes",b),ae=xa(o?.disk_bytes,"disk_bytes",b),K=hs(o?.segment_count,b);return(0,v.jsxs)("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,v.jsxs)("div",{"data-testid":"qdrant-card-header",style:Rs,children:[(0,v.jsxs)("div",{"data-testid":"qdrant-card-title-group",style:Is,children:[(0,v.jsx)("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&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...He[t.healthy?"connected":"error"],style:{...Kt,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ge[t.healthy?"connected":"error"]}),(0,v.jsxs)("span",{"data-testid":"qdrant-latency",style:{...Kt,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",(0,v.jsx)(q,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),c&&(0,v.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:l,onClick:c,style:{...Kt,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:l?"not-allowed":"pointer",fontSize:"13px"},children:l?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),(0,v.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:C,testId:"qdrant-total-points-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:E,testId:"qdrant-total-vectors-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,v.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(Se,{text:J,testId:"qdrant-ram-usage-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,v.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(Se,{text:ae,testId:"qdrant-disk-usage-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:K,testId:"qdrant-segment-count-value"})})]})]}),(0,v.jsxs)("div",{children:[(0,v.jsxs)("h3",{id:m,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",(0,v.jsx)(q,{value:h?y.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),N!==null?(0,v.jsx)("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:N}):y.length===0?(0,v.jsx)("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"}):(0,v.jsx)("section",{tabIndex:0,"aria-labelledby":m,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Ss},children:(0,v.jsxs)("table",{"aria-labelledby":m,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,v.jsx)("thead",{children:(0,v.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[(0,v.jsx)("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${va}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,v.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,v.jsx)("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,v.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,v.jsx)("tbody",{children:y.map(I=>{let Q=p!==void 0&&I.collection_name===p.selectedCollectionName,R=(0,v.jsx)("span",{style:ks,children:I.collection_name}),{dense:O,sparse:A,image:L}=I.vectors_config,G=O===void 0?null:Ae(O.size,ha("dense",I.collection_name),b),g=L===void 0?null:Ae(L.size,ha("image",I.collection_name),b);return(0,v.jsxs)("tr",{"data-testid":`collection-row-${I.collection_name}`,"data-collection-name":I.collection_name,"data-selected":String(Q),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:Q?_s:"transparent"},children:[p===void 0?(0,v.jsx)("td",{style:{padding:`8px ${va}`,color:"#1e293b"},children:R}):(0,v.jsx)("td",{style:ws,children:(0,v.jsx)("div",{style:Es,children:(0,v.jsx)(zt,{selected:Q,controls:p.detailId,onSelect:()=>p.onSelectCollection(I.collection_name),testId:`collection-select-${I.collection_name}`,children:R})})}),(0,v.jsx)("td",{style:{padding:"8px",color:"#475569"},children:I.domain_key}),(0,v.jsx)("td",{"data-testid":`collection-points-${I.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:(0,v.jsx)(q,{value:I.points_count,testId:`collection-points-value-${I.collection_name}`})}),(0,v.jsx)("td",{style:{padding:"8px"},children:(0,v.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[G!==null&&(0,v.jsxs)("span",{"data-testid":`vector-tag-dense-${I.collection_name}`,style:{...Bt,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",(0,v.jsx)(q,{value:G,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${I.collection_name}`})]}),A!==void 0&&(0,v.jsx)("span",{"data-testid":`vector-tag-sparse-${I.collection_name}`,style:{...Bt,backgroundColor:"#fef3c7",color:"#92400e"},children:A.modifier?`Sparse (${A.modifier.toUpperCase()})`:"Sparse"}),g!==null&&(0,v.jsxs)("span",{"data-testid":`vector-tag-image-${I.collection_name}`,style:{...Bt,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",(0,v.jsx)(q,{value:g,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${I.collection_name}`})]})]})})]},I.collection_name)})})]})})]})]})}var w=require("react/jsx-runtime"),Ps="\u5BFE\u8C61\u306A\u3057";function Ls({counts:e,totalFiles:t,failedItems:o=[],onRetryAll:c,onRetryItem:l,isRetrying:p=!1,onRefresh:b}){te();let m=e.SYNCED??0,y=e.PENDING??0,N=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),h=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),C=t>0?`${(m/t*100).toFixed(1)}%`:Ps;return(0,w.jsxs)("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("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"}),(0,w.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,w.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,w.jsx)("span",{"data-testid":"success-rate-value",children:C}),")"]})]}),(0,w.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[b&&(0,w.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:b,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),c&&(0,w.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:p||h===0,onClick:c,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:p||h===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:p||h===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:p?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,w.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,w.jsxs)("div",{"data-testid":"status-card-synced","data-count":m,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,w.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:m})]}),(0,w.jsxs)("div",{"data-testid":"status-card-processing","data-count":N,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,w.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:N})]}),(0,w.jsxs)("div",{"data-testid":"status-card-pending","data-count":y,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,w.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:y})]}),(0,w.jsxs)("div",{"data-testid":"status-card-failed","data-count":h,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,w.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:h})]})]}),(0,w.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,w.jsxs)("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 (",o.length<h?`\u4E0A\u4F4D ${o.length} \u4EF6 / \u5168 ${h} \u4EF6`:`${o.length} \u4EF6`,")"]}),o.length===0?(0,w.jsx)("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"}):(0,w.jsx)("div",{style:{overflowX:"auto"},children:(0,w.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,w.jsx)("thead",{children:(0,w.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,w.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,w.jsx)("tbody",{children:o.map(E=>(0,w.jsxs)("tr",{"data-testid":`failed-item-row-${E.id}`,"data-file-uri":E.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,w.jsxs)("td",{"data-testid":`failed-item-uri-${E.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,w.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:E.file_name}),(0,w.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:E.file_uri})]}),(0,w.jsx)("td",{style:{padding:"8px"},children:(0,w.jsx)("span",{"data-testid":`failed-item-status-${E.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:E.sync_status})}),(0,w.jsx)("td",{"data-testid":`failed-item-error-${E.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:E.error_message??"",children:E.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,w.jsx)("td",{"data-testid":`failed-item-time-${E.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:E.failed_at===null?"\u8A18\u9332\u306A\u3057":(0,w.jsx)(ge,{iso:E.failed_at,testId:`failed-item-time-value-${E.id}`})}),(0,w.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:l&&(0,w.jsx)("button",{type:"button","data-testid":`retry-item-button-${E.id}`,"aria-label":`${E.file_name} (${E.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:p,onClick:()=>l(E.id,E.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:p?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},E.id))})]})})]})]})}0&&(module.exports={CHUNK_SOURCE_LABELS,DegradedSearchBanner,DocumentIngestConsole,EnrichmentStrategyBoard,FLOW_FOCUS_RING,FLOW_GEOMETRY,FLOW_NODE_TEXT,FinishedInstant,GATE_POLICY_LABELS,GATE_STATE_PRESENTATION,InfrastructureHealthMonitor,MetadataSearchWorkbench,ModelComparisonWorkbench,NOTHING_TO_READ_LABELS,OntologyStatusCard,PHASE_LABELS,PIPELINE_RUN_STATUS_PRESENTATION,PIPELINE_STEP_STATUS_PRESENTATION,PIPELINE_TRIGGER_LABELS,PipelineFlowViewer,PipelineRunInspector,QdrantStorageCard,REASON_LABELS,RecordedInstant,SCORE_DISPLAY_DECIMALS,SEARCH_MODE_LABELS,SEARCH_PRESETS,STEP_CARDS_OPEN_LIMIT,SyncStatusMonitor,UNFINISHED_LABEL,formatComparisonScore,gateCaption,gateState,gateStateOf,ingestRowAction,layoutFlow,pipelineRunPresentationKey,rankAgreement,skipReasonLabel,stepGatePolicy,stepGateState});
1
+ "use strict";var ia=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var vs=Object.getOwnPropertyNames;var Ns=Object.prototype.hasOwnProperty;var Ss=(e,t)=>{for(var a in t)ia(e,a,{get:t[a],enumerable:!0})},Es=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vs(t))!Ns.call(e,o)&&o!==a&&ia(e,o,{get:()=>t[o],enumerable:!(s=hs(t,o))||s.enumerable});return e};var Rs=e=>Es(ia({},"__esModule",{value:!0}),e);var zr={};Ss(zr,{CHUNKING_ONLY_NOTE:()=>pa,CHUNK_BODY_FIDELITY_LABELS:()=>la,CHUNK_CHANGE_KIND_LABELS:()=>Kt,CHUNK_SOURCE_LABELS:()=>os,DOCUMENT_STATE_CAUSE_LABELS:()=>it,DegradedSearchBanner:()=>da,DocumentChangeFeed:()=>Ds,DocumentHistoryInspector:()=>ir,DocumentIngestConsole:()=>mr,EnrichmentStrategyBoard:()=>fr,FACET_LABELS:()=>tt,FAILED_RUN_STATE_MARK:()=>ga,FIELD_LABELS:()=>It,FLOW_FOCUS_RING:()=>ot,FLOW_GEOMETRY:()=>ss,FLOW_NODE_TEXT:()=>bt,FinishedInstant:()=>mt,GATE_POLICY_LABELS:()=>za,GATE_STATE_PRESENTATION:()=>Wa,HISTORY_REFUSAL:()=>je,InfrastructureHealthMonitor:()=>xr,MODEL_ONLY_CHANGE_MARK:()=>ba,MetadataSearchWorkbench:()=>Er,ModelComparisonWorkbench:()=>Rr,NOTHING_TO_READ_LABELS:()=>hn,NO_ENRICHMENT_RECORD_TEXT:()=>zn,NO_PREVIOUS_RECORD_TEXT:()=>fa,OntologyStatusCard:()=>kr,PHASE_LABELS:()=>Ga,PIPELINE_RUN_STATUS_PRESENTATION:()=>qe,PIPELINE_STEP_STATUS_PRESENTATION:()=>zt,PIPELINE_TRIGGER_LABELS:()=>jt,PipelineFlowViewer:()=>Dr,QdrantStorageCard:()=>qr,REASON_LABELS:()=>Ja,RESTRICTED_DOCUMENT_TEXT:()=>dt,RESTRICTED_RUN_TEXT:()=>kt,RESTRICTED_STATE_TEXT:()=>ma,RUN_TERMINAL_STEP_LABEL:()=>xn,RUN_TERMINAL_STEP_OUTCOME_LABELS:()=>Sa,RecordedInstant:()=>ge,SCORE_DISPLAY_DECIMALS:()=>Ka,SEARCH_MODE_LABELS:()=>Oa,SEARCH_PRESETS:()=>ts,SyncStatusMonitor:()=>Wr,UNFINISHED_LABEL:()=>Ea,UNRECORDED_RUN_MARK:()=>Ht,UNVERIFIED_CHUNK_NOTE:()=>ua,WHITESPACE_NORMALIZED_NOTE:()=>ca,facetCountsText:()=>wt,fieldLabel:()=>yt,formatComparisonScore:()=>Ua,gateCaption:()=>ds,gateState:()=>ja,gateStateOf:()=>$a,historyFailedSentence:()=>Xe,historyFailureSentence:()=>Ct,ingestRowAction:()=>jn,jsonValueText:()=>at,layoutFlow:()=>Ba,ledgerStepLabel:()=>Xt,pipelineRunPresentationKey:()=>Je,rankAgreement:()=>as,revisionLabel:()=>Ke,revisionTransitionText:()=>Bt,skipReasonLabel:()=>Ra,stepGatePolicy:()=>qa,stepGateState:()=>is,unrecordedRunsMark:()=>ya});module.exports=Rs(zr);var ze=require("react/jsx-runtime"),Ja={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 da({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let s=(e.degradation_reason??"").split(",").map(o=>o.trim()).filter(o=>o.length>0);return(0,ze.jsx)("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:(0,ze.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,ze.jsxs)("div",{children:[(0,ze.jsxs)("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"]}),s.length>0&&(0,ze.jsx)("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:s.map(o=>(0,ze.jsx)("li",{"data-testid":`degraded-reason-${o}`,children:Ja[o]??o},o))})]}),t&&(0,ze.jsx)("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"})]})})}var Dt=require("@aiquants/console-ui/core"),Sn=require("@aiquants/enrichment-core"),ka=require("react");var Qa=require("@aiquants/console-ui/core"),tt={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"},it={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"},Kt={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},la={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"},ca="\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",ua="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",pa="\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",It={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 yt(e){return Object.hasOwn(It,e)?It[e]:e}var dt="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",ma="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",kt="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",fa="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",ga="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",Ht="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",ba="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function ya(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 Ke(e){return`r${e}`}function Bt(e,t){return e===t?`${Ke(t)} (\u540C\u3058\u7248)`:`${Ke(e)} \u2192 ${Ke(t)}`}function wt(e){let t=tt[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let s=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([o,i])=>o===null||o===0?[]:[`${i}${o}`]);return s.length===0?`${t} \u5909\u66F4`:`${t} ${s.join(" ")}`}function at(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var je="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function Ct(e,t,a){return e.failureSentence(t,je,Xe(a))}function Xe(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${(0,Qa.reasonAside)(t)}\u3002`}var xa=require("@aiquants/enrichment-core"),Za=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function en(e){let t=e.states.flatMap(u=>u.kind==="readable"?[u.item]:[]),a=e.runs.flatMap(u=>u.kind==="readable"?[u.item]:[]),s=new Set(a.map(u=>u.id)),o=[...a.map(u=>({kind:"run",key:`run:${u.id}`,time:u.startedAt,run:u,state:t.find(h=>h.runId===u.id)??null})),...t.filter(u=>u.runId===null||!s.has(u.runId)).map(u=>({kind:"state",key:`state:${u.stateId}`,time:u.settledAt,state:u}))].sort(Za),l=[...new Set([...e.revisions.map(u=>u.revision),...o.map(u=>u.kind==="run"?u.run.revision:u.state.revision)])].sort((u,h)=>h-u).map(u=>({revision:u,isCurrent:e.revisions.some(h=>h.revision===u&&h.isCurrent),items:o.filter(h=>(h.kind==="run"?h.run.revision:h.state.revision)===u)})),m=[...e.states.flatMap((u,h)=>u.kind==="restricted"?[{key:`restricted:state:${h}`,time:u.settledAt,mark:u}]:[]),...e.runs.flatMap((u,h)=>u.kind==="restricted"?[{key:`restricted:run:${h}`,time:u.startedAt,mark:u}]:[])].sort(Za);return{groups:l,marks:m,states:t,runs:a}}function ha(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(a=>a.stepKey===xa.RUN_TERMINAL_STEP_KEY);return t===void 0||t.status==="FAILED"}function tn(e,t){let a=t.states.find(i=>i.stateId===e.previousStateId);if(a===void 0)return[];let s=Date.parse(a.settledAt),o=Date.parse(e.settledAt);return t.runs.filter(i=>{let l=Date.parse(i.startedAt);return i.status!=="RUNNING"&&i.id!==e.runId&&l>=s&&l<o&&!t.states.some(m=>m.runId===i.id)&&!i.steps.some(m=>m.stepKey===xa.RUN_TERMINAL_STEP_KEY&&m.status==="SUCCEEDED")}).map(i=>i.id)}function an(e,t){switch(e.kind){case"latest_state":{let a=t.states[0];return a===void 0?null:t.runs.some(s=>s.id===a.runId)?`run:${a.runId}`:`state:${a.stateId}`}case"run":return`run:${e.runId}`;case"state":{let a=t.states.find(s=>s.stateId===e.stateId);return a!==void 0&&t.runs.some(s=>s.id===a.runId)?`run:${a.runId}`:`state:${e.stateId}`}}}function nn(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}var sn=require("react");function Gt(e){let[t,a]=(0,sn.useState)({failure:null,count:0});return e!==null&&e!==t.failure?(a({failure:e,count:t.count+1}),t.count+1):t.count}var Ee=require("@aiquants/console-ui/core"),nt=Ee.TOKENS.type.body.size,va=Ee.TOKENS.space["space-3"],Is=20,rn=(0,Ee.ceil8)(nt*(0,Ee.textWidthEm)("\u3042".repeat(Is))+2*va),on=448,ks=40,ws=2,Cs="+ ",_s=Ee.TOKENS.space["space-4"];function Ts(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 dn(e){let a=(0,Ee.monoTextWidthEm)("0".repeat(Ts(e)+ws))+(0,Ee.monoTextWidthEm)(Cs)+(0,Ee.monoTextWidthEm)("0".repeat(ks));return(0,Ee.ceil8)(nt*2*a+_s)}function lt(e){return(0,Ee.ceil8)(nt*(0,Ee.textWidthEm)(e)+2*va)}function ct(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(lt))}function qt(e){return(0,Ee.ceil8)(nt*(0,Ee.textWidthEm)(e)+4*va)}var ln="0000/00/00 00:00:00",Oe=lt("\u3042".repeat(10));var Y=require("@aiquants/console-ui"),Te=require("react");var _t="ja-JP";function K(){let e=(0,Y.useConsoleUi)();if(e.locale!=="ja"||e.formatLocale!==_t)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${_t}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function ae(e){return K(),(0,Te.createElement)(Y.Measured,e)}function un(e){return K(),(0,Te.createElement)(Y.RowButton,e)}function pn(e){return K(),(0,Te.createElement)(Y.MasterDetail,e)}function mn(e){return K(),(0,Te.createElement)(Y.ComparisonGrid,e)}function Ye(e){return K(),(0,Te.createElement)(Y.Pill,e)}function fn(e){return K(),(0,Te.createElement)(Y.Card,e)}function Le(e){return K(),(0,Te.createElement)(Y.Button,e)}function xt(e){return K(),(0,Te.createElement)(Y.Notice,e)}function Tt(e){return K(),(0,Te.createElement)(Y.AlertMessage,e)}function ut(e){return K(),(0,Te.createElement)(Y.ResourceFailed,e)}function Vt(e){return K(),(0,Te.createElement)(Y.LoadMore,e)}function gn(e){return K(),(0,Te.createElement)(Y.VisuallyHidden,e)}function ht(e){return K(),(0,Te.createElement)(Y.DataTable,e)}function bn(e){return K(),(0,Te.createElement)(Y.SelectableList,e)}function Na(e,t,a){return K(),(0,Y.useResource)(e,t,a)}function Wt(e,t,a){return K(),(0,Y.usePagedResource)(e,t,a)}function Ge(e){return K(),(0,Y.useFocusRescue)(e)}var Pt=require("react/jsx-runtime"),Lt=/[^\s\x1c-\x1f\x85\ufeff]/,Ps={fontVariantNumeric:"tabular-nums"},Ls={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function yn({text:e,testId:t,slot:a}){if(K(),e===null)return(0,Pt.jsx)(ae,{value:null,testId:t});if(!Lt.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(0,Pt.jsx)("span",{"data-measured":"true","data-testid":t,style:a,children:e})}function $t({text:e,testId:t}){return(0,Pt.jsx)(yn,{text:e,testId:t,slot:Ps})}function Fe({text:e,testId:t}){return(0,Pt.jsx)(yn,{text:e,testId:t,slot:Ls})}var pt=require("@aiquants/enrichment-core"),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"}},zt={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"}},jt={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},xn="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Xt(e){return e===pt.RUN_TERMINAL_STEP_KEY?xn:pt.PIPELINE_STEPS[e].label}var Sa={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"},Ea="\u672A\u5B8C\u4E86";function Je(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var hn={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 Ra(e){let t=(0,pt.parseSkipReason)(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`${pt.PIPELINE_STEPS[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return hn[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"}}var vn=require("@aiquants/console-ui/core");function Nn(e,t){return(0,vn.formatInstant)(e,_t,t)}var Ia=require("react/jsx-runtime");function ge({iso:e,testId:t}){let{timeZone:a}=K();return(0,Ia.jsx)(Fe,{text:e===null?null:Nn(e,a),testId:t})}function mt({iso:e,testId:t}){return K(),e===null?Ea:(0,Ia.jsx)(ge,{iso:e,testId:t})}var xe=require("react/jsx-runtime"),$s="document-changes";function Ds({host:e,onOpen:t}){let{labels:a}=K(),s=(0,ka.useRef)(null),o=(0,ka.useRef)(null),i=Wt($s,{first:P=>e.loadChanges(null,P).then(I=>(0,Dt.mapOutcome)(I,p=>({rows:p.rows,next:p.next,meta:null}))),next:(P,I)=>e.loadChanges(P,I).then(p=>(!p.ok&&p.status===Dt.HTTP_FORBIDDEN&&i.reload(),(0,Dt.mapOutcome)(p,T=>({rows:T.rows,next:T.next}))))},0),l=Ge(()=>s.current),m=i.state.kind==="ready"?i.state.refreshFailure:null,u=Gt(m);return(0,xe.jsx)(fn,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:s,testId:"change-feed",children:(()=>{if(i.state.kind==="failed")return(0,xe.jsx)(ut,{failure:i.state,onReload:i.reload,forbiddenMessage:je,failureMessage:Xe("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:l,testId:"change-feed-failed"});if(i.state.kind!=="ready")return(0,xe.jsx)("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:P}=i.state,I=P.rows.map((p,T)=>({row:p,position:T}));return(0,xe.jsxs)(xe.Fragment,{children:[m!==null&&(0,xe.jsx)(Tt,{occurrence:u,testId:"change-feed-refresh-failed",children:Ct(a,m,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),(0,xe.jsx)(ht,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:lt(ln)},align:"start",cell:({row:p,position:T})=>(0,xe.jsx)(ge,{iso:p.kind==="readable"?p.item.settledAt:p.settledAt,testId:`change-feed-time-value-${T}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Oe},align:"start",cell:({row:p})=>p.kind==="readable"?(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)("span",{children:p.item.fileName})," ",(0,xe.jsx)("span",{children:p.item.fileUri})]}):(0,xe.jsx)("span",{"data-restricted-mark":"change",children:dt})},{key:"revision",header:"\u7248",width:{fixedPx:lt("r00000 \u2192 r00000")},align:"start",cell:({row:p})=>p.kind==="readable"?Bt(p.item.previousRevision,p.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:ct(Object.values(it))},align:"start",cell:({row:p})=>p.kind==="readable"?it[p.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Oe},align:"start",cell:({row:p})=>p.kind==="readable"?p.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Oe},align:"start",cell:({row:p,position:T})=>p.kind==="readable"?p.item.changes.map(O=>(0,xe.jsx)(Ye,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${T}-${O.facet}`,children:wt(O)},O.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:qt("\u958B\u304F")},align:"start",cell:({row:p})=>p.kind==="readable"?(0,xe.jsxs)(Le,{variant:"secondary",onClick:()=>t(p.item.metadataId,p.item.stateId),testId:`change-feed-open-${p.item.stateId}`,children:["\u958B\u304F ",(0,xe.jsx)(gn,{testId:`change-feed-open-name-${p.item.stateId}`,children:`${p.item.fileName} ${Bt(p.item.previousRevision,p.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:I,rowKey:({row:p,position:T})=>nn(p,T),rowTestId:"change-feed-row",rowData:({row:p})=>({"data-row-kind":p.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:o}),(0,xe.jsx)(Vt,{onLoad:i.loadMore,busy:P.loadingMore||i.state.refreshing,done:P.next===null,failure:P.moreFailure,limit:Sn.DOCUMENT_CHANGE_FEED_PAGE_SIZE,rows:{count:I.length,ref:o},testId:"change-feed-more"})]})})()})}var vt=require("@aiquants/console-ui/core"),Bn=require("@aiquants/enrichment-core"),se=require("react");var Dn=require("@aiquants/console-ui/core"),An=require("@aiquants/enrichment-core"),st=require("react");var _n=require("react");var Ca=require("@aiquants/console-ui/core"),Yt=require("@aiquants/enrichment-core"),Re=require("react");var v=require("react/jsx-runtime"),_a="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",Rn={context:"",removed:"\u2212",added:"+"},In={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function wa(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 As(e){return e.reduce((t,a)=>Math.max(t,a.oldStart+a.oldLines-1,a.newStart+a.newLines-1),0)}function Ms(e){return e.reduce((t,{line:a})=>Math.max(t,a.oldNumber??0,a.newNumber??0),0)}function Os(e){let t=[],a=0;for(let s=1;s<=e.length;s++)(s===e.length||e[s].page!==e[a].page)&&(t.push(...Fs(e.slice(a,s).map(({line:o})=>o))),a=s);return t}function Fs(e){let t=[],a=[],s=[],o=()=>{for(let i=0;i<Math.max(a.length,s.length);i++)t.push({left:a[i]??null,right:s[i]??null});a=[],s=[]};for(let i of e)i.kind==="context"?(o(),t.push({left:i,right:i})):i.kind==="removed"?(s.length>0&&o(),a.push(i)):s.push(i);return o(),t}function kn(e){return e.segments.map((t,a)=>{let s=`${a}`;return t.kind==="removed"?(0,v.jsx)("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},s):t.kind==="added"?(0,v.jsx)("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},s):(0,v.jsx)("span",{children:t.text},s)})}function En(e,t){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("td",{"data-line-number":t,children:e===null?"":t==="old"?e.oldNumber:e.newNumber}),(0,v.jsx)("td",{"data-line-sign":!0,children:e===null?"":Rn[e.kind]}),(0,v.jsx)("td",{style:In,"data-line-text":t,children:e===null?null:kn(e)})]})}function Us({states:e,target:t,hunk:a,layout:s,tableLabel:o,readLines:i,rescueTarget:l,onLines:m,testId:u}){let h={...e,...t,hunk:a},P=JSON.stringify([e.fromStateId,e.toStateId,t,a]),I=Wt(P,{first:E=>i({...h,offset:0,limit:Yt.DIFF_LINE_PAGE_MAX},E).then($=>(0,Ca.mapOutcome)($,H=>({rows:H.lines.map(Z=>({line:Z,page:0})),next:H.next,meta:null}))),next:(E,$)=>i({...h,offset:E,limit:Yt.DIFF_LINE_PAGE_MAX},$).then(H=>(0,Ca.mapOutcome)(H,Z=>({rows:Z.lines.map(V=>({line:V,page:E})),next:Z.next})))},0),p=Ge(l),T=(0,Re.useRef)(null),O=I.state.kind==="ready"?I.state.value.rows:null;if((0,Re.useEffect)(()=>{O!==null&&m(Ms(O))},[O,m]),I.state.kind==="failed")return(0,v.jsx)(ut,{failure:I.state,onReload:I.reload,forbiddenMessage:je,failureMessage:Xe("\u5DEE\u5206\u306E\u884C"),rescueRef:p,testId:`${u}-failed`});if(I.state.kind!=="ready")return(0,v.jsx)("p",{"aria-busy":"true","data-testid":`${u}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:g}=I.state,k=s==="split"?Os(g.rows):null;return(0,v.jsxs)("div",{"data-testid":u,"data-layout":s,children:[(0,v.jsxs)("table",{"aria-label":o,"data-testid":`${u}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[(0,v.jsx)("thead",{children:s==="split"?(0,v.jsxs)("tr",{children:[(0,v.jsx)("th",{scope:"col",children:"\u65E7"}),(0,v.jsx)("th",{scope:"col",children:"\u7B26\u53F7"}),(0,v.jsx)("th",{scope:"col",children:"\u53E4\u3044\u672C\u6587"}),(0,v.jsx)("th",{scope:"col",children:"\u65B0"}),(0,v.jsx)("th",{scope:"col",children:"\u7B26\u53F7"}),(0,v.jsx)("th",{scope:"col",children:"\u65B0\u3057\u3044\u672C\u6587"})]}):(0,v.jsxs)("tr",{children:[(0,v.jsx)("th",{scope:"col",children:"\u65E7"}),(0,v.jsx)("th",{scope:"col",children:"\u65B0"}),(0,v.jsx)("th",{scope:"col",children:"\u7B26\u53F7"}),(0,v.jsx)("th",{scope:"col",children:"\u672C\u6587"})]})}),(0,v.jsx)("tbody",{ref:T,children:k===null?g.rows.map(({line:E},$)=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":E.kind,children:[(0,v.jsx)("td",{"data-line-number":"old",children:E.oldNumber}),(0,v.jsx)("td",{"data-line-number":"new",children:E.newNumber}),(0,v.jsx)("td",{"data-line-sign":!0,children:Rn[E.kind]}),(0,v.jsx)("td",{style:In,"data-line-text":"unified",children:kn(E)})]},$)):k.map(E=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":E.left===E.right?"context":"changed",children:[En(E.left,"old"),En(E.right,"new")]},`${E.left?.oldNumber??""}:${E.right?.newNumber??""}`))})]}),(0,v.jsx)(Vt,{onLoad:I.loadMore,busy:g.loadingMore||I.state.refreshing,done:g.next===null,failure:g.moreFailure,limit:Yt.DIFF_LINE_PAGE_MAX,rows:{count:k===null?g.rows.length:k.length,ref:T},testId:`${u}-more`})]})}function Ks(){let[e,t]=(0,Re.useState)(null);return[(0,Re.useCallback)((s=>{let o=new ResizeObserver(i=>{for(let l of i)t(l.contentRect.width)});return o.observe(s),()=>o.disconnect()}),[]),e]}function Jt({states:e,target:t,index:a,readLines:s,label:o,rescueTarget:i,onNarrowChange:l,testId:m}){K();let u=(0,Re.useId)(),[h,P]=(0,Re.useState)("split"),[I,p]=(0,Re.useState)(()=>new Set(a===null?[0]:[])),[T,O]=(0,Re.useState)(0),[g,k]=Ks(),E=(0,Re.useRef)(new Map),$=(0,Re.useCallback)(R=>O(W=>Math.max(W,R)),[]),H=dn(Math.max(a===null?0:As(a.hunks),T)),Z=k!==null&&k>=H,V=h==="split"&&Z?"split":"unified",ee=h==="split"&&k!==null&&!Z;(0,Re.useEffect)(()=>{l(u,ee)},[u,ee,l]),(0,Re.useEffect)(()=>()=>l(u,!1),[u,l]);let B=(R,W)=>p(J=>{let be=new Set(J);return W?be.add(R):be.delete(R),be}),q=R=>`${u}-hunk-${R}`,oe=(R,W)=>(0,v.jsx)(Us,{states:e,target:t,hunk:R,layout:V,tableLabel:W,readLines:s,rescueTarget:()=>E.current.get(R)??i(),onLines:$,testId:`${m}-hunk-${R}-body`});return(0,v.jsxs)("div",{ref:g,"data-testid":m,"data-layout":V,"data-split-min-px":H,children:[a!==null&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("dl",{"data-testid":`${m}-stats`,children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u8FFD\u52A0\u3057\u305F\u884C"}),(0,v.jsx)("dd",{children:(0,v.jsx)(ae,{value:a.stats.linesAdded,testId:`${m}-lines-added`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u524A\u9664\u3057\u305F\u884C"}),(0,v.jsx)("dd",{children:(0,v.jsx)(ae,{value:a.stats.linesRemoved,testId:`${m}-lines-removed`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u5909\u308F\u3089\u306A\u3044\u884C"}),(0,v.jsx)("dd",{children:(0,v.jsx)(ae,{value:a.stats.linesUnchanged,testId:`${m}-lines-unchanged`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u8FFD\u52A0\u3057\u305F\u5B57"}),(0,v.jsx)("dd",{children:(0,v.jsx)(ae,{value:a.stats.charsAdded,testId:`${m}-chars-added`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u524A\u9664\u3057\u305F\u5B57"}),(0,v.jsx)("dd",{children:(0,v.jsx)(ae,{value:a.stats.charsRemoved,testId:`${m}-chars-removed`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u985E\u4F3C\u5EA6"}),(0,v.jsx)("dd",{children:(0,v.jsx)(Fe,{text:a.stats.similarity===null?null:`${(a.stats.similarity*100).toFixed(1)}%`,testId:`${m}-similarity`})})]})]}),a.attributes.length>0&&(0,v.jsx)("ul",{"data-testid":`${m}-attributes`,children:a.attributes.map(R=>(0,v.jsxs)("li",{"data-field":R.field,children:[yt(R.field)," ",at(R.before)," \u2192 ",at(R.after)]},R.field))}),a.hunks.length>0&&(0,v.jsx)("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${m}-hunk-index`,children:a.hunks.map(R=>(0,v.jsx)("li",{children:(0,v.jsx)("a",{href:`#${q(R.hunk)}`,onClick:()=>B(R.hunk,!0),"data-hunk":R.hunk,children:wa(R)})},R.hunk))})]}),(0,v.jsx)(Le,{variant:"secondary",onClick:()=>P(h==="split"?"unified":"split"),dataAttributes:{"data-preferred":h},testId:`${m}-layout-toggle`,children:h==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),ee&&(0,v.jsx)("p",{"data-testid":`${m}-narrow`,children:_a}),a===null?oe(0,o):a.hunks.map(R=>{let W=I.has(R.hunk);return(0,v.jsxs)("div",{id:q(R.hunk),"data-testid":`${m}-hunk-${R.hunk}`,"data-open":W,children:[(0,v.jsx)(Le,{variant:"secondary",expanded:W,controls:`${q(R.hunk)}-body`,onClick:()=>B(R.hunk,!W),ref:J=>{J===null?E.current.delete(R.hunk):E.current.set(R.hunk,J)},testId:`${m}-hunk-${R.hunk}-toggle`,children:wa(R)}),(0,v.jsx)("div",{id:`${q(R.hunk)}-body`,children:W&&oe(R.hunk,`${o} ${wa(R)}`)})]},R.hunk)})]})}var $e=require("react/jsx-runtime");function Hs(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 wn(e){return e.new??e.old}function Cn(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function Tn({states:e,stats:t,entries:a,textUnchangedChunkingChanged:s,readLines:o,rescueTarget:i,onNarrowChange:l,testId:m}){K();let[u,h]=(0,_n.useState)(()=>new Set),P=p=>h(T=>{let O=new Set(T);return O.delete(p)||O.add(p),O}),I=p=>{let T=[p.old===null?null:["\u65E7",p.old],p.new===null?null:["\u65B0",p.new]].filter(g=>g!==null),O=new Set(T.flatMap(([,g])=>g.fidelity==="UNVERIFIED"?[ua]:g.fidelity==="WHITESPACE_NORMALIZED"?[ca]:[]));return(0,$e.jsxs)($e.Fragment,{children:[T.map(([g,k])=>(0,$e.jsxs)("span",{"data-fidelity":k.fidelity,"data-side":g,children:[g," ",la[k.fidelity]," "]},g)),[...O].map(g=>(0,$e.jsx)("span",{"data-chunk-note":!0,children:g},g))]})};return(0,$e.jsxs)("div",{"data-testid":m,children:[s&&(0,$e.jsx)(xt,{tone:"info",testId:`${m}-chunking-only`,children:pa}),(0,$e.jsxs)("p",{"data-testid":`${m}-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]}),(0,$e.jsx)(ht,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:ct(Object.values(Kt))},align:"start",cell:p=>Kt[p.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Oe},align:"start",cell:p=>Hs(wn(p))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Oe},align:"start",cell:p=>wn(p).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:lt("#00000 \u2192 #00000")},align:"start",cell:p=>`${p.old===null?"(\u306A\u3057)":`#${p.old.index}`} \u2192 ${p.new===null?"(\u306A\u3057)":`#${p.new.index}`}`},{key:"fidelity",header:"\u672C\u6587\u306E\u518D\u73FE",width:{minPx:Oe},align:"start",cell:I},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:qt("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:p=>Cn(p)?(0,$e.jsx)(Le,{variant:"secondary",expanded:u.has(p.entry),controls:`${m}-diff-${p.entry}`,onClick:()=>P(p.entry),testId:`${m}-diff-toggle-${p.entry}`,children:u.has(p.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:a,rowKey:p=>`${p.entry}`,rowTestId:`${m}-row`,rowData:p=>({"data-entry":p.entry,"data-kind":p.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${m}-table`}),a.filter(p=>Cn(p)&&u.has(p.entry)).map(p=>{let T=`\u30C1\u30E3\u30F3\u30AF #${p.old?.index} \u2192 #${p.new?.index} \u306E\u5DEE\u5206`;return(0,$e.jsx)("section",{id:`${m}-diff-${p.entry}`,"aria-label":T,"data-testid":`${m}-diff-${p.entry}`,children:(0,$e.jsx)(Jt,{states:e,target:{facet:"chunks",entry:p.entry},index:null,readLines:o,label:T,rescueTarget:i,onNarrowChange:l,testId:`${m}-diff-${p.entry}-view`})},p.entry)})]})}var le=require("react/jsx-runtime"),Bs={fontSize:`${nt}px`,fontWeight:Dn.TOKENS.weight.bold},Pn={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},Ln={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},Gs=ct(Object.values(It));function qs(e,t,a){let s=o=>Object.fromEntries(t.map(i=>[i.field,l=>(0,le.jsx)("span",{"data-testid":`${a}-${i.field}-${o}-${l}`,children:at(i[o])})]));return(0,le.jsx)(mn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(o=>({key:o.field,label:yt(o.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:s("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:s("after")}],attributePx:Gs,columnMinPx:Oe,testId:a})}function At(e,t,a){return t.length===0?null:(0,le.jsxs)("div",{"data-testid":a,children:[(0,le.jsxs)("p",{children:[e," (",t.length,")"]}),(0,le.jsx)("ul",{children:t.map(([s,o])=>(0,le.jsx)("li",{children:o},s))})]})}var $n=e=>[e.key,`${e.key}: ${JSON.stringify(e.value)}`],Vs=e=>[e.key,`${e.key}: ${e.fields.map(t=>`${yt(t.field)} ${at(t.before)} \u2192 ${at(t.after)}`).join("\u3001")}`];function Mn({states:e,comparison:t,readLines:a,rescueTarget:s,testId:o}){let{announce:i}=K(),l=(0,st.useId)(),[m,u]=(0,st.useState)(()=>new Set),h=(0,st.useCallback)((g,k)=>u(E=>{if(E.has(g)===k)return E;let $=new Set(E);return k?$.add(g):$.delete(g),$}),[]),P=m.size>0;(0,st.useEffect)(()=>{P&&i(_a)},[P,i]);let I=t.facets.filter(g=>g.change==="CHANGED"),p=An.DOCUMENT_FACETS.filter(g=>!I.some(k=>k.facet===g)),T=g=>`${l}-${g}`,O=g=>{let k=`${o}-${g.facet}`;switch(g.facet){case"classification":case"metadata":return qs(tt[g.facet],g.fields,`${k}-grid`);case"labels":case"assets":return(0,le.jsxs)(le.Fragment,{children:[At("\u8FFD\u52A0",g.added.map($n),`${k}-added`),At("\u524A\u9664",g.removed.map($n),`${k}-removed`),At("\u5909\u66F4",g.modified.map(Vs),`${k}-modified`)]});case"tags":return(0,le.jsxs)(le.Fragment,{children:[At("\u8FFD\u52A0",g.added.map(E=>[E,E]),`${k}-added`),At("\u524A\u9664",g.removed.map(E=>[E,E]),`${k}-removed`)]});case"structured_data":return(0,le.jsx)(ht,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:ct(Object.values(Ln))},align:"start",cell:({operation:E})=>Ln[E.op]},{key:"path",header:"\u9053",width:{minPx:Oe},align:"start",cell:({operation:E})=>E.path===""?"(\u6839)":E.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Oe},align:"start",cell:({operation:E})=>E.op==="add"?null:(0,le.jsx)("pre",{style:Pn,children:JSON.stringify(E.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Oe},align:"start",cell:({operation:E})=>E.op==="remove"?null:(0,le.jsx)("pre",{style:Pn,children:JSON.stringify(E.value,null,2)})}],rows:g.operations.map((E,$)=>({operation:E,position:$})),rowKey:({position:E})=>`${E}`,rowTestId:`${k}-operation`,rowData:({operation:E})=>({"data-op":E.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${k}-operations`});case"text":case"summary":return(0,le.jsx)(Jt,{states:e,target:{facet:g.facet},index:g,readLines:a,label:tt[g.facet],rescueTarget:s,onNarrowChange:h,testId:`${k}-diff`});case"chunks":return(0,le.jsx)(Tn,{states:e,stats:g.stats,entries:g.entries,textUnchangedChunkingChanged:g.textUnchangedChunkingChanged,readLines:a,rescueTarget:s,onNarrowChange:h,testId:`${k}-table`})}};return(0,le.jsxs)("div",{"data-testid":o,children:[I.length>0&&(0,le.jsx)("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${o}-nav`,children:(0,le.jsx)("ul",{children:I.map(g=>(0,le.jsx)("li",{children:(0,le.jsx)("a",{href:`#${T(g.facet)}`,"data-facet":g.facet,children:tt[g.facet]})},g.facet))})}),I.map(g=>(0,le.jsxs)("section",{id:T(g.facet),"aria-labelledby":`${T(g.facet)}-heading`,"data-testid":`${o}-${g.facet}`,"data-facet":g.facet,children:[(0,le.jsx)("h4",{id:`${T(g.facet)}-heading`,style:Bs,children:tt[g.facet]}),O(g)]},g.facet)),p.length>0&&(0,le.jsxs)("p",{"data-testid":`${o}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",p.map(g=>tt[g]).join("\u30FB")]})]})}var ft=require("@aiquants/enrichment-core");var A=require("react/jsx-runtime"),Ws=8,zs={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},js={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"},Fn={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Xs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],Ys=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Js={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Un(e){return Object.hasOwn(Fn,e)}function Mt(e,t){return`run-step-provenance-value-${e}-${t}`}function Qs(e,t,a){if(Un(t)){let o=e[t];return o===null?null:(0,A.jsx)(ae,{value:o,unit:Fn[t],testId:Mt(a,t)})}let s=e[t];return s===null?null:(0,A.jsx)($t,{text:String(s),testId:Mt(a,t)})}function Zs(e,t){let a=Xs.map(i=>({key:i,label:js[i],value:Qs(e,i,t),breaks:Un(i)?"atomic":"anywhere"})),s=e.pages_read!==null||e.pages_total!==null,o=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ae,{value:e.pages_read,testId:Mt(t,"pages_read")})," / ",(0,A.jsx)(ae,{value:e.pages_total,testId:Mt(t,"pages_total")})]});return[...a,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:s?o:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:(0,A.jsx)($t,{text:zs[e.body_source],testId:Mt(t,"body_source")}),breaks:"anywhere"}]}function er(e){let t=[],a=new Map;for(let s of[...e.steps].sort((o,i)=>o.sequence-i.sequence)){let o=s.stepKey;if(o===ft.RUN_TERMINAL_STEP_KEY||ft.PIPELINE_STEPS[o].fanOut!=="children"||s.targetMetadataId===e.metadataId){t.push({kind:"step",step:s});continue}let i=a.get(o);if(i!==void 0){i.push(s);continue}let l=[s];a.set(o,l),t.push({kind:"fan_out",stepKey:o,steps:l})}return t}function tr(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 ar({step:e}){let{labels:t}=K();if(e.status==="SKIPPED")return(0,A.jsxs)("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",Ra(tr(e))]});if(e.stepKey===ft.RUN_TERMINAL_STEP_KEY&&e.status==="SUCCEEDED"){let{outcome:l}=ft.RunTerminalStepDetailSchema.parse(e.provenance?.detail);return(0,A.jsx)("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":l,children:Sa[l]})}if(e.provenance===null)return(0,A.jsx)("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,s=Zs(a,e.sequence),o=s.filter(l=>l.value!==null),i=s.filter(l=>l.value===null);return(0,A.jsxs)(A.Fragment,{children:[o.length>0&&(0,A.jsx)("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:o.map(l=>(0,A.jsxs)("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[(0,A.jsx)("dt",{className:"text-slate-500",children:l.label}),(0,A.jsx)("dd",{className:`text-slate-800 ${Js[l.breaks]}`,"data-provenance-key":l.key,children:l.value})]},l.key))}),i.length>0&&(0,A.jsxs)("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(l=>l.label).join("\u3001")]}),Object.keys(a.detail).length>0&&(0,A.jsxs)("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[(0,A.jsx)("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),(0,A.jsx)("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 On(e,t,a,s){let o=zt[e.status];return(0,A.jsx)("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:(0,A.jsxs)("details",{open:s,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[(0,A.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,A.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),(0,A.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&(0,A.jsxs)("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]}),(0,A.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${o.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:o.label}),(0,A.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:(0,A.jsx)(ae,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),(0,A.jsxs)("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&a>0&&(0,A.jsx)("div",{className:"h-2 rounded-full bg-slate-100",children:(0,A.jsx)("div",{className:`h-2 rounded-full ${o.bar}`,style:{width:`${e.durationMs/a*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&(0,A.jsxs)("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})`]}),(0,A.jsx)(ar,{step:e})]})]})},e.id)}function Kn({run:e}){K();let t=e.steps.reduce((s,o)=>o.durationMs===null?s:Math.max(s,o.durationMs),0),a=e.steps.length<=Ws;return(0,A.jsx)("ol",{className:"space-y-3","data-testid":"run-steps",children:er(e).map(s=>{if(s.kind==="step"){let l=s.step,m=(0,A.jsxs)(A.Fragment,{children:[Xt(l.stepKey),l.targetMetadataId!==e.metadataId&&(0,A.jsxs)("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-${l.sequence}`,children:["\u5BFE\u8C61 #",l.targetMetadataId]})]});return On(l,m,t,l.status==="FAILED"||a)}let o=s.steps.some(l=>l.status==="FAILED"),i=Ys.map(l=>({status:l,count:s.steps.filter(m=>m.status===l).length})).filter(({count:l})=>l>0);return(0,A.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${s.stepKey}`,"data-count":s.steps.length,children:(0,A.jsxs)("details",{open:o||a,className:"group/fanout","data-testid":`run-step-group-card-${s.stepKey}`,children:[(0,A.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,A.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),(0,A.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:Xt(s.stepKey)}),(0,A.jsxs)("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${s.stepKey}`,children:["\u5BFE\u8C61 ",s.steps.length," \u4EF6"]}),(0,A.jsx)("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${s.stepKey}`,children:i.map(({status:l,count:m})=>`${zt[l].label} ${m}`).join(" \xB7 ")})]}),(0,A.jsx)("ol",{className:"space-y-3 px-4 pb-4",children:s.steps.map(l=>On(l,(0,A.jsxs)("span",{"data-testid":`run-step-target-${l.sequence}`,children:["\u5BFE\u8C61 #",l.targetMetadataId]}),t,l.status==="FAILED"||a))})]})},`group-${s.stepKey}`)})})}var d=require("react/jsx-runtime"),nr={fontSize:`${vt.TOKENS.type.title.size}px`,fontWeight:vt.TOKENS.weight.bold},sr={fontSize:`${nt}px`,fontWeight:vt.TOKENS.weight.bold},Ta={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function Hn({host:e,fromStateId:t,toStateId:a,rescueTarget:s}){let o={fromStateId:t,toStateId:a},i=Na(`${t}:${a}`,m=>e.compare(o,m),0),l=Ge(s);return i.state.kind==="failed"?(0,d.jsx)(ut,{failure:i.state,onReload:i.reload,forbiddenMessage:je,failureMessage:Xe("\u6BD4\u8F03"),rescueRef:l,testId:"history-comparison-failed"}):i.state.kind!=="ready"?(0,d.jsx)("p",{"aria-busy":"true","data-testid":"history-comparison-loading",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):(0,d.jsx)(Mn,{states:o,comparison:i.state.value,readLines:e.readLines,rescueTarget:s,testId:"history-change"})}function Pa(e,t,a){let s=tn(e,t);return[e.runOutcome==="FAILED"?(0,d.jsx)("span",{"data-testid":`${a}-failed-run`,"data-state-mark":"failed_run",children:ga},"failed"):null,s.length>0?(0,d.jsx)("span",{"data-testid":`${a}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:ya(s)},"unrecorded"):null,e.modelOnlyChange?(0,d.jsx)("span",{"data-testid":`${a}-model-only`,"data-state-mark":"model_only",children:ba},"model"):null].filter(o=>o!==null)}function rr(e,t){return e.changes===null?null:(0,d.jsx)("span",{"data-testid":`${t}-badges`,children:e.changes.map(a=>(0,d.jsx)(Ye,{tone:"neutral",variant:"tint",testId:`${t}-badge-${a.facet}`,children:wt(a)},a.facet))})}function or({pinned:e,shown:t,onPin:a,onUnpin:s,fallback:o}){let i=(0,se.useRef)(null),l=(0,se.useRef)(null),m=Ge(()=>l.current??i.current??o()),u=(0,se.useCallback)(I=>(p=>{I.current=p;let T=m(p);return()=>{I.current=null,T()}}),[m]),[h]=(0,se.useState)(()=>u(i)),[P]=(0,se.useState)(()=>u(l));return e!==null?(0,d.jsxs)("p",{"data-testid":"history-pin",children:[(0,d.jsx)(Ye,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",Ke(e.revision)," ",(0,d.jsx)(ge,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",(0,d.jsx)(Le,{variant:"secondary",onClick:s,ref:P,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:(0,d.jsx)("p",{"data-testid":"history-pin",children:(0,d.jsx)(Le,{variant:"secondary",onClick:()=>a(t.stateId),ref:h,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function ir({host:e,metadataId:t,target:a,openRequest:s,onClose:o,returnFocusFallback:i,captureState:l}){let{labels:m,announce:u}=K(),h=(0,se.useId)(),P=(0,se.useId)(),I=(0,se.useId)(),p=(0,se.useRef)(null),T=(0,se.useRef)(null),O=(0,se.useRef)(null),g=(0,se.useRef)(null),k=(0,se.useRef)(null),E=(0,se.useRef)(null),$=(0,se.useRef)(i),H=(0,se.useRef)(0),[Z,V]=(0,se.useState)(null),[ee,B]=(0,se.useState)(null),[q,oe]=(0,se.useState)({metadataId:t,groups:{}});q.metadataId!==t&&oe({metadataId:t,groups:{}});let[R,W]=(0,se.useState)(null),J=Na(t,x=>e.loadHistory(t,x),s),be=Ge(()=>T.current),Ue=Ge(()=>T.current),F=J.state.kind==="ready"?J.state.refreshFailure:null,ke=Gt(F),ne=J.state.kind==="ready"&&J.state.refreshing,ie=J.state.kind==="ready"?J.state.value:null,G=ie===null?null:en(ie),ce=Z!==null&&Z.request===s?Z.key:G===null?null:an(a,G),Q=G?.groups.flatMap(x=>x.items).find(x=>x.key===ce),we=Q===void 0||ne?null:`revision:${Q.kind==="run"?Q.run.revision:Q.state.revision}`,He=Ge(()=>ce===null?T.current:O.current);(0,se.useEffect)(()=>{$.current=i},[i]),(0,se.useEffect)(()=>{if(k.current!==s){k.current=s,E.current=null;let x=document.activeElement;p.current?.contains(x)!==!0&&(g.current=(x instanceof HTMLElement||x instanceof SVGElement)&&x!==document.body?x:null),T.current?.focus();return}ce!==null&&ce===E.current&&(E.current=null,O.current?.focus())},[s,ce]),(0,se.useEffect)(()=>{we!==null&&oe(x=>x.groups[we]===!0?x:{metadataId:x.metadataId,groups:{...x.groups,[we]:!0}})},[we,s]),(0,se.useEffect)(()=>()=>{k.current=null,H.current+=1;let x=g.current;if(x?.isConnected){x.focus();return}$.current()?.focus()},[]);let Pe=x=>{x.key==="Escape"&&(x.stopPropagation(),o())},ve=x=>{if(x===ce){O.current?.focus();return}E.current=x,V({request:s,key:x})},y=x=>{H.current+=1;let L=H.current,U=R?.metadataId===t?R.failure:null;W({metadataId:t,busy:!0,failure:U}),x(t).then(z=>{if(H.current===L){if(z.ok){W({metadataId:t,busy:!1,failure:null}),u(z.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),J.refresh();return}W({metadataId:t,busy:!1,failure:{status:z.status,reason:z.reason,occurrence:(U?.occurrence??0)+1}})}})},j=()=>{if(J.state.kind==="failed")return(0,d.jsx)(ut,{failure:J.state,onReload:J.reload,forbiddenMessage:je,failureMessage:Xe("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:be,testId:"history-failed"});if(ie===null||G===null)return(0,d.jsx)("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=G.states,L=G.runs[0],U=l!==void 0&&L!==void 0&&!x.some(S=>S.runId===L.id),z=R?.metadataId===t?R:null,f=x[0];return(0,d.jsxs)("div",{ref:Ue,"data-testid":"history-content",children:[(0,d.jsxs)("dl",{"data-testid":"history-document",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"URI"}),(0,d.jsx)("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-document-uri",children:ie.document.fileUri})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u73FE\u5728\u306E\u7248"}),(0,d.jsx)("dd",{"data-testid":"history-document-revision",children:Ke(ie.document.revision)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),(0,d.jsx)("dd",{"data-testid":"history-document-confidentiality",children:ie.document.confidentialityLevel})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u7248\u306E\u6570"}),(0,d.jsx)("dd",{"data-testid":"history-document-revisions",children:G.groups.length})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6700\u5F8C\u306E\u5909\u5316"}),(0,d.jsx)("dd",{"data-testid":"history-document-last-change",children:f===void 0?"\u8A18\u9332\u306A\u3057":(0,d.jsx)(ge,{iso:f.settledAt,testId:"history-document-last-change-value"})})]})]}),F!==null&&(0,d.jsx)(Tt,{occurrence:ke,testId:"history-refresh-failed",children:Ct(m,F,"\u6587\u66F8\u306E\u5C65\u6B74")}),U&&(0,d.jsx)("p",{"data-testid":"history-capture",children:(0,d.jsx)(Le,{variant:"primary",busy:z?.busy===!0,busyLabel:m.loading,onClick:()=>y(l),ref:He,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),z!==null&&z.failure!==null&&(0,d.jsx)(Tt,{occurrence:z.failure.occurrence,testId:"history-capture-failed",children:m.failureSentence(z.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",S=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${(0,vt.reasonAside)(S)}\u3002`)}),x.length===0&&G.runs.length===0&&G.marks.length===0?(0,d.jsx)("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"}):(0,d.jsx)(pn,{master:Qe(G),detail:Me(G),masterMinPx:rn,detailMinPx:on,testId:"history-master-detail"})]})},he=q.groups,de=(x,L)=>he[x]??L,me=(x,L)=>oe({metadataId:t,groups:{...he,[x]:!de(x,L)}}),Ne=ee!==null&&ee.request===s?ee.stateId:null,Qe=x=>(0,d.jsxs)("div",{"data-testid":"history-timeline",children:[x.marks.length>0&&(0,d.jsxs)("div",{"data-testid":"history-restricted-group",children:[(0,d.jsxs)(Le,{variant:"secondary",expanded:de("restricted",!1),controls:`${P}-restricted`,onClick:()=>me("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",x.marks.length," \u4EF6)"]}),(0,d.jsx)("ul",{role:"list",id:`${P}-restricted`,hidden:!de("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:x.marks.map(({key:L,mark:U})=>(0,d.jsx)("li",{"data-restricted-mark":U.subject,"data-testid":"history-restricted-mark",children:U.subject==="state"?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:ma})," ",(0,d.jsx)(ge,{iso:U.settledAt,testId:`history-${L}-settled-at-value`})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:kt})," ",(0,d.jsx)(Ye,{tone:Ta[U.status],variant:"tint",testId:`history-${L}-status`,children:qe[U.status].label})," ",(0,d.jsx)(ge,{iso:U.startedAt,testId:`history-${L}-started-at-value`})," \u301C ",(0,d.jsx)(mt,{iso:U.finishedAt,testId:`history-${L}-finished-at-value`})]})},L))})]}),x.groups.map(L=>{let U=`revision:${L.revision}`,z=de(U,L.isCurrent),f=`${Ke(L.revision)}${L.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return(0,d.jsxs)("div",{"data-testid":"history-revision-group","data-revision":L.revision,"data-current":L.isCurrent,children:[(0,d.jsx)(Le,{variant:"secondary",expanded:z,controls:`${P}-${U}`,onClick:()=>me(U,L.isCurrent),testId:`history-revision-toggle-${L.revision}`,children:`${f} \u2014 ${L.items.length} \u4EF6`}),(0,d.jsx)("div",{id:`${P}-${U}`,hidden:!z,children:(0,d.jsx)(bn,{label:f,items:L.items,itemKey:S=>S.key,selectedKey:ce,onSelect:S=>ve(S.key),detailId:P,renderRow:S=>Be(S,x),rowTestId:"history-item",rowData:S=>({"data-item-key":S.key,"data-pinned":S.state!==null&&S.state.stateId===Ne}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${L.revision}`})})]},U)})]}),Be=(x,L)=>{let U=x.state,z=`history-row-${x.key}`,f=U===null?[]:Pa(U,L,z);return(0,d.jsxs)(d.Fragment,{children:[x.kind==="run"?(0,d.jsxs)("span",{children:["\u5B9F\u884C #",x.run.id," \xB7 ",jt[x.run.trigger]," ",(0,d.jsx)(Ye,{tone:Ta[Je(x.run)],variant:"tint",testId:`${z}-status`,children:qe[Je(x.run)].label})]}):(0,d.jsx)("span",{children:it[x.state.cause]}),(0,d.jsx)("span",{children:(0,d.jsx)(ge,{iso:x.time,testId:`${z}-time-value`})}),U!==null&&rr(U,z),x.kind==="run"&&ha(x.run)&&(0,d.jsx)("span",{"data-testid":`${z}-unrecorded`,children:Ht}),f,U!==null&&U.stateId===Ne&&(0,d.jsx)(Ye,{tone:"info",variant:"tint",testId:`${z}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},Ae=(x,L)=>{let U=L.states.find(N=>N.stateId===Ne)??null,z=(0,d.jsx)(or,{pinned:U,shown:x,onPin:N=>B({request:s,stateId:N}),onUnpin:()=>B(null),fallback:()=>O.current});if(x===null)return z;let f=()=>O.current,S;if(U!==null&&U.stateId!==x.stateId){let[N,ye]=L.states.indexOf(U)>L.states.indexOf(x)?[U,x]:[x,U];S=(0,d.jsx)(Hn,{host:e,fromStateId:N.stateId,toStateId:ye.stateId,rescueTarget:f})}else x.previousStateId===null?S=(0,d.jsx)("p",{"data-testid":"history-no-previous",children:fa}):S=(0,d.jsx)(Hn,{host:e,fromStateId:x.previousStateId,toStateId:x.stateId,rescueTarget:f});return(0,d.jsxs)(d.Fragment,{children:[z,S]})},te=x=>{if(Q===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let L=Q.state,U=x.states.find(z=>z.stateId===Ne);if(U!==void 0&&L!==null&&U.stateId!==L.stateId){let[z,f]=x.states.indexOf(U)>x.states.indexOf(L)?[U,L]:[L,U];return`\u6BD4\u8F03: ${Ke(z.revision)} \u2192 ${Ke(f.revision)}`}return Q.kind==="run"?`${Ke(Q.run.revision)} \u306E\u5B9F\u884C #${Q.run.id}`:`${Ke(Q.state.revision)} \u306E\u5909\u5316`},We=x=>{if(ce===null)return x.groups.some(f=>f.items.length>0)?(0,d.jsx)("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"}):(0,d.jsx)("p",{role:"status","data-testid":"history-no-selectable",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});if(Q===void 0&&ne)return(0,d.jsx)("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(Q===void 0)return(0,d.jsxs)("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(Q.kind==="state"){let{state:f}=Q;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("dl",{"data-testid":"history-state-summary",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u5951\u6A5F"}),(0,d.jsx)("dd",{"data-testid":"history-state-cause",children:it[f.cause]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6642\u523B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(ge,{iso:f.settledAt,testId:"history-state-settled-at-value"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u64CD\u4F5C\u8005"}),(0,d.jsx)("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-state-actor",children:f.actor})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),(0,d.jsx)("dd",{"data-testid":"history-state-confidentiality",children:f.classification.confidentialityLevel})]})]}),Pa(f,x,"history-detail"),Ae(f,x)]})}let{run:L,state:U}=Q,z=Je(L);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("dl",{"data-testid":"history-run-summary","data-run-id":L.id,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u304D\u3063\u304B\u3051"}),(0,d.jsx)("dd",{"data-testid":"history-run-trigger","data-trigger":L.trigger,children:jt[L.trigger]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u8A66\u884C"}),(0,d.jsx)("dd",{"data-testid":"history-run-attempt",children:L.attempt})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u72B6\u614B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(Ye,{tone:Ta[z],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":L.status,"data-presentation":z},children:qe[z].label})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u7A2E\u985E"}),(0,d.jsx)("dd",{"data-testid":"history-run-kind",children:Bn.DOCUMENT_KIND_LABELS[L.documentKind]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u8981\u6C42\u8005"}),(0,d.jsx)("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-requested-by",children:L.requestedBy})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u958B\u59CB"}),(0,d.jsx)("dd",{children:(0,d.jsx)(ge,{iso:L.startedAt,testId:"history-run-started-at-value"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u7D42\u4E86"}),(0,d.jsx)("dd",{"data-testid":"history-run-finished-at",children:(0,d.jsx)(mt,{iso:L.finishedAt,testId:"history-run-finished-at-value"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u30B8\u30E7\u30D6"}),(0,d.jsx)("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-job-id",children:L.jobId})]})]}),L.errorMessage!==null&&(0,d.jsx)("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:L.errorMessage}),ha(L)&&(0,d.jsx)("p",{"data-testid":"history-run-unrecorded",children:Ht}),U===null?(0,d.jsx)("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"}):Pa(U,x,"history-detail"),Ae(U,x),(0,d.jsxs)("details",{"data-testid":"history-run-steps",children:[(0,d.jsx)("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),(0,d.jsx)(Kn,{run:L})]})]})},Me=x=>(0,d.jsxs)("section",{id:P,"aria-labelledby":I,"data-testid":"history-detail","data-selected-key":ce??"",children:[(0,d.jsx)("h3",{ref:O,id:I,tabIndex:-1,style:sr,"data-testid":"history-detail-heading",children:te(x)}),We(x)]});return(0,d.jsxs)("section",{ref:p,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:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{ref:T,id:h,tabIndex:-1,style:nr,"data-testid":"history-heading",children:ie===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${ie.document.fileName}`}),(0,d.jsx)(Le,{variant:"secondary",onClick:o,testId:"history-close",children:m.close})]}),j()]})}var Ve=require("@aiquants/enrichment-core"),ue=require("react");var Gn=require("@aiquants/console-ui/core");function gt(e,t,a){try{(0,Gn.formatCount)(e,a)}catch(s){throw new RangeError(`${t}: ${s.message}`,{cause:s})}return e}var Vn=1024,dr=[{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 qn(e,t){return Number((e/Vn**t.power).toFixed(t.fractionDigits))}function Qt(e,t,a){gt(e,t,a);let[s,...o]=dr,i=s,l=qn(e,i);for(let m of o){if(l<Vn)break;i=m,l=qn(e,i)}return`${new Intl.NumberFormat(a,{minimumFractionDigits:i.fractionDigits,maximumFractionDigits:i.fractionDigits,useGrouping:!0}).format(l)} ${i.name}`}var n=require("react/jsx-runtime"),zn="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",lr=new Set(Ve.EnrichmentSyncStatusSchema.options.filter(e=>e.startsWith("FAILED"))),cr=new Set(Ve.EnrichmentSyncStatusSchema.options);function jn(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:lr.has(e.syncStatus)?{kind:"retry"}:cr.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Wn(e,t,a){let s=e?.find(o=>o.confidentialityLevel===t&&o.capability===a);return s?s.isEnabled:null}var ur={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"},pr=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function La({field:e}){return(0,n.jsx)("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function mr({policies:e,tenantId:t,domainOptions:a,recentItems:s=[],inspectionResult:o=null,isSubmitting:i=!1,isInspecting:l=!1,onInspectUri:m,onIngestDocument:u,onRetryItem:h,onShowHistory:P,listRefusal:I}){let{formatLocale:p}=K(),T=(0,ue.useId)(),O=(0,ue.useId)(),g=(0,ue.useId)(),k=(0,ue.useId)(),E=(0,ue.useId)(),$=(0,ue.useId)(),H=(0,ue.useId)(),Z=(0,ue.useId)(),[V,ee]=(0,ue.useState)("gdrive://"),[B,q]=(0,ue.useState)(""),[oe,R]=(0,ue.useState)(""),[W,J]=(0,ue.useState)("CONFIDENTIAL"),[be,Ue]=(0,ue.useState)(null),[F,ke]=(0,ue.useState)(""),[ne,ie]=(0,ue.useState)(""),[G,ce]=(0,ue.useState)([]),[Q,we]=(0,ue.useState)(""),[He,Pe]=(0,ue.useState)("user"),[ve,y]=(0,ue.useState)(1),[j,he]=(0,ue.useState)(!1),de=be!==null&&a.some(f=>f.key===be)?be:a.length>0?a[0].key:null,me=(0,ue.useMemo)(()=>({vectorEnabled:Wn(e,W,"vector_indexing"),graphEnabled:Wn(e,W,"graph_indexing")}),[e,W]),Ne=(0,ue.useMemo)(()=>{let f=oe.trim();if(!f)return{valid:!1,error:null};if(!(f.startsWith("file://")||f.startsWith("gdrive://")||f.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 N=f.replace(/^(file|gdrive|gcs):\/\//,"");return!N.trim()||N.trim()==="<id>"||N.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:f.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}},[oe]),Qe=f=>{let S=f.trim(),N=S.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(N)return N[1];let ye=S.match(/[?&]id=([a-zA-Z0-9_-]+)/);return ye?ye[1]:null},Be=f=>{if(ee(f),B.trim()){let S=B.trim().replace(/^(file|gdrive|gcs):\/\//,"");R(`${f}${S}`)}else R("")},Ae=f=>{let S=f.trim();if(!S){q(""),R("");return}let N=Qe(S);if(N){ee("gdrive://"),q(N),R(`gdrive://${N}`);return}if(S.startsWith("gdrive://")){ee("gdrive://");let ye=S.replace(/^gdrive:\/\//,"");q(ye),R(S);return}if(S.startsWith("file://")){ee("file://");let ye=S.replace(/^file:\/\//,"");q(ye),R(S);return}if(S.startsWith("gcs://")){ee("gcs://");let ye=S.replace(/^gcs:\/\//,"");q(ye),R(S);return}if(S.includes("://")){q(f),R(S);return}q(f),R(`${V}${S}`)},te=f=>{switch(f){case"gdrive://":return"1EXAMPLEFILEID0000000000000000000 (\u30D5\u30A1\u30A4\u30EB ID \u307E\u305F\u306F\u5171\u6709\u30EA\u30F3\u30AF)";case"file://":return"/srv/documents/specification.md (\u7D76\u5BFE\u30D1\u30B9)";case"gcs://":return"my-bucket/documents/report.pdf (\u30D0\u30B1\u30C3\u30C8\u540D/\u30D1\u30B9)"}},We=()=>{let f=Q.trim();f&&(G.some(S=>S.labelKey===f)||(ce(S=>[...S,{labelKey:f,category:He,confidenceScore:Number(ve.toFixed(2))}]),we("")))},Me=f=>{G.some(S=>S.labelKey===f)||ce(S=>[...S,{labelKey:f,category:"domain",confidenceScore:1}])},x=f=>{ce(S=>S.filter(N=>N.labelKey!==f))},L=f=>{if(f.preventDefault(),!Ne.valid||de===null)return;let S={fileUri:oe.trim(),confidentialityLevel:W,targetDomainKey:de,departmentId:F.trim()?Number(F):null,titleOverride:ne.trim()?ne.trim():null,labels:G};u?.(S)},U=f=>{let S=jn(f);if(S.kind==="blocked")return(0,n.jsx)("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${f.id}`,"data-reason":S.reason,children:S.reason});let N=S.kind==="retry";return(0,n.jsx)("button",{type:"button",onClick:()=>h?.(f.id),"aria-label":`${f.fileName} \u3092${N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:N?"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-${f.id}`,children:N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},z=f=>{switch(f){case"SYNCED":return(0,n.jsx)("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(0,n.jsx)("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(0,n.jsx)("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(0,n.jsx)("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(0,n.jsx)("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 f.startsWith("FAILED")?(0,n.jsxs)("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: ",f]}):(0,n.jsx)("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:f})}};return(0,n.jsxs)("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("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"}),(0,n.jsx)("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"})]}),(0,n.jsxs)("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: ",(0,n.jsx)("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),(0,n.jsxs)("form",{onSubmit:L,className:"mt-6 space-y-6",children:[(0,n.jsxs)("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("label",{htmlFor:T,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",(0,n.jsx)(La,{field:"uri"})]}),(0,n.jsxs)("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",(0,n.jsx)("strong",{className:"font-semibold text-indigo-600",children:V})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),(0,n.jsx)("button",{type:"button",onClick:()=>Be("gdrive://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${V==="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)"}),(0,n.jsx)("button",{type:"button",onClick:()=>Be("file://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${V==="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)"}),(0,n.jsx)("button",{type:"button",onClick:()=>Be("gcs://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${V==="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)"})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[(0,n.jsxs)("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 ${Ne.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:[(0,n.jsx)("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:V}),(0,n.jsx)("input",{id:T,type:"text",value:B,onChange:f=>Ae(f.target.value),placeholder:te(V),"aria-invalid":!!Ne.error,"aria-describedby":Ne.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})]}),(0,n.jsx)("button",{type:"button",onClick:()=>m?.(oe.trim()),disabled:!Ne.valid||l,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:l?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[(0,n.jsxs)("p",{className:"text-slate-500",children:[V==="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",V==="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",V==="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"]}),oe&&(0,n.jsxs)("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[(0,n.jsx)("span",{children:"\u89E3\u6C7A URI:"}),(0,n.jsx)("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:oe})]})]})]}),Ne.error&&(0,n.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:Ne.error})]}),o&&o.fileUri===oe.trim()&&(0,n.jsxs)("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 ${o.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"font-semibold",children:o.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),(0,n.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:o.fileUri})]}),o.exists&&(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),(0,n.jsx)("span",{className:"font-semibold text-slate-800",children:o.fileName})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),(0,n.jsx)("span",{className:"font-semibold text-slate-800",children:(0,n.jsx)(Fe,{text:Qt(o.fileSize,"fileSize",p),testId:"inspection-file-size-value"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"block text-slate-500",children:"MIME:"}),(0,n.jsx)("span",{className:"font-semibold text-slate-800",children:o.mimeType})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),(0,n.jsx)("span",{className:"font-semibold text-slate-800",children:o.revisionId?.slice(0,8)??"N/A"})]})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("label",{htmlFor:O,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,n.jsx)(La,{field:"confidentiality"})]}),(0,n.jsx)("select",{id:O,value:W,onChange:f=>J(f.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:Ve.ConfidentialityLevelSchema.options.map(f=>(0,n.jsxs)("option",{value:f,children:[f," (",ur[f],")"]},f))})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("label",{htmlFor:g,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,n.jsx)(La,{field:"domain"})]}),(0,n.jsx)("select",{id:g,value:de===null?"":de,onChange:f=>Ue(f.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(f=>(0,n.jsx)("option",{value:f.key,children:f.label},f.key))}),a.length===0&&(0,n.jsx)("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"})]})]}),W===Ve.QUARANTINED_CONFIDENTIALITY_LEVEL&&(0,n.jsxs)("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:[(0,n.jsx)("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Ve.QUARANTINED_CONFIDENTIALITY_LEVEL," \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",(0,n.jsx)("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"})]}),(0,n.jsxs)("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:[(0,n.jsx)("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)"}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,n.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),(0,n.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":me.vectorEnabled===null?"unknown":String(me.vectorEnabled),children:me.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":me.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${W} \u306E\u8A2D\u5B9A)`})]}),(0,n.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,n.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),(0,n.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":me.graphEnabled===null?"unknown":String(me.graphEnabled),children:me.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":me.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${W} \u306E\u8A2D\u5B9A)`})]})]}),(0,n.jsxs)("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 (",(0,n.jsx)("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"]})]}),(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),(0,n.jsxs)("span",{className:"text-slate-500 text-xs",children:[G.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),pr.map(f=>(0,n.jsxs)("button",{type:"button",onClick:()=>Me(f),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-${f}`,children:["+ ",f]},f))]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[(0,n.jsxs)("div",{className:"space-y-1 sm:col-span-2",children:[(0,n.jsx)("label",{htmlFor:$,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,n.jsx)("input",{id:$,type:"text",value:Q,onChange:f=>we(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),We())},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"})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{htmlFor:H,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,n.jsxs)("select",{id:H,value:He,onChange:f=>Pe(f.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:[(0,n.jsx)("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),(0,n.jsx)("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),(0,n.jsx)("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("label",{htmlFor:Z,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",ve.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)"]}),(0,n.jsx)("input",{id:Z,type:"range",min:"0.0",max:"1.0",step:"0.05",value:ve,"aria-valuenow":ve,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(ve*100)}%`,onChange:f=>y(Number.parseFloat(f.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),(0,n.jsx)("div",{children:(0,n.jsx)("button",{type:"button",onClick:We,className:"w-full rounded-sm bg-slate-800 px-3 py-1.5 font-semibold text-white text-xs hover:bg-slate-700","data-testid":"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]}),G.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:G.map(f=>(0,n.jsxs)("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-${f.labelKey}`,children:[(0,n.jsx)("span",{className:"font-semibold",children:f.labelKey}),(0,n.jsxs)("span",{className:"text-indigo-400",children:["(",f.category,")"]}),(0,n.jsx)("button",{type:"button",onClick:()=>x(f.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${f.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${f.labelKey}`,children:"\xD7"})]},f.labelKey))})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":j,"aria-controls":"advanced-settings-panel",onClick:()=>he(f=>!f),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:(0,n.jsxs)("span",{children:[j?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),j&&(0,n.jsxs)("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:[(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{htmlFor:E,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),(0,n.jsx)("input",{id:E,type:"text",value:ne,onChange:f=>ie(f.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"})]})}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{htmlFor:k,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,n.jsx)("input",{id:k,type:"number",value:F,onChange:f=>ke(f.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"})]})})]})]}),(0,n.jsx)("div",{className:"flex justify-end pt-2",children:(0,n.jsx)("button",{type:"submit",disabled:!Ne.valid||de===null||i||l,"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?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),(0,n.jsx)("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):(0,n.jsx)("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),(0,n.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),(0,n.jsx)("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"})]})}),I!==void 0?(0,n.jsx)(xt,{tone:"warning",testId:"recent-items-refused",children:I}):s.length===0?(0,n.jsx)("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"}):(0,n.jsx)("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:(0,n.jsxs)("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:[(0,n.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),(0,n.jsx)("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:s.map((f,S)=>{if(f.kind==="restricted")return(0,n.jsxs)("tr",{"data-testid":`recent-item-restricted-${S}`,"data-restricted-mark":"ingest",children:[(0,n.jsx)("td",{className:"px-3 py-2"}),(0,n.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${S}`,children:dt}),(0,n.jsx)("td",{className:"px-3 py-2"}),(0,n.jsx)("td",{className:"px-3 py-2"}),(0,n.jsx)("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${S}`,children:f.syncStatus===null?(0,n.jsx)("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:zn}):z(f.syncStatus)}),(0,n.jsx)("td",{className:"px-3 py-2"}),(0,n.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${S}`,children:(0,n.jsx)(ge,{iso:f.createdAt,testId:`recent-item-restricted-created-at-value-${S}`})}),(0,n.jsx)("td",{className:"px-3 py-2"})]},`restricted:${S}`);let N=f.item;return(0,n.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${N.id}`,children:[(0,n.jsx)("td",{className:"px-3 py-2 font-bold",children:N.id}),(0,n.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:N.fileUri,children:[(0,n.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:N.fileName}),(0,n.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:N.fileUri})]}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:N.confidentialityLevel})}),(0,n.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",N.revision,N.isCurrent===!1&&(0,n.jsx)("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-${N.id}`,children:"\u65E7\u7248"})]}),(0,n.jsxs)("td",{className:"px-3 py-2 font-sans",children:[z(N.syncStatus),N.errorMessage!==null&&N.errorMessage!==void 0&&N.errorMessage!==""&&(0,n.jsx)("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${N.id}`,title:N.errorMessage,children:N.errorMessage})]}),(0,n.jsxs)("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${N.id}`,children:[N.lastRun===null?(0,n.jsx)("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${N.id}`,children:"\u8A18\u9332\u306A\u3057"}):N.lastRun.kind==="restricted"?(0,n.jsxs)("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${N.id}`,"data-restricted-mark":"run",children:[(0,n.jsx)("div",{className:"text-[11px] text-slate-600",children:kt}),(0,n.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${qe[N.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.status,children:qe[N.lastRun.status].label}),(0,n.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:(0,n.jsx)(mt,{iso:N.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}):(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${qe[Je(N.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.item.status,"data-presentation":Je(N.lastRun.item),children:qe[Je(N.lastRun.item)].label}),N.lastRun.item.failedStepKey!==null&&(0,n.jsx)("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${N.id}`,children:Ve.PIPELINE_STEPS[N.lastRun.item.failedStepKey].label}),(0,n.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:(0,n.jsx)(mt,{iso:N.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}),P!==void 0&&(0,n.jsx)("button",{type:"button",onClick:()=>P(N.id),"aria-label":`${N.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-${N.id}`,children:"\u5C65\u6B74"})]}),(0,n.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${N.id}`,children:(0,n.jsx)(ge,{iso:N.createdAt,testId:`ingest-created-at-value-${N.id}`})}),(0,n.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:U(N)})]},`readable:${N.id}`)})})]})})]})]})}var Zt=require("@aiquants/enrichment-core"),re=require("react/jsx-runtime"),Xn={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 $a(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function fr({strategies:e,featureFlags:t,onToggleStage:a,isUpdating:s=!1}){let o=a===void 0;return(0,re.jsxs)("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:[(0,re.jsxs)("div",{children:[(0,re.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,re.jsxs)("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",(0,re.jsx)("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 ",Zt.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),o&&(0,re.jsx)("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?(0,re.jsx)("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"}):(0,re.jsx)("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:(0,re.jsxs)("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:[(0,re.jsx)("thead",{children:(0,re.jsxs)("tr",{children:[(0,re.jsx)("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"}),Zt.ENRICHMENT_STAGES.map(i=>{let l=$a(i.featureFlagKey,t);return(0,re.jsxs)("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[(0,re.jsx)("div",{children:i.label}),(0,re.jsx)("div",{"data-testid":`strategy-gate-${i.key}`,"data-gate":l,className:"mt-0.5 font-normal text-[10px]",style:{color:Xn[l].color},children:Xn[l].label})]},i.key)})]})}),(0,re.jsx)("tbody",{children:e.map(i=>(0,re.jsxs)("tr",{"data-testid":`strategy-row-${i.domainKey}`,"data-provenance":i.provenance,"data-active":String(i.isActive),children:[(0,re.jsxs)("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[(0,re.jsx)("div",{className:"font-semibold text-slate-900",children:i.domainLabel}),(0,re.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,re.jsx)("code",{children:i.domainKey})," / ",i.strategyName]}),(0,re.jsx)("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&&(0,re.jsx)("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"})]}),Zt.ENRICHMENT_STAGES.map(l=>{let m=i.stages[l.key],u=$a(l.featureFlagKey,t);return(0,re.jsxs)("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[(0,re.jsx)("button",{type:"button",role:"switch","aria-checked":m,"aria-label":`${i.domainLabel} \u306E ${l.label}`,"data-testid":`strategy-stage-${i.domainKey}-${l.key}`,"data-enabled":String(m),"data-effective":String(m&&(u==="open"||u==="absent")),disabled:o||s,onClick:()=>a?.(i,l.key,!m),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${m?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${o||s?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:m?"\u958B":"\u9589"}),m&&u==="unmeasured"&&(0,re.jsx)("div",{"data-testid":`strategy-unmeasured-${i.domainKey}-${l.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"}),m&&u==="closed"&&(0,re.jsx)("div",{"data-testid":`strategy-blocked-${i.domainKey}-${l.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"})]},l.key)})]},`${i.domainKey}:${i.strategyName}`))})]})})]})}var Nt={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},St={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};var w=require("react/jsx-runtime"),gr={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"},Yn=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],br=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),ea={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 Jn(e){return e.kind==="text"?"anywhere":"atomic"}function Zn(e,t){return t===null?{kind:"unmeasured"}:br.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 yr(e){let t=Yn.filter(s=>s in e),a=Object.keys(e).filter(s=>!Yn.includes(s)).sort();return[...t,...a].map(s=>({key:s,label:gr[s]??s,value:Zn(s,e[s])}))}function Qn(e,t){switch(e.kind){case"count":return(0,w.jsx)(ae,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return(0,w.jsx)(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(0,w.jsx)(Fe,{text:String(e.value),testId:t});case"word":return(0,w.jsx)(Fe,{text:e.text,testId:t});case"text":return(0,w.jsx)($t,{text:e.text,testId:t})}}function xr({health:e,isRefreshing:t=!1,onRefresh:a,className:s=""}){let{services:o,allHealthy:i,checkedAt:l}=e;K();let m=[{key:"qdrant",data:o.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:o.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:o.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:o.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:o.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return(0,w.jsxs)("section",{className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${s}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(i),children:[(0,w.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[(0,w.jsxs)("div",{className:"flex items-center gap-3",children:[(0,w.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,w.jsxs)("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:[(0,w.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,w.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,w.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,w.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,w.jsxs)("div",{children:[(0,w.jsx)("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,w.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",(0,w.jsx)("span",{"data-testid":"health-checked-at",children:(0,w.jsx)(ge,{iso:l,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"]})]})]}),(0,w.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,w.jsx)("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...St[i?"connected":"error"],"data-testid":"health-overall-status-badge",children:i?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("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:[(0,w.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,w.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,w.jsxs)("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Nt.connected]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("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:[(0,w.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,w.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,w.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,w.jsxs)("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Nt.error]})]})}),a&&(0,w.jsxs)("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:[(0,w.jsxs)("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:[(0,w.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,w.jsx)("path",{d:"M3 3v5h5"}),(0,w.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,w.jsx)("path",{d:"M16 21h5v-5"})]}),(0,w.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,w.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:m.map(({key:u,data:h,title:P,subtitle:I})=>{let p=Zn("version",h.version),T=ea[Jn(p)],O=Qn(p,`service-version-value-${u}`);return(0,w.jsxs)("div",{"data-testid":`service-card-${u}`,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:[(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[(0,w.jsx)("span",{className:"font-semibold text-sm",children:P}),(0,w.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...St[h.status],"data-testid":`service-status-${u}`,children:[(0,w.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${u}`}),Nt[h.status]]})]}),(0,w.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:I}),(0,w.jsxs)("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[(0,w.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${u}`,children:[(0,w.jsx)("span",{className:T.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,w.jsx)("span",{className:`${T.slot} font-medium text-[11px]`,"data-testid":`service-version-${u}`,children:p.kind==="text"?(0,w.jsx)("code",{className:"font-mono font-semibold",children:O}):O})]}),(0,w.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${u}`,children:[(0,w.jsx)("span",{className:ea.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),(0,w.jsx)("span",{className:`${ea.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${u}`,children:(0,w.jsx)(ae,{value:h.latencyMs,unit:"ms",testId:`health-latency-value-${u}`})})]}),yr(h.details).map(g=>{let k=ea[Jn(g.value)];return(0,w.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${u}-${g.key}`,children:[(0,w.jsxs)("span",{className:k.label,children:[g.label,":"]}),(0,w.jsx)("span",{className:`${k.slot} font-medium text-[11px]`,"data-testid":`health-detail-${u}-${g.key}`,children:Qn(g.value,`health-detail-value-${u}-${g.key}`)})]},g.key)})]})]}),(0,w.jsxs)("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[(0,w.jsx)("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${u}`,children:h.endpoint}),h.errorMessage!==void 0&&Lt.test(h.errorMessage)&&(0,w.jsx)("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...St.error,"data-testid":`service-error-${u}`,children:h.errorMessage})]})]},u)})})]})}var Se=require("@aiquants/enrichment-core"),X=require("react");var r=require("react/jsx-runtime"),Oa={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"}},Et="\u672A\u5B9F\u884C",hr=(Se.SEARCH_PARAM_LIMITS.threshold.min+Se.SEARCH_PARAM_LIMITS.threshold.max)/2,vr=2e3;function Nr(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 Da={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"}},ts=[{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 es(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function Sr(e,t){let a=t.trim();if(!(a&&e))return e;let s=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${s})`,"gi");return e.split(o).map((m,u)=>({id:`chunk-${u}-${m.slice(0,8)}`,part:m,isMatch:m.toLowerCase()===a.toLowerCase()})).map(m=>m.isMatch?(0,r.jsx)("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:m.part},m.id):m.part)}function Aa(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 Ma(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function Er({tenantId:e,onSearch:t,initialParams:a,initialResult:s=null,circuitBreakerStatus:o={},isLoading:i=!1}){let l=(0,X.useId)(),m=(0,X.useId)(),u=(0,X.useId)(),h=(0,X.useId)(),P=(0,X.useId)(),I=(0,X.useId)(),p=(0,X.useId)(),T=(0,X.useId)(),O=(0,X.useId)(),g=(0,X.useId)(),[k,E]=(0,X.useState)(a?.q??""),[$,H]=(0,X.useState)(a?.mode??"HYBRID"),[Z,V]=(0,X.useState)(a?.limit??Se.SEARCH_PARAM_LIMITS.limit.default),[ee,B]=(0,X.useState)(a?.threshold??hr),[q,oe]=(0,X.useState)(a?.fusion??"rrf"),[R,W]=(0,X.useState)(a?.rrf_k??Se.SEARCH_PARAM_LIMITS.rrfK.default),[J,be]=(0,X.useState)(a?.alpha??Se.SEARCH_PARAM_LIMITS.alpha.default),[Ue,F]=(0,X.useState)(a?.confidentiality_level??"ALL"),[ke,ne]=(0,X.useState)(a?.department_id?String(a.department_id):""),[ie,G]=(0,X.useState)(a?.mime_type??""),[ce,Q]=(0,X.useState)(a?.tag??""),we=(0,X.useRef)(0),[He,Pe]=(0,X.useState)(!1),[ve,y]=(0,X.useState)(!1),[j,he]=(0,X.useState)("request"),[de,me]=(0,X.useState)(null),[Ne,Qe]=(0,X.useState)(new Set),[Be,Ae]=(0,X.useState)(!1),[te,We]=(0,X.useState)(s),[Me,x]=(0,X.useState)(null),[L,U]=(0,X.useState)(null),z=i||Be,f=Se.MODE_TIERS[$],S=[f.dense,f.sparse,f.graph,f.lexical].filter(Boolean).length>1,N=f.dense&&!f.sparse,ye=te?.search_metadata.circuit_breaker_status??o,Ce=te?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},oa=L??{};(0,X.useEffect)(()=>{if(!ve)return;let c=fe=>{fe.key==="Escape"&&y(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[ve]);let fs=c=>{H(c.params.mode),V(c.params.limit),c.params.threshold!==void 0&&B(c.params.threshold),c.params.fusion!==void 0&&oe(c.params.fusion),c.params.rrf_k!==void 0&&W(c.params.rrf_k)},gs=async()=>{if(z)return;let c=ke.trim()?Number.parseInt(ke.trim(),10):void 0,fe={q:k.trim(),mode:$,limit:Z,threshold:N?ee:void 0,fusion:S?q:void 0,rrf_k:S&&q==="rrf"?R:void 0,alpha:S&&q==="linear"?J:void 0,department_id:c,confidentiality_level:Ue==="ALL"?void 0:Ue,mime_type:ie.trim()||void 0,tag:ce.trim()||void 0},_e=we.current+1;we.current=_e,x(null),Ae(!0);try{let Ze=await t(fe);if(_e!==we.current)return;We(Ze),U(fe)}catch(Ze){if(_e!==we.current)return;x(Ze instanceof Error?Ze.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{_e===we.current&&Ae(!1)}},Rt=(0,X.useRef)(void 0);(0,X.useEffect)(()=>()=>{Rt.current!==void 0&&clearTimeout(Rt.current)},[]);let bs=async(c,fe)=>{try{await navigator.clipboard.writeText(c),me(fe),Rt.current!==void 0&&clearTimeout(Rt.current),Rt.current=setTimeout(()=>me(null),vr)}catch{}},ys=c=>{Qe(fe=>{let _e=new Set(fe);return _e.has(c)?_e.delete(c):_e.add(c),_e})};return(0,r.jsxs)("div",{"data-testid":"metadata-search-workbench","data-mode":$,"data-loading":String(z),className:"space-y-6",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("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"}),(0,r.jsxs)("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]})]}),(0,r.jsx)("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"})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":ve,"aria-controls":g,onClick:()=>y(c=>!c),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:[(0,r.jsx)("span",{className:"font-mono text-xs",children:"{ }"}),(0,r.jsx)("span",{children:ve?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),(0,r.jsxs)("div",{className:"mt-5 border-slate-100 border-t border-solid pt-4",children:[(0,r.jsx)("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),(0,r.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:ts.map(c=>(0,r.jsx)("button",{type:"button","data-testid":`preset-button-${c.id}`,onClick:()=>fs(c),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:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold text-slate-800",children:c.title}),(0,r.jsxs)("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",c.description,")"]})]})},c.id))})]})]}),(0,r.jsx)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:(0,r.jsxs)("form",{onSubmit:c=>{c.preventDefault(),gs()},className:"space-y-5",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("label",{htmlFor:l,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),(0,r.jsx)("input",{id:l,type:"text","data-testid":"search-query-input",value:k,onChange:c=>E(c.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&&(0,r.jsx)("button",{type:"button","data-testid":"clear-query-button",onClick:()=>E(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),(0,r.jsx)("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:Se.SEARCH_MODES.map(c=>{let fe=$===c;return(0,r.jsx)("button",{type:"button","aria-pressed":fe,title:Oa[c].description,"data-testid":`search-mode-${c}`,"data-active":String(fe),onClick:()=>H(c),className:`shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 font-medium text-xs transition-all ${fe?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:Oa[c].label},c)})}),(0,r.jsx)("button",{type:"submit","data-testid":"execute-search-button",disabled:z,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:z?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{htmlFor:m,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),(0,r.jsx)("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Z})]}),(0,r.jsx)("input",{id:m,type:"range","data-testid":"limit-slider",min:Se.SEARCH_PARAM_LIMITS.limit.min,max:Se.SEARCH_PARAM_LIMITS.limit.max,step:1,value:Z,onChange:c=>V(Number(c.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{htmlFor:u,className:"font-medium text-slate-700 text-xs",title:N?"\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):"}),(0,r.jsx)("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:ee.toFixed(2)})]}),(0,r.jsx)("input",{id:u,type:"range","data-testid":"threshold-slider",min:Se.SEARCH_PARAM_LIMITS.threshold.min,max:Se.SEARCH_PARAM_LIMITS.threshold.max,step:.01,value:ee,disabled:!N,onChange:c=>B(Number(c.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),(0,r.jsx)("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:q.toUpperCase()})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>oe("rrf"),disabled:!S,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${q==="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"}),(0,r.jsx)("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>oe("linear"),disabled:!S,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${q==="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)"})]})]}),(0,r.jsx)("div",{className:"space-y-1.5",children:q==="rrf"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{htmlFor:h,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),(0,r.jsx)("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:R})]}),(0,r.jsx)("input",{id:h,type:"range","data-testid":"rrf-k-slider",min:Se.SEARCH_PARAM_LIMITS.rrfK.min,max:Se.SEARCH_PARAM_LIMITS.rrfK.max,step:1,value:R,disabled:!S,onChange:c=>W(Number(c.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{htmlFor:P,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),(0,r.jsx)("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:J.toFixed(2)})]}),(0,r.jsx)("input",{id:P,type:"range","data-testid":"alpha-slider",min:Se.SEARCH_PARAM_LIMITS.alpha.min,max:Se.SEARCH_PARAM_LIMITS.alpha.max,step:.05,value:J,disabled:!S,onChange:c=>be(Number(c.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>Pe(c=>!c),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,r.jsx)("span",{children:He?"\u25BC":"\u25B6"}),(0,r.jsxs)("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",He?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),He&&(0,r.jsxs)("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:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:p,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),(0,r.jsxs)("select",{id:p,"data-testid":"filter-confidentiality",value:Ue,onChange:c=>F(c.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:[(0,r.jsx)("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),(0,r.jsx)("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),(0,r.jsx)("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),(0,r.jsx)("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),(0,r.jsx)("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:I,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),(0,r.jsx)("input",{id:I,type:"number","data-testid":"filter-department-id",value:ke,onChange:c=>ne(c.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"})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:T,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),(0,r.jsx)("input",{id:T,type:"text","data-testid":"filter-mime-type",value:ie,onChange:c=>G(c.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"})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{htmlFor:O,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),(0,r.jsx)("input",{id:O,type:"text","data-testid":"filter-tag",value:ce,onChange:c=>Q(c.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&&(0,r.jsx)("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&&(0,r.jsx)(da,{metadata:te.search_metadata}),te&&(0,r.jsxs)("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:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",(0,r.jsx)("span",{className:"font-bold text-indigo-600",children:te.count})," \u4EF6"]}),te.search_metadata.execution_time_ms!==void 0&&(0,r.jsxs)("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",(0,r.jsxs)("span",{className:"font-mono font-semibold text-slate-700",children:[te.search_metadata.execution_time_ms," ms"]})]}),(0,r.jsxs)("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]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),(0,r.jsxs)("span",{"data-testid":"tier-badge-sql","data-active":String(Ce.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${Ce.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",Ce.sql?"\u2713":"-"]}),(0,r.jsxs)("span",{"data-testid":"tier-badge-sparse","data-active":String(Ce.sparse),"data-breaker":ye.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${Ce.sparse?"bg-emerald-100 font-semibold text-emerald-800":Aa(ye.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",Ce.sparse?"\u2713":Ma(ye.vector)]}),(0,r.jsxs)("span",{"data-testid":"tier-badge-dense","data-active":String(Ce.dense),"data-breaker":ye.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${Ce.dense?"bg-emerald-100 font-semibold text-emerald-800":Aa(ye.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",Ce.dense?"\u2713":Ma(ye.vector)]}),(0,r.jsxs)("span",{"data-testid":"tier-badge-graph","data-active":String(Ce.graph),"data-breaker":ye.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${Ce.graph?"bg-emerald-100 font-semibold text-emerald-800":Aa(ye.graph)}`,children:["\u30B0\u30E9\u30D5 ",Ce.graph?"\u2713":Ma(ye.graph)]})]})]}),(0,r.jsxs)("div",{"data-testid":"search-results-container",className:"space-y-4",children:[te&&te.hits.length===0&&(0,r.jsxs)("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 border-solid bg-white p-12 text-center",children:[(0,r.jsx)("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"}),(0,r.jsx)("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((c,fe)=>{let _e=Ne.has(c.id),Ze=c.scores?.fused;return(0,r.jsxs)("div",{"data-testid":`search-hit-card-${c.id}`,"data-hit-id":c.id,"data-rank":fe+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:[(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("span",{"data-testid":`hit-rank-${c.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",fe+1]}),(0,r.jsx)("h3",{"data-testid":`hit-filename-${c.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:c.file_name}),(0,r.jsx)("span",{"data-testid":`hit-confidentiality-${c.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${c.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":c.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":c.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:c.confidentiality_level}),c.department_id!==null&&(0,r.jsxs)("span",{"data-testid":`hit-department-${c.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",c.department_id]}),(0,r.jsx)("span",{"data-testid":`hit-mimetype-${c.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:c.mime_type})]}),(0,r.jsx)("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:c.file_uri})]}),Ze!==void 0&&(0,r.jsxs)("div",{className:"flex items-center gap-3 sm:text-right",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),(0,r.jsx)("div",{"data-testid":`hit-fused-score-${c.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:Ze.toFixed(3)})]}),(0,r.jsx)("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:(0,r.jsx)("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,Ze*100))}%`}})})]})]}),c.ai_summary&&(0,r.jsx)("div",{"data-testid":`hit-summary-${c.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:Sr(c.ai_summary,L?.q??k)}),c.scores&&(0,r.jsxs)("div",{"data-testid":`hit-score-breakdown-${c.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),c.scores.vector!==void 0&&(0,r.jsxs)("span",{"data-testid":`score-vector-${c.id}`,"data-score-kind":c.scores.vector.kind,title:Da[c.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Da[c.scores.vector.kind].label,": ",Da[c.scores.vector.kind].format(c.scores.vector.value)]}),c.scores.lexicalRank!==void 0&&(0,r.jsxs)("span",{"data-testid":`score-lexical-${c.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: ",es(c.scores.lexicalRank)]}),c.scores.graphRank!==void 0&&(0,r.jsxs)("span",{"data-testid":`score-graph-${c.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: ",es(c.scores.graphRank)]})]}),c.tags&&c.tags.length>0&&(0,r.jsx)("div",{"data-testid":`hit-tags-${c.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:c.tags.map(et=>(0,r.jsxs)("span",{"data-testid":`hit-tag-${c.id}-${et}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",et]},`tag-${c.id}-${et}`))}),c.graph_relations&&c.graph_relations.length>0&&(0,r.jsxs)("div",{"data-testid":`hit-graph-relations-${c.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),c.graph_relations.map((et,xs)=>(0,r.jsxs)("span",{"data-testid":`hit-relation-${c.id}-${xs}`,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:["-[:",et.relation,"]-> ",et.target_name]},`rel-${c.id}-${et.relation}-${et.target_name}`))]}),c.structured_data!==null&&c.structured_data!==void 0&&(0,r.jsxs)("div",{className:"mt-3 border-slate-100 border-t border-solid pt-2",children:[(0,r.jsxs)("button",{type:"button","data-testid":`toggle-structured-data-${c.id}`,onClick:()=>ys(c.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,r.jsx)("span",{children:_e?"\u25BC":"\u25B6"}),(0,r.jsxs)("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",_e?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),_e&&(0,r.jsx)("pre",{"data-testid":`structured-data-json-${c.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(c.structured_data,null,2)})]})]},c.id)})]}),ve&&(0,r.jsxs)("section",{id:g,"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:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-slate-800 border-b border-solid pb-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),(0,r.jsx)("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let c=JSON.stringify(j==="request"?L??{}:te??{},null,2);bs(c,"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:de==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),(0,r.jsx)("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>y(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),(0,r.jsx)("div",{className:"mt-3 flex gap-2 border-slate-800 border-b border-solid pb-2",children:["request","response","pipeline","graph-trace"].map(c=>{let fe={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},_e=j===c;return(0,r.jsx)("button",{type:"button","data-testid":`inspector-tab-${c}`,"data-active":String(_e),onClick:()=>he(c),className:`rounded-sm px-3 py-1 font-medium text-xs ${_e?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:fe[c]},c)})}),(0,r.jsxs)("div",{className:"mt-4",children:[j==="request"&&(0,r.jsx)("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(L??{},null,2)}),j==="response"&&(0,r.jsx)("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)}),j==="pipeline"&&(0,r.jsxs)("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),(0,r.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),(0,r.jsx)("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?(0,r.jsxs)(r.Fragment,{children:["mode: ",oa.mode,' | q: "',oa.q,'"']}):Et}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),(0,r.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),(0,r.jsx)("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?(0,r.jsxs)(r.Fragment,{children:["SQL SoT: ",Ce.sql?"ACTIVE":"SKIPPED"," | Sparse: ",Ce.sparse?"ACTIVE":"OFFLINE"," | Dense: ",Ce.dense?"ACTIVE":"OFFLINE"," | Graph: ",Ce.graph?"ACTIVE":"OFFLINE"]}):Et}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),(0,r.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),(0,r.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,r.jsxs)("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",te?Nr(oa):Et]})," | ",(0,r.jsxs)("span",{"data-testid":"inspector-output-count",children:["Output count: ",te?te.count:Et]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),(0,r.jsx)("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),(0,r.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,r.jsxs)("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":Et]})," | ",(0,r.jsxs)("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":Et]})," | ","tenant: ",e]})]}),j==="graph-trace"&&(0,r.jsxs)("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[(0,r.jsx)("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),te?.hits.some(c=>c.graph_relations&&c.graph_relations.length>0)?(0,r.jsx)("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:te.hits.map(c=>c.graph_relations?.map(fe=>(0,r.jsxs)("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",c.id,', file: "',c.file_name,'"}) -[:',fe.relation,']-> (:Entity {name: "',fe.target_name,'"})']},`gtrace-${c.id}-${fe.relation}-${fe.target_name}`)))}):(0,r.jsx)("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"})]})]})]})]})}var ta=require("@aiquants/enrichment-core"),De=require("react"),M=require("react/jsx-runtime"),Ka=4;function Ua(e){return e.toFixed(Ka)}function as(e,t){let a=h=>{let P=new Map;return h.forEach((I,p)=>{P.has(I)||P.set(I,p+1)}),P},s=a(e),o=a(t),i=[...s.keys()].filter(h=>o.has(h)),l=new Set([...s.keys(),...o.keys()]).size,m=l===0?null:i.length/l,u=i.length===0?null:i.reduce((h,P)=>h+Math.abs(s.get(P)-o.get(P)),0)/i.length;return{sharedCount:i.length,overlapRatio:m,meanAbsoluteRankDifference:u}}function Fa(e){return`${e.label} (${e.embeddingModel})`}function Rr({variants:e,onCompare:t}){let a=(0,De.useId)(),s=(0,De.useId)(),o=(0,De.useId)(),i=(0,De.useId)(),l=(0,De.useId)(),[m,u]=(0,De.useState)(null),[h,P]=(0,De.useState)(null),[I,p]=(0,De.useState)(""),[T,O]=(0,De.useState)(ta.SEARCH_PARAM_LIMITS.limit.default),[g,k]=(0,De.useState)(!1),[E,$]=(0,De.useState)(null),[H,Z]=(0,De.useState)(null),V=e.length>=2,ee=e.map(F=>F.strategyId),B=m!==null&&ee.includes(m)?m:V?ee[0]:null,q=h!==null&&ee.includes(h)?h:V?ee[1]:null,oe=B!==null&&B===q,R=I.trim(),W=V&&!oe&&R!==""&&!g,J=async F=>{if(F.preventDefault(),!W||B===null||q===null)return;let ke={query:R,strategyIds:[B,q],limit:T};k(!0),$(null);try{let ne=await t(ke);if(!ne.ok){Z(null),$(ne.reason);return}let ie=ne.results.find(ce=>ce.strategyId===B),G=ne.results.find(ce=>ce.strategyId===q);if(ie===void 0||G===void 0){Z(null),$(`\u5FDC\u7B54\u306B\u6226\u7565 #${ie===void 0?B:q} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}Z({input:ke,left:ie,right:G})}catch(ne){Z(null),$(`\u6BD4\u8F03\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${ne instanceof Error?ne.message:String(ne)}`)}finally{k(!1)}},be=H===null?null:as(H.left.hits.map(F=>F.id),H.right.hits.map(F=>F.id)),Ue=F=>{let ke=e.find(ne=>ne.strategyId===F.strategyId);return(0,M.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${F.strategyId}`,children:[(0,M.jsx)("h3",{className:"font-bold text-base text-slate-900",children:ke===void 0?`\u6226\u7565 #${F.strategyId}`:Fa(ke)}),(0,M.jsx)("p",{className:"mt-1 text-[11px] text-slate-500",children:(0,M.jsxs)("span",{"data-testid":`compare-execution-ms-${F.strategyId}`,children:[F.executionMs," ms"]})}),F.hits.length===0?(0,M.jsx)("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${F.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):(0,M.jsx)("ol",{className:"mt-3 space-y-2",children:F.hits.map((ne,ie)=>(0,M.jsxs)("li",{"aria-label":`${ie+1} \u4F4D ${ne.title} (\u30B9\u30B3\u30A2 ${Ua(ne.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${F.strategyId}-${ie+1}`,"data-hit-id":ne.id,"data-score":String(ne.score),children:[(0,M.jsx)("span",{className:"w-6 text-right font-mono text-slate-500",children:ie+1}),(0,M.jsx)("span",{title:ne.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${F.strategyId}-${ie+1}`,children:ne.title}),(0,M.jsx)("span",{title:String(ne.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${F.strategyId}-${ie+1}`,children:Ua(ne.score)})]},ie))})]})};return(0,M.jsxs)("section",{className:"space-y-6","aria-labelledby":a,"data-testid":"model-comparison-workbench","data-running":g,children:[(0,M.jsxs)("form",{onSubmit:J,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,M.jsx)("h2",{id:a,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),(0,M.jsxs)("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 ",Ka," \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"]}),!V&&(0,M.jsxs)("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"]}),(0,M.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,M.jsxs)("div",{className:"space-y-1",children:[(0,M.jsx)("label",{htmlFor:i,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),(0,M.jsx)("select",{id:i,value:B===null?"":String(B),onChange:F=>u(Number(F.target.value)),disabled:!V,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(F=>(0,M.jsx)("option",{value:String(F.strategyId),children:Fa(F)},F.strategyId))})]}),(0,M.jsxs)("div",{className:"space-y-1",children:[(0,M.jsx)("label",{htmlFor:l,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),(0,M.jsx)("select",{id:l,value:q===null?"":String(q),onChange:F=>P(Number(F.target.value)),disabled:!V,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(F=>(0,M.jsx)("option",{value:String(F.strategyId),children:Fa(F)},F.strategyId))})]})]}),oe&&(0,M.jsx)("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"}),(0,M.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[(0,M.jsxs)("div",{className:"space-y-1",children:[(0,M.jsx)("label",{htmlFor:s,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),(0,M.jsx)("input",{id:s,type:"text",value:I,onChange:F=>p(F.target.value),disabled:!V,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"})]}),(0,M.jsxs)("div",{className:"space-y-1",children:[(0,M.jsx)("label",{htmlFor:o,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),(0,M.jsx)("input",{id:o,type:"number",min:ta.SEARCH_PARAM_LIMITS.limit.min,max:ta.SEARCH_PARAM_LIMITS.limit.max,step:1,value:T,onChange:F=>O(Number(F.target.value)),disabled:!V,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"})]})]}),(0,M.jsx)("div",{className:"mt-4",children:(0,M.jsx)("button",{type:"submit",disabled:!W,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:g?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),E!==null&&(0,M.jsx)("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:E}),H!==null&&be!==null&&(0,M.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[(0,M.jsxs)("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[(0,M.jsxs)("div",{children:[(0,M.jsx)("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),(0,M.jsxs)("dd",{"data-testid":"compare-shared-count",children:[be.sharedCount," \u4EF6 (A ",H.left.hits.length," \u4EF6 / B ",H.right.hits.length," \u4EF6)"]})]}),(0,M.jsxs)("div",{children:[(0,M.jsx)("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),(0,M.jsx)("dd",{"data-testid":"compare-overlap-ratio",children:be.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(be.overlapRatio*100).toFixed(1)}%`})]}),(0,M.jsxs)("div",{children:[(0,M.jsx)("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),(0,M.jsx)("dd",{"data-testid":"compare-rank-difference",children:be.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":be.meanAbsoluteRankDifference.toFixed(2)})]})]}),(0,M.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[Ue(H.left),Ue(H.right)]})]})]})}var C=require("react/jsx-runtime");function ns(e){return e===null?Ft:`${e.length} \u7A2E`}var Ft="\u672A\u8A2D\u5B9A";function Ot(e,t=""){return e===null?Ft:`${e}${t}`}function aa(e){return e===null?Ft:`${e} \u4EF6`}function Ir(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?Ft:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??Ft})`}function kr({tenantId:e,ontologyStatus:t}){let a=t.classes,s=t.predicates;return(0,C.jsxs)("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[(0,C.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,C.jsxs)("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("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"}),(0,C.jsx)("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"}),(0,C.jsx)("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:Ir(t)})]}),(0,C.jsx)("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"})]}),(0,C.jsxs)("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:"," ",(0,C.jsx)("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),(0,C.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,C.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,C.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),(0,C.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:aa(t.totalConstraints)})]}),(0,C.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,C.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),(0,C.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:aa(t.searchIndexes)}),(0,C.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",aa(t.totalIndexes)]})]}),(0,C.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,C.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),(0,C.jsxs)("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[Ot(t.promotionThresholds.confidence)," / ",Ot(t.promotionThresholds.cooccurrence," \u56DE")]})]}),(0,C.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,C.jsx)("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),(0,C.jsx)("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:aa(t.unresolvedCandidatesCount)})]})]})]}),(0,C.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,C.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,C.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("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)"}),(0,C.jsx)("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"})]}),(0,C.jsx)("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:ns(a)})]}),(0,C.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[a===null&&(0,C.jsx)("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(o=>(0,C.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${o.name}`,children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:o.name}),(0,C.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:o.description})]}),typeof o.count=="number"&&(0,C.jsx)("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:o.count.toLocaleString()})]},o.name))]})]}),(0,C.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,C.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),(0,C.jsx)("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"})]}),(0,C.jsx)("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:ns(s)})]}),(0,C.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[s===null&&(0,C.jsx)("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"}),s?.map(o=>(0,C.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${o.name}`,children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:o.name}),(0,C.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:o.description})]}),(0,C.jsx)("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:o.direction})]},o.name))]})]})]}),(0,C.jsxs)("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:[(0,C.jsx)("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"}),(0,C.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[(0,C.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,C.jsx)("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),(0,C.jsxs)("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",Ot(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",Ot(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",Ot(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),(0,C.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,C.jsx)("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),(0,C.jsx)("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"})]}),(0,C.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,C.jsx)("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),(0,C.jsxs)("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",(0,C.jsx)("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"]})]})]})]})]})}var pe=require("@aiquants/enrichment-core"),Ie=require("react");var na=require("@aiquants/console-ui/core"),sa=require("@aiquants/enrichment-core"),bt={inset:12,labelFontSize:13,captionFontSize:11},ot={offset:3,stroke:2},ss={node:{width:(0,na.ceil8)(Math.max(...Object.values(sa.PIPELINE_STEPS).map(e=>(0,na.textWidthEm)(e.label)))*bt.labelFontSize+2*bt.inset),height:56},gap:{column:48,row:24},padding:24};function rt(e){return Math.round(e*1e3)/1e3}function wr(e){let t=new Map;for(let a of e){let s=a.dependsOn.reduce((o,i)=>Math.max(o,t.get(i)),-1);t.set(a.step,s+1)}return t}function Ha(e,t){return`${e}->${t}`}function Cr(e,t){let a=[],s=new Map;return{slots:[...e.map(i=>{let l=t.get(i.step),m=i.dependsOn.map(u=>{let h=[],P=u;for(let I=t.get(u)+1;I<l;I+=1){let p=`${Ha(u,i.step)}@${I}`;a.push({id:p,rank:I,predecessors:[P]}),h.push(p),P=p}return s.set(Ha(u,i.step),h),P});return{id:i.step,rank:l,predecessors:m}}),...a],chains:s}}function _r(e){let t=new Map,a=Math.max(...e.map(s=>s.rank));for(let s=0;s<=a;s+=1){let i=e.filter(l=>l.rank===s).map((l,m)=>{let u=s===0?m:l.predecessors.reduce((h,P)=>h+t.get(P),0)/l.predecessors.length;return{slot:l,barycenter:u}});i.sort((l,m)=>l.barycenter-m.barycenter),i.forEach(({slot:l},m)=>{t.set(l.id,m)})}return t}function Ba(e,t=ss){let a=(0,sa.orderedSteps)(e),s=wr(a),{slots:o,chains:i}=Cr(a,s),l=_r(o),{node:m,gap:u,padding:h}=t,P=$=>({x:rt(h+$.rank*(m.width+u.column)),y:rt(h+l.get($.id)*(m.height+u.row))}),I=new Map(o.map($=>[$.id,P($)])),p=a.map($=>{let H=I.get($.step);return{key:$.step,x:H.x,y:H.y,rank:s.get($.step),order:l.get($.step),width:m.width,height:m.height}}),T=$=>rt($+m.height/2),O=a.flatMap($=>$.dependsOn.map(H=>{let Z=I.get(H),V=I.get($.step),ee=rt(Z.x+m.width),B=T(Z.y),q=`M ${ee} ${B}`,oe=(R,W)=>{let J=rt((ee+R)/2);q+=` C ${J} ${B}, ${J} ${W}, ${R} ${W}`};for(let R of i.get(Ha(H,$.step))){let W=I.get(R),J=T(W.y);oe(W.x,J),ee=rt(W.x+m.width),B=J,q+=` L ${ee} ${B}`}return oe(V.x,T(V.y)),{from:H,to:$.step,path:q}})),g=[...I.values()],k=rt(Math.max(...g.map($=>$.x+m.width))+h),E=rt(Math.max(...g.map($=>$.y+m.height))+h);return{width:k,height:E,steps:p,edges:O}}var b=require("react/jsx-runtime"),rs="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Ga={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},os={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"}},za={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"},Tr={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},Ut="rgb(248 250 252)",Pr={backgroundColor:Ut,backgroundImage:`linear-gradient(to right, ${Ut}, ${Ut}), linear-gradient(to right, ${Ut}, ${Ut}), 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 ja(e,t){let a=t[e.featureFlagKey];return a===void 0?"unmeasured":a?"open":"closed"}function is(e,t){let a=e.map(s=>({gate:s,state:ja(s,t)}));return a.some(({gate:s,state:o})=>o==="closed"&&s.whenClosed==="fail")?"closed-fail":a.some(({state:s})=>s==="closed")?"closed-skip":a.some(({state:s})=>s==="unmeasured")?"unmeasured":"open"}function qa(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function ds(e,t){let{badge:a}=Wa[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?a:`${a}\u30FB${za[t]}`}function Lr(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 Va(e){return e.map(t=>pe.PIPELINE_STEPS[t].label).join("\u3001")}function $r(e){return e.dependsOn.length===0?rs:`\u4F9D\u5B58: ${Va(e.dependsOn)}`}function Dr({featureFlags:e,metrics:t,metricSampleWindow:a,selectedKind:s,onSelectKind:o,selectedStepKey:i,onSelectStep:l}){if(!Number.isSafeInteger(a)||a<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${a}.`);let m=(0,Ie.useId)(),u=(0,Ie.useId)(),h=(0,Ie.useId)(),P=(0,Ie.useId)(),I=(0,Ie.useId)(),[p,T]=(0,Ie.useState)(pe.DOCUMENT_KINDS[0]),[O,g]=(0,Ie.useState)(null),[k,E]=(0,Ie.useState)(null),$=(0,Ie.useRef)(new Map),H=(0,Ie.useRef)(new Map),Z=(0,Ie.useRef)(null),V=(0,Ie.useRef)(null),{labels:ee}=K(),B=s!==void 0?s:p,q=i!==void 0?i:O,oe=(0,pe.flowFor)(B),R=Ba(oe),W=new Map(oe.steps.map(y=>[y.step,y])),J=y=>{g(y),l?.(y)},be=y=>{T(y),o?.(y),J(null)},Ue=(y,j)=>{let he=pe.DOCUMENT_KINDS.length-1,de;switch(y.key){case"ArrowRight":de=j===he?0:j+1;break;case"ArrowLeft":de=j===0?he:j-1;break;case"Home":de=0;break;case"End":de=he;break;default:return}y.preventDefault();let me=pe.DOCUMENT_KINDS[de];be(me),$.current.get(me)?.focus()},F=y=>{let j=V.current;if(J(null),j?.isConnected){j.focus();return}H.current.get(y)?.focus()},ke=y=>{J(y===q?null:y)},ne=(y,j)=>{y.currentTarget.focus(),ke(j)},ie=(y,j)=>{y.key==="Enter"||y.key===" "?(y.preventDefault(),ke(j)):y.key==="Escape"&&J(null)},G=q===null?void 0:W.get(q),ce=G===void 0?null:G.step;(0,Ie.useEffect)(()=>{if(ce===null){V.current=null;return}let y=document.activeElement;(y instanceof HTMLElement||y instanceof SVGElement)&&y!==document.body&&Z.current?.contains(y)===!1&&(V.current=y)},[ce]);let Q=G===void 0?void 0:pe.PIPELINE_STEPS[G.step],we=G===void 0?[]:(0,pe.flowStepGates)(G),He=G===void 0?[]:oe.steps.filter(y=>y.dependsOn.includes(G.step)).map(y=>y.step),Pe=Q===void 0?void 0:t.find(y=>y.documentKind===B&&y.stepKey===Q.key),ve=pe.DOCUMENT_KIND_LABELS[B];return(0,b.jsxs)("section",{className:"space-y-6","aria-labelledby":m,"data-testid":"pipeline-flow-viewer","data-kind":B,children:[(0,b.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,b.jsx)("h2",{id:m,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),(0,b.jsx)("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"}),(0,b.jsx)("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:pe.DOCUMENT_KINDS.map((y,j)=>{let he=y===B;return(0,b.jsx)("button",{ref:de=>{de===null?$.current.delete(y):$.current.set(y,de)},type:"button",role:"tab","aria-selected":he,"aria-controls":u,tabIndex:he?0:-1,onClick:()=>be(y),onKeyDown:de=>Ue(de,j),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-${y}`,children:pe.DOCUMENT_KIND_LABELS[y]},y)})}),(0,b.jsx)("div",{id:u,role:"tabpanel","aria-label":`${pe.DOCUMENT_KIND_LABELS[B]} \u306E\u6D41\u308C`,"aria-describedby":h,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:Pr,"data-testid":"flow-scroll",children:(0,b.jsxs)("svg",{viewBox:`0 0 ${R.width} ${R.height}`,width:R.width,height:R.height,role:"group","aria-label":`${pe.DOCUMENT_KIND_LABELS[B]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[(0,b.jsx)("title",{children:`${pe.DOCUMENT_KIND_LABELS[B]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),(0,b.jsx)("defs",{children:(0,b.jsx)("marker",{id:`${u}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:(0,b.jsx)("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),R.edges.map(y=>(0,b.jsx)("path",{d:y.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${u}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${y.from}-${y.to}`},`${y.from}-${y.to}`)),R.steps.map(y=>{let j=pe.PIPELINE_STEPS[y.key],he=W.get(y.key),de=(0,pe.flowStepGates)(he),me=is(de,e),Ne=qa(de),Qe=Wa[me],Be=ds(me,Ne),Ae=y.key===q,te=y.key===k,We=`${u}-depends-${y.key}`;return(0,b.jsxs)("g",{ref:Me=>{Me===null?H.current.delete(y.key):H.current.set(y.key,Me)},transform:`translate(${y.x} ${y.y})`,role:"button",tabIndex:0,"aria-label":`${j.label} (${Be})`,"aria-describedby":We,"aria-expanded":Ae,"aria-controls":Ae?I:void 0,onClick:Me=>ne(Me,y.key),onKeyDown:Me=>ie(Me,y.key),onFocus:()=>E(y.key),onBlur:()=>E(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${y.key}`,"data-step-key":y.key,"data-gate-state":me,"data-gate-policy":Ne,"data-selected":Ae,"data-focused":te,children:[(0,b.jsx)("desc",{id:We,"data-testid":`flow-node-dependencies-${y.key}`,children:$r(he)}),te&&(0,b.jsx)("rect",{x:-ot.offset,y:-ot.offset,width:y.width+2*ot.offset,height:y.height+2*ot.offset,rx:8+ot.offset,fill:"none",strokeWidth:ot.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${y.key}`}),(0,b.jsx)("rect",{width:y.width,height:y.height,rx:8,strokeWidth:Ae?3:1.5,strokeDasharray:Qe.dash,className:`${Qe.stroke} ${Ae?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${y.key}`}),(0,b.jsx)("text",{x:bt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${y.key}`,children:j.label}),(0,b.jsx)("text",{x:bt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${y.key}`,children:Ga[j.phase]}),(0,b.jsx)("text",{x:bt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${y.key}`,"data-gate-state":me,children:Be})]},y.key)})]})}),(0,b.jsxs)("p",{id:h,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",R.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"]})]}),Q!==void 0&&G!==void 0&&(0,b.jsxs)("section",{id:I,ref:Z,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":P,"data-testid":"flow-step-detail","data-step-key":Q.key,children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{id:P,className:"font-bold text-base text-slate-900",children:Q.label}),(0,b.jsx)("p",{className:"mt-1 text-[13px] text-slate-600",children:Q.description})]}),(0,b.jsx)("button",{type:"button",onClick:()=>F(Q.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"})]}),(0,b.jsxs)("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:Q.endpoint})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),(0,b.jsxs)("dd",{"data-testid":"flow-step-phase",children:[Ga[Q.phase]," (",Q.phase,")"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),(0,b.jsx)("dd",{"data-testid":"flow-step-capability",children:Q.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":Q.capability})]}),G.chunkSource!==void 0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),(0,b.jsxs)("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":G.chunkSource,children:[os[G.chunkSource]," (",G.chunkSource,")"]})]}),(0,b.jsxs)("div",{className:"sm:col-span-2",children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),(0,b.jsx)("dd",{"data-testid":"flow-step-depends-on",children:G.dependsOn.length===0?rs:Va(G.dependsOn)})]}),(0,b.jsxs)("div",{className:"sm:col-span-2",children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),(0,b.jsx)("dd",{"data-testid":"flow-step-dependents",children:He.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Va(He)})]}),(0,b.jsxs)("div",{className:"sm:col-span-2",children:[(0,b.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),(0,b.jsx)("dd",{children:we.length===0?(0,b.jsx)("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("ul",{className:"space-y-1",children:we.map(y=>{let j=ja(y,e);return(0,b.jsxs)("li",{"data-testid":`flow-gate-${y.featureFlagKey}`,"data-gate-state":j,"data-when-closed":y.whenClosed,children:[(0,b.jsx)("code",{className:"font-mono",children:y.featureFlagKey}),": ",Tr[j]," \u2014 ",Lr(y)]},y.featureFlagKey)})}),G.gatePolicy!==void 0&&(0,b.jsxs)("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[ve," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",za[qa(Q.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",G.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),(0,b.jsxs)("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:[(0,b.jsxs)("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",ve,"\u30FB\u76F4\u8FD1 ",a," \u4EF6)"]}),(0,b.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[ve," \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?(0,b.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[ee.unmeasured," (",ve," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),(0,b.jsx)("dd",{"data-testid":"flow-metric-sample-count",children:(0,b.jsx)(ae,{value:Pe.sampleCount,testId:"flow-metric-sample-count-value"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"\u6210\u529F"}),(0,b.jsx)("dd",{"data-testid":"flow-metric-succeeded",children:(0,b.jsx)(ae,{value:Pe.succeeded,testId:"flow-metric-succeeded-value"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"\u5931\u6557"}),(0,b.jsx)("dd",{"data-testid":"flow-metric-failed",children:(0,b.jsx)(ae,{value:Pe.failed,testId:"flow-metric-failed-value"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"\u7701\u7565"}),(0,b.jsx)("dd",{"data-testid":"flow-metric-skipped",children:(0,b.jsx)(ae,{value:Pe.skipped,testId:"flow-metric-skipped-value"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"p50"}),(0,b.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:(0,b.jsx)(ae,{value:Pe.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"p95"}),(0,b.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:(0,b.jsx)(ae,{value:Pe.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),(0,b.jsxs)("div",{className:"col-span-2",children:[(0,b.jsx)("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),(0,b.jsx)("dd",{"data-testid":"flow-metric-last-started-at",children:(0,b.jsx)(ge,{iso:Pe.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),(0,b.jsxs)("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 ",ee.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"]})]})]})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,b.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),(0,b.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",(0,b.jsx)("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",pe.DOCUMENT_KIND_LABELS.other,"\u300D\u3067\u3059\u3002"]}),(0,b.jsx)("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:(0,b.jsxs)("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[(0,b.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),(0,b.jsx)("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100",children:pe.MIME_KIND_RULES.map(([y,j],he)=>(0,b.jsxs)("tr",{className:j===B?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${he}`,"data-kind":j,"data-selected":j===B,children:[(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)("code",{className:"font-mono",children:y})}),(0,b.jsx)("td",{className:"px-3 py-2",children:pe.DOCUMENT_KIND_LABELS[j]})]},y))})]})})]})]})}var ra=require("@aiquants/console-ui/core"),ms=require("react");var _=require("react/jsx-runtime");function Ar(e,t){return e==null?null:gt(e,"segment_count",t)}function ls(e,t,a){return e==null?null:Qt(e,t,a)}function Mr(e){let t=e.probe_failure;if(t===null)return null;if(!Lt.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 cs(e,t,a){return e.reduce((s,o)=>s+gt(o[t],`${t} of collection ${o.collection_name}`,a),0)}var Or=(0,ra.cssVar)("space-1"),Fr={padding:0,height:"1px",color:"#1e293b"},Ur={display:"flex",height:"100%"},Kr={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},Hr={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},Br={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Xa={whiteSpace:"nowrap"},us=(0,ra.cssVar)("space-3"),Gr=(0,ra.cssVar)("info-tint"),Ya={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function ps(e,t){return`vectors_config.${e}.size of collection ${t}`}function qr({overview:e,health:t,resources:a,onRefresh:s,isRefreshing:o=!1,selection:i}){let{formatLocale:l}=K(),m=(0,ms.useId)(),{collections:u}=e,h=Mr(e),P=h===null,I=P?cs(u,"points_count",l):null,p=P?cs(u,"vectors_count",l):null,T=ls(a?.ram_bytes,"ram_bytes",l),O=ls(a?.disk_bytes,"disk_bytes",l),g=Ar(a?.segment_count,l);return(0,_.jsxs)("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,_.jsxs)("div",{"data-testid":"qdrant-card-header",style:Hr,children:[(0,_.jsxs)("div",{"data-testid":"qdrant-card-title-group",style:Br,children:[(0,_.jsx)("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&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...St[t.healthy?"connected":"error"],style:{...Xa,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Nt[t.healthy?"connected":"error"]}),(0,_.jsxs)("span",{"data-testid":"qdrant-latency",style:{...Xa,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",(0,_.jsx)(ae,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),s&&(0,_.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:o,onClick:s,style:{...Xa,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:o?"not-allowed":"pointer",fontSize:"13px"},children:o?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),(0,_.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,_.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,_.jsx)(ae,{value:I,testId:"qdrant-total-points-value"})})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,_.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,_.jsx)(ae,{value:p,testId:"qdrant-total-vectors-value"})})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,_.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,_.jsx)(Fe,{text:T,testId:"qdrant-ram-usage-value"})})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,_.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,_.jsx)(Fe,{text:O,testId:"qdrant-disk-usage-value"})})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,_.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,_.jsx)(ae,{value:g,testId:"qdrant-segment-count-value"})})]})]}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("h3",{id:m,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",(0,_.jsx)(ae,{value:P?u.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),h!==null?(0,_.jsx)("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}):u.length===0?(0,_.jsx)("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"}):(0,_.jsx)("section",{tabIndex:0,"aria-labelledby":m,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Or},children:(0,_.jsxs)("table",{"aria-labelledby":m,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[(0,_.jsx)("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${us}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,_.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,_.jsx)("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,_.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,_.jsx)("tbody",{children:u.map(k=>{let E=i!==void 0&&k.collection_name===i.selectedCollectionName,$=(0,_.jsx)("span",{style:Kr,children:k.collection_name}),{dense:H,sparse:Z,image:V}=k.vectors_config,ee=H===void 0?null:gt(H.size,ps("dense",k.collection_name),l),B=V===void 0?null:gt(V.size,ps("image",k.collection_name),l);return(0,_.jsxs)("tr",{"data-testid":`collection-row-${k.collection_name}`,"data-collection-name":k.collection_name,"data-selected":String(E),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:E?Gr:"transparent"},children:[i===void 0?(0,_.jsx)("td",{style:{padding:`8px ${us}`,color:"#1e293b"},children:$}):(0,_.jsx)("td",{style:Fr,children:(0,_.jsx)("div",{style:Ur,children:(0,_.jsx)(un,{selected:E,controls:i.detailId,onSelect:()=>i.onSelectCollection(k.collection_name),testId:`collection-select-${k.collection_name}`,children:$})})}),(0,_.jsx)("td",{style:{padding:"8px",color:"#475569"},children:k.domain_key}),(0,_.jsx)("td",{"data-testid":`collection-points-${k.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:(0,_.jsx)(ae,{value:k.points_count,testId:`collection-points-value-${k.collection_name}`})}),(0,_.jsx)("td",{style:{padding:"8px"},children:(0,_.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[ee!==null&&(0,_.jsxs)("span",{"data-testid":`vector-tag-dense-${k.collection_name}`,style:{...Ya,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",(0,_.jsx)(ae,{value:ee,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${k.collection_name}`})]}),Z!==void 0&&(0,_.jsx)("span",{"data-testid":`vector-tag-sparse-${k.collection_name}`,style:{...Ya,backgroundColor:"#fef3c7",color:"#92400e"},children:Z.modifier?`Sparse (${Z.modifier.toUpperCase()})`:"Sparse"}),B!==null&&(0,_.jsxs)("span",{"data-testid":`vector-tag-image-${k.collection_name}`,style:{...Ya,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",(0,_.jsx)(ae,{value:B,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${k.collection_name}`})]})]})})]},k.collection_name)})})]})})]})]})}var D=require("react/jsx-runtime"),Vr="\u5BFE\u8C61\u306A\u3057";function Wr({counts:e,totalFiles:t,failedItems:a=[],onRetryAll:s,onRetryItem:o,isRetrying:i=!1,onRefresh:l,listRefusal:m}){K();let u=e.SYNCED??0,h=e.PENDING??0,P=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),I=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),p=t>0?`${(u/t*100).toFixed(1)}%`:Vr;return(0,D.jsxs)("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,D.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("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"}),(0,D.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,D.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,D.jsx)("span",{"data-testid":"success-rate-value",children:p}),")"]})]}),(0,D.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[l&&(0,D.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),s&&(0,D.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:i||I===0,onClick:s,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:i||I===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:i||I===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:i?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,D.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,D.jsxs)("div",{"data-testid":"status-card-synced","data-count":u,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,D.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,D.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:u})]}),(0,D.jsxs)("div",{"data-testid":"status-card-processing","data-count":P,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,D.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,D.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:P})]}),(0,D.jsxs)("div",{"data-testid":"status-card-pending","data-count":h,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,D.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,D.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:h})]}),(0,D.jsxs)("div",{"data-testid":"status-card-failed","data-count":I,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,D.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,D.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:I})]})]}),(0,D.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,D.jsxs)("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",m!==void 0?"":` (${a.length<I?`\u4E0A\u4F4D ${a.length} \u4EF6 / \u5168 ${I} \u4EF6`:`${a.length} \u4EF6`})`]}),m!==void 0?(0,D.jsx)(xt,{tone:"warning",testId:"failed-items-refused",children:m}):a.length===0?(0,D.jsx)("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"}):(0,D.jsx)("div",{style:{overflowX:"auto"},children:(0,D.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,D.jsx)("thead",{children:(0,D.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,D.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,D.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,D.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,D.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,D.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,D.jsx)("tbody",{children:a.map((T,O)=>{if(T.kind==="restricted")return(0,D.jsxs)("tr",{"data-testid":`failed-item-restricted-${O}`,"data-restricted-mark":"failure",children:[(0,D.jsx)("td",{"data-testid":`failed-item-restricted-text-${O}`,style:{padding:"8px"},children:dt}),(0,D.jsx)("td",{style:{padding:"8px"},children:(0,D.jsx)("span",{"data-testid":`failed-item-restricted-status-${O}`,style:{fontSize:"11px"},children:T.syncStatus})}),(0,D.jsx)("td",{style:{padding:"8px"}}),(0,D.jsx)("td",{"data-testid":`failed-item-restricted-time-${O}`,style:{padding:"8px",whiteSpace:"nowrap"},children:T.failedAt===null?"\u8A18\u9332\u306A\u3057":(0,D.jsx)(ge,{iso:T.failedAt,testId:`failed-item-restricted-time-value-${O}`})}),(0,D.jsx)("td",{style:{padding:"8px"}})]},`restricted:${O}`);let g=T.item;return(0,D.jsxs)("tr",{"data-testid":`failed-item-row-${g.id}`,"data-file-uri":g.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,D.jsxs)("td",{"data-testid":`failed-item-uri-${g.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,D.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:g.file_name}),(0,D.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:g.file_uri})]}),(0,D.jsx)("td",{style:{padding:"8px"},children:(0,D.jsx)("span",{"data-testid":`failed-item-status-${g.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:g.sync_status})}),(0,D.jsx)("td",{"data-testid":`failed-item-error-${g.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:g.error_message??"",children:g.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,D.jsx)("td",{"data-testid":`failed-item-time-${g.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:g.failed_at===null?"\u8A18\u9332\u306A\u3057":(0,D.jsx)(ge,{iso:g.failed_at,testId:`failed-item-time-value-${g.id}`})}),(0,D.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:o&&(0,D.jsx)("button",{type:"button","data-testid":`retry-item-button-${g.id}`,"aria-label":`${g.file_name} (${g.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:i,onClick:()=>o(g.id,g.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"})})]},`readable:${g.id}`)})})]})})]})]})}0&&(module.exports={CHUNKING_ONLY_NOTE,CHUNK_BODY_FIDELITY_LABELS,CHUNK_CHANGE_KIND_LABELS,CHUNK_SOURCE_LABELS,DOCUMENT_STATE_CAUSE_LABELS,DegradedSearchBanner,DocumentChangeFeed,DocumentHistoryInspector,DocumentIngestConsole,EnrichmentStrategyBoard,FACET_LABELS,FAILED_RUN_STATE_MARK,FIELD_LABELS,FLOW_FOCUS_RING,FLOW_GEOMETRY,FLOW_NODE_TEXT,FinishedInstant,GATE_POLICY_LABELS,GATE_STATE_PRESENTATION,HISTORY_REFUSAL,InfrastructureHealthMonitor,MODEL_ONLY_CHANGE_MARK,MetadataSearchWorkbench,ModelComparisonWorkbench,NOTHING_TO_READ_LABELS,NO_ENRICHMENT_RECORD_TEXT,NO_PREVIOUS_RECORD_TEXT,OntologyStatusCard,PHASE_LABELS,PIPELINE_RUN_STATUS_PRESENTATION,PIPELINE_STEP_STATUS_PRESENTATION,PIPELINE_TRIGGER_LABELS,PipelineFlowViewer,QdrantStorageCard,REASON_LABELS,RESTRICTED_DOCUMENT_TEXT,RESTRICTED_RUN_TEXT,RESTRICTED_STATE_TEXT,RUN_TERMINAL_STEP_LABEL,RUN_TERMINAL_STEP_OUTCOME_LABELS,RecordedInstant,SCORE_DISPLAY_DECIMALS,SEARCH_MODE_LABELS,SEARCH_PRESETS,SyncStatusMonitor,UNFINISHED_LABEL,UNRECORDED_RUN_MARK,UNVERIFIED_CHUNK_NOTE,WHITESPACE_NORMALIZED_NOTE,facetCountsText,fieldLabel,formatComparisonScore,gateCaption,gateState,gateStateOf,historyFailedSentence,historyFailureSentence,ingestRowAction,jsonValueText,layoutFlow,ledgerStepLabel,pipelineRunPresentationKey,rankAgreement,revisionLabel,revisionTransitionText,skipReasonLabel,stepGatePolicy,stepGateState,unrecordedRunsMark});