@aiquants/enrichment-react 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/package.json +8 -6
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var $n=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Wr=Object.getOwnPropertyNames;var Yr=Object.prototype.hasOwnProperty;var Xr=(e,t)=>{for(var n in t)$n(e,n,{get:t[n],enumerable:!0})},jr=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wr(t))!Yr.call(e,o)&&o!==n&&$n(e,o,{get:()=>t[o],enumerable:!(a=zr(t,o))||a.enumerable});return e};var Jr=e=>jr($n({},"__esModule",{value:!0}),e);var Do={};Xr(Do,{BREAKER_STATE_LABELS:()=>Pt,CHUNKING_ONLY_NOTE:()=>zn,CHUNK_BODY_FIDELITY_LABELS:()=>Vn,CHUNK_CHANGE_KIND_LABELS:()=>fn,CHUNK_SOURCE_LABELS:()=>Fr,CONFIDENTIALITY_LEVEL_LABELS:()=>Lr,DEGRADATION_REASON_LABELS:()=>Dn,DOCUMENT_STATE_CAUSE_LABELS:()=>Et,DegradedSearchBanner:()=>Hn,DocumentChangeFeed:()=>is,DocumentHistoryInspector:()=>Ks,DocumentIngestConsole:()=>Ws,EnrichmentStrategyBoard:()=>Ys,FACET_LABELS:()=>ut,FAILED_RUN_STATE_MARK:()=>Xn,FIELD_LABELS:()=>qt,FLOW_FOCUS_RING:()=>bt,FLOW_GEOMETRY:()=>Mr,FLOW_NODE_TEXT:()=>kt,FinishedInstant:()=>Ct,GATE_POLICY_LABELS:()=>Ia,GATE_STATE_PRESENTATION:()=>_a,HIDDEN_FIELD_TEXT:()=>xt,HISTORY_REFUSAL:()=>st,INERT_STAGE_NOTE:()=>_r,InfrastructureHealthMonitor:()=>Qs,MODEL_ONLY_CHANGE_MARK:()=>jn,MetadataSearchWorkbench:()=>lo,ModelComparisonWorkbench:()=>uo,NOTHING_TO_READ_LABELS:()=>Ya,NO_ENRICHMENT_RECORD_TEXT:()=>Nr,NO_PREVIOUS_RECORD_TEXT:()=>Yn,OntologyStatusCard:()=>mo,PHASE_LABELS:()=>Na,PIPELINE_RUN_STATUS_PRESENTATION:()=>et,PIPELINE_STEP_STATUS_PRESENTATION:()=>xn,PIPELINE_TRIGGER_LABELS:()=>hn,PipelineFlowViewer:()=>So,QUALITY_TIER_LABELS:()=>wt,QdrantStorageCard:()=>Po,RESTRICTED_DOCUMENT_TEXT:()=>Rt,RESTRICTED_RUN_TEXT:()=>zt,RESTRICTED_STATE_TEXT:()=>Wn,RUN_TERMINAL_STEP_LABEL:()=>Wa,RUN_TERMINAL_STEP_OUTCOME_LABELS:()=>na,RecordedInstant:()=>ge,SCORE_DECIMALS:()=>ht,SCORE_DISPLAY_DECIMALS:()=>Dr,SEARCH_FUSION_LABELS:()=>An,SEARCH_MODE_LABELS:()=>rt,SEARCH_PRESETS:()=>Pr,SyncStatusMonitor:()=>$o,UNFINISHED_LABEL:()=>aa,UNRECORDED_RUN_MARK:()=>yn,UNVERIFIED_CHUNK_NOTE:()=>qn,WHITESPACE_NORMALIZED_NOTE:()=>Gn,degradationReasonText:()=>Ht,documentKindLabel:()=>ta,facetCountsText:()=>Wt,fieldLabel:()=>At,gateCaption:()=>Kr,gateState:()=>Ca,gateStateOf:()=>xa,historyFailedSentence:()=>ot,historyFailureSentence:()=>Yt,ingestRowAction:()=>Er,jsonValueText:()=>pt,layoutFlow:()=>Sa,ledgerStepLabel:()=>Ot,pipelineRunPresentationKey:()=>it,rankAgreement:()=>On,revisionLabel:()=>We,revisionTransitionText:()=>gn,skipReasonLabel:()=>ra,stepGatePolicy:()=>Ea,stepGateState:()=>Ur,unrecordedRunsMark:()=>Jn,variantHitKey:()=>sn,vectorScoreText:()=>Mn});module.exports=Jr(Do);var xt="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",rt={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\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\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\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\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},An={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},wt={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},Pt={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Dn={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\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"};function Ht(e){return Object.hasOwn(Dn,e)?Dn[e]:e}var ht=3;function Mn(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(ht)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function On(e,t){let n=l=>{let i=new Map;return l.forEach((x,O)=>{i.has(x)||i.set(x,O+1)}),i},a=n(e),o=n(t),r=[...a.keys()].filter(l=>o.has(l)),u=new Set([...a.keys(),...o.keys()]).size;return{sharedCount:r.length,overlapRatio:u===0?null:r.length/u,meanAbsoluteRankDifference:r.length===0?null:r.reduce((l,i)=>l+Math.abs(a.get(i)-o.get(i)),0)/r.length}}function sn(e){return`${e.metadata_id}:${e.chunk_index}`}var $=require("@aiquants/console-ui"),ce=require("react");var Vt="ja-JP";function T(){let e=(0,$.useConsoleUi)();if(e.locale!=="ja"||e.formatLocale!==Vt)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${Vt}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function j(e){return T(),(0,ce.createElement)($.Measured,e)}function $a(e){return T(),(0,ce.createElement)($.RowButton,e)}function on(e){return T(),(0,ce.createElement)($.MasterDetail,e)}function dn(e){return T(),(0,ce.createElement)($.ComparisonGrid,e)}function Ge(e){return T(),(0,ce.createElement)($.Pill,e)}function dt(e){return T(),(0,ce.createElement)($.Card,e)}function Ne(e){return T(),(0,ce.createElement)($.Button,e)}function qe(e){return T(),(0,ce.createElement)($.Notice,e)}function ze(e){return T(),(0,ce.createElement)($.AlertMessage,e)}function vt(e){return T(),(0,ce.createElement)($.ResourceFailed,e)}function ln(e){return T(),(0,ce.createElement)($.LoadMore,e)}function Da(e){return T(),(0,ce.createElement)($.VisuallyHidden,e)}function Lt(e){return T(),(0,ce.createElement)($.DataTable,e)}function cn(e){return T(),(0,ce.createElement)($.SelectableList,e)}function Fn(e,t,n){return T(),(0,$.useResource)(e,t,n)}function un(e,t,n){return T(),(0,$.usePagedResource)(e,t,n)}function Ze(e){return T(),(0,$.useFocusRescue)(e)}function Un(e){return T(),(0,ce.createElement)($.CardSection,e)}function Kn(e){return T(),(0,ce.createElement)($.CodeBlock,e)}function $t(e){return T(),(0,ce.createElement)($.DescriptionList,e)}function pn(e){return T(),(0,ce.createElement)($.Disclosure,e)}function Bn(e){return T(),(0,ce.createElement)($.Meter,e)}function mn(e){return T(),(0,ce.createElement)($.SegmentedControl,e)}function Gt(e){return T(),(0,ce.createElement)($.Select,e)}function St(e){return T(),(0,ce.createElement)($.Slider,e)}function Te(e){return T(),(0,ce.createElement)($.Stack,e)}function lt(e){return T(),(0,ce.createElement)($.Cluster,e)}function G(e){return T(),(0,ce.createElement)($.Text,e)}function Nt(e){return T(),(0,ce.createElement)($.TextInput,e)}function Dt(){return T(),(0,$.useAnnounce)()}var ct=require("react/jsx-runtime");function Hn({metadata:e,testId:t}){if(T(),!e.is_degraded)return null;let n=e.executed_tiers,a=rt[e.requested_mode].label,o=wt[e.quality_tier],u=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${o})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u3001${rt[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${o})\u3002`;return(0,ct.jsx)(qe,{tone:"warning",testId:t,children:(0,ct.jsxs)(Te,{gap:"space-2",testId:`${t}-body`,children:[(0,ct.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:u}),e.degradation_reasons.length>0&&(0,ct.jsx)("ul",{"data-testid":`${t}-reasons`,children:e.degradation_reasons.map((l,i)=>(0,ct.jsx)("li",{"data-reason":l,children:(0,ct.jsx)(G,{fg:"fg",type:"prose",testId:`${t}-reason-${i}`,children:Ht(l)})},`${i}-${l}`))})]})})}var Qt=require("@aiquants/console-ui/core"),Ja=require("@aiquants/enrichment-core"),oa=require("react");var Aa=require("@aiquants/console-ui/core"),ut={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"},Et={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"},fn={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Vn={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"},Gn="\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",qn="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",zn="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",qt={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function At(e){return Object.hasOwn(qt,e)?qt[e]:e}var Rt="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Wn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",zt="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",Yn="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Xn="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",yn="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",jn="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Jn(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 We(e){return`r${e}`}function gn(e,t){return e===t?`${We(t)} (\u540C\u3058\u7248)`:`${We(e)} \u2192 ${We(t)}`}function Wt(e){let t=ut[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let a=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([o,r])=>o===null||o===0?[]:[`${r}${o}`]);return a.length===0?`${t} \u5909\u66F4`:`${t} ${a.join(" ")}`}function pt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var st="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function Yt(e,t,n){return e.failureSentence(t,st,ot(n))}function ot(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${(0,Aa.reasonAside)(t)}\u3002`}var Qn=require("@aiquants/enrichment-core"),Ma=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Oa(e){let t=e.states.flatMap(i=>i.kind==="readable"?[i.item]:[]),n=e.runs.flatMap(i=>i.kind==="readable"?[i.item]:[]),a=new Set(n.map(i=>i.id)),o=[...n.map(i=>({kind:"run",key:`run:${i.id}`,time:i.startedAt,run:i,state:t.find(x=>x.runId===i.id)??null})),...t.filter(i=>i.runId===null||!a.has(i.runId)).map(i=>({kind:"state",key:`state:${i.stateId}`,time:i.settledAt,state:i}))].sort(Ma),u=[...new Set([...e.revisions.map(i=>i.revision),...o.map(i=>i.kind==="run"?i.run.revision:i.state.revision)])].sort((i,x)=>x-i).map(i=>({revision:i,isCurrent:e.revisions.some(x=>x.revision===i&&x.isCurrent),items:o.filter(x=>(x.kind==="run"?x.run.revision:x.state.revision)===i)})),l=[...e.states.flatMap((i,x)=>i.kind==="restricted"?[{key:`restricted:state:${x}`,time:i.settledAt,mark:i}]:[]),...e.runs.flatMap((i,x)=>i.kind==="restricted"?[{key:`restricted:run:${x}`,time:i.startedAt,mark:i}]:[])].sort(Ma);return{groups:u,marks:l,states:t,runs:n}}function Zn(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Qn.RUN_TERMINAL_STEP_KEY);return t===void 0||t.status==="FAILED"}function Fa(e,t){let n=t.states.find(r=>r.stateId===e.previousStateId);if(n===void 0)return[];let a=Date.parse(n.settledAt),o=Date.parse(e.settledAt);return t.runs.filter(r=>{let u=Date.parse(r.startedAt);return r.status!=="RUNNING"&&r.id!==e.runId&&u>=a&&u<o&&!t.states.some(l=>l.runId===r.id)&&!r.steps.some(l=>l.stepKey===Qn.RUN_TERMINAL_STEP_KEY&&l.status==="SUCCEEDED")}).map(r=>r.id)}function Ua(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(a=>a.stateId===e.stateId);return n!==void 0&&t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function Ka(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}var Ba=require("react");function Mt(e){let[t,n]=(0,Ba.useState)({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}var we=require("@aiquants/console-ui/core"),mt=we.TOKENS.type.body.size,ea=we.TOKENS.space["space-3"],Qr=20,Ha=(0,we.ceil8)(mt*(0,we.textWidthEm)("\u3042".repeat(Qr))+2*ea),Va=448,Zr=40,es=2,ts="+ ",ns=we.TOKENS.space["space-4"];function as(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 Ga(e){let n=(0,we.monoTextWidthEm)("0".repeat(as(e)+es))+(0,we.monoTextWidthEm)(ts)+(0,we.monoTextWidthEm)("0".repeat(Zr));return(0,we.ceil8)(mt*2*n+ns)}function _t(e){return(0,we.ceil8)(mt*(0,we.textWidthEm)(e)+2*ea)}function It(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(_t))}function bn(e){return(0,we.ceil8)(mt*(0,we.textWidthEm)(e)+4*ea)}var qa="0000/00/00 00:00:00",Be=_t("\u3042".repeat(10));var Xt=require("react/jsx-runtime"),jt=/[^\s\x1c-\x1f\x85\ufeff]/,rs={fontVariantNumeric:"tabular-nums"},ss={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function za({text:e,testId:t,slot:n}){if(T(),e===null)return(0,Xt.jsx)(j,{value:null,testId:t});if(!jt.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,Xt.jsx)("span",{"data-cui-migration":"pending","data-measured":"true","data-testid":t,style:n,children:e})}function Jt({text:e,testId:t}){return(0,Xt.jsx)(za,{text:e,testId:t,slot:rs})}function He({text:e,testId:t}){return(0,Xt.jsx)(za,{text:e,testId:t,slot:ss})}var Ye=require("@aiquants/enrichment-core"),et={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"}},xn={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"}},hn={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},Wa="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Ot(e){return(0,Ye.isUnknownTerm)(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===Ye.RUN_TERMINAL_STEP_KEY?Wa:Ye.PIPELINE_STEPS[e].label}function ta(e){return(0,Ye.isUnknownTerm)(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:Ye.DOCUMENT_KIND_LABELS[e]}var na={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"},aa="\u672A\u5B8C\u4E86";function it(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var Ya={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)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function ra(e){let t=(0,Ye.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`${Ye.PIPELINE_STEPS[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return Ya[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";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}var Xa=require("@aiquants/console-ui/core");function ja(e,t){return(0,Xa.formatInstant)(e,Vt,t)}var sa=require("react/jsx-runtime");function ge({iso:e,testId:t}){let{timeZone:n}=T();return(0,sa.jsx)(He,{text:e===null?null:ja(e,n),testId:t})}function Ct({iso:e,testId:t}){return T(),e===null?aa:(0,sa.jsx)(ge,{iso:e,testId:t})}var Ee=require("react/jsx-runtime"),os="document-changes";function is({host:e,onOpen:t}){let{labels:n}=T(),a=(0,oa.useRef)(null),o=(0,oa.useRef)(null),r=un(os,{first:O=>e.loadChanges(null,O).then(P=>(0,Qt.mapOutcome)(P,p=>({rows:p.rows,next:p.next,meta:null}))),next:(O,P)=>e.loadChanges(O,P).then(p=>(!p.ok&&p.status===Qt.HTTP_FORBIDDEN&&r.reload(),(0,Qt.mapOutcome)(p,D=>({rows:D.rows,next:D.next}))))},0),u=Ze(()=>a.current),l=r.state.kind==="ready"?r.state.refreshFailure:null,i=Mt(l);return(0,Ee.jsx)(dt,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:a,testId:"change-feed",children:(()=>{if(r.state.kind==="failed")return(0,Ee.jsx)(vt,{failure:r.state,onReload:r.reload,forbiddenMessage:st,failureMessage:ot("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:u,testId:"change-feed-failed"});if(r.state.kind!=="ready")return(0,Ee.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:O}=r.state,P=O.rows.map((p,D)=>({row:p,position:D}));return(0,Ee.jsxs)(Ee.Fragment,{children:[l!==null&&(0,Ee.jsx)(ze,{occurrence:i,testId:"change-feed-refresh-failed",children:Yt(n,l,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),(0,Ee.jsx)(Lt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:_t(qa)},align:"start",cell:({row:p,position:D})=>(0,Ee.jsx)(ge,{iso:p.kind==="readable"?p.item.settledAt:p.settledAt,testId:`change-feed-time-value-${D}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Be},align:"start",cell:({row:p})=>p.kind==="readable"?(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("span",{children:p.item.fileName})," ",(0,Ee.jsx)("span",{children:p.item.fileUri})]}):(0,Ee.jsx)("span",{"data-restricted-mark":"change",children:Rt})},{key:"revision",header:"\u7248",width:{fixedPx:_t("r00000 \u2192 r00000")},align:"start",cell:({row:p})=>p.kind==="readable"?gn(p.item.previousRevision,p.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:It(Object.values(Et))},align:"start",cell:({row:p})=>p.kind==="readable"?Et[p.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Be},align:"start",cell:({row:p})=>p.kind==="readable"?p.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Be},align:"start",cell:({row:p,position:D})=>p.kind==="readable"?p.item.changes.map(K=>(0,Ee.jsx)(Ge,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${D}-${K.facet}`,children:Wt(K)},K.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:bn("\u958B\u304F")},align:"start",cell:({row:p})=>p.kind==="readable"?(0,Ee.jsxs)(Ne,{variant:"secondary",onClick:()=>t(p.item.metadataId,p.item.stateId),testId:`change-feed-open-${p.item.stateId}`,children:["\u958B\u304F ",(0,Ee.jsx)(Da,{testId:`change-feed-open-name-${p.item.stateId}`,children:`${p.item.fileName} ${gn(p.item.previousRevision,p.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:P,rowKey:({row:p,position:D})=>Ka(p,D),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,Ee.jsx)(ln,{onLoad:r.loadMore,busy:O.loadingMore||r.state.refreshing,done:O.next===null,failure:O.moreFailure,limit:Ja.DOCUMENT_CHANGE_FEED_PAGE_SIZE,rows:{count:P.length,ref:o},testId:"change-feed-more"})]})})()})}var Ft=require("@aiquants/console-ui/core"),ie=require("react");var cr=require("@aiquants/console-ui/core"),ur=require("@aiquants/enrichment-core"),tt=require("react");var rr=require("react");var da=require("@aiquants/console-ui/core"),vn=require("@aiquants/enrichment-core"),Pe=require("react");var v=require("react/jsx-runtime"),la="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",Za={context:"",removed:"\u2212",added:"+"},er={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function ia(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function ds(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function ls(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function cs(e){let t=[],n=0;for(let a=1;a<=e.length;a++)(a===e.length||e[a].page!==e[n].page)&&(t.push(...us(e.slice(n,a).map(({line:o})=>o))),n=a);return t}function us(e){let t=[],n=[],a=[],o=()=>{for(let r=0;r<Math.max(n.length,a.length);r++)t.push({left:n[r]??null,right:a[r]??null});n=[],a=[]};for(let r of e)r.kind==="context"?(o(),t.push({left:r,right:r})):r.kind==="removed"?(a.length>0&&o(),n.push(r)):a.push(r);return o(),t}function tr(e){return e.segments.map((t,n)=>{let a=`${n}`;return t.kind==="removed"?(0,v.jsx)("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},a):t.kind==="added"?(0,v.jsx)("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},a):(0,v.jsx)("span",{children:t.text},a)})}function Qa(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?"":Za[e.kind]}),(0,v.jsx)("td",{style:er,"data-line-text":t,children:e===null?null:tr(e)})]})}function ps({states:e,target:t,hunk:n,layout:a,tableLabel:o,readLines:r,rescueTarget:u,onLines:l,testId:i}){let x={...e,...t,hunk:n},O=JSON.stringify([e.fromStateId,e.toStateId,t,n]),P=un(O,{first:N=>r({...x,offset:0,limit:vn.DIFF_LINE_PAGE_MAX},N).then(F=>(0,da.mapOutcome)(F,W=>({rows:W.lines.map(Q=>({line:Q,page:0})),next:W.next,meta:null}))),next:(N,F)=>r({...x,offset:N,limit:vn.DIFF_LINE_PAGE_MAX},F).then(W=>(0,da.mapOutcome)(W,Q=>({rows:Q.lines.map(ue=>({line:ue,page:N})),next:Q.next})))},0),p=Ze(u),D=(0,Pe.useRef)(null),K=P.state.kind==="ready"?P.state.value.rows:null;if((0,Pe.useEffect)(()=>{K!==null&&l(ls(K))},[K,l]),P.state.kind==="failed")return(0,v.jsx)(vt,{failure:P.state,onReload:P.reload,forbiddenMessage:st,failureMessage:ot("\u5DEE\u5206\u306E\u884C"),rescueRef:p,testId:`${i}-failed`});if(P.state.kind!=="ready")return(0,v.jsx)("p",{"aria-busy":"true","data-testid":`${i}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:m}=P.state,R=a==="split"?cs(m.rows):null;return(0,v.jsxs)("div",{"data-testid":i,"data-layout":a,children:[(0,v.jsxs)("table",{"aria-label":o,"data-testid":`${i}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[(0,v.jsx)("thead",{children:a==="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:D,children:R===null?m.rows.map(({line:N},F)=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":N.kind,children:[(0,v.jsx)("td",{"data-line-number":"old",children:N.oldNumber}),(0,v.jsx)("td",{"data-line-number":"new",children:N.newNumber}),(0,v.jsx)("td",{"data-line-sign":!0,children:Za[N.kind]}),(0,v.jsx)("td",{style:er,"data-line-text":"unified",children:tr(N)})]},F)):R.map(N=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":N.left===N.right?"context":"changed",children:[Qa(N.left,"old"),Qa(N.right,"new")]},`${N.left?.oldNumber??""}:${N.right?.newNumber??""}`))})]}),(0,v.jsx)(ln,{onLoad:P.loadMore,busy:m.loadingMore||P.state.refreshing,done:m.next===null,failure:m.moreFailure,limit:vn.DIFF_LINE_PAGE_MAX,rows:{count:R===null?m.rows.length:R.length,ref:D},testId:`${i}-more`})]})}function ms(){let[e,t]=(0,Pe.useState)(null);return[(0,Pe.useCallback)((a=>{let o=new ResizeObserver(r=>{for(let u of r)t(u.contentRect.width)});return o.observe(a),()=>o.disconnect()}),[]),e]}function Sn({states:e,target:t,index:n,readLines:a,label:o,rescueTarget:r,onNarrowChange:u,testId:l}){T();let i=(0,Pe.useId)(),[x,O]=(0,Pe.useState)("split"),[P,p]=(0,Pe.useState)(()=>new Set(n===null?[0]:[])),[D,K]=(0,Pe.useState)(0),[m,R]=ms(),N=(0,Pe.useRef)(new Map),F=(0,Pe.useCallback)(k=>K(Z=>Math.max(Z,k)),[]),W=Ga(Math.max(n===null?0:ds(n.hunks),D)),Q=R!==null&&R>=W,ue=x==="split"&&Q?"split":"unified",te=x==="split"&&R!==null&&!Q;(0,Pe.useEffect)(()=>{u(i,te)},[i,te,u]),(0,Pe.useEffect)(()=>()=>u(i,!1),[i,u]);let q=(k,Z)=>p(Y=>{let _e=new Set(Y);return Z?_e.add(k):_e.delete(k),_e}),de=k=>`${i}-hunk-${k}`,Se=(k,Z)=>(0,v.jsx)(ps,{states:e,target:t,hunk:k,layout:ue,tableLabel:Z,readLines:a,rescueTarget:()=>N.current.get(k)??r(),onLines:F,testId:`${l}-hunk-${k}-body`});return(0,v.jsxs)("div",{"data-cui-migration":"pending",ref:m,"data-testid":l,"data-layout":ue,"data-split-min-px":W,children:[n!==null&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("dl",{"data-testid":`${l}-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)(j,{value:n.stats.linesAdded,testId:`${l}-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)(j,{value:n.stats.linesRemoved,testId:`${l}-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)(j,{value:n.stats.linesUnchanged,testId:`${l}-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)(j,{value:n.stats.charsAdded,testId:`${l}-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)(j,{value:n.stats.charsRemoved,testId:`${l}-chars-removed`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u985E\u4F3C\u5EA6"}),(0,v.jsx)("dd",{children:(0,v.jsx)(He,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,testId:`${l}-similarity`})})]})]}),n.attributes.length>0&&(0,v.jsx)("ul",{"data-testid":`${l}-attributes`,children:n.attributes.map(k=>(0,v.jsxs)("li",{"data-field":k.field,children:[At(k.field)," ",pt(k.before)," \u2192 ",pt(k.after)]},k.field))}),n.hunks.length>0&&(0,v.jsx)("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${l}-hunk-index`,children:n.hunks.map(k=>(0,v.jsx)("li",{children:(0,v.jsx)("a",{href:`#${de(k.hunk)}`,onClick:()=>q(k.hunk,!0),"data-hunk":k.hunk,children:ia(k)})},k.hunk))})]}),(0,v.jsx)(Ne,{variant:"secondary",onClick:()=>O(x==="split"?"unified":"split"),dataAttributes:{"data-preferred":x},testId:`${l}-layout-toggle`,children:x==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),te&&(0,v.jsx)("p",{"data-testid":`${l}-narrow`,children:la}),n===null?Se(0,o):n.hunks.map(k=>{let Z=P.has(k.hunk);return(0,v.jsxs)("div",{id:de(k.hunk),"data-testid":`${l}-hunk-${k.hunk}`,"data-open":Z,children:[(0,v.jsx)(Ne,{variant:"secondary",expanded:Z,controls:`${de(k.hunk)}-body`,onClick:()=>q(k.hunk,!Z),ref:Y=>{Y===null?N.current.delete(k.hunk):N.current.set(k.hunk,Y)},testId:`${l}-hunk-${k.hunk}-toggle`,children:ia(k)}),(0,v.jsx)("div",{id:`${de(k.hunk)}-body`,children:Z&&Se(k.hunk,`${o} ${ia(k)}`)})]},k.hunk)})]})}var Me=require("react/jsx-runtime");function fs(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(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function nr(e){return e.new??e.old}function ar(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function sr({states:e,stats:t,entries:n,textUnchangedChunkingChanged:a,readLines:o,rescueTarget:r,onNarrowChange:u,testId:l}){T();let[i,x]=(0,rr.useState)(()=>new Set),O=p=>x(D=>{let K=new Set(D);return K.delete(p)||K.add(p),K}),P=p=>{let D=[p.old===null?null:["\u65E7",p.old],p.new===null?null:["\u65B0",p.new]].filter(m=>m!==null),K=new Set(D.flatMap(([,m])=>m.fidelity==="UNVERIFIED"?[qn]:m.fidelity==="WHITESPACE_NORMALIZED"?[Gn]:[]));return(0,Me.jsxs)(Me.Fragment,{children:[D.map(([m,R])=>(0,Me.jsxs)("span",{"data-fidelity":R.fidelity,"data-side":m,children:[m," ",Vn[R.fidelity]," "]},m)),[...K].map(m=>(0,Me.jsx)("span",{"data-chunk-note":!0,children:m},m))]})};return(0,Me.jsxs)("div",{"data-testid":l,children:[a&&(0,Me.jsx)(qe,{tone:"info",testId:`${l}-chunking-only`,children:zn}),(0,Me.jsxs)("p",{"data-testid":`${l}-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,Me.jsx)(Lt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:It(Object.values(fn))},align:"start",cell:p=>fn[p.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Be},align:"start",cell:p=>fs(nr(p))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Be},align:"start",cell:p=>nr(p).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:_t("#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:Be},align:"start",cell:P},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:bn("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:p=>ar(p)?(0,Me.jsx)(Ne,{variant:"secondary",expanded:i.has(p.entry),controls:`${l}-diff-${p.entry}`,onClick:()=>O(p.entry),testId:`${l}-diff-toggle-${p.entry}`,children:i.has(p.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:n,rowKey:p=>`${p.entry}`,rowTestId:`${l}-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:`${l}-table`}),n.filter(p=>ar(p)&&i.has(p.entry)).map(p=>{let D=`\u30C1\u30E3\u30F3\u30AF #${p.old?.index} \u2192 #${p.new?.index} \u306E\u5DEE\u5206`;return(0,Me.jsx)("section",{id:`${l}-diff-${p.entry}`,"aria-label":D,"data-testid":`${l}-diff-${p.entry}`,children:(0,Me.jsx)(Sn,{states:e,target:{facet:"chunks",entry:p.entry},index:null,readLines:o,label:D,rescueTarget:r,onNarrowChange:u,testId:`${l}-diff-${p.entry}-view`})},p.entry)})]})}var Nn=require("@aiquants/enrichment-core"),or=require("react");var ca=require("react/jsx-runtime");function ys(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:a})=>({path:n,label:(0,Nn.treePathLabel)(n),item:a})).sort((n,a)=>(0,Nn.compareTreePaths)(n.path,a.path))}function En({items:e,renderItem:t,testId:n}){T();let a=(0,or.useMemo)(()=>ys(e),[e]);return(0,ca.jsx)("ol",{role:"list","data-testid":n,children:a.map(({path:o,label:r,item:u})=>(0,ca.jsx)("li",{"data-testid":`${n}-item-${o}`,children:t(u,r,o)},o))})}var J=require("react/jsx-runtime"),gs={fontSize:`${mt}px`,fontWeight:cr.TOKENS.weight.bold},ir={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},dr={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},bs=It(Object.values(qt));function xs(e,t,n){let a=o=>Object.fromEntries(t.map(r=>[r.field,u=>(0,J.jsx)("span",{"data-testid":`${n}-${r.field}-${o}-${u}`,children:pt(r[o])})]));return(0,J.jsx)(dn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(o=>({key:o.field,label:At(o.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:a("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:a("after")}],attributePx:bs,columnMinPx:Be,testId:n})}function Zt(e,t,n){return t.length===0?null:(0,J.jsxs)("div",{"data-testid":n,children:[(0,J.jsxs)("p",{children:[e," (",t.length,")"]}),(0,J.jsx)("ul",{children:t.map(([a,o])=>(0,J.jsx)("li",{children:o},a))})]})}function ua(e,t,n){return t.length===0?null:(0,J.jsxs)("div",{"data-testid":n,children:[(0,J.jsxs)("p",{children:[e," (",t.length,")"]}),(0,J.jsx)(En,{items:t,renderItem:(a,o)=>`${o}: ${a}`,testId:`${n}-tree`})]})}var pa=e=>JSON.stringify(e.value),pr=e=>e.fields.map(t=>`${At(t.field)} ${pt(t.before)} \u2192 ${pt(t.after)}`).join("\u3001"),lr=e=>[e.key,`${e.key}: ${pa(e)}`],hs=e=>[e.key,`${e.key}: ${pr(e)}`];function vs({diff:e,testId:t}){let n=(0,tt.useMemo)(()=>({added:e.added.map(a=>({path:a.key,item:pa(a)})),removed:e.removed.map(a=>({path:a.key,item:pa(a)})),modified:e.modified.map(a=>({path:a.key,item:pr(a)}))}),[e]);return(0,J.jsxs)(J.Fragment,{children:[ua("\u8FFD\u52A0",n.added,`${t}-added`),ua("\u524A\u9664",n.removed,`${t}-removed`),ua("\u5909\u66F4",n.modified,`${t}-modified`)]})}function mr({states:e,comparison:t,readLines:n,rescueTarget:a,testId:o}){let{announce:r}=T(),u=(0,tt.useId)(),[l,i]=(0,tt.useState)(()=>new Set),x=(0,tt.useCallback)((m,R)=>i(N=>{if(N.has(m)===R)return N;let F=new Set(N);return R?F.add(m):F.delete(m),F}),[]),O=l.size>0;(0,tt.useEffect)(()=>{O&&r(la)},[O,r]);let P=t.facets.filter(m=>m.change==="CHANGED"),p=ur.DOCUMENT_FACETS.filter(m=>!P.some(R=>R.facet===m)),D=m=>`${u}-${m}`,K=m=>{let R=`${o}-${m.facet}`;switch(m.facet){case"classification":case"metadata":return xs(ut[m.facet],m.fields,`${R}-grid`);case"labels":return(0,J.jsxs)(J.Fragment,{children:[Zt("\u8FFD\u52A0",m.added.map(lr),`${R}-added`),Zt("\u524A\u9664",m.removed.map(lr),`${R}-removed`),Zt("\u5909\u66F4",m.modified.map(hs),`${R}-modified`)]});case"assets":return(0,J.jsx)(vs,{diff:m,testId:R});case"tags":return(0,J.jsxs)(J.Fragment,{children:[Zt("\u8FFD\u52A0",m.added.map(N=>[N,N]),`${R}-added`),Zt("\u524A\u9664",m.removed.map(N=>[N,N]),`${R}-removed`)]});case"structured_data":return(0,J.jsx)(Lt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:It(Object.values(dr))},align:"start",cell:({operation:N})=>dr[N.op]},{key:"path",header:"\u9053",width:{minPx:Be},align:"start",cell:({operation:N})=>N.path===""?"(\u6839)":N.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Be},align:"start",cell:({operation:N})=>N.op==="add"?null:(0,J.jsx)("pre",{style:ir,children:JSON.stringify(N.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Be},align:"start",cell:({operation:N})=>N.op==="remove"?null:(0,J.jsx)("pre",{style:ir,children:JSON.stringify(N.value,null,2)})}],rows:m.operations.map((N,F)=>({operation:N,position:F})),rowKey:({position:N})=>`${N}`,rowTestId:`${R}-operation`,rowData:({operation:N})=>({"data-op":N.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${R}-operations`});case"text":case"summary":return(0,J.jsx)(Sn,{states:e,target:{facet:m.facet},index:m,readLines:n,label:ut[m.facet],rescueTarget:a,onNarrowChange:x,testId:`${R}-diff`});case"chunks":return(0,J.jsx)(sr,{states:e,stats:m.stats,entries:m.entries,textUnchangedChunkingChanged:m.textUnchangedChunkingChanged,readLines:n,rescueTarget:a,onNarrowChange:x,testId:`${R}-table`})}};return(0,J.jsxs)("div",{"data-cui-migration":"pending","data-testid":o,children:[P.length>0&&(0,J.jsx)("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${o}-nav`,children:(0,J.jsx)("ul",{children:P.map(m=>(0,J.jsx)("li",{children:(0,J.jsx)("a",{href:`#${D(m.facet)}`,"data-facet":m.facet,children:ut[m.facet]})},m.facet))})}),P.map(m=>(0,J.jsxs)("section",{id:D(m.facet),"aria-labelledby":`${D(m.facet)}-heading`,"data-testid":`${o}-${m.facet}`,"data-facet":m.facet,children:[(0,J.jsx)("h4",{id:`${D(m.facet)}-heading`,style:gs,children:ut[m.facet]}),K(m)]},m.facet)),p.length>0&&(0,J.jsxs)("p",{"data-testid":`${o}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",p.map(m=>ut[m]).join("\u30FB")]})]})}var je=require("@aiquants/enrichment-core"),fr=require("react");var M=require("react/jsx-runtime"),Ss=8,Ns={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Es={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"},yr={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Rs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],_s=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Is="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)",Cs={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function gr(e){return Object.hasOwn(yr,e)}function en(e,t){return`run-step-provenance-value-${e}-${t}`}function ks(e,t,n){if(gr(t)){let o=e[t];return o===null?null:(0,M.jsx)(j,{value:o,unit:yr[t],testId:en(n,t)})}let a=e[t];return a===null?null:(0,M.jsx)(Jt,{text:String(a),testId:en(n,t)})}function Ts(e,t){let n=Rs.map(r=>({key:r,label:Es[r],value:ks(e,r,t),breaks:gr(r)?"atomic":"anywhere"})),a=e.pages_read!==null||e.pages_total!==null,o=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(j,{value:e.pages_read,testId:en(t,"pages_read")})," / ",(0,M.jsx)(j,{value:e.pages_total,testId:en(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:a?o:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:(0,M.jsx)(Jt,{text:Ns[e.body_source],testId:en(t,"body_source")}),breaks:"anywhere"}]}function ws(e,t){let n=new Map,a=[];for(let r of t){if(r.targetTreePath===null){a.push(r);continue}let u=n.get(r.targetTreePath);u===void 0?n.set(r.targetTreePath,[r]):u.push(r)}let o=Array.from(n,([r,u])=>({path:r,item:u}));return{kind:"fan_out",stepKey:e,steps:t,placed:o,pathless:a}}function Ps(e){let t=[],n=new Map;for(let a of[...e.steps].sort((o,r)=>o.sequence-r.sequence)){let o=a.stepKey;if(o===je.RUN_TERMINAL_STEP_KEY||(0,je.isUnknownTerm)(o)||je.PIPELINE_STEPS[o].fanOut!=="children"||a.targetMetadataId===e.metadataId){t.push({kind:"step",step:a});continue}let r=n.get(o);if(r!==void 0){r.push(a);continue}let u=[a];n.set(o,u),t.push({kind:"fan_out",stepKey:o,steps:u})}return t.map(a=>a.kind==="step"?a:ws(a.stepKey,a.steps))}function Ls(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 $s({step:e}){let{labels:t}=T();if(e.status==="SKIPPED")return(0,M.jsxs)("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",ra(Ls(e))]});if(e.stepKey===je.RUN_TERMINAL_STEP_KEY&&e.status==="SUCCEEDED"){let{outcome:u}=je.RunTerminalStepDetailSchema.parse(e.provenance?.detail);return(0,M.jsx)("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":u,children:na[u]})}if(e.provenance===null)return(0,M.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 n=e.provenance,a=Ts(n,e.sequence),o=a.filter(u=>u.value!==null),r=a.filter(u=>u.value===null);return(0,M.jsxs)(M.Fragment,{children:[o.length>0&&(0,M.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(u=>(0,M.jsxs)("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[(0,M.jsx)("dt",{className:"text-slate-500",children:u.label}),(0,M.jsx)("dd",{className:`text-slate-800 ${Cs[u.breaks]}`,"data-provenance-key":u.key,children:u.value})]},u.key))}),r.length>0&&(0,M.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",r.map(u=>u.label).join("\u3001")]}),Object.keys(n.detail).length>0&&(0,M.jsxs)("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[(0,M.jsx)("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),(0,M.jsx)("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function ma(e,t,n,a,o){let r=xn[e.status],u=o==="tree"?"div":"li",l=o==="alert"?{"data-cui-surface":"surface","data-cui-fg":"fg"}:void 0;return(0,M.jsx)(u,{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":(0,je.storedTermText)(e.stepKey),...l,children:(0,M.jsxs)("details",{open:a,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[(0,M.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,M.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),(0,M.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&(0,M.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,M.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),(0,M.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:(0,M.jsx)(j,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),(0,M.jsxs)("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&(0,M.jsx)("div",{className:"h-2 rounded-full bg-slate-100",children:(0,M.jsx)("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&(0,M.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,M.jsx)($s,{step:e})]})]})},e.id)}var Ds=`${Is}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function As({steps:e,longestDuration:t,opensEverything:n,testId:a}){let o=Mt(e);return(0,M.jsx)(ze,{occurrence:o,testId:a,children:(0,M.jsxs)("div",{className:"space-y-3",children:[(0,M.jsx)("p",{"data-testid":`${a}-reason`,children:Ds}),(0,M.jsx)("ol",{role:"list","data-testid":`${a}-list`,children:e.map(r=>ma(r,(0,M.jsx)("span",{"data-testid":`run-step-target-${r.sequence}`,children:`#${r.id} \u2192 #${r.targetMetadataId}`}),t,r.status==="FAILED"||n,"alert"))})]})})}function br({run:e}){T();let t=e.steps.reduce((o,r)=>r.durationMs===null?o:Math.max(o,r.durationMs),0),n=e.steps.length<=Ss,a=(0,fr.useMemo)(()=>Ps(e),[e]);return(0,M.jsx)("ol",{"data-cui-migration":"pending",className:"space-y-3","data-testid":"run-steps",children:a.map(o=>{if(o.kind==="step"){let l=o.step,i=(0,M.jsxs)(M.Fragment,{children:[Ot(l.stepKey),l.targetMetadataId!==e.metadataId&&(0,M.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 ma(l,i,t,l.status==="FAILED"||n,"timeline")}let r=o.steps.some(l=>l.status==="FAILED"),u=_s.map(l=>({status:l,count:o.steps.filter(i=>i.status===l).length})).filter(({count:l})=>l>0);return(0,M.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${o.stepKey}`,"data-count":o.steps.length,children:(0,M.jsxs)("details",{open:r||o.pathless.length>0||n,className:"group/fanout","data-testid":`run-step-group-card-${o.stepKey}`,children:[(0,M.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,M.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),(0,M.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:Ot(o.stepKey)}),(0,M.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-${o.stepKey}`,children:["\u5BFE\u8C61 ",o.steps.length," \u4EF6"]}),(0,M.jsx)("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${o.stepKey}`,children:u.map(({status:l,count:i})=>`${xn[l].label} ${i}`).join(" \xB7 ")})]}),(0,M.jsxs)("div",{className:"space-y-3 px-4 pb-4 [&_li+li]:mt-3 [&_li>div+div]:mt-3",children:[o.pathless.length>0&&(0,M.jsx)(As,{steps:o.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${o.stepKey}`}),o.placed.length>0&&(0,M.jsx)(En,{items:o.placed,renderItem:(l,i)=>l.map(x=>ma(x,(0,M.jsx)("span",{"data-testid":`run-step-target-${x.sequence}`,children:`${i} (#${x.targetMetadataId})`}),t,x.status==="FAILED"||n,"tree")),testId:`run-step-tree-${o.steps[0].sequence}`})]})]})},`group-${o.stepKey}`)})})}var d=require("react/jsx-runtime"),Ms={fontSize:`${Ft.TOKENS.type.title.size}px`,fontWeight:Ft.TOKENS.weight.bold},Os={fontSize:`${mt}px`,fontWeight:Ft.TOKENS.weight.bold},fa={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function xr({host:e,fromStateId:t,toStateId:n,rescueTarget:a}){let o={fromStateId:t,toStateId:n},r=Fn(`${t}:${n}`,l=>e.compare(o,l),0),u=Ze(a);return r.state.kind==="failed"?(0,d.jsx)(vt,{failure:r.state,onReload:r.reload,forbiddenMessage:st,failureMessage:ot("\u6BD4\u8F03"),rescueRef:u,testId:"history-comparison-failed"}):r.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)(mr,{states:o,comparison:r.state.value,readLines:e.readLines,rescueTarget:a,testId:"history-change"})}function ya(e,t,n){let a=Fa(e,t);return[e.runOutcome==="FAILED"?(0,d.jsx)("span",{"data-testid":`${n}-failed-run`,"data-state-mark":"failed_run",children:Xn},"failed"):null,a.length>0?(0,d.jsx)("span",{"data-testid":`${n}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:Jn(a)},"unrecorded"):null,e.modelOnlyChange?(0,d.jsx)("span",{"data-testid":`${n}-model-only`,"data-state-mark":"model_only",children:jn},"model"):null].filter(o=>o!==null)}function Fs(e,t){return e.changes===null?null:(0,d.jsx)("span",{"data-testid":`${t}-badges`,children:e.changes.map(n=>(0,d.jsx)(Ge,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:Wt(n)},n.facet))})}function Us({pinned:e,shown:t,onPin:n,onUnpin:a,fallback:o}){let r=(0,ie.useRef)(null),u=(0,ie.useRef)(null),l=Ze(()=>u.current??r.current??o()),i=(0,ie.useCallback)(P=>(p=>{P.current=p;let D=l(p);return()=>{P.current=null,D()}}),[l]),[x]=(0,ie.useState)(()=>i(r)),[O]=(0,ie.useState)(()=>i(u));return e!==null?(0,d.jsxs)("p",{"data-testid":"history-pin",children:[(0,d.jsx)(Ge,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",We(e.revision)," ",(0,d.jsx)(ge,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",(0,d.jsx)(Ne,{variant:"secondary",onClick:a,ref:O,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:(0,d.jsx)("p",{"data-testid":"history-pin",children:(0,d.jsx)(Ne,{variant:"secondary",onClick:()=>n(t.stateId),ref:x,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function Ks({host:e,metadataId:t,target:n,openRequest:a,onClose:o,returnFocusFallback:r,captureState:u}){let{labels:l,announce:i}=T(),x=(0,ie.useId)(),O=(0,ie.useId)(),P=(0,ie.useId)(),p=(0,ie.useRef)(null),D=(0,ie.useRef)(null),K=(0,ie.useRef)(null),m=(0,ie.useRef)(null),R=(0,ie.useRef)(null),N=(0,ie.useRef)(null),F=(0,ie.useRef)(r),W=(0,ie.useRef)(0),[Q,ue]=(0,ie.useState)(null),[te,q]=(0,ie.useState)(null),[de,Se]=(0,ie.useState)({metadataId:t,groups:{}});de.metadataId!==t&&Se({metadataId:t,groups:{}});let[k,Z]=(0,ie.useState)(null),Y=Fn(t,b=>e.loadHistory(t,b),a),_e=Ze(()=>D.current),Xe=Ze(()=>D.current),De=Y.state.kind==="ready"?Y.state.refreshFailure:null,Ie=Mt(De),$e=Y.state.kind==="ready"&&Y.state.refreshing,le=Y.state.kind==="ready"?Y.state.value:null,E=le===null?null:Oa(le),X=Q!==null&&Q.request===a?Q.key:E===null?null:Ua(n,E),B=E?.groups.flatMap(b=>b.items).find(b=>b.key===X),se=B===void 0||$e?null:`revision:${B.kind==="run"?B.run.revision:B.state.revision}`,ve=Ze(()=>X===null?D.current:K.current);(0,ie.useEffect)(()=>{F.current=r},[r]),(0,ie.useEffect)(()=>{if(R.current!==a){R.current=a,N.current=null;let b=document.activeElement;p.current?.contains(b)!==!0&&(m.current=(b instanceof HTMLElement||b instanceof SVGElement)&&b!==document.body?b:null),D.current?.focus();return}X!==null&&X===N.current&&(N.current=null,K.current?.focus())},[a,X]),(0,ie.useEffect)(()=>{se!==null&&Se(b=>b.groups[se]===!0?b:{metadataId:b.metadataId,groups:{...b.groups,[se]:!0}})},[se,a]),(0,ie.useEffect)(()=>()=>{R.current=null,W.current+=1;let b=m.current;if(b?.isConnected){b.focus();return}F.current()?.focus()},[]);let oe=b=>{b.key==="Escape"&&(b.stopPropagation(),o())},Fe=b=>{if(b===X){K.current?.focus();return}N.current=b,ue({request:a,key:b})},f=b=>{W.current+=1;let w=W.current,U=k?.metadataId===t?k.failure:null;Z({metadataId:t,busy:!0,failure:U}),b(t).then(z=>{if(W.current===w){if(z.ok){Z({metadataId:t,busy:!1,failure:null}),i(z.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),Y.refresh();return}Z({metadataId:t,busy:!1,failure:{status:z.status,reason:z.reason,occurrence:(U?.occurrence??0)+1}})}})},H=()=>{if(Y.state.kind==="failed")return(0,d.jsx)(vt,{failure:Y.state,onReload:Y.reload,forbiddenMessage:st,failureMessage:ot("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:_e,testId:"history-failed"});if(le===null||E===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 b=E.states,w=E.runs[0],U=u!==void 0&&w!==void 0&&!b.some(V=>V.runId===w.id),z=k?.metadataId===t?k:null,ye=b[0];return(0,d.jsxs)("div",{ref:Xe,"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:le.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:We(le.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:le.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:E.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:ye===void 0?"\u8A18\u9332\u306A\u3057":(0,d.jsx)(ge,{iso:ye.settledAt,testId:"history-document-last-change-value"})})]})]}),De!==null&&(0,d.jsx)(ze,{occurrence:Ie,testId:"history-refresh-failed",children:Yt(l,De,"\u6587\u66F8\u306E\u5C65\u6B74")}),U&&(0,d.jsx)("p",{"data-testid":"history-capture",children:(0,d.jsx)(Ne,{variant:"primary",busy:z?.busy===!0,busyLabel:l.loading,onClick:()=>f(u),ref:ve,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),z!==null&&z.failure!==null&&(0,d.jsx)(ze,{occurrence:z.failure.occurrence,testId:"history-capture-failed",children:l.failureSentence(z.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",V=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${(0,Ft.reasonAside)(V)}\u3002`)}),b.length===0&&E.runs.length===0&&E.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)(on,{master:Ue(E),detail:Ke(E),masterMinPx:Ha,detailMinPx:Va,testId:"history-master-detail"})]})},pe=de.groups,me=(b,w)=>pe[b]??w,Ce=(b,w)=>Se({metadataId:t,groups:{...pe,[b]:!me(b,w)}}),Ve=te!==null&&te.request===a?te.stateId:null,Ue=b=>(0,d.jsxs)("div",{"data-testid":"history-timeline",children:[b.marks.length>0&&(0,d.jsxs)("div",{"data-testid":"history-restricted-group",children:[(0,d.jsxs)(Ne,{variant:"secondary",expanded:me("restricted",!1),controls:`${O}-restricted`,onClick:()=>Ce("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",b.marks.length," \u4EF6)"]}),(0,d.jsx)("ul",{role:"list",id:`${O}-restricted`,hidden:!me("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:b.marks.map(({key:w,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:Wn})," ",(0,d.jsx)(ge,{iso:U.settledAt,testId:`history-${w}-settled-at-value`})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:zt})," ",(0,d.jsx)(Ge,{tone:fa[U.status],variant:"tint",testId:`history-${w}-status`,children:et[U.status].label})," ",(0,d.jsx)(ge,{iso:U.startedAt,testId:`history-${w}-started-at-value`})," \u301C ",(0,d.jsx)(Ct,{iso:U.finishedAt,testId:`history-${w}-finished-at-value`})]})},w))})]}),b.groups.map(w=>{let U=`revision:${w.revision}`,z=me(U,w.isCurrent),ye=`${We(w.revision)}${w.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return(0,d.jsxs)("div",{"data-testid":"history-revision-group","data-revision":w.revision,"data-current":w.isCurrent,children:[(0,d.jsx)(Ne,{variant:"secondary",expanded:z,controls:`${O}-${U}`,onClick:()=>Ce(U,w.isCurrent),testId:`history-revision-toggle-${w.revision}`,children:`${ye} \u2014 ${w.items.length} \u4EF6`}),(0,d.jsx)("div",{id:`${O}-${U}`,hidden:!z,children:(0,d.jsx)(cn,{label:ye,items:w.items,itemKey:V=>V.key,selectedKey:X,onSelect:V=>Fe(V.key),detailId:O,renderRow:V=>nt(V,b),rowTestId:"history-item",rowData:V=>({"data-item-key":V.key,"data-pinned":V.state!==null&&V.state.stateId===Ve}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${w.revision}`})})]},U)})]}),nt=(b,w)=>{let U=b.state,z=`history-row-${b.key}`,ye=U===null?[]:ya(U,w,z);return(0,d.jsxs)(d.Fragment,{children:[b.kind==="run"?(0,d.jsxs)("span",{children:["\u5B9F\u884C #",b.run.id," \xB7 ",hn[b.run.trigger]," ",(0,d.jsx)(Ge,{tone:fa[it(b.run)],variant:"tint",testId:`${z}-status`,children:et[it(b.run)].label})]}):(0,d.jsx)("span",{children:Et[b.state.cause]}),(0,d.jsx)("span",{children:(0,d.jsx)(ge,{iso:b.time,testId:`${z}-time-value`})}),U!==null&&Fs(U,z),b.kind==="run"&&Zn(b.run)&&(0,d.jsx)("span",{"data-testid":`${z}-unrecorded`,children:yn}),ye,U!==null&&U.stateId===Ve&&(0,d.jsx)(Ge,{tone:"info",variant:"tint",testId:`${z}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},ke=(b,w)=>{let U=w.states.find(he=>he.stateId===Ve)??null,z=(0,d.jsx)(Us,{pinned:U,shown:b,onPin:he=>q({request:a,stateId:he}),onUnpin:()=>q(null),fallback:()=>K.current});if(b===null)return z;let ye=()=>K.current,V;if(U!==null&&U.stateId!==b.stateId){let[he,Tt]=w.states.indexOf(U)>w.states.indexOf(b)?[U,b]:[b,U];V=(0,d.jsx)(xr,{host:e,fromStateId:he.stateId,toStateId:Tt.stateId,rescueTarget:ye})}else b.previousStateId===null?V=(0,d.jsx)("p",{"data-testid":"history-no-previous",children:Yn}):V=(0,d.jsx)(xr,{host:e,fromStateId:b.previousStateId,toStateId:b.stateId,rescueTarget:ye});return(0,d.jsxs)(d.Fragment,{children:[z,V]})},at=b=>{if(B===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let w=B.state,U=b.states.find(z=>z.stateId===Ve);if(U!==void 0&&w!==null&&U.stateId!==w.stateId){let[z,ye]=b.states.indexOf(U)>b.states.indexOf(w)?[U,w]:[w,U];return`\u6BD4\u8F03: ${We(z.revision)} \u2192 ${We(ye.revision)}`}return B.kind==="run"?`${We(B.run.revision)} \u306E\u5B9F\u884C #${B.run.id}`:`${We(B.state.revision)} \u306E\u5909\u5316`},Ae=b=>{if(X===null)return b.groups.some(ye=>ye.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(B===void 0&&$e)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(B===void 0)return(0,d.jsxs)("p",{role:"status","data-testid":"history-selection-missing",children:[X.startsWith("run:")?`\u5B9F\u884C #${X.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(B.kind==="state"){let{state:ye}=B;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:Et[ye.cause]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6642\u523B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(ge,{iso:ye.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:ye.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:ye.classification.confidentialityLevel})]})]}),ya(ye,b,"history-detail"),ke(ye,b)]})}let{run:w,state:U}=B,z=it(w);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("dl",{"data-testid":"history-run-summary","data-run-id":w.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":w.trigger,children:hn[w.trigger]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u8A66\u884C"}),(0,d.jsx)("dd",{"data-testid":"history-run-attempt",children:w.attempt})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u72B6\u614B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(Ge,{tone:fa[z],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":w.status,"data-presentation":z},children:et[z].label})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u7A2E\u985E"}),(0,d.jsx)("dd",{"data-testid":"history-run-kind",children:ta(w.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:w.requestedBy})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u958B\u59CB"}),(0,d.jsx)("dd",{children:(0,d.jsx)(ge,{iso:w.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)(Ct,{iso:w.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:w.jobId})]})]}),w.errorMessage!==null&&(0,d.jsx)("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:w.errorMessage}),Zn(w)&&(0,d.jsx)("p",{"data-testid":"history-run-unrecorded",children:yn}),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"}):ya(U,b,"history-detail"),ke(U,b),(0,d.jsxs)("details",{"data-testid":"history-run-steps",children:[(0,d.jsx)("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),(0,d.jsx)(br,{run:w})]})]})},Ke=b=>(0,d.jsxs)("section",{id:O,"aria-labelledby":P,"data-testid":"history-detail","data-selected-key":X??"",children:[(0,d.jsx)("h3",{ref:K,id:P,tabIndex:-1,style:Os,"data-testid":"history-detail-heading",children:at(b)}),Ae(b)]});return(0,d.jsxs)("section",{"data-cui-migration":"pending",ref:p,role:"dialog","aria-labelledby":x,onKeyDown:oe,"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:D,id:x,tabIndex:-1,style:Ms,"data-testid":"history-heading",children:le===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${le.document.fileName}`}),(0,d.jsx)(Ne,{variant:"secondary",onClick:o,testId:"history-close",children:l.close})]}),H()]})}var be=require("@aiquants/enrichment-core"),ne=require("react");var ga=require("@aiquants/console-ui/core");function ft(e,t,n){try{(0,ga.formatCount)(e,n)}catch(a){throw new RangeError(`${t}: ${a.message}`,{cause:a})}return e}function Rn(e,t,n){return(0,ga.formatCount)(ft(e,t,n),n)}var vr=1024,Bs=[{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 hr(e,t){return Number((e/vr**t.power).toFixed(t.fractionDigits))}function _n(e,t,n){ft(e,t,n);let[a,...o]=Bs,r=a,u=hr(e,r);for(let l of o){if(u<vr)break;r=l,u=hr(e,r)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:r.fractionDigits,maximumFractionDigits:r.fractionDigits,useGrouping:!0}).format(u)} ${r.name}`}var s=require("react/jsx-runtime"),Nr="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",Hs=new Set(be.EnrichmentSyncStatusSchema.options.filter(e=>e.startsWith("FAILED"))),Vs=new Set(be.EnrichmentSyncStatusSchema.options);function Er(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Hs.has(e.syncStatus)?{kind:"retry"}:Vs.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Sr(e,t,n){let a=e?.find(o=>o.confidentialityLevel===t&&o.capability===n);return a?a.isEnabled:null}var Gs={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"},qs=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function zs(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ba({field:e}){return(0,s.jsx)("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Ws({policies:e,tenantId:t,sources:n,domainOptions:a,recentItems:o=[],inspectionResult:r=null,isSubmitting:u=!1,isInspecting:l=!1,isBusy:i=!1,promotingId:x=null,onInspectUri:O,onIngestDocument:P,onRetryItem:p,onShowHistory:D,onPromoteUnlockedCopy:K,listRefusal:m}){let{formatLocale:R}=T(),N=Dt(),F=(0,ne.useRef)(new Map),W=(0,ne.useRef)(null),Q=(0,ne.useId)(),ue=(0,ne.useId)(),te=(0,ne.useId)(),q=(0,ne.useId)(),de=(0,ne.useId)(),Se=(0,ne.useId)(),k=(0,ne.useId)(),Z=(0,ne.useId)(),[Y,_e]=(0,ne.useState)(null),[Xe,De]=(0,ne.useState)(""),[Ie,$e]=(0,ne.useState)(""),[le,E]=(0,ne.useState)("CONFIDENTIAL"),[X,B]=(0,ne.useState)(null),[se,ve]=(0,ne.useState)(""),[oe,Fe]=(0,ne.useState)(""),[f,H]=(0,ne.useState)([]),[pe,me]=(0,ne.useState)(""),[Ce,Ve]=(0,ne.useState)("user"),[Ue,nt]=(0,ne.useState)(1),[ke,at]=(0,ne.useState)(!1),Ae=X!==null&&a.some(c=>c.key===X)?X:a.length>0?a[0].key:null,Ke=Y===null?void 0:n.find(c=>c.uri_prefix===Y),b=Ke!==void 0?Ke:n.length>0?n[0]:null,w=(0,ne.useMemo)(()=>({vectorEnabled:Sr(e,le,"vector_indexing"),graphEnabled:Sr(e,le,"graph_indexing")}),[e,le]),U=(0,ne.useMemo)(()=>{let c=Ie.trim();if(!c||n.length===0)return{valid:!1,error:null};let _=(0,be.sourceOfUri)(n,c);if(_===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(Qe=>Qe.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let S=c.slice(_.uri_prefix.length);return S.trim()?c.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"}:(0,be.identifierMatches)(_,S)?{valid:!0,error:null}:{valid:!1,error:`${zs(_.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${_.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[Ie,n]),z=c=>{if(_e(c),Xe.trim()){let _=Xe.trim(),S=(0,be.sourceOfUri)(n,_),Qe=S===void 0?_:_.slice(S.uri_prefix.length);$e(`${c}${Qe}`)}else $e("")},ye=c=>{let _=c.trim();if(!_){De(""),$e("");return}let S=(0,be.pastedIdentifier)(n,_);if(S!==void 0){_e(S.source.uri_prefix),De(S.identifier),$e(`${S.source.uri_prefix}${S.identifier}`);return}let Qe=(0,be.sourceOfUri)(n,_);if(Qe!==void 0){_e(Qe.uri_prefix),De(_.slice(Qe.uri_prefix.length)),$e(_);return}if(_.includes("://")){De(c),$e(_);return}De(c),$e(b===null?_:`${b.uri_prefix}${_}`)},V=()=>{let c=pe.trim();c&&(f.some(_=>_.labelKey===c)||(H(_=>[..._,{labelKey:c,category:Ce,confidenceScore:Number(Ue.toFixed(2))}]),me("")))},he=c=>{f.some(_=>_.labelKey===c)||H(_=>[..._,{labelKey:c,category:"domain",confidenceScore:1}])},Tt=c=>{H(_=>_.filter(S=>S.labelKey!==c))},Bt=c=>{if(c.preventDefault(),!U.valid||Ae===null)return;let _={fileUri:Ie.trim(),confidentialityLevel:le,targetDomainKey:Ae,departmentId:se.trim()?Number(se):null,titleOverride:oe.trim()?oe.trim():null,labels:f};P?.(_)};(0,ne.useLayoutEffect)(()=>{let c=W.current;if(c===null)return;let _=o.find(S=>S.kind==="readable"&&S.item.id===c)?.item;_?.unlock?.disposition==="copy_promoted"&&(W.current=null,document.activeElement===document.body&&F.current.get(c)?.focus(),N(`${_.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[o,N]);let Ln=c=>{let _=c.unlock;if(_===null)return null;let S=_.disposition==="copy_original"&&_.copyReason!==null&&(0,be.isPromotable)(_.copyReason)&&c.isCurrent!==!1,Qe=x===c.id,wa=Qe?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return(0,s.jsxs)("div",{ref:Pa=>{Pa===null?F.current.delete(c.id):F.current.set(c.id,Pa)},tabIndex:-1,className:"mt-1 max-w-xs space-y-1 text-[11px] text-slate-700","data-testid":`ingest-unlock-${c.id}`,"data-disposition":_.disposition,"data-protection":_.protectionScheme,children:[(0,s.jsxs)("div",{children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",be.PROTECTION_SCHEME_LABELS[_.protectionScheme]]}),(0,s.jsxs)("div",{"data-testid":`ingest-unlock-disposition-${c.id}`,children:[be.UNLOCK_DISPOSITION_LABELS[_.disposition],_.copyReason!==null&&` (${be.COPY_REASON_LABELS[_.copyReason]})`]}),S&&K!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>{W.current=c.id,K(c.id)},disabled:i,"aria-busy":Qe,"aria-label":`${c.fileName} \u306E${wa}`,className:"min-h-11 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 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":`ingest-promote-button-${c.id}`,children:wa})]})},g=c=>{let _=Er(c);if(_.kind==="blocked")return(0,s.jsx)("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${c.id}`,"data-reason":_.reason,children:_.reason});let S=_.kind==="retry";return(0,s.jsx)("button",{type:"button",onClick:()=>p?.(c.id),disabled:i,"aria-label":`${c.fileName} \u3092${S?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:S?"min-h-11 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 disabled:cursor-not-allowed":"min-h-11 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 disabled:cursor-not-allowed","data-testid":`ingest-${_.kind}-button-${c.id}`,children:S?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},Re=c=>{switch(c){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 c.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: ",c]}):(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:c})}};return(0,s.jsxs)("div",{"data-cui-migration":"pending",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:Bt,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:Q,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)(ba,{field:"uri"})]}),b!==null&&(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:b.uri_prefix})]})]}),b===null&&(0,s.jsx)(qe,{tone:"warning",testId:"ingest-no-sources",children:"\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002"}),(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:"}),n.map(c=>(0,s.jsx)("button",{type:"button",onClick:()=>z(c.uri_prefix),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${b?.uri_prefix===c.uri_prefix?"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-${c.scheme}`,children:`${c.scheme}:// (${c.title.ja})`},c.scheme))]}),(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 ${U.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:b?.uri_prefix}),(0,s.jsx)("input",{id:Q,type:"text",value:Xe,onChange:c=>ye(c.target.value),placeholder:b?.input_hint.ja,disabled:b===null,"aria-invalid":!!U.error,"aria-describedby":U.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:()=>O?.(Ie.trim()),disabled:!U.valid||l||i,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,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[b!==null&&(0,s.jsx)("p",{className:"text-slate-500",children:b.guidance.ja}),Ie&&(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:Ie})]})]})]}),U.error&&(0,s.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:U.error})]}),r&&r.fileUri===Ie.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 ${r.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold",children:r.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),(0,s.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.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:r.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)(He,{text:_n(r.fileSize,"fileSize",R),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:r.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:r.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:ue,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,s.jsx)(ba,{field:"confidentiality"})]}),(0,s.jsx)("select",{id:ue,value:le,onChange:c=>E(c.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:be.ConfidentialityLevelSchema.options.map(c=>(0,s.jsxs)("option",{value:c,children:[c," (",Gs[c],")"]},c))})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:te,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,s.jsx)(ba,{field:"domain"})]}),(0,s.jsx)("select",{id:te,value:Ae===null?"":Ae,onChange:c=>B(c.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(c=>(0,s.jsx)("option",{value:c.key,children:c.label},c.key))}),a.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"})]})]}),le===be.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"})," ",be.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":w.vectorEnabled===null?"unknown":String(w.vectorEnabled),children:w.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":w.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${le} \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":w.graphEnabled===null?"unknown":String(w.graphEnabled),children:w.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":w.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${le} \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:[f.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:"}),qs.map(c=>(0,s.jsxs)("button",{type:"button",onClick:()=>he(c),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-${c}`,children:["+ ",c]},c))]}),(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:Se,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,s.jsx)("input",{id:Se,type:"text",value:pe,onChange:c=>me(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),V())},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:k,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,s.jsxs)("select",{id:k,value:Ce,onChange:c=>Ve(c.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:Z,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Ue.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:Z,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Ue,"aria-valuenow":Ue,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Ue*100)}%`,onChange:c=>nt(Number.parseFloat(c.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:V,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"})})]}),f.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:f.map(c=>(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-${c.labelKey}`,children:[(0,s.jsx)("span",{className:"font-semibold",children:c.labelKey}),(0,s.jsxs)("span",{className:"text-indigo-400",children:["(",c.category,")"]}),(0,s.jsx)("button",{type:"button",onClick:()=>Tt(c.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${c.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${c.labelKey}`,children:"\xD7"})]},c.labelKey))})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":ke,"aria-controls":"advanced-settings-panel",onClick:()=>at(c=>!c),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:[ke?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),ke&&(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:de,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:de,type:"text",value:oe,onChange:c=>Fe(c.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:q,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,s.jsx)("input",{id:q,type:"number",value:se,onChange:c=>ve(c.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:!U.valid||Ae===null||u||l||i,"aria-busy":u,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:u?(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"})]})}),m!==void 0?(0,s.jsx)(qe,{tone:"warning",testId:"recent-items-refused",children:m}):o.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:o.map((c,_)=>{if(c.kind==="restricted")return(0,s.jsxs)("tr",{"data-testid":`recent-item-restricted-${_}`,"data-restricted-mark":"ingest",children:[(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${_}`,children:Rt}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${_}`,children:c.syncStatus===null?(0,s.jsx)("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:Nr}):Re(c.syncStatus)}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${_}`,children:(0,s.jsx)(ge,{iso:c.createdAt,testId:`recent-item-restricted-created-at-value-${_}`})}),(0,s.jsx)("td",{className:"px-3 py-2"})]},`restricted:${_}`);let S=c.item;return(0,s.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${S.id}`,children:[(0,s.jsx)("td",{className:"px-3 py-2 font-bold",children:S.id}),(0,s.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:S.fileUri,children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:S.fileName}),(0,s.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:S.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:S.confidentialityLevel})}),(0,s.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",S.revision,S.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-${S.id}`,children:"\u65E7\u7248"})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans",children:[Re(S.syncStatus),S.errorMessage!==null&&S.errorMessage!==void 0&&S.errorMessage!==""&&(0,s.jsx)("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${S.id}`,title:S.errorMessage,children:S.errorMessage}),Ln(S)]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${S.id}`,children:[S.lastRun===null?(0,s.jsx)("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${S.id}`,children:"\u8A18\u9332\u306A\u3057"}):S.lastRun.kind==="restricted"?(0,s.jsxs)("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${S.id}`,"data-restricted-mark":"run",children:[(0,s.jsx)("div",{className:"text-[11px] text-slate-600",children:zt}),(0,s.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${et[S.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${S.id}`,"data-status":S.lastRun.status,children:et[S.lastRun.status].label}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${S.id}`,children:(0,s.jsx)(Ct,{iso:S.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${S.id}`})})]}):(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] ${et[it(S.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${S.id}`,"data-status":S.lastRun.item.status,"data-presentation":it(S.lastRun.item),children:et[it(S.lastRun.item)].label}),S.lastRun.item.failedStepKey!==null&&(0,s.jsx)("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${S.id}`,children:Ot(S.lastRun.item.failedStepKey)}),S.lastRun.item.failedStepKey==="unlock_document"&&(0,s.jsx)("div",{className:"max-w-xs text-[11px] text-slate-700","data-testid":`ingest-unlock-hint-${S.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${S.id}`,children:(0,s.jsx)(Ct,{iso:S.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${S.id}`})})]}),D!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>D(S.id),"aria-label":`${S.fileName} \u306E\u5C65\u6B74`,className:"mt-1 min-h-11 rounded-sm border border-slate-300 border-solid bg-white px-2 py-0.5 font-semibold text-[11px] text-slate-700 hover:bg-slate-50","data-testid":`ingest-history-button-${S.id}`,children:"\u5C65\u6B74"})]}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${S.id}`,children:(0,s.jsx)(ge,{iso:S.createdAt,testId:`ingest-created-at-value-${S.id}`})}),(0,s.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:g(S)})]},`readable:${S.id}`)})})]})})]})]})}var In=require("@aiquants/enrichment-core"),ee=require("react/jsx-runtime"),_r="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",Rr={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 xa(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Ys({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:a=!1}){let o=n===void 0;return(0,ee.jsxs)("div",{"data-cui-migration":"pending","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,ee.jsxs)("div",{children:[(0,ee.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,ee.jsxs)("p",{className:"text-slate-500 text-xs",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \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,ee.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 ",In.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),(0,ee.jsx)("p",{"data-testid":"strategy-inert-note",className:"mt-1 text-slate-500 text-xs",children:_r}),o&&(0,ee.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,ee.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,ee.jsx)("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:(0,ee.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,ee.jsx)("thead",{children:(0,ee.jsxs)("tr",{children:[(0,ee.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"}),In.ENRICHMENT_STAGES.map(r=>{let u=xa(r.featureFlagKey,t);return(0,ee.jsxs)("th",{scope:"col","data-inert":String(!r.readByPipeline),className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[(0,ee.jsx)("div",{children:r.label}),(0,ee.jsx)("div",{"data-testid":`strategy-gate-${r.key}`,"data-gate":u,className:"mt-0.5 font-normal text-[10px]",style:{color:Rr[u].color},children:Rr[u].label}),!r.readByPipeline&&(0,ee.jsx)("div",{"data-testid":`strategy-inert-${r.key}`,className:"mt-0.5 font-normal text-[10px] text-slate-500",children:"\u4ECA\u306F\u52B9\u304B\u306A\u3044"})]},r.key)})]})}),(0,ee.jsx)("tbody",{children:e.map(r=>(0,ee.jsxs)("tr",{"data-testid":`strategy-row-${r.domainKey}`,"data-provenance":r.provenance,"data-active":String(r.isActive),children:[(0,ee.jsxs)("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[(0,ee.jsx)("div",{className:"font-semibold text-slate-900",children:r.domainLabel}),(0,ee.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,ee.jsx)("code",{children:r.domainKey})," / ",r.strategyName]}),(0,ee.jsx)("div",{"data-testid":`strategy-provenance-${r.domainKey}`,className:"text-[10px] text-slate-500",children:r.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"}),!r.isActive&&(0,ee.jsx)("div",{"data-testid":`strategy-inactive-${r.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"})]}),In.ENRICHMENT_STAGES.map(u=>{let l=r.stages[u.key],i=xa(u.featureFlagKey,t),x=!u.readByPipeline;return(0,ee.jsxs)("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[(0,ee.jsx)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":x?`${r.domainLabel} \u306E ${u.label} (\u4ECA\u306F\u52B9\u304B\u306A\u3044)`:`${r.domainLabel} \u306E ${u.label}`,"data-testid":`strategy-stage-${r.domainKey}-${u.key}`,"data-enabled":String(l),"data-effective":String(!x&&l&&(i==="open"||i==="absent")),"data-inert":String(x),disabled:o||a,onClick:()=>n?.(r,u.key,!l),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${l?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${o||a?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:l?"\u958B":"\u9589"}),!x&&l&&i==="unmeasured"&&(0,ee.jsx)("div",{"data-testid":`strategy-unmeasured-${r.domainKey}-${u.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"}),!x&&l&&i==="closed"&&(0,ee.jsx)("div",{"data-testid":`strategy-blocked-${r.domainKey}-${u.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"})]},u.key)})]},`${r.domainKey}:${r.strategyName}`))})]})})]})}var Ut={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Kt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};var I=require("react/jsx-runtime"),Xs={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"},Ir=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],js=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),Cn={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 Cr(e){return e.kind==="text"?"anywhere":"atomic"}function Tr(e,t){return t===null?{kind:"unmeasured"}:js.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 Js(e){let t=Ir.filter(a=>a in e),n=Object.keys(e).filter(a=>!Ir.includes(a)).sort();return[...t,...n].map(a=>({key:a,label:Xs[a]??a,value:Tr(a,e[a])}))}function kr(e,t){switch(e.kind){case"count":return(0,I.jsx)(j,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return(0,I.jsx)(He,{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,I.jsx)(He,{text:String(e.value),testId:t});case"word":return(0,I.jsx)(He,{text:e.text,testId:t});case"text":return(0,I.jsx)(Jt,{text:e.text,testId:t})}}function Qs({health:e,isRefreshing:t=!1,onRefresh:n,className:a=""}){let{services:o,allHealthy:r,checkedAt:u}=e;T();let l=[{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,I.jsxs)("section",{"data-cui-migration":"pending",className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${a}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(r),children:[(0,I.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[(0,I.jsxs)("div",{className:"flex items-center gap-3",children:[(0,I.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,I.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,I.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,I.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,I.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,I.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,I.jsxs)("div",{children:[(0,I.jsx)("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,I.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",(0,I.jsx)("span",{"data-testid":"health-checked-at",children:(0,I.jsx)(ge,{iso:u,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,I.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,I.jsx)("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...Kt[r?"connected":"error"],"data-testid":"health-overall-status-badge",children:r?(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,I.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,I.jsxs)("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ut.connected]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,I.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,I.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,I.jsxs)("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ut.error]})]})}),n&&(0,I.jsxs)("button",{type:"button",onClick:n,disabled:t,"data-testid":"health-refresh-button",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-solid bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[(0,I.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,I.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,I.jsx)("path",{d:"M3 3v5h5"}),(0,I.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,I.jsx)("path",{d:"M16 21h5v-5"})]}),(0,I.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,I.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:l.map(({key:i,data:x,title:O,subtitle:P})=>{let p=Tr("version",x.version),D=Cn[Cr(p)],K=kr(p,`service-version-value-${i}`);return(0,I.jsxs)("div",{"data-testid":`service-card-${i}`,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,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[(0,I.jsx)("span",{className:"font-semibold text-sm",children:O}),(0,I.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]",...Kt[x.status],"data-testid":`service-status-${i}`,children:[(0,I.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${i}`}),Ut[x.status]]})]}),(0,I.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:P}),(0,I.jsxs)("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${i}`,children:[(0,I.jsx)("span",{className:D.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,I.jsx)("span",{className:`${D.slot} font-medium text-[11px]`,"data-testid":`service-version-${i}`,children:p.kind==="text"?(0,I.jsx)("code",{className:"font-mono font-semibold",children:K}):K})]}),(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${i}`,children:[(0,I.jsx)("span",{className:Cn.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),(0,I.jsx)("span",{className:`${Cn.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${i}`,children:(0,I.jsx)(j,{value:x.latencyMs,unit:"ms",testId:`health-latency-value-${i}`})})]}),Js(x.details).map(m=>{let R=Cn[Cr(m.value)];return(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${i}-${m.key}`,children:[(0,I.jsxs)("span",{className:R.label,children:[m.label,":"]}),(0,I.jsx)("span",{className:`${R.slot} font-medium text-[11px]`,"data-testid":`health-detail-${i}-${m.key}`,children:kr(m.value,`health-detail-value-${i}-${m.key}`)})]},m.key)})]})]}),(0,I.jsxs)("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[(0,I.jsx)("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${i}`,children:x.endpoint}),x.errorMessage!==void 0&&jt.test(x.errorMessage)&&(0,I.jsx)("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Kt.error,"data-testid":`service-error-${i}`,children:x.errorMessage})]})]},i)})})]})}var fe=require("@aiquants/enrichment-core"),ae=require("react");var h=require("react/jsx-runtime"),Pr=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Lr={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},ha="ALL",tn={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Zs="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",eo=(fe.SEARCH_PARAM_LIMITS.threshold.min+fe.SEARCH_PARAM_LIMITS.threshold.max)/2,to=336,no=544;function ao(e){let t=e.trim().length;return t<fe.SEARCH_PARAM_LIMITS.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>fe.SEARCH_PARAM_LIMITS.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${fe.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function ro(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function wr(e,t){return t.trim().length>fe.SEARCH_PARAM_LIMITS.filterTextLength.max?`${e}\u306F ${fe.SEARCH_PARAM_LIMITS.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function so(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function oo({params:e,answer:t}){let n=t.search_metadata,a=n.executed_tiers,o=r=>r?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${rt[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${rt[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${o(a.lexical)} / \u758E ${o(a.sparse)} / \u5BC6 ${o(a.dense)} / \u30B0\u30E9\u30D5 ${o(a.graph)}`,`\u878D\u5408: ${so(e)}`,`\u54C1\u8CEA: ${wt[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${Pt[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${Pt[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
|
|
1
|
+
"use strict";var $n=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Wr=Object.getOwnPropertyNames;var Yr=Object.prototype.hasOwnProperty;var Xr=(e,t)=>{for(var n in t)$n(e,n,{get:t[n],enumerable:!0})},jr=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wr(t))!Yr.call(e,o)&&o!==n&&$n(e,o,{get:()=>t[o],enumerable:!(a=zr(t,o))||a.enumerable});return e};var Jr=e=>jr($n({},"__esModule",{value:!0}),e);var Do={};Xr(Do,{BREAKER_STATE_LABELS:()=>Pt,CHUNKING_ONLY_NOTE:()=>zn,CHUNK_BODY_FIDELITY_LABELS:()=>Vn,CHUNK_CHANGE_KIND_LABELS:()=>fn,CHUNK_SOURCE_LABELS:()=>Fr,CONFIDENTIALITY_LEVEL_LABELS:()=>Lr,DEGRADATION_REASON_LABELS:()=>Dn,DOCUMENT_STATE_CAUSE_LABELS:()=>Et,DegradedSearchBanner:()=>Hn,DocumentChangeFeed:()=>is,DocumentHistoryInspector:()=>Ks,DocumentIngestConsole:()=>Ws,EnrichmentStrategyBoard:()=>Ys,FACET_LABELS:()=>ut,FAILED_RUN_STATE_MARK:()=>Xn,FIELD_LABELS:()=>qt,FLOW_FOCUS_RING:()=>bt,FLOW_GEOMETRY:()=>Mr,FLOW_NODE_TEXT:()=>kt,FinishedInstant:()=>Ct,GATE_POLICY_LABELS:()=>Ia,GATE_STATE_PRESENTATION:()=>_a,HIDDEN_FIELD_TEXT:()=>xt,HISTORY_REFUSAL:()=>st,INERT_STAGE_NOTE:()=>_r,InfrastructureHealthMonitor:()=>Qs,MODEL_ONLY_CHANGE_MARK:()=>jn,MetadataSearchWorkbench:()=>lo,ModelComparisonWorkbench:()=>uo,NOTHING_TO_READ_LABELS:()=>Ya,NO_ENRICHMENT_RECORD_TEXT:()=>Nr,NO_PREVIOUS_RECORD_TEXT:()=>Yn,OntologyStatusCard:()=>mo,PHASE_LABELS:()=>Na,PIPELINE_RUN_STATUS_PRESENTATION:()=>et,PIPELINE_STEP_STATUS_PRESENTATION:()=>xn,PIPELINE_TRIGGER_LABELS:()=>hn,PipelineFlowViewer:()=>So,QUALITY_TIER_LABELS:()=>wt,QdrantStorageCard:()=>Po,RESTRICTED_DOCUMENT_TEXT:()=>Rt,RESTRICTED_RUN_TEXT:()=>zt,RESTRICTED_STATE_TEXT:()=>Wn,RUN_TERMINAL_STEP_LABEL:()=>Wa,RUN_TERMINAL_STEP_OUTCOME_LABELS:()=>na,RecordedInstant:()=>be,SCORE_DECIMALS:()=>ht,SCORE_DISPLAY_DECIMALS:()=>Dr,SEARCH_FUSION_LABELS:()=>An,SEARCH_MODE_LABELS:()=>rt,SEARCH_PRESETS:()=>Pr,SyncStatusMonitor:()=>$o,UNFINISHED_LABEL:()=>aa,UNRECORDED_RUN_MARK:()=>yn,UNVERIFIED_CHUNK_NOTE:()=>qn,WHITESPACE_NORMALIZED_NOTE:()=>Gn,degradationReasonText:()=>Ht,documentKindLabel:()=>ta,facetCountsText:()=>Wt,fieldLabel:()=>At,gateCaption:()=>Kr,gateState:()=>Ca,gateStateOf:()=>xa,historyFailedSentence:()=>ot,historyFailureSentence:()=>Yt,ingestRowAction:()=>Er,jsonValueText:()=>pt,layoutFlow:()=>Sa,ledgerStepLabel:()=>Ot,pipelineRunPresentationKey:()=>it,rankAgreement:()=>On,revisionLabel:()=>Ye,revisionTransitionText:()=>gn,skipReasonLabel:()=>ra,stepGatePolicy:()=>Ea,stepGateState:()=>Ur,unrecordedRunsMark:()=>Jn,variantHitKey:()=>sn,vectorScoreText:()=>Mn});module.exports=Jr(Do);var xt="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",rt={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\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\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\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\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},An={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},wt={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},Pt={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Dn={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\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"};function Ht(e){return Object.hasOwn(Dn,e)?Dn[e]:e}var ht=3;function Mn(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(ht)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function On(e,t){let n=l=>{let i=new Map;return l.forEach((x,O)=>{i.has(x)||i.set(x,O+1)}),i},a=n(e),o=n(t),r=[...a.keys()].filter(l=>o.has(l)),u=new Set([...a.keys(),...o.keys()]).size;return{sharedCount:r.length,overlapRatio:u===0?null:r.length/u,meanAbsoluteRankDifference:r.length===0?null:r.reduce((l,i)=>l+Math.abs(a.get(i)-o.get(i)),0)/r.length}}function sn(e){return`${e.metadata_id}:${e.chunk_index}`}var $=require("@aiquants/console-ui"),ce=require("react");var Vt="ja-JP";function T(){let e=(0,$.useConsoleUi)();if(e.locale!=="ja"||e.formatLocale!==Vt)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${Vt}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function j(e){return T(),(0,ce.createElement)($.Measured,e)}function $a(e){return T(),(0,ce.createElement)($.RowButton,e)}function on(e){return T(),(0,ce.createElement)($.MasterDetail,e)}function dn(e){return T(),(0,ce.createElement)($.ComparisonGrid,e)}function qe(e){return T(),(0,ce.createElement)($.Pill,e)}function dt(e){return T(),(0,ce.createElement)($.Card,e)}function Ne(e){return T(),(0,ce.createElement)($.Button,e)}function ze(e){return T(),(0,ce.createElement)($.Notice,e)}function We(e){return T(),(0,ce.createElement)($.AlertMessage,e)}function vt(e){return T(),(0,ce.createElement)($.ResourceFailed,e)}function ln(e){return T(),(0,ce.createElement)($.LoadMore,e)}function Da(e){return T(),(0,ce.createElement)($.VisuallyHidden,e)}function Lt(e){return T(),(0,ce.createElement)($.DataTable,e)}function cn(e){return T(),(0,ce.createElement)($.SelectableList,e)}function Fn(e,t,n){return T(),(0,$.useResource)(e,t,n)}function un(e,t,n){return T(),(0,$.usePagedResource)(e,t,n)}function Ze(e){return T(),(0,$.useFocusRescue)(e)}function Un(e){return T(),(0,ce.createElement)($.CardSection,e)}function Kn(e){return T(),(0,ce.createElement)($.CodeBlock,e)}function $t(e){return T(),(0,ce.createElement)($.DescriptionList,e)}function pn(e){return T(),(0,ce.createElement)($.Disclosure,e)}function Bn(e){return T(),(0,ce.createElement)($.Meter,e)}function mn(e){return T(),(0,ce.createElement)($.SegmentedControl,e)}function Gt(e){return T(),(0,ce.createElement)($.Select,e)}function St(e){return T(),(0,ce.createElement)($.Slider,e)}function we(e){return T(),(0,ce.createElement)($.Stack,e)}function lt(e){return T(),(0,ce.createElement)($.Cluster,e)}function G(e){return T(),(0,ce.createElement)($.Text,e)}function Nt(e){return T(),(0,ce.createElement)($.TextInput,e)}function Dt(){return T(),(0,$.useAnnounce)()}var ct=require("react/jsx-runtime");function Hn({metadata:e,testId:t}){if(T(),!e.is_degraded)return null;let n=e.executed_tiers,a=rt[e.requested_mode].label,o=wt[e.quality_tier],u=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${o})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u3001${rt[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${o})\u3002`;return(0,ct.jsx)(ze,{tone:"warning",testId:t,children:(0,ct.jsxs)(we,{gap:"space-2",testId:`${t}-body`,children:[(0,ct.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:u}),e.degradation_reasons.length>0&&(0,ct.jsx)("ul",{"data-testid":`${t}-reasons`,children:e.degradation_reasons.map((l,i)=>(0,ct.jsx)("li",{"data-reason":l,children:(0,ct.jsx)(G,{fg:"fg",type:"prose",testId:`${t}-reason-${i}`,children:Ht(l)})},`${i}-${l}`))})]})})}var Qt=require("@aiquants/console-ui/core"),Ja=require("@aiquants/enrichment-core"),oa=require("react");var Aa=require("@aiquants/console-ui/core"),ut={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"},Et={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"},fn={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Vn={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"},Gn="\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",qn="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",zn="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",qt={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function At(e){return Object.hasOwn(qt,e)?qt[e]:e}var Rt="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Wn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",zt="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",Yn="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Xn="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",yn="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",jn="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Jn(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 Ye(e){return`r${e}`}function gn(e,t){return e===t?`${Ye(t)} (\u540C\u3058\u7248)`:`${Ye(e)} \u2192 ${Ye(t)}`}function Wt(e){let t=ut[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let a=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([o,r])=>o===null||o===0?[]:[`${r}${o}`]);return a.length===0?`${t} \u5909\u66F4`:`${t} ${a.join(" ")}`}function pt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var st="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function Yt(e,t,n){return e.failureSentence(t,st,ot(n))}function ot(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${(0,Aa.reasonAside)(t)}\u3002`}var Qn=require("@aiquants/enrichment-core"),Ma=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Oa(e){let t=e.states.flatMap(i=>i.kind==="readable"?[i.item]:[]),n=e.runs.flatMap(i=>i.kind==="readable"?[i.item]:[]),a=new Set(n.map(i=>i.id)),o=[...n.map(i=>({kind:"run",key:`run:${i.id}`,time:i.startedAt,run:i,state:t.find(x=>x.runId===i.id)??null})),...t.filter(i=>i.runId===null||!a.has(i.runId)).map(i=>({kind:"state",key:`state:${i.stateId}`,time:i.settledAt,state:i}))].sort(Ma),u=[...new Set([...e.revisions.map(i=>i.revision),...o.map(i=>i.kind==="run"?i.run.revision:i.state.revision)])].sort((i,x)=>x-i).map(i=>({revision:i,isCurrent:e.revisions.some(x=>x.revision===i&&x.isCurrent),items:o.filter(x=>(x.kind==="run"?x.run.revision:x.state.revision)===i)})),l=[...e.states.flatMap((i,x)=>i.kind==="restricted"?[{key:`restricted:state:${x}`,time:i.settledAt,mark:i}]:[]),...e.runs.flatMap((i,x)=>i.kind==="restricted"?[{key:`restricted:run:${x}`,time:i.startedAt,mark:i}]:[])].sort(Ma);return{groups:u,marks:l,states:t,runs:n}}function Zn(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Qn.RUN_TERMINAL_STEP_KEY);return t===void 0||t.status==="FAILED"}function Fa(e,t){let n=t.states.find(r=>r.stateId===e.previousStateId);if(n===void 0)return[];let a=Date.parse(n.settledAt),o=Date.parse(e.settledAt);return t.runs.filter(r=>{let u=Date.parse(r.startedAt);return r.status!=="RUNNING"&&r.id!==e.runId&&u>=a&&u<o&&!t.states.some(l=>l.runId===r.id)&&!r.steps.some(l=>l.stepKey===Qn.RUN_TERMINAL_STEP_KEY&&l.status==="SUCCEEDED")}).map(r=>r.id)}function Ua(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(a=>a.stateId===e.stateId);return n!==void 0&&t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function Ka(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}var Ba=require("react");function Mt(e){let[t,n]=(0,Ba.useState)({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}var Pe=require("@aiquants/console-ui/core"),mt=Pe.TOKENS.type.body.size,ea=Pe.TOKENS.space["space-3"],Qr=20,Ha=(0,Pe.ceil8)(mt*(0,Pe.textWidthEm)("\u3042".repeat(Qr))+2*ea),Va=448,Zr=40,es=2,ts="+ ",ns=Pe.TOKENS.space["space-4"];function as(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 Ga(e){let n=(0,Pe.monoTextWidthEm)("0".repeat(as(e)+es))+(0,Pe.monoTextWidthEm)(ts)+(0,Pe.monoTextWidthEm)("0".repeat(Zr));return(0,Pe.ceil8)(mt*2*n+ns)}function _t(e){return(0,Pe.ceil8)(mt*(0,Pe.textWidthEm)(e)+2*ea)}function It(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(_t))}function bn(e){return(0,Pe.ceil8)(mt*(0,Pe.textWidthEm)(e)+4*ea)}var qa="0000/00/00 00:00:00",Be=_t("\u3042".repeat(10));var Xt=require("react/jsx-runtime"),jt=/[^\s\x1c-\x1f\x85\ufeff]/,rs={fontVariantNumeric:"tabular-nums"},ss={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function za({text:e,testId:t,slot:n}){if(T(),e===null)return(0,Xt.jsx)(j,{value:null,testId:t});if(!jt.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,Xt.jsx)("span",{"data-cui-migration":"pending","data-measured":"true","data-testid":t,style:n,children:e})}function Jt({text:e,testId:t}){return(0,Xt.jsx)(za,{text:e,testId:t,slot:rs})}function He({text:e,testId:t}){return(0,Xt.jsx)(za,{text:e,testId:t,slot:ss})}var Xe=require("@aiquants/enrichment-core"),et={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"}},xn={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"}},hn={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},Wa="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Ot(e){return(0,Xe.isUnknownTerm)(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===Xe.RUN_TERMINAL_STEP_KEY?Wa:Xe.PIPELINE_STEPS[e].label}function ta(e){return(0,Xe.isUnknownTerm)(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:Xe.DOCUMENT_KIND_LABELS[e]}var na={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"},aa="\u672A\u5B8C\u4E86";function it(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var Ya={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)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function ra(e){let t=(0,Xe.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`${Xe.PIPELINE_STEPS[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return Ya[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";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}var Xa=require("@aiquants/console-ui/core");function ja(e,t){return(0,Xa.formatInstant)(e,Vt,t)}var sa=require("react/jsx-runtime");function be({iso:e,testId:t}){let{timeZone:n}=T();return(0,sa.jsx)(He,{text:e===null?null:ja(e,n),testId:t})}function Ct({iso:e,testId:t}){return T(),e===null?aa:(0,sa.jsx)(be,{iso:e,testId:t})}var Ee=require("react/jsx-runtime"),os="document-changes";function is({host:e,onOpen:t}){let{labels:n}=T(),a=(0,oa.useRef)(null),o=(0,oa.useRef)(null),r=un(os,{first:O=>e.loadChanges(null,O).then(P=>(0,Qt.mapOutcome)(P,p=>({rows:p.rows,next:p.next,meta:null}))),next:(O,P)=>e.loadChanges(O,P).then(p=>(!p.ok&&p.status===Qt.HTTP_FORBIDDEN&&r.reload(),(0,Qt.mapOutcome)(p,D=>({rows:D.rows,next:D.next}))))},0),u=Ze(()=>a.current),l=r.state.kind==="ready"?r.state.refreshFailure:null,i=Mt(l);return(0,Ee.jsx)(dt,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:a,testId:"change-feed",children:(()=>{if(r.state.kind==="failed")return(0,Ee.jsx)(vt,{failure:r.state,onReload:r.reload,forbiddenMessage:st,failureMessage:ot("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:u,testId:"change-feed-failed"});if(r.state.kind!=="ready")return(0,Ee.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:O}=r.state,P=O.rows.map((p,D)=>({row:p,position:D}));return(0,Ee.jsxs)(Ee.Fragment,{children:[l!==null&&(0,Ee.jsx)(We,{occurrence:i,testId:"change-feed-refresh-failed",children:Yt(n,l,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),(0,Ee.jsx)(Lt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:_t(qa)},align:"start",cell:({row:p,position:D})=>(0,Ee.jsx)(be,{iso:p.kind==="readable"?p.item.settledAt:p.settledAt,testId:`change-feed-time-value-${D}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Be},align:"start",cell:({row:p})=>p.kind==="readable"?(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("span",{children:p.item.fileName})," ",(0,Ee.jsx)("span",{children:p.item.fileUri})]}):(0,Ee.jsx)("span",{"data-restricted-mark":"change",children:Rt})},{key:"revision",header:"\u7248",width:{fixedPx:_t("r00000 \u2192 r00000")},align:"start",cell:({row:p})=>p.kind==="readable"?gn(p.item.previousRevision,p.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:It(Object.values(Et))},align:"start",cell:({row:p})=>p.kind==="readable"?Et[p.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Be},align:"start",cell:({row:p})=>p.kind==="readable"?p.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Be},align:"start",cell:({row:p,position:D})=>p.kind==="readable"?p.item.changes.map(K=>(0,Ee.jsx)(qe,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${D}-${K.facet}`,children:Wt(K)},K.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:bn("\u958B\u304F")},align:"start",cell:({row:p})=>p.kind==="readable"?(0,Ee.jsxs)(Ne,{variant:"secondary",onClick:()=>t(p.item.metadataId,p.item.stateId),testId:`change-feed-open-${p.item.stateId}`,children:["\u958B\u304F ",(0,Ee.jsx)(Da,{testId:`change-feed-open-name-${p.item.stateId}`,children:`${p.item.fileName} ${gn(p.item.previousRevision,p.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:P,rowKey:({row:p,position:D})=>Ka(p,D),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,Ee.jsx)(ln,{onLoad:r.loadMore,busy:O.loadingMore||r.state.refreshing,done:O.next===null,failure:O.moreFailure,limit:Ja.DOCUMENT_CHANGE_FEED_PAGE_SIZE,rows:{count:P.length,ref:o},testId:"change-feed-more"})]})})()})}var Ft=require("@aiquants/console-ui/core"),ie=require("react");var cr=require("@aiquants/console-ui/core"),ur=require("@aiquants/enrichment-core"),tt=require("react");var rr=require("react");var da=require("@aiquants/console-ui/core"),vn=require("@aiquants/enrichment-core"),Le=require("react");var v=require("react/jsx-runtime"),la="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",Za={context:"",removed:"\u2212",added:"+"},er={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function ia(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function ds(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function ls(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function cs(e){let t=[],n=0;for(let a=1;a<=e.length;a++)(a===e.length||e[a].page!==e[n].page)&&(t.push(...us(e.slice(n,a).map(({line:o})=>o))),n=a);return t}function us(e){let t=[],n=[],a=[],o=()=>{for(let r=0;r<Math.max(n.length,a.length);r++)t.push({left:n[r]??null,right:a[r]??null});n=[],a=[]};for(let r of e)r.kind==="context"?(o(),t.push({left:r,right:r})):r.kind==="removed"?(a.length>0&&o(),n.push(r)):a.push(r);return o(),t}function tr(e){return e.segments.map((t,n)=>{let a=`${n}`;return t.kind==="removed"?(0,v.jsx)("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},a):t.kind==="added"?(0,v.jsx)("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},a):(0,v.jsx)("span",{children:t.text},a)})}function Qa(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?"":Za[e.kind]}),(0,v.jsx)("td",{style:er,"data-line-text":t,children:e===null?null:tr(e)})]})}function ps({states:e,target:t,hunk:n,layout:a,tableLabel:o,readLines:r,rescueTarget:u,onLines:l,testId:i}){let x={...e,...t,hunk:n},O=JSON.stringify([e.fromStateId,e.toStateId,t,n]),P=un(O,{first:S=>r({...x,offset:0,limit:vn.DIFF_LINE_PAGE_MAX},S).then(F=>(0,da.mapOutcome)(F,W=>({rows:W.lines.map(Q=>({line:Q,page:0})),next:W.next,meta:null}))),next:(S,F)=>r({...x,offset:S,limit:vn.DIFF_LINE_PAGE_MAX},F).then(W=>(0,da.mapOutcome)(W,Q=>({rows:Q.lines.map(ue=>({line:ue,page:S})),next:Q.next})))},0),p=Ze(u),D=(0,Le.useRef)(null),K=P.state.kind==="ready"?P.state.value.rows:null;if((0,Le.useEffect)(()=>{K!==null&&l(ls(K))},[K,l]),P.state.kind==="failed")return(0,v.jsx)(vt,{failure:P.state,onReload:P.reload,forbiddenMessage:st,failureMessage:ot("\u5DEE\u5206\u306E\u884C"),rescueRef:p,testId:`${i}-failed`});if(P.state.kind!=="ready")return(0,v.jsx)("p",{"aria-busy":"true","data-testid":`${i}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:m}=P.state,_=a==="split"?cs(m.rows):null;return(0,v.jsxs)("div",{"data-testid":i,"data-layout":a,children:[(0,v.jsxs)("table",{"aria-label":o,"data-testid":`${i}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[(0,v.jsx)("thead",{children:a==="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:D,children:_===null?m.rows.map(({line:S},F)=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":S.kind,children:[(0,v.jsx)("td",{"data-line-number":"old",children:S.oldNumber}),(0,v.jsx)("td",{"data-line-number":"new",children:S.newNumber}),(0,v.jsx)("td",{"data-line-sign":!0,children:Za[S.kind]}),(0,v.jsx)("td",{style:er,"data-line-text":"unified",children:tr(S)})]},F)):_.map(S=>(0,v.jsxs)("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":S.left===S.right?"context":"changed",children:[Qa(S.left,"old"),Qa(S.right,"new")]},`${S.left?.oldNumber??""}:${S.right?.newNumber??""}`))})]}),(0,v.jsx)(ln,{onLoad:P.loadMore,busy:m.loadingMore||P.state.refreshing,done:m.next===null,failure:m.moreFailure,limit:vn.DIFF_LINE_PAGE_MAX,rows:{count:_===null?m.rows.length:_.length,ref:D},testId:`${i}-more`})]})}function ms(){let[e,t]=(0,Le.useState)(null);return[(0,Le.useCallback)((a=>{let o=new ResizeObserver(r=>{for(let u of r)t(u.contentRect.width)});return o.observe(a),()=>o.disconnect()}),[]),e]}function Sn({states:e,target:t,index:n,readLines:a,label:o,rescueTarget:r,onNarrowChange:u,testId:l}){T();let i=(0,Le.useId)(),[x,O]=(0,Le.useState)("split"),[P,p]=(0,Le.useState)(()=>new Set(n===null?[0]:[])),[D,K]=(0,Le.useState)(0),[m,_]=ms(),S=(0,Le.useRef)(new Map),F=(0,Le.useCallback)(k=>K(Z=>Math.max(Z,k)),[]),W=Ga(Math.max(n===null?0:ds(n.hunks),D)),Q=_!==null&&_>=W,ue=x==="split"&&Q?"split":"unified",te=x==="split"&&_!==null&&!Q;(0,Le.useEffect)(()=>{u(i,te)},[i,te,u]),(0,Le.useEffect)(()=>()=>u(i,!1),[i,u]);let q=(k,Z)=>p(Y=>{let _e=new Set(Y);return Z?_e.add(k):_e.delete(k),_e}),de=k=>`${i}-hunk-${k}`,Se=(k,Z)=>(0,v.jsx)(ps,{states:e,target:t,hunk:k,layout:ue,tableLabel:Z,readLines:a,rescueTarget:()=>S.current.get(k)??r(),onLines:F,testId:`${l}-hunk-${k}-body`});return(0,v.jsxs)("div",{"data-cui-migration":"pending",ref:m,"data-testid":l,"data-layout":ue,"data-split-min-px":W,children:[n!==null&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("dl",{"data-testid":`${l}-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)(j,{value:n.stats.linesAdded,testId:`${l}-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)(j,{value:n.stats.linesRemoved,testId:`${l}-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)(j,{value:n.stats.linesUnchanged,testId:`${l}-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)(j,{value:n.stats.charsAdded,testId:`${l}-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)(j,{value:n.stats.charsRemoved,testId:`${l}-chars-removed`})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("dt",{children:"\u985E\u4F3C\u5EA6"}),(0,v.jsx)("dd",{children:(0,v.jsx)(He,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,testId:`${l}-similarity`})})]})]}),n.attributes.length>0&&(0,v.jsx)("ul",{"data-testid":`${l}-attributes`,children:n.attributes.map(k=>(0,v.jsxs)("li",{"data-field":k.field,children:[At(k.field)," ",pt(k.before)," \u2192 ",pt(k.after)]},k.field))}),n.hunks.length>0&&(0,v.jsx)("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${l}-hunk-index`,children:n.hunks.map(k=>(0,v.jsx)("li",{children:(0,v.jsx)("a",{href:`#${de(k.hunk)}`,onClick:()=>q(k.hunk,!0),"data-hunk":k.hunk,children:ia(k)})},k.hunk))})]}),(0,v.jsx)(Ne,{variant:"secondary",onClick:()=>O(x==="split"?"unified":"split"),dataAttributes:{"data-preferred":x},testId:`${l}-layout-toggle`,children:x==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),te&&(0,v.jsx)("p",{"data-testid":`${l}-narrow`,children:la}),n===null?Se(0,o):n.hunks.map(k=>{let Z=P.has(k.hunk);return(0,v.jsxs)("div",{id:de(k.hunk),"data-testid":`${l}-hunk-${k.hunk}`,"data-open":Z,children:[(0,v.jsx)(Ne,{variant:"secondary",expanded:Z,controls:`${de(k.hunk)}-body`,onClick:()=>q(k.hunk,!Z),ref:Y=>{Y===null?S.current.delete(k.hunk):S.current.set(k.hunk,Y)},testId:`${l}-hunk-${k.hunk}-toggle`,children:ia(k)}),(0,v.jsx)("div",{id:`${de(k.hunk)}-body`,children:Z&&Se(k.hunk,`${o} ${ia(k)}`)})]},k.hunk)})]})}var Me=require("react/jsx-runtime");function fs(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(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function nr(e){return e.new??e.old}function ar(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function sr({states:e,stats:t,entries:n,textUnchangedChunkingChanged:a,readLines:o,rescueTarget:r,onNarrowChange:u,testId:l}){T();let[i,x]=(0,rr.useState)(()=>new Set),O=p=>x(D=>{let K=new Set(D);return K.delete(p)||K.add(p),K}),P=p=>{let D=[p.old===null?null:["\u65E7",p.old],p.new===null?null:["\u65B0",p.new]].filter(m=>m!==null),K=new Set(D.flatMap(([,m])=>m.fidelity==="UNVERIFIED"?[qn]:m.fidelity==="WHITESPACE_NORMALIZED"?[Gn]:[]));return(0,Me.jsxs)(Me.Fragment,{children:[D.map(([m,_])=>(0,Me.jsxs)("span",{"data-fidelity":_.fidelity,"data-side":m,children:[m," ",Vn[_.fidelity]," "]},m)),[...K].map(m=>(0,Me.jsx)("span",{"data-chunk-note":!0,children:m},m))]})};return(0,Me.jsxs)("div",{"data-testid":l,children:[a&&(0,Me.jsx)(ze,{tone:"info",testId:`${l}-chunking-only`,children:zn}),(0,Me.jsxs)("p",{"data-testid":`${l}-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,Me.jsx)(Lt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:It(Object.values(fn))},align:"start",cell:p=>fn[p.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Be},align:"start",cell:p=>fs(nr(p))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Be},align:"start",cell:p=>nr(p).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:_t("#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:Be},align:"start",cell:P},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:bn("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:p=>ar(p)?(0,Me.jsx)(Ne,{variant:"secondary",expanded:i.has(p.entry),controls:`${l}-diff-${p.entry}`,onClick:()=>O(p.entry),testId:`${l}-diff-toggle-${p.entry}`,children:i.has(p.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:n,rowKey:p=>`${p.entry}`,rowTestId:`${l}-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:`${l}-table`}),n.filter(p=>ar(p)&&i.has(p.entry)).map(p=>{let D=`\u30C1\u30E3\u30F3\u30AF #${p.old?.index} \u2192 #${p.new?.index} \u306E\u5DEE\u5206`;return(0,Me.jsx)("section",{id:`${l}-diff-${p.entry}`,"aria-label":D,"data-testid":`${l}-diff-${p.entry}`,children:(0,Me.jsx)(Sn,{states:e,target:{facet:"chunks",entry:p.entry},index:null,readLines:o,label:D,rescueTarget:r,onNarrowChange:u,testId:`${l}-diff-${p.entry}-view`})},p.entry)})]})}var Nn=require("@aiquants/enrichment-core"),or=require("react");var ca=require("react/jsx-runtime");function ys(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:a})=>({path:n,label:(0,Nn.treePathLabel)(n),item:a})).sort((n,a)=>(0,Nn.compareTreePaths)(n.path,a.path))}function En({items:e,renderItem:t,testId:n}){T();let a=(0,or.useMemo)(()=>ys(e),[e]);return(0,ca.jsx)("ol",{role:"list","data-testid":n,children:a.map(({path:o,label:r,item:u})=>(0,ca.jsx)("li",{"data-testid":`${n}-item-${o}`,children:t(u,r,o)},o))})}var J=require("react/jsx-runtime"),gs={fontSize:`${mt}px`,fontWeight:cr.TOKENS.weight.bold},ir={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},dr={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},bs=It(Object.values(qt));function xs(e,t,n){let a=o=>Object.fromEntries(t.map(r=>[r.field,u=>(0,J.jsx)("span",{"data-testid":`${n}-${r.field}-${o}-${u}`,children:pt(r[o])})]));return(0,J.jsx)(dn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(o=>({key:o.field,label:At(o.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:a("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:a("after")}],attributePx:bs,columnMinPx:Be,testId:n})}function Zt(e,t,n){return t.length===0?null:(0,J.jsxs)("div",{"data-testid":n,children:[(0,J.jsxs)("p",{children:[e," (",t.length,")"]}),(0,J.jsx)("ul",{children:t.map(([a,o])=>(0,J.jsx)("li",{children:o},a))})]})}function ua(e,t,n){return t.length===0?null:(0,J.jsxs)("div",{"data-testid":n,children:[(0,J.jsxs)("p",{children:[e," (",t.length,")"]}),(0,J.jsx)(En,{items:t,renderItem:(a,o)=>`${o}: ${a}`,testId:`${n}-tree`})]})}var pa=e=>JSON.stringify(e.value),pr=e=>e.fields.map(t=>`${At(t.field)} ${pt(t.before)} \u2192 ${pt(t.after)}`).join("\u3001"),lr=e=>[e.key,`${e.key}: ${pa(e)}`],hs=e=>[e.key,`${e.key}: ${pr(e)}`];function vs({diff:e,testId:t}){let n=(0,tt.useMemo)(()=>({added:e.added.map(a=>({path:a.key,item:pa(a)})),removed:e.removed.map(a=>({path:a.key,item:pa(a)})),modified:e.modified.map(a=>({path:a.key,item:pr(a)}))}),[e]);return(0,J.jsxs)(J.Fragment,{children:[ua("\u8FFD\u52A0",n.added,`${t}-added`),ua("\u524A\u9664",n.removed,`${t}-removed`),ua("\u5909\u66F4",n.modified,`${t}-modified`)]})}function mr({states:e,comparison:t,readLines:n,rescueTarget:a,testId:o}){let{announce:r}=T(),u=(0,tt.useId)(),[l,i]=(0,tt.useState)(()=>new Set),x=(0,tt.useCallback)((m,_)=>i(S=>{if(S.has(m)===_)return S;let F=new Set(S);return _?F.add(m):F.delete(m),F}),[]),O=l.size>0;(0,tt.useEffect)(()=>{O&&r(la)},[O,r]);let P=t.facets.filter(m=>m.change==="CHANGED"),p=ur.DOCUMENT_FACETS.filter(m=>!P.some(_=>_.facet===m)),D=m=>`${u}-${m}`,K=m=>{let _=`${o}-${m.facet}`;switch(m.facet){case"classification":case"metadata":return xs(ut[m.facet],m.fields,`${_}-grid`);case"labels":return(0,J.jsxs)(J.Fragment,{children:[Zt("\u8FFD\u52A0",m.added.map(lr),`${_}-added`),Zt("\u524A\u9664",m.removed.map(lr),`${_}-removed`),Zt("\u5909\u66F4",m.modified.map(hs),`${_}-modified`)]});case"assets":return(0,J.jsx)(vs,{diff:m,testId:_});case"tags":return(0,J.jsxs)(J.Fragment,{children:[Zt("\u8FFD\u52A0",m.added.map(S=>[S,S]),`${_}-added`),Zt("\u524A\u9664",m.removed.map(S=>[S,S]),`${_}-removed`)]});case"structured_data":return(0,J.jsx)(Lt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:It(Object.values(dr))},align:"start",cell:({operation:S})=>dr[S.op]},{key:"path",header:"\u9053",width:{minPx:Be},align:"start",cell:({operation:S})=>S.path===""?"(\u6839)":S.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Be},align:"start",cell:({operation:S})=>S.op==="add"?null:(0,J.jsx)("pre",{style:ir,children:JSON.stringify(S.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Be},align:"start",cell:({operation:S})=>S.op==="remove"?null:(0,J.jsx)("pre",{style:ir,children:JSON.stringify(S.value,null,2)})}],rows:m.operations.map((S,F)=>({operation:S,position:F})),rowKey:({position:S})=>`${S}`,rowTestId:`${_}-operation`,rowData:({operation:S})=>({"data-op":S.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${_}-operations`});case"text":case"summary":return(0,J.jsx)(Sn,{states:e,target:{facet:m.facet},index:m,readLines:n,label:ut[m.facet],rescueTarget:a,onNarrowChange:x,testId:`${_}-diff`});case"chunks":return(0,J.jsx)(sr,{states:e,stats:m.stats,entries:m.entries,textUnchangedChunkingChanged:m.textUnchangedChunkingChanged,readLines:n,rescueTarget:a,onNarrowChange:x,testId:`${_}-table`})}};return(0,J.jsxs)("div",{"data-cui-migration":"pending","data-testid":o,children:[P.length>0&&(0,J.jsx)("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${o}-nav`,children:(0,J.jsx)("ul",{children:P.map(m=>(0,J.jsx)("li",{children:(0,J.jsx)("a",{href:`#${D(m.facet)}`,"data-facet":m.facet,children:ut[m.facet]})},m.facet))})}),P.map(m=>(0,J.jsxs)("section",{id:D(m.facet),"aria-labelledby":`${D(m.facet)}-heading`,"data-testid":`${o}-${m.facet}`,"data-facet":m.facet,children:[(0,J.jsx)("h4",{id:`${D(m.facet)}-heading`,style:gs,children:ut[m.facet]}),K(m)]},m.facet)),p.length>0&&(0,J.jsxs)("p",{"data-testid":`${o}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",p.map(m=>ut[m]).join("\u30FB")]})]})}var Je=require("@aiquants/enrichment-core"),fr=require("react");var M=require("react/jsx-runtime"),Ss=8,Ns={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Es={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"},yr={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Rs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],_s=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Is="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)",Cs={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function gr(e){return Object.hasOwn(yr,e)}function en(e,t){return`run-step-provenance-value-${e}-${t}`}function ks(e,t,n){if(gr(t)){let o=e[t];return o===null?null:(0,M.jsx)(j,{value:o,unit:yr[t],testId:en(n,t)})}let a=e[t];return a===null?null:(0,M.jsx)(Jt,{text:String(a),testId:en(n,t)})}function Ts(e,t){let n=Rs.map(r=>({key:r,label:Es[r],value:ks(e,r,t),breaks:gr(r)?"atomic":"anywhere"})),a=e.pages_read!==null||e.pages_total!==null,o=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(j,{value:e.pages_read,testId:en(t,"pages_read")})," / ",(0,M.jsx)(j,{value:e.pages_total,testId:en(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:a?o:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:(0,M.jsx)(Jt,{text:Ns[e.body_source],testId:en(t,"body_source")}),breaks:"anywhere"}]}function ws(e,t){let n=new Map,a=[];for(let r of t){if(r.targetTreePath===null){a.push(r);continue}let u=n.get(r.targetTreePath);u===void 0?n.set(r.targetTreePath,[r]):u.push(r)}let o=Array.from(n,([r,u])=>({path:r,item:u}));return{kind:"fan_out",stepKey:e,steps:t,placed:o,pathless:a}}function Ps(e){let t=[],n=new Map;for(let a of[...e.steps].sort((o,r)=>o.sequence-r.sequence)){let o=a.stepKey;if(o===Je.RUN_TERMINAL_STEP_KEY||(0,Je.isUnknownTerm)(o)||Je.PIPELINE_STEPS[o].fanOut!=="children"||a.targetMetadataId===e.metadataId){t.push({kind:"step",step:a});continue}let r=n.get(o);if(r!==void 0){r.push(a);continue}let u=[a];n.set(o,u),t.push({kind:"fan_out",stepKey:o,steps:u})}return t.map(a=>a.kind==="step"?a:ws(a.stepKey,a.steps))}function Ls(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 $s({step:e}){let{labels:t}=T();if(e.status==="SKIPPED")return(0,M.jsxs)("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",ra(Ls(e))]});if(e.stepKey===Je.RUN_TERMINAL_STEP_KEY&&e.status==="SUCCEEDED"){let{outcome:u}=Je.RunTerminalStepDetailSchema.parse(e.provenance?.detail);return(0,M.jsx)("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":u,children:na[u]})}if(e.provenance===null)return(0,M.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 n=e.provenance,a=Ts(n,e.sequence),o=a.filter(u=>u.value!==null),r=a.filter(u=>u.value===null);return(0,M.jsxs)(M.Fragment,{children:[o.length>0&&(0,M.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(u=>(0,M.jsxs)("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[(0,M.jsx)("dt",{className:"text-slate-500",children:u.label}),(0,M.jsx)("dd",{className:`text-slate-800 ${Cs[u.breaks]}`,"data-provenance-key":u.key,children:u.value})]},u.key))}),r.length>0&&(0,M.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",r.map(u=>u.label).join("\u3001")]}),Object.keys(n.detail).length>0&&(0,M.jsxs)("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[(0,M.jsx)("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),(0,M.jsx)("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function ma(e,t,n,a,o){let r=xn[e.status],u=o==="tree"?"div":"li",l=o==="alert"?{"data-cui-surface":"surface","data-cui-fg":"fg"}:void 0;return(0,M.jsx)(u,{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":(0,Je.storedTermText)(e.stepKey),...l,children:(0,M.jsxs)("details",{open:a,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[(0,M.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,M.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),(0,M.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&(0,M.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,M.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),(0,M.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:(0,M.jsx)(j,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),(0,M.jsxs)("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&(0,M.jsx)("div",{className:"h-2 rounded-full bg-slate-100",children:(0,M.jsx)("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&(0,M.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,M.jsx)($s,{step:e})]})]})},e.id)}var Ds=`${Is}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function As({steps:e,longestDuration:t,opensEverything:n,testId:a}){let o=Mt(e);return(0,M.jsx)(We,{occurrence:o,testId:a,children:(0,M.jsxs)("div",{className:"space-y-3",children:[(0,M.jsx)("p",{"data-testid":`${a}-reason`,children:Ds}),(0,M.jsx)("ol",{role:"list","data-testid":`${a}-list`,children:e.map(r=>ma(r,(0,M.jsx)("span",{"data-testid":`run-step-target-${r.sequence}`,children:`#${r.id} \u2192 #${r.targetMetadataId}`}),t,r.status==="FAILED"||n,"alert"))})]})})}function br({run:e}){T();let t=e.steps.reduce((o,r)=>r.durationMs===null?o:Math.max(o,r.durationMs),0),n=e.steps.length<=Ss,a=(0,fr.useMemo)(()=>Ps(e),[e]);return(0,M.jsx)("ol",{"data-cui-migration":"pending",className:"space-y-3","data-testid":"run-steps",children:a.map(o=>{if(o.kind==="step"){let l=o.step,i=(0,M.jsxs)(M.Fragment,{children:[Ot(l.stepKey),l.targetMetadataId!==e.metadataId&&(0,M.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 ma(l,i,t,l.status==="FAILED"||n,"timeline")}let r=o.steps.some(l=>l.status==="FAILED"),u=_s.map(l=>({status:l,count:o.steps.filter(i=>i.status===l).length})).filter(({count:l})=>l>0);return(0,M.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${o.stepKey}`,"data-count":o.steps.length,children:(0,M.jsxs)("details",{open:r||o.pathless.length>0||n,className:"group/fanout","data-testid":`run-step-group-card-${o.stepKey}`,children:[(0,M.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,M.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),(0,M.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:Ot(o.stepKey)}),(0,M.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-${o.stepKey}`,children:["\u5BFE\u8C61 ",o.steps.length," \u4EF6"]}),(0,M.jsx)("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${o.stepKey}`,children:u.map(({status:l,count:i})=>`${xn[l].label} ${i}`).join(" \xB7 ")})]}),(0,M.jsxs)("div",{className:"space-y-3 px-4 pb-4 [&_li+li]:mt-3 [&_li>div+div]:mt-3",children:[o.pathless.length>0&&(0,M.jsx)(As,{steps:o.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${o.stepKey}`}),o.placed.length>0&&(0,M.jsx)(En,{items:o.placed,renderItem:(l,i)=>l.map(x=>ma(x,(0,M.jsx)("span",{"data-testid":`run-step-target-${x.sequence}`,children:`${i} (#${x.targetMetadataId})`}),t,x.status==="FAILED"||n,"tree")),testId:`run-step-tree-${o.steps[0].sequence}`})]})]})},`group-${o.stepKey}`)})})}var d=require("react/jsx-runtime"),Ms={fontSize:`${Ft.TOKENS.type.title.size}px`,fontWeight:Ft.TOKENS.weight.bold},Os={fontSize:`${mt}px`,fontWeight:Ft.TOKENS.weight.bold},fa={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function xr({host:e,fromStateId:t,toStateId:n,rescueTarget:a}){let o={fromStateId:t,toStateId:n},r=Fn(`${t}:${n}`,l=>e.compare(o,l),0),u=Ze(a);return r.state.kind==="failed"?(0,d.jsx)(vt,{failure:r.state,onReload:r.reload,forbiddenMessage:st,failureMessage:ot("\u6BD4\u8F03"),rescueRef:u,testId:"history-comparison-failed"}):r.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)(mr,{states:o,comparison:r.state.value,readLines:e.readLines,rescueTarget:a,testId:"history-change"})}function ya(e,t,n){let a=Fa(e,t);return[e.runOutcome==="FAILED"?(0,d.jsx)("span",{"data-testid":`${n}-failed-run`,"data-state-mark":"failed_run",children:Xn},"failed"):null,a.length>0?(0,d.jsx)("span",{"data-testid":`${n}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:Jn(a)},"unrecorded"):null,e.modelOnlyChange?(0,d.jsx)("span",{"data-testid":`${n}-model-only`,"data-state-mark":"model_only",children:jn},"model"):null].filter(o=>o!==null)}function Fs(e,t){return e.changes===null?null:(0,d.jsx)("span",{"data-testid":`${t}-badges`,children:e.changes.map(n=>(0,d.jsx)(qe,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:Wt(n)},n.facet))})}function Us({pinned:e,shown:t,onPin:n,onUnpin:a,fallback:o}){let r=(0,ie.useRef)(null),u=(0,ie.useRef)(null),l=Ze(()=>u.current??r.current??o()),i=(0,ie.useCallback)(P=>(p=>{P.current=p;let D=l(p);return()=>{P.current=null,D()}}),[l]),[x]=(0,ie.useState)(()=>i(r)),[O]=(0,ie.useState)(()=>i(u));return e!==null?(0,d.jsxs)("p",{"data-testid":"history-pin",children:[(0,d.jsx)(qe,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",Ye(e.revision)," ",(0,d.jsx)(be,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",(0,d.jsx)(Ne,{variant:"secondary",onClick:a,ref:O,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:(0,d.jsx)("p",{"data-testid":"history-pin",children:(0,d.jsx)(Ne,{variant:"secondary",onClick:()=>n(t.stateId),ref:x,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function Ks({host:e,metadataId:t,target:n,openRequest:a,onClose:o,returnFocusFallback:r,captureState:u}){let{labels:l,announce:i}=T(),x=(0,ie.useId)(),O=(0,ie.useId)(),P=(0,ie.useId)(),p=(0,ie.useRef)(null),D=(0,ie.useRef)(null),K=(0,ie.useRef)(null),m=(0,ie.useRef)(null),_=(0,ie.useRef)(null),S=(0,ie.useRef)(null),F=(0,ie.useRef)(r),W=(0,ie.useRef)(0),[Q,ue]=(0,ie.useState)(null),[te,q]=(0,ie.useState)(null),[de,Se]=(0,ie.useState)({metadataId:t,groups:{}});de.metadataId!==t&&Se({metadataId:t,groups:{}});let[k,Z]=(0,ie.useState)(null),Y=Fn(t,b=>e.loadHistory(t,b),a),_e=Ze(()=>D.current),je=Ze(()=>D.current),De=Y.state.kind==="ready"?Y.state.refreshFailure:null,Ie=Mt(De),Ce=Y.state.kind==="ready"&&Y.state.refreshing,le=Y.state.kind==="ready"?Y.state.value:null,R=le===null?null:Oa(le),X=Q!==null&&Q.request===a?Q.key:R===null?null:Ua(n,R),B=R?.groups.flatMap(b=>b.items).find(b=>b.key===X),se=B===void 0||Ce?null:`revision:${B.kind==="run"?B.run.revision:B.state.revision}`,ve=Ze(()=>X===null?D.current:K.current);(0,ie.useEffect)(()=>{F.current=r},[r]),(0,ie.useEffect)(()=>{if(_.current!==a){_.current=a,S.current=null;let b=document.activeElement;p.current?.contains(b)!==!0&&(m.current=(b instanceof HTMLElement||b instanceof SVGElement)&&b!==document.body?b:null),D.current?.focus();return}X!==null&&X===S.current&&(S.current=null,K.current?.focus())},[a,X]),(0,ie.useEffect)(()=>{se!==null&&Se(b=>b.groups[se]===!0?b:{metadataId:b.metadataId,groups:{...b.groups,[se]:!0}})},[se,a]),(0,ie.useEffect)(()=>()=>{_.current=null,W.current+=1;let b=m.current;if(b?.isConnected){b.focus();return}F.current()?.focus()},[]);let oe=b=>{b.key==="Escape"&&(b.stopPropagation(),o())},Fe=b=>{if(b===X){K.current?.focus();return}S.current=b,ue({request:a,key:b})},f=b=>{W.current+=1;let w=W.current,U=k?.metadataId===t?k.failure:null;Z({metadataId:t,busy:!0,failure:U}),b(t).then(z=>{if(W.current===w){if(z.ok){Z({metadataId:t,busy:!1,failure:null}),i(z.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),Y.refresh();return}Z({metadataId:t,busy:!1,failure:{status:z.status,reason:z.reason,occurrence:(U?.occurrence??0)+1}})}})},H=()=>{if(Y.state.kind==="failed")return(0,d.jsx)(vt,{failure:Y.state,onReload:Y.reload,forbiddenMessage:st,failureMessage:ot("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:_e,testId:"history-failed"});if(le===null||R===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 b=R.states,w=R.runs[0],U=u!==void 0&&w!==void 0&&!b.some(V=>V.runId===w.id),z=k?.metadataId===t?k:null,ye=b[0];return(0,d.jsxs)("div",{ref:je,"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:le.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:Ye(le.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:le.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:R.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:ye===void 0?"\u8A18\u9332\u306A\u3057":(0,d.jsx)(be,{iso:ye.settledAt,testId:"history-document-last-change-value"})})]})]}),De!==null&&(0,d.jsx)(We,{occurrence:Ie,testId:"history-refresh-failed",children:Yt(l,De,"\u6587\u66F8\u306E\u5C65\u6B74")}),U&&(0,d.jsx)("p",{"data-testid":"history-capture",children:(0,d.jsx)(Ne,{variant:"primary",busy:z?.busy===!0,busyLabel:l.loading,onClick:()=>f(u),ref:ve,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),z!==null&&z.failure!==null&&(0,d.jsx)(We,{occurrence:z.failure.occurrence,testId:"history-capture-failed",children:l.failureSentence(z.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",V=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${(0,Ft.reasonAside)(V)}\u3002`)}),b.length===0&&R.runs.length===0&&R.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)(on,{master:Ue(R),detail:Ke(R),masterMinPx:Ha,detailMinPx:Va,testId:"history-master-detail"})]})},pe=de.groups,me=(b,w)=>pe[b]??w,ke=(b,w)=>Se({metadataId:t,groups:{...pe,[b]:!me(b,w)}}),Ve=te!==null&&te.request===a?te.stateId:null,Ue=b=>(0,d.jsxs)("div",{"data-testid":"history-timeline",children:[b.marks.length>0&&(0,d.jsxs)("div",{"data-testid":"history-restricted-group",children:[(0,d.jsxs)(Ne,{variant:"secondary",expanded:me("restricted",!1),controls:`${O}-restricted`,onClick:()=>ke("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",b.marks.length," \u4EF6)"]}),(0,d.jsx)("ul",{role:"list",id:`${O}-restricted`,hidden:!me("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:b.marks.map(({key:w,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:Wn})," ",(0,d.jsx)(be,{iso:U.settledAt,testId:`history-${w}-settled-at-value`})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:zt})," ",(0,d.jsx)(qe,{tone:fa[U.status],variant:"tint",testId:`history-${w}-status`,children:et[U.status].label})," ",(0,d.jsx)(be,{iso:U.startedAt,testId:`history-${w}-started-at-value`})," \u301C ",(0,d.jsx)(Ct,{iso:U.finishedAt,testId:`history-${w}-finished-at-value`})]})},w))})]}),b.groups.map(w=>{let U=`revision:${w.revision}`,z=me(U,w.isCurrent),ye=`${Ye(w.revision)}${w.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return(0,d.jsxs)("div",{"data-testid":"history-revision-group","data-revision":w.revision,"data-current":w.isCurrent,children:[(0,d.jsx)(Ne,{variant:"secondary",expanded:z,controls:`${O}-${U}`,onClick:()=>ke(U,w.isCurrent),testId:`history-revision-toggle-${w.revision}`,children:`${ye} \u2014 ${w.items.length} \u4EF6`}),(0,d.jsx)("div",{id:`${O}-${U}`,hidden:!z,children:(0,d.jsx)(cn,{label:ye,items:w.items,itemKey:V=>V.key,selectedKey:X,onSelect:V=>Fe(V.key),detailId:O,renderRow:V=>nt(V,b),rowTestId:"history-item",rowData:V=>({"data-item-key":V.key,"data-pinned":V.state!==null&&V.state.stateId===Ve}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${w.revision}`})})]},U)})]}),nt=(b,w)=>{let U=b.state,z=`history-row-${b.key}`,ye=U===null?[]:ya(U,w,z);return(0,d.jsxs)(d.Fragment,{children:[b.kind==="run"?(0,d.jsxs)("span",{children:["\u5B9F\u884C #",b.run.id," \xB7 ",hn[b.run.trigger]," ",(0,d.jsx)(qe,{tone:fa[it(b.run)],variant:"tint",testId:`${z}-status`,children:et[it(b.run)].label})]}):(0,d.jsx)("span",{children:Et[b.state.cause]}),(0,d.jsx)("span",{children:(0,d.jsx)(be,{iso:b.time,testId:`${z}-time-value`})}),U!==null&&Fs(U,z),b.kind==="run"&&Zn(b.run)&&(0,d.jsx)("span",{"data-testid":`${z}-unrecorded`,children:yn}),ye,U!==null&&U.stateId===Ve&&(0,d.jsx)(qe,{tone:"info",variant:"tint",testId:`${z}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},Te=(b,w)=>{let U=w.states.find(he=>he.stateId===Ve)??null,z=(0,d.jsx)(Us,{pinned:U,shown:b,onPin:he=>q({request:a,stateId:he}),onUnpin:()=>q(null),fallback:()=>K.current});if(b===null)return z;let ye=()=>K.current,V;if(U!==null&&U.stateId!==b.stateId){let[he,Tt]=w.states.indexOf(U)>w.states.indexOf(b)?[U,b]:[b,U];V=(0,d.jsx)(xr,{host:e,fromStateId:he.stateId,toStateId:Tt.stateId,rescueTarget:ye})}else b.previousStateId===null?V=(0,d.jsx)("p",{"data-testid":"history-no-previous",children:Yn}):V=(0,d.jsx)(xr,{host:e,fromStateId:b.previousStateId,toStateId:b.stateId,rescueTarget:ye});return(0,d.jsxs)(d.Fragment,{children:[z,V]})},at=b=>{if(B===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let w=B.state,U=b.states.find(z=>z.stateId===Ve);if(U!==void 0&&w!==null&&U.stateId!==w.stateId){let[z,ye]=b.states.indexOf(U)>b.states.indexOf(w)?[U,w]:[w,U];return`\u6BD4\u8F03: ${Ye(z.revision)} \u2192 ${Ye(ye.revision)}`}return B.kind==="run"?`${Ye(B.run.revision)} \u306E\u5B9F\u884C #${B.run.id}`:`${Ye(B.state.revision)} \u306E\u5909\u5316`},Ae=b=>{if(X===null)return b.groups.some(ye=>ye.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(B===void 0&&Ce)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(B===void 0)return(0,d.jsxs)("p",{role:"status","data-testid":"history-selection-missing",children:[X.startsWith("run:")?`\u5B9F\u884C #${X.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(B.kind==="state"){let{state:ye}=B;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:Et[ye.cause]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u6642\u523B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(be,{iso:ye.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:ye.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:ye.classification.confidentialityLevel})]})]}),ya(ye,b,"history-detail"),Te(ye,b)]})}let{run:w,state:U}=B,z=it(w);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("dl",{"data-testid":"history-run-summary","data-run-id":w.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":w.trigger,children:hn[w.trigger]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u8A66\u884C"}),(0,d.jsx)("dd",{"data-testid":"history-run-attempt",children:w.attempt})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u72B6\u614B"}),(0,d.jsx)("dd",{children:(0,d.jsx)(qe,{tone:fa[z],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":w.status,"data-presentation":z},children:et[z].label})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u7A2E\u985E"}),(0,d.jsx)("dd",{"data-testid":"history-run-kind",children:ta(w.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:w.requestedBy})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:"\u958B\u59CB"}),(0,d.jsx)("dd",{children:(0,d.jsx)(be,{iso:w.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)(Ct,{iso:w.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:w.jobId})]})]}),w.errorMessage!==null&&(0,d.jsx)("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:w.errorMessage}),Zn(w)&&(0,d.jsx)("p",{"data-testid":"history-run-unrecorded",children:yn}),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"}):ya(U,b,"history-detail"),Te(U,b),(0,d.jsxs)("details",{"data-testid":"history-run-steps",children:[(0,d.jsx)("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),(0,d.jsx)(br,{run:w})]})]})},Ke=b=>(0,d.jsxs)("section",{id:O,"aria-labelledby":P,"data-testid":"history-detail","data-selected-key":X??"",children:[(0,d.jsx)("h3",{ref:K,id:P,tabIndex:-1,style:Os,"data-testid":"history-detail-heading",children:at(b)}),Ae(b)]});return(0,d.jsxs)("section",{"data-cui-migration":"pending",ref:p,role:"dialog","aria-labelledby":x,onKeyDown:oe,"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:D,id:x,tabIndex:-1,style:Ms,"data-testid":"history-heading",children:le===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${le.document.fileName}`}),(0,d.jsx)(Ne,{variant:"secondary",onClick:o,testId:"history-close",children:l.close})]}),H()]})}var ge=require("@aiquants/enrichment-core"),ne=require("react");var ga=require("@aiquants/console-ui/core");function ft(e,t,n){try{(0,ga.formatCount)(e,n)}catch(a){throw new RangeError(`${t}: ${a.message}`,{cause:a})}return e}function Rn(e,t,n){return(0,ga.formatCount)(ft(e,t,n),n)}var vr=1024,Bs=[{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 hr(e,t){return Number((e/vr**t.power).toFixed(t.fractionDigits))}function _n(e,t,n){ft(e,t,n);let[a,...o]=Bs,r=a,u=hr(e,r);for(let l of o){if(u<vr)break;r=l,u=hr(e,r)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:r.fractionDigits,maximumFractionDigits:r.fractionDigits,useGrouping:!0}).format(u)} ${r.name}`}var s=require("react/jsx-runtime"),Nr="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",Hs=new Set(ge.EnrichmentSyncStatusSchema.options.filter(e=>e.startsWith("FAILED"))),Vs=new Set(ge.EnrichmentSyncStatusSchema.options);function Er(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Hs.has(e.syncStatus)?{kind:"retry"}:Vs.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Sr(e,t,n){let a=e?.find(o=>o.confidentialityLevel===t&&o.capability===n);return a?a.isEnabled:null}var Gs={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"},qs=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function zs(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ba({field:e}){return(0,s.jsx)("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Ws({policies:e,tenantId:t,sources:n,domainOptions:a,recentItems:o=[],inspectionResult:r=null,isSubmitting:u=!1,isInspecting:l=!1,isBusy:i=!1,promotingId:x=null,onInspectUri:O,onIngestDocument:P,onRetryItem:p,onShowHistory:D,onPromoteUnlockedCopy:K,listRefusal:m}){let{formatLocale:_}=T(),S=Dt(),F=(0,ne.useRef)(new Map),W=(0,ne.useRef)(null),Q=(0,ne.useId)(),ue=(0,ne.useId)(),te=(0,ne.useId)(),q=(0,ne.useId)(),de=(0,ne.useId)(),Se=(0,ne.useId)(),k=(0,ne.useId)(),Z=(0,ne.useId)(),[Y,_e]=(0,ne.useState)(null),[je,De]=(0,ne.useState)(""),[Ie,Ce]=(0,ne.useState)(""),[le,R]=(0,ne.useState)("CONFIDENTIAL"),[X,B]=(0,ne.useState)(null),[se,ve]=(0,ne.useState)(""),[oe,Fe]=(0,ne.useState)(""),[f,H]=(0,ne.useState)([]),[pe,me]=(0,ne.useState)(""),[ke,Ve]=(0,ne.useState)("user"),[Ue,nt]=(0,ne.useState)(1),[Te,at]=(0,ne.useState)(!1),Ae=X!==null&&a.some(c=>c.key===X)?X:a.length>0?a[0].key:null,Ke=Y===null?void 0:n.find(c=>c.uri_prefix===Y),b=Ke!==void 0?Ke:n.length>0?n[0]:null,w=(0,ne.useMemo)(()=>({vectorEnabled:Sr(e,le,"vector_indexing"),graphEnabled:Sr(e,le,"graph_indexing")}),[e,le]),U=(0,ne.useMemo)(()=>{let c=Ie.trim();if(!c||n.length===0)return{valid:!1,error:null};let E=(0,ge.sourceOfUri)(n,c);if(E===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(Ge=>Ge.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let N=c.slice(E.uri_prefix.length);return N.trim()?c.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"}:(0,ge.identifierMatches)(E,N)?{valid:!0,error:null}:{valid:!1,error:`${zs(E.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${E.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[Ie,n]),z=c=>{if(_e(c),je.trim()){let E=je.trim(),N=(0,ge.sourceOfUri)(n,E),Ge=N===void 0?E:E.slice(N.uri_prefix.length);Ce(`${c}${Ge}`)}else Ce("")},ye=c=>{let E=c.trim();if(!E){De(""),Ce("");return}let N=(0,ge.sourceOfUri)(n,E);if(N!==void 0){_e(N.uri_prefix),De(E.slice(N.uri_prefix.length)),Ce(E);return}if(b!==null&&(0,ge.identifierMatches)(b,E)){De(c),Ce(`${b.uri_prefix}${E}`);return}let Ge=(0,ge.pastedIdentifier)(n,E);if(Ge!==void 0){_e(Ge.source.uri_prefix),De(Ge.identifier),Ce(`${Ge.source.uri_prefix}${Ge.identifier}`);return}if(E.includes("://")){De(c),Ce(E);return}De(c),Ce(b===null?E:`${b.uri_prefix}${E}`)},V=()=>{let c=pe.trim();c&&(f.some(E=>E.labelKey===c)||(H(E=>[...E,{labelKey:c,category:ke,confidenceScore:Number(Ue.toFixed(2))}]),me("")))},he=c=>{f.some(E=>E.labelKey===c)||H(E=>[...E,{labelKey:c,category:"domain",confidenceScore:1}])},Tt=c=>{H(E=>E.filter(N=>N.labelKey!==c))},Bt=c=>{if(c.preventDefault(),!U.valid||Ae===null)return;let E={fileUri:Ie.trim(),confidentialityLevel:le,targetDomainKey:Ae,departmentId:se.trim()?Number(se):null,titleOverride:oe.trim()?oe.trim():null,labels:f};P?.(E)};(0,ne.useLayoutEffect)(()=>{let c=W.current;if(c===null)return;let E=o.find(N=>N.kind==="readable"&&N.item.id===c)?.item;E?.unlock?.disposition==="copy_promoted"&&(W.current=null,document.activeElement===document.body&&F.current.get(c)?.focus(),S(`${E.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[o,S]);let Ln=c=>{let E=c.unlock;if(E===null)return null;let N=E.disposition==="copy_original"&&E.copyReason!==null&&(0,ge.isPromotable)(E.copyReason)&&c.isCurrent!==!1,Ge=x===c.id,wa=Ge?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return(0,s.jsxs)("div",{ref:Pa=>{Pa===null?F.current.delete(c.id):F.current.set(c.id,Pa)},tabIndex:-1,className:"mt-1 max-w-xs space-y-1 text-[11px] text-slate-700","data-testid":`ingest-unlock-${c.id}`,"data-disposition":E.disposition,"data-protection":E.protectionScheme,children:[(0,s.jsxs)("div",{children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",ge.PROTECTION_SCHEME_LABELS[E.protectionScheme]]}),(0,s.jsxs)("div",{"data-testid":`ingest-unlock-disposition-${c.id}`,children:[ge.UNLOCK_DISPOSITION_LABELS[E.disposition],E.copyReason!==null&&` (${ge.COPY_REASON_LABELS[E.copyReason]})`]}),N&&K!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>{W.current=c.id,K(c.id)},disabled:i,"aria-busy":Ge,"aria-label":`${c.fileName} \u306E${wa}`,className:"min-h-11 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 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":`ingest-promote-button-${c.id}`,children:wa})]})},g=c=>{let E=Er(c);if(E.kind==="blocked")return(0,s.jsx)("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${c.id}`,"data-reason":E.reason,children:E.reason});let N=E.kind==="retry";return(0,s.jsx)("button",{type:"button",onClick:()=>p?.(c.id),disabled:i,"aria-label":`${c.fileName} \u3092${N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:N?"min-h-11 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 disabled:cursor-not-allowed":"min-h-11 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 disabled:cursor-not-allowed","data-testid":`ingest-${E.kind}-button-${c.id}`,children:N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},Re=c=>{switch(c){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 c.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: ",c]}):(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:c})}};return(0,s.jsxs)("div",{"data-cui-migration":"pending",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:Bt,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:Q,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)(ba,{field:"uri"})]}),b!==null&&(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:b.uri_prefix})]})]}),b===null&&(0,s.jsx)(ze,{tone:"warning",testId:"ingest-no-sources",children:"\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002"}),(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:"}),n.map(c=>(0,s.jsx)("button",{type:"button",onClick:()=>z(c.uri_prefix),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${b?.uri_prefix===c.uri_prefix?"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-${c.scheme}`,children:`${c.scheme}:// (${c.title.ja})`},c.scheme))]}),(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 ${U.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:b?.uri_prefix}),(0,s.jsx)("input",{id:Q,type:"text",value:je,onChange:c=>ye(c.target.value),placeholder:b?.input_hint.ja,disabled:b===null,"aria-invalid":!!U.error,"aria-describedby":U.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:()=>O?.(Ie.trim()),disabled:!U.valid||l||i,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,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[b!==null&&(0,s.jsx)("p",{className:"text-slate-500",children:b.guidance.ja}),Ie&&(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:Ie})]})]})]}),U.error&&(0,s.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:U.error})]}),r&&r.fileUri===Ie.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 ${r.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold",children:r.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),(0,s.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.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:r.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)(He,{text:_n(r.fileSize,"fileSize",_),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:r.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:r.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:ue,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,s.jsx)(ba,{field:"confidentiality"})]}),(0,s.jsx)("select",{id:ue,value:le,onChange:c=>R(c.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:ge.ConfidentialityLevelSchema.options.map(c=>(0,s.jsxs)("option",{value:c,children:[c," (",Gs[c],")"]},c))})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:te,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,s.jsx)(ba,{field:"domain"})]}),(0,s.jsx)("select",{id:te,value:Ae===null?"":Ae,onChange:c=>B(c.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(c=>(0,s.jsx)("option",{value:c.key,children:c.label},c.key))}),a.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"})]})]}),le===ge.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"})," ",ge.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":w.vectorEnabled===null?"unknown":String(w.vectorEnabled),children:w.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":w.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${le} \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":w.graphEnabled===null?"unknown":String(w.graphEnabled),children:w.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":w.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${le} \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:[f.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:"}),qs.map(c=>(0,s.jsxs)("button",{type:"button",onClick:()=>he(c),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-${c}`,children:["+ ",c]},c))]}),(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:Se,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,s.jsx)("input",{id:Se,type:"text",value:pe,onChange:c=>me(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),V())},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:k,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,s.jsxs)("select",{id:k,value:ke,onChange:c=>Ve(c.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:Z,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Ue.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:Z,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Ue,"aria-valuenow":Ue,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Ue*100)}%`,onChange:c=>nt(Number.parseFloat(c.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:V,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"})})]}),f.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:f.map(c=>(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-${c.labelKey}`,children:[(0,s.jsx)("span",{className:"font-semibold",children:c.labelKey}),(0,s.jsxs)("span",{className:"text-indigo-400",children:["(",c.category,")"]}),(0,s.jsx)("button",{type:"button",onClick:()=>Tt(c.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${c.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${c.labelKey}`,children:"\xD7"})]},c.labelKey))})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":Te,"aria-controls":"advanced-settings-panel",onClick:()=>at(c=>!c),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:[Te?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),Te&&(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:de,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:de,type:"text",value:oe,onChange:c=>Fe(c.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:q,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,s.jsx)("input",{id:q,type:"number",value:se,onChange:c=>ve(c.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:!U.valid||Ae===null||u||l||i,"aria-busy":u,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:u?(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"})]})}),m!==void 0?(0,s.jsx)(ze,{tone:"warning",testId:"recent-items-refused",children:m}):o.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:o.map((c,E)=>{if(c.kind==="restricted")return(0,s.jsxs)("tr",{"data-testid":`recent-item-restricted-${E}`,"data-restricted-mark":"ingest",children:[(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${E}`,children:Rt}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${E}`,children:c.syncStatus===null?(0,s.jsx)("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:Nr}):Re(c.syncStatus)}),(0,s.jsx)("td",{className:"px-3 py-2"}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${E}`,children:(0,s.jsx)(be,{iso:c.createdAt,testId:`recent-item-restricted-created-at-value-${E}`})}),(0,s.jsx)("td",{className:"px-3 py-2"})]},`restricted:${E}`);let N=c.item;return(0,s.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${N.id}`,children:[(0,s.jsx)("td",{className:"px-3 py-2 font-bold",children:N.id}),(0,s.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:N.fileUri,children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:N.fileName}),(0,s.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:N.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:N.confidentialityLevel})}),(0,s.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",N.revision,N.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-${N.id}`,children:"\u65E7\u7248"})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans",children:[Re(N.syncStatus),N.errorMessage!==null&&N.errorMessage!==void 0&&N.errorMessage!==""&&(0,s.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}),Ln(N)]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${N.id}`,children:[N.lastRun===null?(0,s.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,s.jsxs)("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${N.id}`,"data-restricted-mark":"run",children:[(0,s.jsx)("div",{className:"text-[11px] text-slate-600",children:zt}),(0,s.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${et[N.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.status,children:et[N.lastRun.status].label}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:(0,s.jsx)(Ct,{iso:N.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}):(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] ${et[it(N.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.item.status,"data-presentation":it(N.lastRun.item),children:et[it(N.lastRun.item)].label}),N.lastRun.item.failedStepKey!==null&&(0,s.jsx)("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${N.id}`,children:Ot(N.lastRun.item.failedStepKey)}),N.lastRun.item.failedStepKey==="unlock_document"&&(0,s.jsx)("div",{className:"max-w-xs text-[11px] text-slate-700","data-testid":`ingest-unlock-hint-${N.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:(0,s.jsx)(Ct,{iso:N.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}),D!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>D(N.id),"aria-label":`${N.fileName} \u306E\u5C65\u6B74`,className:"mt-1 min-h-11 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,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${N.id}`,children:(0,s.jsx)(be,{iso:N.createdAt,testId:`ingest-created-at-value-${N.id}`})}),(0,s.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:g(N)})]},`readable:${N.id}`)})})]})})]})]})}var In=require("@aiquants/enrichment-core"),ee=require("react/jsx-runtime"),_r="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",Rr={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 xa(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Ys({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:a=!1}){let o=n===void 0;return(0,ee.jsxs)("div",{"data-cui-migration":"pending","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,ee.jsxs)("div",{children:[(0,ee.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,ee.jsxs)("p",{className:"text-slate-500 text-xs",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \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,ee.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 ",In.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),(0,ee.jsx)("p",{"data-testid":"strategy-inert-note",className:"mt-1 text-slate-500 text-xs",children:_r}),o&&(0,ee.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,ee.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,ee.jsx)("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:(0,ee.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,ee.jsx)("thead",{children:(0,ee.jsxs)("tr",{children:[(0,ee.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"}),In.ENRICHMENT_STAGES.map(r=>{let u=xa(r.featureFlagKey,t);return(0,ee.jsxs)("th",{scope:"col","data-inert":String(!r.readByPipeline),className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[(0,ee.jsx)("div",{children:r.label}),(0,ee.jsx)("div",{"data-testid":`strategy-gate-${r.key}`,"data-gate":u,className:"mt-0.5 font-normal text-[10px]",style:{color:Rr[u].color},children:Rr[u].label}),!r.readByPipeline&&(0,ee.jsx)("div",{"data-testid":`strategy-inert-${r.key}`,className:"mt-0.5 font-normal text-[10px] text-slate-500",children:"\u4ECA\u306F\u52B9\u304B\u306A\u3044"})]},r.key)})]})}),(0,ee.jsx)("tbody",{children:e.map(r=>(0,ee.jsxs)("tr",{"data-testid":`strategy-row-${r.domainKey}`,"data-provenance":r.provenance,"data-active":String(r.isActive),children:[(0,ee.jsxs)("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[(0,ee.jsx)("div",{className:"font-semibold text-slate-900",children:r.domainLabel}),(0,ee.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,ee.jsx)("code",{children:r.domainKey})," / ",r.strategyName]}),(0,ee.jsx)("div",{"data-testid":`strategy-provenance-${r.domainKey}`,className:"text-[10px] text-slate-500",children:r.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"}),!r.isActive&&(0,ee.jsx)("div",{"data-testid":`strategy-inactive-${r.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"})]}),In.ENRICHMENT_STAGES.map(u=>{let l=r.stages[u.key],i=xa(u.featureFlagKey,t),x=!u.readByPipeline;return(0,ee.jsxs)("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[(0,ee.jsx)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":x?`${r.domainLabel} \u306E ${u.label} (\u4ECA\u306F\u52B9\u304B\u306A\u3044)`:`${r.domainLabel} \u306E ${u.label}`,"data-testid":`strategy-stage-${r.domainKey}-${u.key}`,"data-enabled":String(l),"data-effective":String(!x&&l&&(i==="open"||i==="absent")),"data-inert":String(x),disabled:o||a,onClick:()=>n?.(r,u.key,!l),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${l?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${o||a?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:l?"\u958B":"\u9589"}),!x&&l&&i==="unmeasured"&&(0,ee.jsx)("div",{"data-testid":`strategy-unmeasured-${r.domainKey}-${u.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"}),!x&&l&&i==="closed"&&(0,ee.jsx)("div",{"data-testid":`strategy-blocked-${r.domainKey}-${u.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"})]},u.key)})]},`${r.domainKey}:${r.strategyName}`))})]})})]})}var Ut={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Kt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};var I=require("react/jsx-runtime"),Xs={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"},Ir=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],js=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),Cn={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 Cr(e){return e.kind==="text"?"anywhere":"atomic"}function Tr(e,t){return t===null?{kind:"unmeasured"}:js.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 Js(e){let t=Ir.filter(a=>a in e),n=Object.keys(e).filter(a=>!Ir.includes(a)).sort();return[...t,...n].map(a=>({key:a,label:Xs[a]??a,value:Tr(a,e[a])}))}function kr(e,t){switch(e.kind){case"count":return(0,I.jsx)(j,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return(0,I.jsx)(He,{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,I.jsx)(He,{text:String(e.value),testId:t});case"word":return(0,I.jsx)(He,{text:e.text,testId:t});case"text":return(0,I.jsx)(Jt,{text:e.text,testId:t})}}function Qs({health:e,isRefreshing:t=!1,onRefresh:n,className:a=""}){let{services:o,allHealthy:r,checkedAt:u}=e;T();let l=[{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,I.jsxs)("section",{"data-cui-migration":"pending",className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${a}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(r),children:[(0,I.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[(0,I.jsxs)("div",{className:"flex items-center gap-3",children:[(0,I.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,I.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,I.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,I.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,I.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,I.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,I.jsxs)("div",{children:[(0,I.jsx)("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,I.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",(0,I.jsx)("span",{"data-testid":"health-checked-at",children:(0,I.jsx)(be,{iso:u,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,I.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,I.jsx)("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...Kt[r?"connected":"error"],"data-testid":"health-overall-status-badge",children:r?(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,I.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,I.jsxs)("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ut.connected]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,I.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,I.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,I.jsxs)("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ut.error]})]})}),n&&(0,I.jsxs)("button",{type:"button",onClick:n,disabled:t,"data-testid":"health-refresh-button",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-solid bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[(0,I.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,I.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,I.jsx)("path",{d:"M3 3v5h5"}),(0,I.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,I.jsx)("path",{d:"M16 21h5v-5"})]}),(0,I.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,I.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:l.map(({key:i,data:x,title:O,subtitle:P})=>{let p=Tr("version",x.version),D=Cn[Cr(p)],K=kr(p,`service-version-value-${i}`);return(0,I.jsxs)("div",{"data-testid":`service-card-${i}`,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,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[(0,I.jsx)("span",{className:"font-semibold text-sm",children:O}),(0,I.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]",...Kt[x.status],"data-testid":`service-status-${i}`,children:[(0,I.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${i}`}),Ut[x.status]]})]}),(0,I.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:P}),(0,I.jsxs)("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${i}`,children:[(0,I.jsx)("span",{className:D.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,I.jsx)("span",{className:`${D.slot} font-medium text-[11px]`,"data-testid":`service-version-${i}`,children:p.kind==="text"?(0,I.jsx)("code",{className:"font-mono font-semibold",children:K}):K})]}),(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${i}`,children:[(0,I.jsx)("span",{className:Cn.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),(0,I.jsx)("span",{className:`${Cn.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${i}`,children:(0,I.jsx)(j,{value:x.latencyMs,unit:"ms",testId:`health-latency-value-${i}`})})]}),Js(x.details).map(m=>{let _=Cn[Cr(m.value)];return(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${i}-${m.key}`,children:[(0,I.jsxs)("span",{className:_.label,children:[m.label,":"]}),(0,I.jsx)("span",{className:`${_.slot} font-medium text-[11px]`,"data-testid":`health-detail-${i}-${m.key}`,children:kr(m.value,`health-detail-value-${i}-${m.key}`)})]},m.key)})]})]}),(0,I.jsxs)("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[(0,I.jsx)("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${i}`,children:x.endpoint}),x.errorMessage!==void 0&&jt.test(x.errorMessage)&&(0,I.jsx)("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Kt.error,"data-testid":`service-error-${i}`,children:x.errorMessage})]})]},i)})})]})}var fe=require("@aiquants/enrichment-core"),ae=require("react");var h=require("react/jsx-runtime"),Pr=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Lr={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},ha="ALL",tn={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Zs="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",eo=(fe.SEARCH_PARAM_LIMITS.threshold.min+fe.SEARCH_PARAM_LIMITS.threshold.max)/2,to=336,no=544;function ao(e){let t=e.trim().length;return t<fe.SEARCH_PARAM_LIMITS.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>fe.SEARCH_PARAM_LIMITS.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${fe.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function ro(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function wr(e,t){return t.trim().length>fe.SEARCH_PARAM_LIMITS.filterTextLength.max?`${e}\u306F ${fe.SEARCH_PARAM_LIMITS.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function so(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function oo({params:e,answer:t}){let n=t.search_metadata,a=n.executed_tiers,o=r=>r?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${rt[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${rt[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${o(a.lexical)} / \u758E ${o(a.sparse)} / \u5BC6 ${o(a.dense)} / \u30B0\u30E9\u30D5 ${o(a.graph)}`,`\u878D\u5408: ${so(e)}`,`\u54C1\u8CEA: ${wt[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${Pt[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${Pt[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
|
|
2
2
|
`)}function io({answer:e}){if(!e.search_metadata.executed_tiers.graph)return"\u30B0\u30E9\u30D5\u306E\u5C64\u306F\u8D70\u3063\u3066\u3044\u307E\u305B\u3093\u3002";if(e.authz_scopes.row_scope_applied)return"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u3001\u95A2\u4FC2\u306F\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002";let t=e.hits.flatMap((n,a)=>(n.graph_relations??[]).map(o=>`#${a+1} ${n.file_name??xt}: ${o.relation} \u2192 ${o.target_name}`));return t.length===0?"\u3069\u306E\u6587\u66F8\u306B\u3082\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3002":t.join(`
|
|
3
|
-
`)}function Je(e,t){return e?xt:t===null||t===""?"\u7121\u3057":String(t)}function lo({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:a}=T(),o=Dt(),r=(0,ae.useId)(),[u,l]=(0,ae.useState)(n?.q??""),[i,x]=(0,ae.useState)(n?.mode??"HYBRID"),[O,P]=(0,ae.useState)(n?.limit??fe.SEARCH_PARAM_LIMITS.limit.default),[p,D]=(0,ae.useState)(n?.threshold??eo),[K,m]=(0,ae.useState)(n?.fusion??"rrf"),[R,N]=(0,ae.useState)(n?.rrf_k??fe.SEARCH_PARAM_LIMITS.rrfK.default),[F,W]=(0,ae.useState)(n?.alpha??fe.SEARCH_PARAM_LIMITS.alpha.default),[Q,ue]=(0,ae.useState)(n?.confidentiality_level??ha),[te,q]=(0,ae.useState)(n?.department_id===void 0?"":String(n.department_id)),[de,Se]=(0,ae.useState)(n?.mime_type??""),[k,Z]=(0,ae.useState)(n?.tag??""),[Y,_e]=(0,ae.useState)(!1),[Xe,De]=(0,ae.useState)(!1),[Ie,$e]=(0,ae.useState)(!1),[le,E]=(0,ae.useState)("request"),[X,B]=(0,ae.useState)(!1),[se,ve]=(0,ae.useState)(!1),[oe,Fe]=(0,ae.useState)(null),[f,H]=(0,ae.useState)(null),[pe,me]=(0,ae.useState)(null),[Ce,Ve]=(0,ae.useState)(null),Ue=(0,ae.useRef)(0),nt=(0,ae.useRef)(0),ke=(0,ae.useRef)(null);(0,ae.useEffect)(()=>()=>ke.current?.abort(),[]);let at={query:ao(u),department:ro(te),mimeType:wr("MIME \u30BF\u30A4\u30D7",de),tag:wr("\u30BF\u30B0",k)},Ae=X?at:{},Ke=()=>{let g=te.trim(),Re=de.trim(),c=k.trim();return{q:u.trim(),mode:i,limit:O,...i==="DENSE"?{threshold:p}:{},...i==="HYBRID"?{fusion:K,rrf_k:R,...K==="linear"?{alpha:F}:{}}:{},...Q===ha?{}:{confidentiality_level:Q},...g===""?{}:{department_id:Number(g)},...Re===""?{}:{mime_type:Re},...c===""?{}:{tag:c}}},b=async g=>{let Re=new AbortController;ke.current=Re,ve(!0);try{let c=await t(g,Re.signal);if(Re.signal.aborted)return;Fe({params:g,answer:c}),H(c.hits.length===0?null:"1"),me(null),o(c.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${c.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(c){if(Re.signal.aborted)return;Ue.current+=1,me({message:c instanceof Error?c.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:Ue.current})}finally{ke.current===Re&&(ke.current=null,ve(!1))}},w=g=>{g.preventDefault(),B(!0),!(se||Object.values(at).some(Re=>Re!==void 0))&&b(Ke())},U=g=>{x(g.params.mode),P(g.params.limit),g.params.threshold!==void 0&&D(g.params.threshold),g.params.fusion!==void 0&&m(g.params.fusion),g.params.rrf_k!==void 0&&N(g.params.rrf_k),o(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${g.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},z=g=>{if(oe===null)return Zs;switch(g){case"request":return JSON.stringify(oe.params,null,2);case"response":return JSON.stringify(oe.answer,null,2);case"flow":return oo(oe);case"graph":return io(oe)}},ye=async()=>{try{await navigator.clipboard.writeText(z(le)),Ve(null),o(`${tn[le]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(g){nt.current+=1,Ve({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${g instanceof Error?g.message:String(g)}`,occurrence:nt.current})}},V=oe?.answer??null,he=g=>V?.authz_scopes.hidden_columns.includes(g)===!0,Tt=V===null?[]:V.hits.map((g,Re)=>({hit:g,rank:Re+1})),Bt=Tt.find(g=>String(g.rank)===f)??null,Ln=(g,Re)=>{let c=g.scores;return(0,h.jsx)(Un,{id:r,title:`#${Re} ${Je(he("file_name"),g.file_name)}`,region:!0,testId:"search-hit-detail",children:(0,h.jsxs)(Te,{gap:"space-4",testId:"search-hit-detail-body",children:[(0,h.jsx)($t,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:(0,h.jsx)(Bn,{label:"\u878D\u5408\u306E\u5024",value:c.fused,min:0,max:1,valueText:c.fused.toFixed(ht),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":Mn(c.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":c.lexical_rank.toFixed(ht)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":c.graph_rank.toFixed(ht)})}],testId:"search-hit-scores"}),(0,h.jsx)($t,{items:[{key:"file_uri",term:"URI",description:(0,h.jsx)(G,{fg:"fg",type:"body",face:"mono",children:Je(he("file_uri"),g.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("mime_type"),g.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("folder_path"),g.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("confidentiality_level"),g.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("department_id"),g.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("created_by"),g.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:he("mtime")?(0,h.jsx)(G,{fg:"fg",type:"body",children:xt}):(0,h.jsx)(ge,{iso:g.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:he("tags")||g.tags===null||g.tags.length===0?(0,h.jsx)(G,{fg:"fg",type:"body",children:Je(he("tags"),null)}):(0,h.jsx)(lt,{gap:"space-2",testId:"search-hit-tags",children:g.tags.map(_=>(0,h.jsx)(Ge,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${_}`,children:_},_))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:(0,h.jsx)(G,{fg:"fg",type:"prose",children:Je(he("ai_summary"),g.ai_summary)})}],testId:"search-hit-fields"}),(0,h.jsxs)(Te,{gap:"space-2",testId:"search-hit-relations",children:[(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),g.graph_relations===null?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):g.graph_relations.length===0?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):(0,h.jsx)("ul",{"data-testid":"search-hit-relation-list",children:g.graph_relations.map(_=>(0,h.jsx)("li",{children:(0,h.jsx)(G,{fg:"fg",type:"body",children:`${_.relation} \u2192 ${_.target_name}`})},`${_.relation}-${_.target_name}`))})]}),he("structured_data")||g.structured_data===null?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${Je(he("structured_data"),null)}`}):(0,h.jsx)(Kn,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(g.structured_data,null,2),testId:"search-hit-structured"})]})})};return(0,h.jsxs)(Te,{gap:"space-6",testId:"metadata-search-workbench",children:[(0,h.jsx)(dt,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":i,"data-running":se},children:(0,h.jsx)("form",{onSubmit:w,noValidate:!0,"data-testid":"search-form",children:(0,h.jsxs)(Te,{gap:"space-4",testId:"search-form-fields",children:[(0,h.jsx)(Nt,{label:"\u691C\u7D22\u8A9E",type:"search",value:u,onValueChange:l,required:!0,description:`1\u301C${fe.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57`,error:Ae.query,testId:"search-query"}),(0,h.jsx)(mn,{label:"\u691C\u7D22\u306E\u6226\u7565",options:fe.SEARCH_MODES.map(g=>({value:g,label:rt[g].label})),value:i,onValueChange:g=>x(g),testId:"search-mode"}),(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:rt[i].description}),(0,h.jsx)(St,{label:"\u4EF6\u6570",value:O,min:fe.SEARCH_PARAM_LIMITS.limit.min,max:fe.SEARCH_PARAM_LIMITS.limit.max,step:1,valueText:g=>`${g} \u4EF6`,onValueChange:P,testId:"search-limit"}),i==="DENSE"&&(0,h.jsx)(St,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:p,min:fe.SEARCH_PARAM_LIMITS.threshold.min,max:fe.SEARCH_PARAM_LIMITS.threshold.max,step:.01,valueText:g=>g.toFixed(2),onValueChange:D,testId:"search-threshold"}),i==="HYBRID"&&(0,h.jsxs)(Te,{gap:"space-4",testId:"search-fusion-controls",children:[(0,h.jsx)(mn,{label:"\u878D\u5408",options:fe.SEARCH_FUSIONS.map(g=>({value:g,label:An[g]})),value:K,onValueChange:g=>m(g),testId:"search-fusion"}),(0,h.jsx)(St,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:R,min:fe.SEARCH_PARAM_LIMITS.rrfK.min,max:fe.SEARCH_PARAM_LIMITS.rrfK.max,step:1,valueText:String,onValueChange:N,testId:"search-rrf-k"}),K==="linear"&&(0,h.jsx)(St,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:F,min:fe.SEARCH_PARAM_LIMITS.alpha.min,max:fe.SEARCH_PARAM_LIMITS.alpha.max,step:.05,valueText:g=>g.toFixed(2),onValueChange:W,testId:"search-alpha"})]}),(0,h.jsx)(pn,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:Y,onOpenChange:_e,testId:"search-filters",children:(0,h.jsxs)(Te,{gap:"space-4",testId:"search-filter-fields",children:[(0,h.jsx)(Gt,{label:"\u6A5F\u5BC6\u533A\u5206",value:Q,options:[{value:ha,label:"\u5168\u3066\u306E\u533A\u5206"},...fe.FILTERABLE_CONFIDENTIALITY_LEVELS.map(g=>({value:g,label:Lr[g]}))],onValueChange:ue,testId:"search-confidentiality"}),(0,h.jsx)(Nt,{label:"\u90E8\u7F72\u306E ID",type:"text",value:te,onValueChange:q,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:Ae.department,testId:"search-department"}),(0,h.jsx)(Nt,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:de,onValueChange:Se,error:Ae.mimeType,testId:"search-mime-type"}),(0,h.jsx)(Nt,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:k,onValueChange:Z,error:Ae.tag,testId:"search-tag"})]})}),(0,h.jsx)(pn,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:Xe,onOpenChange:De,testId:"search-presets",children:(0,h.jsx)(Te,{gap:"space-2",testId:"search-preset-list",children:Pr.map(g=>(0,h.jsxs)(lt,{gap:"space-2",testId:`search-preset-${g.id}`,children:[(0,h.jsx)(Ne,{variant:"secondary",onClick:()=>U(g),testId:`search-preset-${g.id}-apply`,children:g.title}),(0,h.jsx)(G,{fg:"fg-secondary",type:"body",children:g.description})]},g.id))})}),(0,h.jsx)(lt,{gap:"space-2",testId:"search-actions",children:(0,h.jsx)(Ne,{variant:"primary",type:"submit",busy:se,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),pe!==null&&(0,h.jsx)(ze,{occurrence:pe.occurrence,testId:"search-failure",children:pe.message}),V!==null&&(0,h.jsx)(Hn,{metadata:V.search_metadata,testId:"search-degraded"}),V!==null&&(0,h.jsx)(dt,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${V.hits.length} \u4EF6 \xB7 ${Rn(V.search_metadata.execution_time_ms,"execution_time_ms",a)} ms \xB7 \u54C1\u8CEA: ${wt[V.search_metadata.quality_tier]}`,testId:"search-results",children:(0,h.jsxs)(Te,{gap:"space-4",testId:"search-results-body",children:[(0,h.jsx)($t,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:(0,h.jsx)(lt,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([g,Re])=>(0,h.jsx)(Ge,{tone:V.search_metadata.executed_tiers[g]?"success":"neutral",variant:"tint",testId:`search-tier-${g}`,dataAttributes:{"data-ran":V.search_metadata.executed_tiers[g]},children:`${Re} ${V.search_metadata.executed_tiers[g]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},g))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${Pt[V.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${Pt[V.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-row-scope",children:V.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-column-scope",children:V.authz_scopes.column_scope_applied?V.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${V.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),(0,h.jsx)(on,{master:(0,h.jsx)(cn,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:Tt,itemKey:g=>String(g.rank),selectedKey:f,onSelect:g=>H(String(g.rank)),detailId:r,renderRow:g=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(G,{fg:"fg",type:"body",children:`#${g.rank} ${Je(he("file_name"),g.hit.file_name)}`}),(0,h.jsx)(Bn,{label:`#${g.rank} \u306E\u878D\u5408\u306E\u5024`,value:g.hit.scores.fused,min:0,max:1,valueText:g.hit.scores.fused.toFixed(ht),testId:`search-hit-${g.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:g=>({"data-rank":g.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Bt===null?(0,h.jsx)(Un,{id:r,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):Ln(Bt.hit,Bt.rank),masterMinPx:to,detailMinPx:no,testId:"search-master-detail"})]})}),(0,h.jsx)(pn,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:Ie,onOpenChange:$e,testId:"search-inspector",children:(0,h.jsxs)(Te,{gap:"space-4",testId:"search-inspector-body",children:[(0,h.jsx)(mn,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(tn).map(g=>({value:g,label:tn[g]})),value:le,onValueChange:g=>E(g),testId:"search-inspector-view"}),(0,h.jsx)(Kn,{label:`\u70B9\u691C\u306E\u7A93: ${tn[le]}`,code:z(le),testId:"search-inspector-code"}),(0,h.jsx)(lt,{gap:"space-2",testId:"search-inspector-actions",children:(0,h.jsx)(Ne,{variant:"secondary",onClick:()=>{ye()},testId:"search-inspector-copy",children:`${tn[le]}\u3092\u5199\u3059`})}),Ce!==null&&(0,h.jsx)(ze,{occurrence:Ce.occurrence,testId:"search-inspector-copy-failure",children:Ce.message})]})})]})}var yt=require("@aiquants/enrichment-core"),Oe=require("react");var re=require("react/jsx-runtime"),Dr=4;function $r(e){return`${e.label} (${e.embeddingModel})`}function co(e){let t=e.trim().length;return t<yt.SEARCH_PARAM_LIMITS.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>yt.SEARCH_PARAM_LIMITS.queryLength.max?`\u554F\u3044\u306F ${yt.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function uo({variants:e,onCompare:t}){let{formatLocale:n}=T(),a=Dt(),[o,r]=(0,Oe.useState)(null),[u,l]=(0,Oe.useState)(null),[i,x]=(0,Oe.useState)(""),[O,P]=(0,Oe.useState)(yt.SEARCH_PARAM_LIMITS.limit.default),[p,D]=(0,Oe.useState)(!1),[K,m]=(0,Oe.useState)(!1),[R,N]=(0,Oe.useState)(null),[F,W]=(0,Oe.useState)(null),Q=(0,Oe.useRef)(0),ue=(0,Oe.useRef)(null);(0,Oe.useEffect)(()=>()=>ue.current?.abort(),[]);let te=e.map(E=>E.strategyId),q=o!==null&&te.includes(o)?o:te[0]??null,de=u!==null&&te.includes(u)?u:te[1]??null,Se=q!==null&&q===de,k={query:co(i),variant:Se?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},Z=p?k.query:void 0,Y=E=>{let X=e.find(B=>B.strategyId===E);return X===void 0?`\u6226\u7565 #${E}`:$r(X)},_e=E=>{Q.current+=1,N(null),W({message:E,occurrence:Q.current})},Xe=async E=>{let X=new AbortController;ue.current=X,m(!0);try{let B=await t(E,X.signal);if(X.signal.aborted)return;let se=B.results.find(oe=>oe.strategy_id===E.strategy_ids[0]),ve=B.results.find(oe=>oe.strategy_id===E.strategy_ids[1]);if(se===void 0||ve===void 0){_e(`\u7B54\u3048\u306B\u6226\u7565 #${se===void 0?E.strategy_ids[0]:E.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}N({input:E,answer:B,results:[se,ve]}),W(null),a(`\u5909\u7A2E A \u306F ${se.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${ve.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(B){if(X.signal.aborted)return;_e(B instanceof Error?B.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{ue.current===X&&(ue.current=null,m(!1))}},De=E=>{E.preventDefault(),D(!0),!(K||q===null||de===null||k.query!==void 0||k.variant!==void 0)&&Xe({query:i.trim(),strategy_ids:[q,de],limit:O})},Ie=e.map(E=>({value:String(E.strategyId),label:$r(E)})),$e=(E,X,B,se,ve)=>E===void 0?(0,re.jsx)(G,{fg:"fg-muted",type:"body",testId:`compare-${X}-${B}-${se}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):(0,re.jsxs)(Te,{gap:"space-1",testId:`compare-${X}-${B}-${se}`,children:[(0,re.jsx)(G,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${E.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${E.chunk_index} \xB7 ${E.score.toFixed(Dr)}`}),(0,re.jsx)(G,{fg:"fg",type:"prose",children:ve||E.text===null?xt:E.text})]}),le=({answer:E,results:X})=>{let[B,se]=X,ve=On(B.hits.map(sn),se.hits.map(sn)),oe=Array.from({length:Math.max(B.hits.length,se.hits.length)},(f,H)=>H+1),Fe=(f,H)=>({key:H,heading:`\u5909\u7A2E ${H.toUpperCase()}: ${Y(f.strategy_id)} \xB7 ${Rn(f.execution_ms,`execution_ms of strategy ${f.strategy_id}`,n)} ms`,cells:Object.fromEntries(oe.map(pe=>[`rank-${pe}`,me=>$e(f.hits[pe-1],H,pe,me,E.text_hidden)]))});return(0,re.jsx)(dt,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:(0,re.jsxs)(Te,{gap:"space-4",testId:"compare-results-body",children:[(0,re.jsx)($t,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${ve.sharedCount} \u4EF6 (A ${B.hits.length} \u4EF6 / B ${se.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:ve.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(ve.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-rank-difference",children:ve.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":ve.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-text-hidden",children:E.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[B,"A"],[se,"B"]].map(([f,H])=>f.dense_ran?null:(0,re.jsx)(qe,{tone:"warning",testId:`compare-degraded-${H.toLowerCase()}`,children:(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${H} (${Y(f.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${f.degradation_reasons.map(Ht).join(" ")}`})},H)),oe.length===0?(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,re.jsx)(dn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:oe.map(f=>({key:`rank-${f}`,label:`${f} \u4F4D`})),columns:[Fe(B,"a"),Fe(se,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return(0,re.jsxs)(Te,{gap:"space-6",testId:"model-comparison-workbench",children:[(0,re.jsx)(dt,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":K},children:e.length<2?(0,re.jsx)(qe,{tone:"info",testId:"compare-variants-insufficient",children:(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):(0,re.jsx)("form",{onSubmit:De,noValidate:!0,"data-testid":"compare-form",children:(0,re.jsxs)(Te,{gap:"space-4",testId:"compare-form-fields",children:[(0,re.jsx)(Gt,{label:"\u5909\u7A2E A",value:String(q),options:Ie,onValueChange:E=>r(Number(E)),testId:"compare-variant-a"}),(0,re.jsx)(Gt,{label:"\u5909\u7A2E B",value:String(de),options:Ie,onValueChange:E=>l(Number(E)),error:k.variant,testId:"compare-variant-b"}),(0,re.jsx)(Nt,{label:"\u554F\u3044",type:"search",value:i,onValueChange:x,required:!0,description:`1\u301C${yt.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57`,error:Z,testId:"compare-query"}),(0,re.jsx)(St,{label:"\u4EF6\u6570",value:O,min:yt.SEARCH_PARAM_LIMITS.limit.min,max:yt.SEARCH_PARAM_LIMITS.limit.max,step:1,valueText:E=>`${E} \u4EF6`,onValueChange:P,testId:"compare-limit"}),(0,re.jsx)(lt,{gap:"space-2",testId:"compare-actions",children:(0,re.jsx)(Ne,{variant:"primary",type:"submit",busy:K,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),F!==null&&(0,re.jsx)(ze,{occurrence:F.occurrence,testId:"compare-failure",children:F.message}),R!==null&&le(R)]})}var C=require("react/jsx-runtime");function Ar(e){return e===null?an:`${e.length} \u7A2E`}var an="\u672A\u8A2D\u5B9A";function nn(e,t=""){return e===null?an:`${e}${t}`}function kn(e){return e===null?an:`${e} \u4EF6`}function po(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?an:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??an})`}function mo({tenantId:e,ontologyStatus:t}){let n=t.classes,a=t.predicates;return(0,C.jsxs)("div",{"data-cui-migration":"pending",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:po(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:kn(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:kn(t.searchIndexes)}),(0,C.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",kn(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:[nn(t.promotionThresholds.confidence)," / ",nn(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:kn(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:Ar(n)})]}),(0,C.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[n===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"}),n?.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:Ar(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-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"}),a?.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 ",nn(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",nn(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",nn(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 xe=require("@aiquants/enrichment-core"),Le=require("react");var Tn=require("@aiquants/console-ui/core"),wn=require("@aiquants/enrichment-core"),kt={inset:12,labelFontSize:13,captionFontSize:11},bt={offset:3,stroke:2},Mr={node:{width:(0,Tn.ceil8)(Math.max(...Object.values(wn.PIPELINE_STEPS).map(e=>(0,Tn.textWidthEm)(e.label)))*kt.labelFontSize+2*kt.inset),height:56},gap:{column:48,row:24},padding:24};function gt(e){return Math.round(e*1e3)/1e3}function fo(e){let t=new Map;for(let n of e){let a=n.dependsOn.reduce((o,r)=>Math.max(o,t.get(r)),-1);t.set(n.step,a+1)}return t}function va(e,t){return`${e}->${t}`}function yo(e,t){let n=[],a=new Map;return{slots:[...e.map(r=>{let u=t.get(r.step),l=r.dependsOn.map(i=>{let x=[],O=i;for(let P=t.get(i)+1;P<u;P+=1){let p=`${va(i,r.step)}@${P}`;n.push({id:p,rank:P,predecessors:[O]}),x.push(p),O=p}return a.set(va(i,r.step),x),O});return{id:r.step,rank:u,predecessors:l}}),...n],chains:a}}function go(e){let t=new Map,n=Math.max(...e.map(a=>a.rank));for(let a=0;a<=n;a+=1){let r=e.filter(u=>u.rank===a).map((u,l)=>{let i=a===0?l:u.predecessors.reduce((x,O)=>x+t.get(O),0)/u.predecessors.length;return{slot:u,barycenter:i}});r.sort((u,l)=>u.barycenter-l.barycenter),r.forEach(({slot:u},l)=>{t.set(u.id,l)})}return t}function Sa(e,t=Mr){let n=(0,wn.orderedSteps)(e),a=fo(n),{slots:o,chains:r}=yo(n,a),u=go(o),{node:l,gap:i,padding:x}=t,O=F=>({x:gt(x+F.rank*(l.width+i.column)),y:gt(x+u.get(F.id)*(l.height+i.row))}),P=new Map(o.map(F=>[F.id,O(F)])),p=n.map(F=>{let W=P.get(F.step);return{key:F.step,x:W.x,y:W.y,rank:a.get(F.step),order:u.get(F.step),width:l.width,height:l.height}}),D=F=>gt(F+l.height/2),K=n.flatMap(F=>F.dependsOn.map(W=>{let Q=P.get(W),ue=P.get(F.step),te=gt(Q.x+l.width),q=D(Q.y),de=`M ${te} ${q}`,Se=(k,Z)=>{let Y=gt((te+k)/2);de+=` C ${Y} ${q}, ${Y} ${Z}, ${k} ${Z}`};for(let k of r.get(va(W,F.step))){let Z=P.get(k),Y=D(Z.y);Se(Z.x,Y),te=gt(Z.x+l.width),q=Y,de+=` L ${te} ${q}`}return Se(ue.x,D(ue.y)),{from:W,to:F.step,path:de}})),m=[...P.values()],R=gt(Math.max(...m.map(F=>F.x+l.width))+x),N=gt(Math.max(...m.map(F=>F.y+l.height))+x);return{width:R,height:N,steps:p,edges:K}}var y=require("react/jsx-runtime"),Or="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Na={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},Fr={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},_a={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"}},Ia={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"},bo={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},rn="rgb(248 250 252)",xo={backgroundColor:rn,backgroundImage:`linear-gradient(to right, ${rn}, ${rn}), linear-gradient(to right, ${rn}, ${rn}), 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 Ca(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function Ur(e,t){let n=e.map(a=>({gate:a,state:Ca(a,t)}));return n.some(({gate:a,state:o})=>o==="closed"&&a.whenClosed==="fail")?"closed-fail":n.some(({state:a})=>a==="closed")?"closed-skip":n.some(({state:a})=>a==="unmeasured")?"unmeasured":"open"}function Ea(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function Kr(e,t){let{badge:n}=_a[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${Ia[t]}`}function ho(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 Ra(e){return e.map(t=>xe.PIPELINE_STEPS[t].label).join("\u3001")}function vo(e){return e.dependsOn.length===0?Or:`\u4F9D\u5B58: ${Ra(e.dependsOn)}`}function So({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:a,onSelectKind:o,selectedStepKey:r,onSelectStep:u}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let l=(0,Le.useId)(),i=(0,Le.useId)(),x=(0,Le.useId)(),O=(0,Le.useId)(),P=(0,Le.useId)(),[p,D]=(0,Le.useState)(xe.DOCUMENT_KINDS[0]),[K,m]=(0,Le.useState)(null),[R,N]=(0,Le.useState)(null),F=(0,Le.useRef)(new Map),W=(0,Le.useRef)(new Map),Q=(0,Le.useRef)(null),ue=(0,Le.useRef)(null),{labels:te}=T(),q=a!==void 0?a:p,de=r!==void 0?r:K,Se=(0,xe.flowFor)(q),k=Sa(Se),Z=new Map(Se.steps.map(f=>[f.step,f])),Y=f=>{m(f),u?.(f)},_e=f=>{D(f),o?.(f),Y(null)},Xe=(f,H)=>{let pe=xe.DOCUMENT_KINDS.length-1,me;switch(f.key){case"ArrowRight":me=H===pe?0:H+1;break;case"ArrowLeft":me=H===0?pe:H-1;break;case"Home":me=0;break;case"End":me=pe;break;default:return}f.preventDefault();let Ce=xe.DOCUMENT_KINDS[me];_e(Ce),F.current.get(Ce)?.focus()},De=f=>{let H=ue.current;if(Y(null),H?.isConnected){H.focus();return}W.current.get(f)?.focus()},Ie=f=>{Y(f===de?null:f)},$e=(f,H)=>{f.currentTarget.focus(),Ie(H)},le=(f,H)=>{f.key==="Enter"||f.key===" "?(f.preventDefault(),Ie(H)):f.key==="Escape"&&Y(null)},E=de===null?void 0:Z.get(de),X=E===void 0?null:E.step;(0,Le.useEffect)(()=>{if(X===null){ue.current=null;return}let f=document.activeElement;(f instanceof HTMLElement||f instanceof SVGElement)&&f!==document.body&&Q.current?.contains(f)===!1&&(ue.current=f)},[X]);let B=E===void 0?void 0:xe.PIPELINE_STEPS[E.step],se=E===void 0?[]:(0,xe.flowStepGates)(E),ve=E===void 0?[]:Se.steps.filter(f=>f.dependsOn.includes(E.step)).map(f=>f.step),oe=B===void 0?void 0:t.find(f=>f.documentKind===q&&f.stepKey===B.key),Fe=xe.DOCUMENT_KIND_LABELS[q];return(0,y.jsxs)("section",{"data-cui-migration":"pending",className:"space-y-6","aria-labelledby":l,"data-testid":"pipeline-flow-viewer","data-kind":q,children:[(0,y.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,y.jsx)("h2",{id:l,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),(0,y.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,y.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:xe.DOCUMENT_KINDS.map((f,H)=>{let pe=f===q;return(0,y.jsx)("button",{ref:me=>{me===null?F.current.delete(f):F.current.set(f,me)},type:"button",role:"tab","aria-selected":pe,"aria-controls":i,tabIndex:pe?0:-1,onClick:()=>_e(f),onKeyDown:me=>Xe(me,H),className:pe?"rounded-lg border border-indigo-600 border-solid bg-indigo-600 px-3 py-1.5 font-semibold text-[13px] text-white":"rounded-lg border border-slate-300 border-solid bg-white px-3 py-1.5 font-medium text-[13px] text-slate-700 hover:bg-slate-50","data-testid":`flow-kind-${f}`,children:xe.DOCUMENT_KIND_LABELS[f]},f)})}),(0,y.jsx)("div",{id:i,role:"tabpanel","aria-label":`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u6D41\u308C`,"aria-describedby":x,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:xo,"data-testid":"flow-scroll",children:(0,y.jsxs)("svg",{viewBox:`0 0 ${k.width} ${k.height}`,width:k.width,height:k.height,role:"group","aria-label":`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[(0,y.jsx)("title",{children:`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),(0,y.jsx)("defs",{children:(0,y.jsx)("marker",{id:`${i}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:(0,y.jsx)("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),k.edges.map(f=>(0,y.jsx)("path",{d:f.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${i}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${f.from}-${f.to}`},`${f.from}-${f.to}`)),k.steps.map(f=>{let H=xe.PIPELINE_STEPS[f.key],pe=Z.get(f.key),me=(0,xe.flowStepGates)(pe),Ce=Ur(me,e),Ve=Ea(me),Ue=_a[Ce],nt=Kr(Ce,Ve),ke=f.key===de,at=f.key===R,Ae=`${i}-depends-${f.key}`;return(0,y.jsxs)("g",{ref:Ke=>{Ke===null?W.current.delete(f.key):W.current.set(f.key,Ke)},transform:`translate(${f.x} ${f.y})`,role:"button",tabIndex:0,"aria-label":`${H.label} (${nt})`,"aria-describedby":Ae,"aria-expanded":ke,"aria-controls":ke?P:void 0,onClick:Ke=>$e(Ke,f.key),onKeyDown:Ke=>le(Ke,f.key),onFocus:()=>N(f.key),onBlur:()=>N(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${f.key}`,"data-step-key":f.key,"data-gate-state":Ce,"data-gate-policy":Ve,"data-selected":ke,"data-focused":at,children:[(0,y.jsx)("desc",{id:Ae,"data-testid":`flow-node-dependencies-${f.key}`,children:vo(pe)}),at&&(0,y.jsx)("rect",{x:-bt.offset,y:-bt.offset,width:f.width+2*bt.offset,height:f.height+2*bt.offset,rx:8+bt.offset,fill:"none",strokeWidth:bt.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${f.key}`}),(0,y.jsx)("rect",{width:f.width,height:f.height,rx:8,strokeWidth:ke?3:1.5,strokeDasharray:Ue.dash,className:`${Ue.stroke} ${ke?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${f.key}`}),(0,y.jsx)("text",{x:kt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${f.key}`,children:H.label}),(0,y.jsx)("text",{x:kt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${f.key}`,children:Na[H.phase]}),(0,y.jsx)("text",{x:kt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${f.key}`,"data-gate-state":Ce,children:nt})]},f.key)})]})}),(0,y.jsxs)("p",{id:x,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",k.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"]})]}),B!==void 0&&E!==void 0&&(0,y.jsxs)("section",{id:P,ref:Q,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":O,"data-testid":"flow-step-detail","data-step-key":B.key,children:[(0,y.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{id:O,className:"font-bold text-base text-slate-900",children:B.label}),(0,y.jsx)("p",{className:"mt-1 text-[13px] text-slate-600",children:B.description})]}),(0,y.jsx)("button",{type:"button",onClick:()=>De(B.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,y.jsxs)("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),(0,y.jsx)("dd",{children:(0,y.jsx)("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:B.endpoint})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),(0,y.jsxs)("dd",{"data-testid":"flow-step-phase",children:[Na[B.phase]," (",B.phase,")"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),(0,y.jsx)("dd",{"data-testid":"flow-step-capability",children:B.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":B.capability})]}),E.chunkSource!==void 0&&(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),(0,y.jsxs)("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":E.chunkSource,children:[Fr[E.chunkSource]," (",E.chunkSource,")"]})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),(0,y.jsx)("dd",{"data-testid":"flow-step-depends-on",children:E.dependsOn.length===0?Or:Ra(E.dependsOn)})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),(0,y.jsx)("dd",{"data-testid":"flow-step-dependents",children:ve.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Ra(ve)})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),(0,y.jsx)("dd",{children:se.length===0?(0,y.jsx)("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("ul",{className:"space-y-1",children:se.map(f=>{let H=Ca(f,e);return(0,y.jsxs)("li",{"data-testid":`flow-gate-${f.featureFlagKey}`,"data-gate-state":H,"data-when-closed":f.whenClosed,children:[(0,y.jsx)("code",{className:"font-mono",children:f.featureFlagKey}),": ",bo[H]," \u2014 ",ho(f)]},f.featureFlagKey)})}),E.gatePolicy!==void 0&&(0,y.jsxs)("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Fe," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",Ia[Ea(B.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",E.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),(0,y.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":q,children:[(0,y.jsxs)("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Fe,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),(0,y.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Fe," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),oe===void 0?(0,y.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[te.unmeasured," (",Fe," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-sample-count",children:(0,y.jsx)(j,{value:oe.sampleCount,testId:"flow-metric-sample-count-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6210\u529F"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-succeeded",children:(0,y.jsx)(j,{value:oe.succeeded,testId:"flow-metric-succeeded-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u5931\u6557"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-failed",children:(0,y.jsx)(j,{value:oe.failed,testId:"flow-metric-failed-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u7701\u7565"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-skipped",children:(0,y.jsx)(j,{value:oe.skipped,testId:"flow-metric-skipped-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"p50"}),(0,y.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:(0,y.jsx)(j,{value:oe.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"p95"}),(0,y.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:(0,y.jsx)(j,{value:oe.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),(0,y.jsxs)("div",{className:"col-span-2",children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-last-started-at",children:(0,y.jsx)(ge,{iso:oe.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),(0,y.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 ",te.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,y.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,y.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),(0,y.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,y.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",xe.DOCUMENT_KIND_LABELS.other,"\u300D\u3067\u3059\u3002"]}),(0,y.jsx)("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:(0,y.jsxs)("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[(0,y.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),(0,y.jsx)("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),(0,y.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100",children:xe.MIME_KIND_RULES.map(([f,H],pe)=>(0,y.jsxs)("tr",{className:H===q?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${pe}`,"data-kind":H,"data-selected":H===q,children:[(0,y.jsx)("td",{className:"px-3 py-2",children:(0,y.jsx)("code",{className:"font-mono",children:f})}),(0,y.jsx)("td",{className:"px-3 py-2",children:xe.DOCUMENT_KIND_LABELS[H]})]},f))})]})})]})]})}var Pn=require("@aiquants/console-ui/core"),qr=require("react");var L=require("react/jsx-runtime");function No(e,t){return e==null?null:ft(e,"segment_count",t)}function Br(e,t,n){return e==null?null:_n(e,t,n)}function Eo(e){let t=e.probe_failure;if(t===null)return null;if(!jt.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 Hr(e,t,n){return e.reduce((a,o)=>a+ft(o[t],`${t} of collection ${o.collection_name}`,n),0)}var Ro=(0,Pn.cssVar)("space-1"),_o={padding:0,height:"1px",color:"#1e293b"},Io={display:"flex",height:"100%"},Co={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},ko={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},To={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},ka={whiteSpace:"nowrap"},Vr=(0,Pn.cssVar)("space-3"),wo=(0,Pn.cssVar)("info-tint"),Ta={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function Gr(e,t){return`vectors_config.${e}.size of collection ${t}`}function Po({overview:e,health:t,resources:n,onRefresh:a,isRefreshing:o=!1,selection:r}){let{formatLocale:u}=T(),l=(0,qr.useId)(),{collections:i}=e,x=Eo(e),O=x===null,P=O?Hr(i,"points_count",u):null,p=O?Hr(i,"vectors_count",u):null,D=Br(n?.ram_bytes,"ram_bytes",u),K=Br(n?.disk_bytes,"disk_bytes",u),m=No(n?.segment_count,u);return(0,L.jsxs)("div",{"data-cui-migration":"pending","data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,L.jsxs)("div",{"data-testid":"qdrant-card-header",style:ko,children:[(0,L.jsxs)("div",{"data-testid":"qdrant-card-title-group",style:To,children:[(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Kt[t.healthy?"connected":"error"],style:{...ka,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ut[t.healthy?"connected":"error"]}),(0,L.jsxs)("span",{"data-testid":"qdrant-latency",style:{...ka,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",(0,L.jsx)(j,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),a&&(0,L.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:o,onClick:a,style:{...ka,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,L.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:P,testId:"qdrant-total-points-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:p,testId:"qdrant-total-vectors-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,L.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(He,{text:D,testId:"qdrant-ram-usage-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,L.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(He,{text:K,testId:"qdrant-disk-usage-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:m,testId:"qdrant-segment-count-value"})})]})]}),(0,L.jsxs)("div",{children:[(0,L.jsxs)("h3",{id:l,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",(0,L.jsx)(j,{value:O?i.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),x!==null?(0,L.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:x}):i.length===0?(0,L.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,L.jsx)("section",{tabIndex:0,"aria-labelledby":l,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Ro},children:(0,L.jsxs)("table",{"aria-labelledby":l,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,L.jsx)("thead",{children:(0,L.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[(0,L.jsx)("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${Vr}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,L.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,L.jsx)("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,L.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,L.jsx)("tbody",{children:i.map(R=>{let N=r!==void 0&&R.collection_name===r.selectedCollectionName,F=(0,L.jsx)("span",{style:Co,children:R.collection_name}),{dense:W,sparse:Q,image:ue}=R.vectors_config,te=W===void 0?null:ft(W.size,Gr("dense",R.collection_name),u),q=ue===void 0?null:ft(ue.size,Gr("image",R.collection_name),u);return(0,L.jsxs)("tr",{"data-testid":`collection-row-${R.collection_name}`,"data-collection-name":R.collection_name,"data-selected":String(N),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:N?wo:"transparent"},children:[r===void 0?(0,L.jsx)("td",{style:{padding:`8px ${Vr}`,color:"#1e293b"},children:F}):(0,L.jsx)("td",{style:_o,children:(0,L.jsx)("div",{style:Io,children:(0,L.jsx)($a,{selected:N,controls:r.detailId,onSelect:()=>r.onSelectCollection(R.collection_name),testId:`collection-select-${R.collection_name}`,children:F})})}),(0,L.jsx)("td",{style:{padding:"8px",color:"#475569"},children:R.domain_key}),(0,L.jsx)("td",{"data-testid":`collection-points-${R.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:(0,L.jsx)(j,{value:R.points_count,testId:`collection-points-value-${R.collection_name}`})}),(0,L.jsx)("td",{style:{padding:"8px"},children:(0,L.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[te!==null&&(0,L.jsxs)("span",{"data-testid":`vector-tag-dense-${R.collection_name}`,style:{...Ta,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",(0,L.jsx)(j,{value:te,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${R.collection_name}`})]}),Q!==void 0&&(0,L.jsx)("span",{"data-testid":`vector-tag-sparse-${R.collection_name}`,style:{...Ta,backgroundColor:"#fef3c7",color:"#92400e"},children:Q.modifier?`Sparse (${Q.modifier.toUpperCase()})`:"Sparse"}),q!==null&&(0,L.jsxs)("span",{"data-testid":`vector-tag-image-${R.collection_name}`,style:{...Ta,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",(0,L.jsx)(j,{value:q,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${R.collection_name}`})]})]})})]},R.collection_name)})})]})})]})]})}var A=require("react/jsx-runtime"),Lo="\u5BFE\u8C61\u306A\u3057";function $o({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:a,onRetryItem:o,isRetrying:r=!1,onRefresh:u,listRefusal:l}){T();let i=e.SYNCED??0,x=e.PENDING??0,O=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),P=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),p=t>0?`${(i/t*100).toFixed(1)}%`:Lo;return(0,A.jsxs)("div",{"data-cui-migration":"pending","data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,A.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,A.jsxs)("div",{children:[(0,A.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,A.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,A.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,A.jsx)("span",{"data-testid":"success-rate-value",children:p}),")"]})]}),(0,A.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[u&&(0,A.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:u,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),a&&(0,A.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:r||P===0,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:r||P===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:r||P===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:r?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,A.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,A.jsxs)("div",{"data-testid":"status-card-synced","data-count":i,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,A.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:i})]}),(0,A.jsxs)("div",{"data-testid":"status-card-processing","data-count":O,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,A.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:O})]}),(0,A.jsxs)("div",{"data-testid":"status-card-pending","data-count":x,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,A.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:x})]}),(0,A.jsxs)("div",{"data-testid":"status-card-failed","data-count":P,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,A.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:P})]})]}),(0,A.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,A.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",l!==void 0?"":` (${n.length<P?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${P} \u4EF6`:`${n.length} \u4EF6`})`]}),l!==void 0?(0,A.jsx)(qe,{tone:"warning",testId:"failed-items-refused",children:l}):n.length===0?(0,A.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,A.jsx)("div",{style:{overflowX:"auto"},children:(0,A.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,A.jsx)("thead",{children:(0,A.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,A.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,A.jsx)("tbody",{children:n.map((D,K)=>{if(D.kind==="restricted")return(0,A.jsxs)("tr",{"data-testid":`failed-item-restricted-${K}`,"data-restricted-mark":"failure",children:[(0,A.jsx)("td",{"data-testid":`failed-item-restricted-text-${K}`,style:{padding:"8px"},children:Rt}),(0,A.jsx)("td",{style:{padding:"8px"},children:(0,A.jsx)("span",{"data-testid":`failed-item-restricted-status-${K}`,style:{fontSize:"11px"},children:D.syncStatus})}),(0,A.jsx)("td",{style:{padding:"8px"}}),(0,A.jsx)("td",{"data-testid":`failed-item-restricted-time-${K}`,style:{padding:"8px",whiteSpace:"nowrap"},children:D.failedAt===null?"\u8A18\u9332\u306A\u3057":(0,A.jsx)(ge,{iso:D.failedAt,testId:`failed-item-restricted-time-value-${K}`})}),(0,A.jsx)("td",{style:{padding:"8px"}})]},`restricted:${K}`);let m=D.item;return(0,A.jsxs)("tr",{"data-testid":`failed-item-row-${m.id}`,"data-file-uri":m.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,A.jsxs)("td",{"data-testid":`failed-item-uri-${m.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,A.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:m.file_name}),(0,A.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:m.file_uri})]}),(0,A.jsx)("td",{style:{padding:"8px"},children:(0,A.jsx)("span",{"data-testid":`failed-item-status-${m.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:m.sync_status})}),(0,A.jsx)("td",{"data-testid":`failed-item-error-${m.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:m.error_message??"",children:m.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,A.jsx)("td",{"data-testid":`failed-item-time-${m.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:m.failed_at===null?"\u8A18\u9332\u306A\u3057":(0,A.jsx)(ge,{iso:m.failed_at,testId:`failed-item-time-value-${m.id}`})}),(0,A.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:o&&(0,A.jsx)("button",{type:"button","data-testid":`retry-item-button-${m.id}`,"aria-label":`${m.file_name} (${m.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:r,onClick:()=>o(m.id,m.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:r?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${m.id}`)})})]})})]})]})}0&&(module.exports={BREAKER_STATE_LABELS,CHUNKING_ONLY_NOTE,CHUNK_BODY_FIDELITY_LABELS,CHUNK_CHANGE_KIND_LABELS,CHUNK_SOURCE_LABELS,CONFIDENTIALITY_LEVEL_LABELS,DEGRADATION_REASON_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,HIDDEN_FIELD_TEXT,HISTORY_REFUSAL,INERT_STAGE_NOTE,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,QUALITY_TIER_LABELS,QdrantStorageCard,RESTRICTED_DOCUMENT_TEXT,RESTRICTED_RUN_TEXT,RESTRICTED_STATE_TEXT,RUN_TERMINAL_STEP_LABEL,RUN_TERMINAL_STEP_OUTCOME_LABELS,RecordedInstant,SCORE_DECIMALS,SCORE_DISPLAY_DECIMALS,SEARCH_FUSION_LABELS,SEARCH_MODE_LABELS,SEARCH_PRESETS,SyncStatusMonitor,UNFINISHED_LABEL,UNRECORDED_RUN_MARK,UNVERIFIED_CHUNK_NOTE,WHITESPACE_NORMALIZED_NOTE,degradationReasonText,documentKindLabel,facetCountsText,fieldLabel,gateCaption,gateState,gateStateOf,historyFailedSentence,historyFailureSentence,ingestRowAction,jsonValueText,layoutFlow,ledgerStepLabel,pipelineRunPresentationKey,rankAgreement,revisionLabel,revisionTransitionText,skipReasonLabel,stepGatePolicy,stepGateState,unrecordedRunsMark,variantHitKey,vectorScoreText});
|
|
3
|
+
`)}function Qe(e,t){return e?xt:t===null||t===""?"\u7121\u3057":String(t)}function lo({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:a}=T(),o=Dt(),r=(0,ae.useId)(),[u,l]=(0,ae.useState)(n?.q??""),[i,x]=(0,ae.useState)(n?.mode??"HYBRID"),[O,P]=(0,ae.useState)(n?.limit??fe.SEARCH_PARAM_LIMITS.limit.default),[p,D]=(0,ae.useState)(n?.threshold??eo),[K,m]=(0,ae.useState)(n?.fusion??"rrf"),[_,S]=(0,ae.useState)(n?.rrf_k??fe.SEARCH_PARAM_LIMITS.rrfK.default),[F,W]=(0,ae.useState)(n?.alpha??fe.SEARCH_PARAM_LIMITS.alpha.default),[Q,ue]=(0,ae.useState)(n?.confidentiality_level??ha),[te,q]=(0,ae.useState)(n?.department_id===void 0?"":String(n.department_id)),[de,Se]=(0,ae.useState)(n?.mime_type??""),[k,Z]=(0,ae.useState)(n?.tag??""),[Y,_e]=(0,ae.useState)(!1),[je,De]=(0,ae.useState)(!1),[Ie,Ce]=(0,ae.useState)(!1),[le,R]=(0,ae.useState)("request"),[X,B]=(0,ae.useState)(!1),[se,ve]=(0,ae.useState)(!1),[oe,Fe]=(0,ae.useState)(null),[f,H]=(0,ae.useState)(null),[pe,me]=(0,ae.useState)(null),[ke,Ve]=(0,ae.useState)(null),Ue=(0,ae.useRef)(0),nt=(0,ae.useRef)(0),Te=(0,ae.useRef)(null);(0,ae.useEffect)(()=>()=>Te.current?.abort(),[]);let at={query:ao(u),department:ro(te),mimeType:wr("MIME \u30BF\u30A4\u30D7",de),tag:wr("\u30BF\u30B0",k)},Ae=X?at:{},Ke=()=>{let g=te.trim(),Re=de.trim(),c=k.trim();return{q:u.trim(),mode:i,limit:O,...i==="DENSE"?{threshold:p}:{},...i==="HYBRID"?{fusion:K,rrf_k:_,...K==="linear"?{alpha:F}:{}}:{},...Q===ha?{}:{confidentiality_level:Q},...g===""?{}:{department_id:Number(g)},...Re===""?{}:{mime_type:Re},...c===""?{}:{tag:c}}},b=async g=>{let Re=new AbortController;Te.current=Re,ve(!0);try{let c=await t(g,Re.signal);if(Re.signal.aborted)return;Fe({params:g,answer:c}),H(c.hits.length===0?null:"1"),me(null),o(c.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${c.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(c){if(Re.signal.aborted)return;Ue.current+=1,me({message:c instanceof Error?c.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:Ue.current})}finally{Te.current===Re&&(Te.current=null,ve(!1))}},w=g=>{g.preventDefault(),B(!0),!(se||Object.values(at).some(Re=>Re!==void 0))&&b(Ke())},U=g=>{x(g.params.mode),P(g.params.limit),g.params.threshold!==void 0&&D(g.params.threshold),g.params.fusion!==void 0&&m(g.params.fusion),g.params.rrf_k!==void 0&&S(g.params.rrf_k),o(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${g.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},z=g=>{if(oe===null)return Zs;switch(g){case"request":return JSON.stringify(oe.params,null,2);case"response":return JSON.stringify(oe.answer,null,2);case"flow":return oo(oe);case"graph":return io(oe)}},ye=async()=>{try{await navigator.clipboard.writeText(z(le)),Ve(null),o(`${tn[le]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(g){nt.current+=1,Ve({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${g instanceof Error?g.message:String(g)}`,occurrence:nt.current})}},V=oe?.answer??null,he=g=>V?.authz_scopes.hidden_columns.includes(g)===!0,Tt=V===null?[]:V.hits.map((g,Re)=>({hit:g,rank:Re+1})),Bt=Tt.find(g=>String(g.rank)===f)??null,Ln=(g,Re)=>{let c=g.scores;return(0,h.jsx)(Un,{id:r,title:`#${Re} ${Qe(he("file_name"),g.file_name)}`,region:!0,testId:"search-hit-detail",children:(0,h.jsxs)(we,{gap:"space-4",testId:"search-hit-detail-body",children:[(0,h.jsx)($t,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:(0,h.jsx)(Bn,{label:"\u878D\u5408\u306E\u5024",value:c.fused,min:0,max:1,valueText:c.fused.toFixed(ht),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":Mn(c.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":c.lexical_rank.toFixed(ht)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:c.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":c.graph_rank.toFixed(ht)})}],testId:"search-hit-scores"}),(0,h.jsx)($t,{items:[{key:"file_uri",term:"URI",description:(0,h.jsx)(G,{fg:"fg",type:"body",face:"mono",children:Qe(he("file_uri"),g.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("mime_type"),g.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("folder_path"),g.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("confidentiality_level"),g.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("department_id"),g.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("created_by"),g.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:he("mtime")?(0,h.jsx)(G,{fg:"fg",type:"body",children:xt}):(0,h.jsx)(be,{iso:g.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:he("tags")||g.tags===null||g.tags.length===0?(0,h.jsx)(G,{fg:"fg",type:"body",children:Qe(he("tags"),null)}):(0,h.jsx)(lt,{gap:"space-2",testId:"search-hit-tags",children:g.tags.map(E=>(0,h.jsx)(qe,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${E}`,children:E},E))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:(0,h.jsx)(G,{fg:"fg",type:"prose",children:Qe(he("ai_summary"),g.ai_summary)})}],testId:"search-hit-fields"}),(0,h.jsxs)(we,{gap:"space-2",testId:"search-hit-relations",children:[(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),g.graph_relations===null?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):g.graph_relations.length===0?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):(0,h.jsx)("ul",{"data-testid":"search-hit-relation-list",children:g.graph_relations.map(E=>(0,h.jsx)("li",{children:(0,h.jsx)(G,{fg:"fg",type:"body",children:`${E.relation} \u2192 ${E.target_name}`})},`${E.relation}-${E.target_name}`))})]}),he("structured_data")||g.structured_data===null?(0,h.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${Qe(he("structured_data"),null)}`}):(0,h.jsx)(Kn,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(g.structured_data,null,2),testId:"search-hit-structured"})]})})};return(0,h.jsxs)(we,{gap:"space-6",testId:"metadata-search-workbench",children:[(0,h.jsx)(dt,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":i,"data-running":se},children:(0,h.jsx)("form",{onSubmit:w,noValidate:!0,"data-testid":"search-form",children:(0,h.jsxs)(we,{gap:"space-4",testId:"search-form-fields",children:[(0,h.jsx)(Nt,{label:"\u691C\u7D22\u8A9E",type:"search",value:u,onValueChange:l,required:!0,description:`1\u301C${fe.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57`,error:Ae.query,testId:"search-query"}),(0,h.jsx)(mn,{label:"\u691C\u7D22\u306E\u6226\u7565",options:fe.SEARCH_MODES.map(g=>({value:g,label:rt[g].label})),value:i,onValueChange:g=>x(g),testId:"search-mode"}),(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:rt[i].description}),(0,h.jsx)(St,{label:"\u4EF6\u6570",value:O,min:fe.SEARCH_PARAM_LIMITS.limit.min,max:fe.SEARCH_PARAM_LIMITS.limit.max,step:1,valueText:g=>`${g} \u4EF6`,onValueChange:P,testId:"search-limit"}),i==="DENSE"&&(0,h.jsx)(St,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:p,min:fe.SEARCH_PARAM_LIMITS.threshold.min,max:fe.SEARCH_PARAM_LIMITS.threshold.max,step:.01,valueText:g=>g.toFixed(2),onValueChange:D,testId:"search-threshold"}),i==="HYBRID"&&(0,h.jsxs)(we,{gap:"space-4",testId:"search-fusion-controls",children:[(0,h.jsx)(mn,{label:"\u878D\u5408",options:fe.SEARCH_FUSIONS.map(g=>({value:g,label:An[g]})),value:K,onValueChange:g=>m(g),testId:"search-fusion"}),(0,h.jsx)(St,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:_,min:fe.SEARCH_PARAM_LIMITS.rrfK.min,max:fe.SEARCH_PARAM_LIMITS.rrfK.max,step:1,valueText:String,onValueChange:S,testId:"search-rrf-k"}),K==="linear"&&(0,h.jsx)(St,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:F,min:fe.SEARCH_PARAM_LIMITS.alpha.min,max:fe.SEARCH_PARAM_LIMITS.alpha.max,step:.05,valueText:g=>g.toFixed(2),onValueChange:W,testId:"search-alpha"})]}),(0,h.jsx)(pn,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:Y,onOpenChange:_e,testId:"search-filters",children:(0,h.jsxs)(we,{gap:"space-4",testId:"search-filter-fields",children:[(0,h.jsx)(Gt,{label:"\u6A5F\u5BC6\u533A\u5206",value:Q,options:[{value:ha,label:"\u5168\u3066\u306E\u533A\u5206"},...fe.FILTERABLE_CONFIDENTIALITY_LEVELS.map(g=>({value:g,label:Lr[g]}))],onValueChange:ue,testId:"search-confidentiality"}),(0,h.jsx)(Nt,{label:"\u90E8\u7F72\u306E ID",type:"text",value:te,onValueChange:q,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:Ae.department,testId:"search-department"}),(0,h.jsx)(Nt,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:de,onValueChange:Se,error:Ae.mimeType,testId:"search-mime-type"}),(0,h.jsx)(Nt,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:k,onValueChange:Z,error:Ae.tag,testId:"search-tag"})]})}),(0,h.jsx)(pn,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:je,onOpenChange:De,testId:"search-presets",children:(0,h.jsx)(we,{gap:"space-2",testId:"search-preset-list",children:Pr.map(g=>(0,h.jsxs)(lt,{gap:"space-2",testId:`search-preset-${g.id}`,children:[(0,h.jsx)(Ne,{variant:"secondary",onClick:()=>U(g),testId:`search-preset-${g.id}-apply`,children:g.title}),(0,h.jsx)(G,{fg:"fg-secondary",type:"body",children:g.description})]},g.id))})}),(0,h.jsx)(lt,{gap:"space-2",testId:"search-actions",children:(0,h.jsx)(Ne,{variant:"primary",type:"submit",busy:se,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),pe!==null&&(0,h.jsx)(We,{occurrence:pe.occurrence,testId:"search-failure",children:pe.message}),V!==null&&(0,h.jsx)(Hn,{metadata:V.search_metadata,testId:"search-degraded"}),V!==null&&(0,h.jsx)(dt,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${V.hits.length} \u4EF6 \xB7 ${Rn(V.search_metadata.execution_time_ms,"execution_time_ms",a)} ms \xB7 \u54C1\u8CEA: ${wt[V.search_metadata.quality_tier]}`,testId:"search-results",children:(0,h.jsxs)(we,{gap:"space-4",testId:"search-results-body",children:[(0,h.jsx)($t,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:(0,h.jsx)(lt,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([g,Re])=>(0,h.jsx)(qe,{tone:V.search_metadata.executed_tiers[g]?"success":"neutral",variant:"tint",testId:`search-tier-${g}`,dataAttributes:{"data-ran":V.search_metadata.executed_tiers[g]},children:`${Re} ${V.search_metadata.executed_tiers[g]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},g))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${Pt[V.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${Pt[V.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-row-scope",children:V.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:(0,h.jsx)(G,{fg:"fg",type:"body",testId:"search-column-scope",children:V.authz_scopes.column_scope_applied?V.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${V.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),(0,h.jsx)(on,{master:(0,h.jsx)(cn,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:Tt,itemKey:g=>String(g.rank),selectedKey:f,onSelect:g=>H(String(g.rank)),detailId:r,renderRow:g=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(G,{fg:"fg",type:"body",children:`#${g.rank} ${Qe(he("file_name"),g.hit.file_name)}`}),(0,h.jsx)(Bn,{label:`#${g.rank} \u306E\u878D\u5408\u306E\u5024`,value:g.hit.scores.fused,min:0,max:1,valueText:g.hit.scores.fused.toFixed(ht),testId:`search-hit-${g.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:g=>({"data-rank":g.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Bt===null?(0,h.jsx)(Un,{id:r,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:(0,h.jsx)(G,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):Ln(Bt.hit,Bt.rank),masterMinPx:to,detailMinPx:no,testId:"search-master-detail"})]})}),(0,h.jsx)(pn,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:Ie,onOpenChange:Ce,testId:"search-inspector",children:(0,h.jsxs)(we,{gap:"space-4",testId:"search-inspector-body",children:[(0,h.jsx)(mn,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(tn).map(g=>({value:g,label:tn[g]})),value:le,onValueChange:g=>R(g),testId:"search-inspector-view"}),(0,h.jsx)(Kn,{label:`\u70B9\u691C\u306E\u7A93: ${tn[le]}`,code:z(le),testId:"search-inspector-code"}),(0,h.jsx)(lt,{gap:"space-2",testId:"search-inspector-actions",children:(0,h.jsx)(Ne,{variant:"secondary",onClick:()=>{ye()},testId:"search-inspector-copy",children:`${tn[le]}\u3092\u5199\u3059`})}),ke!==null&&(0,h.jsx)(We,{occurrence:ke.occurrence,testId:"search-inspector-copy-failure",children:ke.message})]})})]})}var yt=require("@aiquants/enrichment-core"),Oe=require("react");var re=require("react/jsx-runtime"),Dr=4;function $r(e){return`${e.label} (${e.embeddingModel})`}function co(e){let t=e.trim().length;return t<yt.SEARCH_PARAM_LIMITS.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>yt.SEARCH_PARAM_LIMITS.queryLength.max?`\u554F\u3044\u306F ${yt.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function uo({variants:e,onCompare:t}){let{formatLocale:n}=T(),a=Dt(),[o,r]=(0,Oe.useState)(null),[u,l]=(0,Oe.useState)(null),[i,x]=(0,Oe.useState)(""),[O,P]=(0,Oe.useState)(yt.SEARCH_PARAM_LIMITS.limit.default),[p,D]=(0,Oe.useState)(!1),[K,m]=(0,Oe.useState)(!1),[_,S]=(0,Oe.useState)(null),[F,W]=(0,Oe.useState)(null),Q=(0,Oe.useRef)(0),ue=(0,Oe.useRef)(null);(0,Oe.useEffect)(()=>()=>ue.current?.abort(),[]);let te=e.map(R=>R.strategyId),q=o!==null&&te.includes(o)?o:te[0]??null,de=u!==null&&te.includes(u)?u:te[1]??null,Se=q!==null&&q===de,k={query:co(i),variant:Se?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},Z=p?k.query:void 0,Y=R=>{let X=e.find(B=>B.strategyId===R);return X===void 0?`\u6226\u7565 #${R}`:$r(X)},_e=R=>{Q.current+=1,S(null),W({message:R,occurrence:Q.current})},je=async R=>{let X=new AbortController;ue.current=X,m(!0);try{let B=await t(R,X.signal);if(X.signal.aborted)return;let se=B.results.find(oe=>oe.strategy_id===R.strategy_ids[0]),ve=B.results.find(oe=>oe.strategy_id===R.strategy_ids[1]);if(se===void 0||ve===void 0){_e(`\u7B54\u3048\u306B\u6226\u7565 #${se===void 0?R.strategy_ids[0]:R.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}S({input:R,answer:B,results:[se,ve]}),W(null),a(`\u5909\u7A2E A \u306F ${se.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${ve.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(B){if(X.signal.aborted)return;_e(B instanceof Error?B.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{ue.current===X&&(ue.current=null,m(!1))}},De=R=>{R.preventDefault(),D(!0),!(K||q===null||de===null||k.query!==void 0||k.variant!==void 0)&&je({query:i.trim(),strategy_ids:[q,de],limit:O})},Ie=e.map(R=>({value:String(R.strategyId),label:$r(R)})),Ce=(R,X,B,se,ve)=>R===void 0?(0,re.jsx)(G,{fg:"fg-muted",type:"body",testId:`compare-${X}-${B}-${se}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):(0,re.jsxs)(we,{gap:"space-1",testId:`compare-${X}-${B}-${se}`,children:[(0,re.jsx)(G,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${R.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${R.chunk_index} \xB7 ${R.score.toFixed(Dr)}`}),(0,re.jsx)(G,{fg:"fg",type:"prose",children:ve||R.text===null?xt:R.text})]}),le=({answer:R,results:X})=>{let[B,se]=X,ve=On(B.hits.map(sn),se.hits.map(sn)),oe=Array.from({length:Math.max(B.hits.length,se.hits.length)},(f,H)=>H+1),Fe=(f,H)=>({key:H,heading:`\u5909\u7A2E ${H.toUpperCase()}: ${Y(f.strategy_id)} \xB7 ${Rn(f.execution_ms,`execution_ms of strategy ${f.strategy_id}`,n)} ms`,cells:Object.fromEntries(oe.map(pe=>[`rank-${pe}`,me=>Ce(f.hits[pe-1],H,pe,me,R.text_hidden)]))});return(0,re.jsx)(dt,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:(0,re.jsxs)(we,{gap:"space-4",testId:"compare-results-body",children:[(0,re.jsx)($t,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${ve.sharedCount} \u4EF6 (A ${B.hits.length} \u4EF6 / B ${se.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:ve.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(ve.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-rank-difference",children:ve.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":ve.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:(0,re.jsx)(G,{fg:"fg",type:"body",testId:"compare-text-hidden",children:R.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[B,"A"],[se,"B"]].map(([f,H])=>f.dense_ran?null:(0,re.jsx)(ze,{tone:"warning",testId:`compare-degraded-${H.toLowerCase()}`,children:(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${H} (${Y(f.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${f.degradation_reasons.map(Ht).join(" ")}`})},H)),oe.length===0?(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,re.jsx)(dn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:oe.map(f=>({key:`rank-${f}`,label:`${f} \u4F4D`})),columns:[Fe(B,"a"),Fe(se,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return(0,re.jsxs)(we,{gap:"space-6",testId:"model-comparison-workbench",children:[(0,re.jsx)(dt,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":K},children:e.length<2?(0,re.jsx)(ze,{tone:"info",testId:"compare-variants-insufficient",children:(0,re.jsx)(G,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):(0,re.jsx)("form",{onSubmit:De,noValidate:!0,"data-testid":"compare-form",children:(0,re.jsxs)(we,{gap:"space-4",testId:"compare-form-fields",children:[(0,re.jsx)(Gt,{label:"\u5909\u7A2E A",value:String(q),options:Ie,onValueChange:R=>r(Number(R)),testId:"compare-variant-a"}),(0,re.jsx)(Gt,{label:"\u5909\u7A2E B",value:String(de),options:Ie,onValueChange:R=>l(Number(R)),error:k.variant,testId:"compare-variant-b"}),(0,re.jsx)(Nt,{label:"\u554F\u3044",type:"search",value:i,onValueChange:x,required:!0,description:`1\u301C${yt.SEARCH_PARAM_LIMITS.queryLength.max} \u5B57`,error:Z,testId:"compare-query"}),(0,re.jsx)(St,{label:"\u4EF6\u6570",value:O,min:yt.SEARCH_PARAM_LIMITS.limit.min,max:yt.SEARCH_PARAM_LIMITS.limit.max,step:1,valueText:R=>`${R} \u4EF6`,onValueChange:P,testId:"compare-limit"}),(0,re.jsx)(lt,{gap:"space-2",testId:"compare-actions",children:(0,re.jsx)(Ne,{variant:"primary",type:"submit",busy:K,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),F!==null&&(0,re.jsx)(We,{occurrence:F.occurrence,testId:"compare-failure",children:F.message}),_!==null&&le(_)]})}var C=require("react/jsx-runtime");function Ar(e){return e===null?an:`${e.length} \u7A2E`}var an="\u672A\u8A2D\u5B9A";function nn(e,t=""){return e===null?an:`${e}${t}`}function kn(e){return e===null?an:`${e} \u4EF6`}function po(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?an:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??an})`}function mo({tenantId:e,ontologyStatus:t}){let n=t.classes,a=t.predicates;return(0,C.jsxs)("div",{"data-cui-migration":"pending",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:po(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:kn(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:kn(t.searchIndexes)}),(0,C.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",kn(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:[nn(t.promotionThresholds.confidence)," / ",nn(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:kn(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:Ar(n)})]}),(0,C.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[n===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"}),n?.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:Ar(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-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"}),a?.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 ",nn(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",nn(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",nn(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 xe=require("@aiquants/enrichment-core"),$e=require("react");var Tn=require("@aiquants/console-ui/core"),wn=require("@aiquants/enrichment-core"),kt={inset:12,labelFontSize:13,captionFontSize:11},bt={offset:3,stroke:2},Mr={node:{width:(0,Tn.ceil8)(Math.max(...Object.values(wn.PIPELINE_STEPS).map(e=>(0,Tn.textWidthEm)(e.label)))*kt.labelFontSize+2*kt.inset),height:56},gap:{column:48,row:24},padding:24};function gt(e){return Math.round(e*1e3)/1e3}function fo(e){let t=new Map;for(let n of e){let a=n.dependsOn.reduce((o,r)=>Math.max(o,t.get(r)),-1);t.set(n.step,a+1)}return t}function va(e,t){return`${e}->${t}`}function yo(e,t){let n=[],a=new Map;return{slots:[...e.map(r=>{let u=t.get(r.step),l=r.dependsOn.map(i=>{let x=[],O=i;for(let P=t.get(i)+1;P<u;P+=1){let p=`${va(i,r.step)}@${P}`;n.push({id:p,rank:P,predecessors:[O]}),x.push(p),O=p}return a.set(va(i,r.step),x),O});return{id:r.step,rank:u,predecessors:l}}),...n],chains:a}}function go(e){let t=new Map,n=Math.max(...e.map(a=>a.rank));for(let a=0;a<=n;a+=1){let r=e.filter(u=>u.rank===a).map((u,l)=>{let i=a===0?l:u.predecessors.reduce((x,O)=>x+t.get(O),0)/u.predecessors.length;return{slot:u,barycenter:i}});r.sort((u,l)=>u.barycenter-l.barycenter),r.forEach(({slot:u},l)=>{t.set(u.id,l)})}return t}function Sa(e,t=Mr){let n=(0,wn.orderedSteps)(e),a=fo(n),{slots:o,chains:r}=yo(n,a),u=go(o),{node:l,gap:i,padding:x}=t,O=F=>({x:gt(x+F.rank*(l.width+i.column)),y:gt(x+u.get(F.id)*(l.height+i.row))}),P=new Map(o.map(F=>[F.id,O(F)])),p=n.map(F=>{let W=P.get(F.step);return{key:F.step,x:W.x,y:W.y,rank:a.get(F.step),order:u.get(F.step),width:l.width,height:l.height}}),D=F=>gt(F+l.height/2),K=n.flatMap(F=>F.dependsOn.map(W=>{let Q=P.get(W),ue=P.get(F.step),te=gt(Q.x+l.width),q=D(Q.y),de=`M ${te} ${q}`,Se=(k,Z)=>{let Y=gt((te+k)/2);de+=` C ${Y} ${q}, ${Y} ${Z}, ${k} ${Z}`};for(let k of r.get(va(W,F.step))){let Z=P.get(k),Y=D(Z.y);Se(Z.x,Y),te=gt(Z.x+l.width),q=Y,de+=` L ${te} ${q}`}return Se(ue.x,D(ue.y)),{from:W,to:F.step,path:de}})),m=[...P.values()],_=gt(Math.max(...m.map(F=>F.x+l.width))+x),S=gt(Math.max(...m.map(F=>F.y+l.height))+x);return{width:_,height:S,steps:p,edges:K}}var y=require("react/jsx-runtime"),Or="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Na={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},Fr={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},_a={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"}},Ia={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"},bo={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},rn="rgb(248 250 252)",xo={backgroundColor:rn,backgroundImage:`linear-gradient(to right, ${rn}, ${rn}), linear-gradient(to right, ${rn}, ${rn}), 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 Ca(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function Ur(e,t){let n=e.map(a=>({gate:a,state:Ca(a,t)}));return n.some(({gate:a,state:o})=>o==="closed"&&a.whenClosed==="fail")?"closed-fail":n.some(({state:a})=>a==="closed")?"closed-skip":n.some(({state:a})=>a==="unmeasured")?"unmeasured":"open"}function Ea(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function Kr(e,t){let{badge:n}=_a[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${Ia[t]}`}function ho(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 Ra(e){return e.map(t=>xe.PIPELINE_STEPS[t].label).join("\u3001")}function vo(e){return e.dependsOn.length===0?Or:`\u4F9D\u5B58: ${Ra(e.dependsOn)}`}function So({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:a,onSelectKind:o,selectedStepKey:r,onSelectStep:u}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let l=(0,$e.useId)(),i=(0,$e.useId)(),x=(0,$e.useId)(),O=(0,$e.useId)(),P=(0,$e.useId)(),[p,D]=(0,$e.useState)(xe.DOCUMENT_KINDS[0]),[K,m]=(0,$e.useState)(null),[_,S]=(0,$e.useState)(null),F=(0,$e.useRef)(new Map),W=(0,$e.useRef)(new Map),Q=(0,$e.useRef)(null),ue=(0,$e.useRef)(null),{labels:te}=T(),q=a!==void 0?a:p,de=r!==void 0?r:K,Se=(0,xe.flowFor)(q),k=Sa(Se),Z=new Map(Se.steps.map(f=>[f.step,f])),Y=f=>{m(f),u?.(f)},_e=f=>{D(f),o?.(f),Y(null)},je=(f,H)=>{let pe=xe.DOCUMENT_KINDS.length-1,me;switch(f.key){case"ArrowRight":me=H===pe?0:H+1;break;case"ArrowLeft":me=H===0?pe:H-1;break;case"Home":me=0;break;case"End":me=pe;break;default:return}f.preventDefault();let ke=xe.DOCUMENT_KINDS[me];_e(ke),F.current.get(ke)?.focus()},De=f=>{let H=ue.current;if(Y(null),H?.isConnected){H.focus();return}W.current.get(f)?.focus()},Ie=f=>{Y(f===de?null:f)},Ce=(f,H)=>{f.currentTarget.focus(),Ie(H)},le=(f,H)=>{f.key==="Enter"||f.key===" "?(f.preventDefault(),Ie(H)):f.key==="Escape"&&Y(null)},R=de===null?void 0:Z.get(de),X=R===void 0?null:R.step;(0,$e.useEffect)(()=>{if(X===null){ue.current=null;return}let f=document.activeElement;(f instanceof HTMLElement||f instanceof SVGElement)&&f!==document.body&&Q.current?.contains(f)===!1&&(ue.current=f)},[X]);let B=R===void 0?void 0:xe.PIPELINE_STEPS[R.step],se=R===void 0?[]:(0,xe.flowStepGates)(R),ve=R===void 0?[]:Se.steps.filter(f=>f.dependsOn.includes(R.step)).map(f=>f.step),oe=B===void 0?void 0:t.find(f=>f.documentKind===q&&f.stepKey===B.key),Fe=xe.DOCUMENT_KIND_LABELS[q];return(0,y.jsxs)("section",{"data-cui-migration":"pending",className:"space-y-6","aria-labelledby":l,"data-testid":"pipeline-flow-viewer","data-kind":q,children:[(0,y.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,y.jsx)("h2",{id:l,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),(0,y.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,y.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:xe.DOCUMENT_KINDS.map((f,H)=>{let pe=f===q;return(0,y.jsx)("button",{ref:me=>{me===null?F.current.delete(f):F.current.set(f,me)},type:"button",role:"tab","aria-selected":pe,"aria-controls":i,tabIndex:pe?0:-1,onClick:()=>_e(f),onKeyDown:me=>je(me,H),className:pe?"rounded-lg border border-indigo-600 border-solid bg-indigo-600 px-3 py-1.5 font-semibold text-[13px] text-white":"rounded-lg border border-slate-300 border-solid bg-white px-3 py-1.5 font-medium text-[13px] text-slate-700 hover:bg-slate-50","data-testid":`flow-kind-${f}`,children:xe.DOCUMENT_KIND_LABELS[f]},f)})}),(0,y.jsx)("div",{id:i,role:"tabpanel","aria-label":`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u6D41\u308C`,"aria-describedby":x,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:xo,"data-testid":"flow-scroll",children:(0,y.jsxs)("svg",{viewBox:`0 0 ${k.width} ${k.height}`,width:k.width,height:k.height,role:"group","aria-label":`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[(0,y.jsx)("title",{children:`${xe.DOCUMENT_KIND_LABELS[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),(0,y.jsx)("defs",{children:(0,y.jsx)("marker",{id:`${i}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:(0,y.jsx)("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),k.edges.map(f=>(0,y.jsx)("path",{d:f.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${i}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${f.from}-${f.to}`},`${f.from}-${f.to}`)),k.steps.map(f=>{let H=xe.PIPELINE_STEPS[f.key],pe=Z.get(f.key),me=(0,xe.flowStepGates)(pe),ke=Ur(me,e),Ve=Ea(me),Ue=_a[ke],nt=Kr(ke,Ve),Te=f.key===de,at=f.key===_,Ae=`${i}-depends-${f.key}`;return(0,y.jsxs)("g",{ref:Ke=>{Ke===null?W.current.delete(f.key):W.current.set(f.key,Ke)},transform:`translate(${f.x} ${f.y})`,role:"button",tabIndex:0,"aria-label":`${H.label} (${nt})`,"aria-describedby":Ae,"aria-expanded":Te,"aria-controls":Te?P:void 0,onClick:Ke=>Ce(Ke,f.key),onKeyDown:Ke=>le(Ke,f.key),onFocus:()=>S(f.key),onBlur:()=>S(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${f.key}`,"data-step-key":f.key,"data-gate-state":ke,"data-gate-policy":Ve,"data-selected":Te,"data-focused":at,children:[(0,y.jsx)("desc",{id:Ae,"data-testid":`flow-node-dependencies-${f.key}`,children:vo(pe)}),at&&(0,y.jsx)("rect",{x:-bt.offset,y:-bt.offset,width:f.width+2*bt.offset,height:f.height+2*bt.offset,rx:8+bt.offset,fill:"none",strokeWidth:bt.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${f.key}`}),(0,y.jsx)("rect",{width:f.width,height:f.height,rx:8,strokeWidth:Te?3:1.5,strokeDasharray:Ue.dash,className:`${Ue.stroke} ${Te?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${f.key}`}),(0,y.jsx)("text",{x:kt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${f.key}`,children:H.label}),(0,y.jsx)("text",{x:kt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${f.key}`,children:Na[H.phase]}),(0,y.jsx)("text",{x:kt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${f.key}`,"data-gate-state":ke,children:nt})]},f.key)})]})}),(0,y.jsxs)("p",{id:x,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",k.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"]})]}),B!==void 0&&R!==void 0&&(0,y.jsxs)("section",{id:P,ref:Q,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":O,"data-testid":"flow-step-detail","data-step-key":B.key,children:[(0,y.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{id:O,className:"font-bold text-base text-slate-900",children:B.label}),(0,y.jsx)("p",{className:"mt-1 text-[13px] text-slate-600",children:B.description})]}),(0,y.jsx)("button",{type:"button",onClick:()=>De(B.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,y.jsxs)("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),(0,y.jsx)("dd",{children:(0,y.jsx)("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:B.endpoint})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),(0,y.jsxs)("dd",{"data-testid":"flow-step-phase",children:[Na[B.phase]," (",B.phase,")"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),(0,y.jsx)("dd",{"data-testid":"flow-step-capability",children:B.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":B.capability})]}),R.chunkSource!==void 0&&(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),(0,y.jsxs)("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":R.chunkSource,children:[Fr[R.chunkSource]," (",R.chunkSource,")"]})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),(0,y.jsx)("dd",{"data-testid":"flow-step-depends-on",children:R.dependsOn.length===0?Or:Ra(R.dependsOn)})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),(0,y.jsx)("dd",{"data-testid":"flow-step-dependents",children:ve.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Ra(ve)})]}),(0,y.jsxs)("div",{className:"sm:col-span-2",children:[(0,y.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),(0,y.jsx)("dd",{children:se.length===0?(0,y.jsx)("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("ul",{className:"space-y-1",children:se.map(f=>{let H=Ca(f,e);return(0,y.jsxs)("li",{"data-testid":`flow-gate-${f.featureFlagKey}`,"data-gate-state":H,"data-when-closed":f.whenClosed,children:[(0,y.jsx)("code",{className:"font-mono",children:f.featureFlagKey}),": ",bo[H]," \u2014 ",ho(f)]},f.featureFlagKey)})}),R.gatePolicy!==void 0&&(0,y.jsxs)("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Fe," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",Ia[Ea(B.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",R.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),(0,y.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":q,children:[(0,y.jsxs)("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Fe,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),(0,y.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Fe," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),oe===void 0?(0,y.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[te.unmeasured," (",Fe," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-sample-count",children:(0,y.jsx)(j,{value:oe.sampleCount,testId:"flow-metric-sample-count-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6210\u529F"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-succeeded",children:(0,y.jsx)(j,{value:oe.succeeded,testId:"flow-metric-succeeded-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u5931\u6557"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-failed",children:(0,y.jsx)(j,{value:oe.failed,testId:"flow-metric-failed-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u7701\u7565"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-skipped",children:(0,y.jsx)(j,{value:oe.skipped,testId:"flow-metric-skipped-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"p50"}),(0,y.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:(0,y.jsx)(j,{value:oe.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"p95"}),(0,y.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:(0,y.jsx)(j,{value:oe.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),(0,y.jsxs)("div",{className:"col-span-2",children:[(0,y.jsx)("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),(0,y.jsx)("dd",{"data-testid":"flow-metric-last-started-at",children:(0,y.jsx)(be,{iso:oe.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),(0,y.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 ",te.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,y.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,y.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),(0,y.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,y.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",xe.DOCUMENT_KIND_LABELS.other,"\u300D\u3067\u3059\u3002"]}),(0,y.jsx)("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:(0,y.jsxs)("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[(0,y.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),(0,y.jsx)("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),(0,y.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100",children:xe.MIME_KIND_RULES.map(([f,H],pe)=>(0,y.jsxs)("tr",{className:H===q?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${pe}`,"data-kind":H,"data-selected":H===q,children:[(0,y.jsx)("td",{className:"px-3 py-2",children:(0,y.jsx)("code",{className:"font-mono",children:f})}),(0,y.jsx)("td",{className:"px-3 py-2",children:xe.DOCUMENT_KIND_LABELS[H]})]},f))})]})})]})]})}var Pn=require("@aiquants/console-ui/core"),qr=require("react");var L=require("react/jsx-runtime");function No(e,t){return e==null?null:ft(e,"segment_count",t)}function Br(e,t,n){return e==null?null:_n(e,t,n)}function Eo(e){let t=e.probe_failure;if(t===null)return null;if(!jt.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 Hr(e,t,n){return e.reduce((a,o)=>a+ft(o[t],`${t} of collection ${o.collection_name}`,n),0)}var Ro=(0,Pn.cssVar)("space-1"),_o={padding:0,height:"1px",color:"#1e293b"},Io={display:"flex",height:"100%"},Co={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},ko={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},To={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},ka={whiteSpace:"nowrap"},Vr=(0,Pn.cssVar)("space-3"),wo=(0,Pn.cssVar)("info-tint"),Ta={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function Gr(e,t){return`vectors_config.${e}.size of collection ${t}`}function Po({overview:e,health:t,resources:n,onRefresh:a,isRefreshing:o=!1,selection:r}){let{formatLocale:u}=T(),l=(0,qr.useId)(),{collections:i}=e,x=Eo(e),O=x===null,P=O?Hr(i,"points_count",u):null,p=O?Hr(i,"vectors_count",u):null,D=Br(n?.ram_bytes,"ram_bytes",u),K=Br(n?.disk_bytes,"disk_bytes",u),m=No(n?.segment_count,u);return(0,L.jsxs)("div",{"data-cui-migration":"pending","data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,L.jsxs)("div",{"data-testid":"qdrant-card-header",style:ko,children:[(0,L.jsxs)("div",{"data-testid":"qdrant-card-title-group",style:To,children:[(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Kt[t.healthy?"connected":"error"],style:{...ka,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ut[t.healthy?"connected":"error"]}),(0,L.jsxs)("span",{"data-testid":"qdrant-latency",style:{...ka,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",(0,L.jsx)(j,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),a&&(0,L.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:o,onClick:a,style:{...ka,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,L.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:P,testId:"qdrant-total-points-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:p,testId:"qdrant-total-vectors-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,L.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(He,{text:D,testId:"qdrant-ram-usage-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,L.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(He,{text:K,testId:"qdrant-disk-usage-value"})})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,L.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,L.jsx)(j,{value:m,testId:"qdrant-segment-count-value"})})]})]}),(0,L.jsxs)("div",{children:[(0,L.jsxs)("h3",{id:l,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",(0,L.jsx)(j,{value:O?i.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),x!==null?(0,L.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:x}):i.length===0?(0,L.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,L.jsx)("section",{tabIndex:0,"aria-labelledby":l,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Ro},children:(0,L.jsxs)("table",{"aria-labelledby":l,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,L.jsx)("thead",{children:(0,L.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[(0,L.jsx)("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${Vr}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,L.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,L.jsx)("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,L.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,L.jsx)("tbody",{children:i.map(_=>{let S=r!==void 0&&_.collection_name===r.selectedCollectionName,F=(0,L.jsx)("span",{style:Co,children:_.collection_name}),{dense:W,sparse:Q,image:ue}=_.vectors_config,te=W===void 0?null:ft(W.size,Gr("dense",_.collection_name),u),q=ue===void 0?null:ft(ue.size,Gr("image",_.collection_name),u);return(0,L.jsxs)("tr",{"data-testid":`collection-row-${_.collection_name}`,"data-collection-name":_.collection_name,"data-selected":String(S),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:S?wo:"transparent"},children:[r===void 0?(0,L.jsx)("td",{style:{padding:`8px ${Vr}`,color:"#1e293b"},children:F}):(0,L.jsx)("td",{style:_o,children:(0,L.jsx)("div",{style:Io,children:(0,L.jsx)($a,{selected:S,controls:r.detailId,onSelect:()=>r.onSelectCollection(_.collection_name),testId:`collection-select-${_.collection_name}`,children:F})})}),(0,L.jsx)("td",{style:{padding:"8px",color:"#475569"},children:_.domain_key}),(0,L.jsx)("td",{"data-testid":`collection-points-${_.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:(0,L.jsx)(j,{value:_.points_count,testId:`collection-points-value-${_.collection_name}`})}),(0,L.jsx)("td",{style:{padding:"8px"},children:(0,L.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[te!==null&&(0,L.jsxs)("span",{"data-testid":`vector-tag-dense-${_.collection_name}`,style:{...Ta,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",(0,L.jsx)(j,{value:te,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${_.collection_name}`})]}),Q!==void 0&&(0,L.jsx)("span",{"data-testid":`vector-tag-sparse-${_.collection_name}`,style:{...Ta,backgroundColor:"#fef3c7",color:"#92400e"},children:Q.modifier?`Sparse (${Q.modifier.toUpperCase()})`:"Sparse"}),q!==null&&(0,L.jsxs)("span",{"data-testid":`vector-tag-image-${_.collection_name}`,style:{...Ta,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",(0,L.jsx)(j,{value:q,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${_.collection_name}`})]})]})})]},_.collection_name)})})]})})]})]})}var A=require("react/jsx-runtime"),Lo="\u5BFE\u8C61\u306A\u3057";function $o({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:a,onRetryItem:o,isRetrying:r=!1,onRefresh:u,listRefusal:l}){T();let i=e.SYNCED??0,x=e.PENDING??0,O=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),P=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),p=t>0?`${(i/t*100).toFixed(1)}%`:Lo;return(0,A.jsxs)("div",{"data-cui-migration":"pending","data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,A.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,A.jsxs)("div",{children:[(0,A.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,A.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,A.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,A.jsx)("span",{"data-testid":"success-rate-value",children:p}),")"]})]}),(0,A.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[u&&(0,A.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:u,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),a&&(0,A.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:r||P===0,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:r||P===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:r||P===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:r?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,A.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,A.jsxs)("div",{"data-testid":"status-card-synced","data-count":i,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,A.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:i})]}),(0,A.jsxs)("div",{"data-testid":"status-card-processing","data-count":O,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,A.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:O})]}),(0,A.jsxs)("div",{"data-testid":"status-card-pending","data-count":x,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,A.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:x})]}),(0,A.jsxs)("div",{"data-testid":"status-card-failed","data-count":P,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,A.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,A.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:P})]})]}),(0,A.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,A.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",l!==void 0?"":` (${n.length<P?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${P} \u4EF6`:`${n.length} \u4EF6`})`]}),l!==void 0?(0,A.jsx)(ze,{tone:"warning",testId:"failed-items-refused",children:l}):n.length===0?(0,A.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,A.jsx)("div",{style:{overflowX:"auto"},children:(0,A.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,A.jsx)("thead",{children:(0,A.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,A.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,A.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,A.jsx)("tbody",{children:n.map((D,K)=>{if(D.kind==="restricted")return(0,A.jsxs)("tr",{"data-testid":`failed-item-restricted-${K}`,"data-restricted-mark":"failure",children:[(0,A.jsx)("td",{"data-testid":`failed-item-restricted-text-${K}`,style:{padding:"8px"},children:Rt}),(0,A.jsx)("td",{style:{padding:"8px"},children:(0,A.jsx)("span",{"data-testid":`failed-item-restricted-status-${K}`,style:{fontSize:"11px"},children:D.syncStatus})}),(0,A.jsx)("td",{style:{padding:"8px"}}),(0,A.jsx)("td",{"data-testid":`failed-item-restricted-time-${K}`,style:{padding:"8px",whiteSpace:"nowrap"},children:D.failedAt===null?"\u8A18\u9332\u306A\u3057":(0,A.jsx)(be,{iso:D.failedAt,testId:`failed-item-restricted-time-value-${K}`})}),(0,A.jsx)("td",{style:{padding:"8px"}})]},`restricted:${K}`);let m=D.item;return(0,A.jsxs)("tr",{"data-testid":`failed-item-row-${m.id}`,"data-file-uri":m.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,A.jsxs)("td",{"data-testid":`failed-item-uri-${m.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,A.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:m.file_name}),(0,A.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:m.file_uri})]}),(0,A.jsx)("td",{style:{padding:"8px"},children:(0,A.jsx)("span",{"data-testid":`failed-item-status-${m.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:m.sync_status})}),(0,A.jsx)("td",{"data-testid":`failed-item-error-${m.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:m.error_message??"",children:m.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,A.jsx)("td",{"data-testid":`failed-item-time-${m.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:m.failed_at===null?"\u8A18\u9332\u306A\u3057":(0,A.jsx)(be,{iso:m.failed_at,testId:`failed-item-time-value-${m.id}`})}),(0,A.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:o&&(0,A.jsx)("button",{type:"button","data-testid":`retry-item-button-${m.id}`,"aria-label":`${m.file_name} (${m.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:r,onClick:()=>o(m.id,m.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:r?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${m.id}`)})})]})})]})]})}0&&(module.exports={BREAKER_STATE_LABELS,CHUNKING_ONLY_NOTE,CHUNK_BODY_FIDELITY_LABELS,CHUNK_CHANGE_KIND_LABELS,CHUNK_SOURCE_LABELS,CONFIDENTIALITY_LEVEL_LABELS,DEGRADATION_REASON_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,HIDDEN_FIELD_TEXT,HISTORY_REFUSAL,INERT_STAGE_NOTE,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,QUALITY_TIER_LABELS,QdrantStorageCard,RESTRICTED_DOCUMENT_TEXT,RESTRICTED_RUN_TEXT,RESTRICTED_STATE_TEXT,RUN_TERMINAL_STEP_LABEL,RUN_TERMINAL_STEP_OUTCOME_LABELS,RecordedInstant,SCORE_DECIMALS,SCORE_DISPLAY_DECIMALS,SEARCH_FUSION_LABELS,SEARCH_MODE_LABELS,SEARCH_PRESETS,SyncStatusMonitor,UNFINISHED_LABEL,UNRECORDED_RUN_MARK,UNVERIFIED_CHUNK_NOTE,WHITESPACE_NORMALIZED_NOTE,degradationReasonText,documentKindLabel,facetCountsText,fieldLabel,gateCaption,gateState,gateStateOf,historyFailedSentence,historyFailureSentence,ingestRowAction,jsonValueText,layoutFlow,ledgerStepLabel,pipelineRunPresentationKey,rankAgreement,revisionLabel,revisionTransitionText,skipReasonLabel,stepGatePolicy,stepGateState,unrecordedRunsMark,variantHitKey,vectorScoreText});
|