@aiquants/governance-react 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Quants
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @aiquants/governance-react
2
+
3
+ React UI components for enterprise knowledge governance:
4
+ CitationProofBadge, DryRunDiffViewer, KnowledgeGraphExplorer, SystemParameterTable, FeatureFlagBoard, PromptTemplateConsole, ClassificationRuleEditor, and TriStoreIntegrityAudit.
5
+
6
+ ## Prerequisites
7
+
8
+ - Node.js >= 18.0.0
9
+ - React >= 18.0.0
10
+ - `@aiquants/enrichment-core`
11
+ - `@aiquants/governance-core`
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pnpm add @aiquants/governance-react @aiquants/governance-core @aiquants/enrichment-core
17
+ ```
18
+
19
+ ## Exported Components
20
+
21
+ 1. `CitationProofBadge`: Visual badge for cryptographic Merkle citation proof status and groundness.
22
+ 2. `DryRunDiffViewer`: Side-by-side or comparison viewer for dry-run simulation against golden benchmarks.
23
+ 3. `KnowledgeGraphExplorer`: Interactive Neo4j knowledge graph explorer with bitemporal timeline and HITL approval queue.
24
+ 4. `SystemParameterTable`: Table for safely editing and invalidating the 25 system parameters.
25
+ 5. `FeatureFlagBoard`: Switchboard for the 15 system feature flags with double-confirmation safety modals.
26
+ 6. `PromptTemplateConsole`: Browser editor and benchmark dry-run test console for 7 prompt templates.
27
+ 7. `ClassificationRuleEditor`: Priority reordering and condition editor for dynamic classification rules.
28
+ 8. `TriStoreIntegrityAudit`: Consistency audit viewer across SQL Server, Qdrant, and Neo4j.
29
+
30
+ ## License
31
+
32
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var se=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var We=Object.prototype.hasOwnProperty;var Fe=(e,r)=>{for(var i in r)se(e,i,{get:r[i],enumerable:!0})},De=(e,r,i,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Ge(r))!We.call(e,s)&&s!==i&&se(e,s,{get:()=>r[s],enumerable:!(d=Me(r,s))||d.enumerable});return e};var je=e=>De(se({},"__esModule",{value:!0}),e);var yt={};Fe(yt,{CitationProofBadge:()=>qe,ClassificationRuleEditor:()=>Ue,ConfidentialityPolicyBoard:()=>Ve,FeatureFlagBoard:()=>Ze,GovernanceDryRunConsole:()=>ot,KnowledgeGraphExplorer:()=>ct,PromptTemplateConsole:()=>ft,SCHEMA_PRESETS:()=>fe,SystemParameterTable:()=>bt,TranscriptionAdaptationBoard:()=>xt,TriStoreIntegrityAudit:()=>gt,computeDateFromPercent:()=>Re,normalizeDomain:()=>be,parseBoost:()=>Be,parseParameterValue:()=>we});module.exports=je(yt);var ge=require("react"),B=require("react/jsx-runtime");function Ke(e){return!e||e.length<16?e??"N/A":`${e.slice(0,8)}...${e.slice(-8)}`}function qe({proof:e,verificationState:r="verified",onVerify:i,isVerifying:d=!1}){let[s,a]=(0,ge.useState)(!1),u={verified:{bg:"#ecfdf5",text:"#065f46",label:"\u691C\u8A3C\u6E08\u307F (Verified)"},degraded:{bg:"#fffbeb",text:"#92400e",label:"\u7E2E\u9000\u30E2\u30FC\u30C9 (Degraded)"},invalid:{bg:"#fef2f2",text:"#991b1b",label:"\u6539\u3056\u3093\u691C\u77E5 (Invalid)"},pending:{bg:"#f1f5f9",text:"#475569",label:"\u672A\u691C\u8A3C (Pending)"}},{bg:o,text:x,label:g}=u[r];return(0,B.jsxs)("div",{"data-testid":"citation-proof-badge","data-verification-state":r,"data-leaf-count":e.leaf_count,"data-grounded":String(e.is_fully_grounded),style:{display:"inline-block",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"8px 12px",backgroundColor:"#ffffff",fontSize:"13px"},children:[(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[(0,B.jsx)("span",{"data-testid":"proof-state-label",style:{padding:"2px 8px",borderRadius:"12px",backgroundColor:o,color:x,fontWeight:600,fontSize:"12px"},children:g}),(0,B.jsxs)("span",{style:{color:"#64748b"},children:["\u30EA\u30FC\u30D5\u6570: ",(0,B.jsx)("strong",{"data-testid":"merkle-leaf-count",children:e.leaf_count})]}),(0,B.jsxs)("span",{style:{color:"#64748b"},children:["\u6839\u30CF\u30C3\u30B7\u30E5:"," ",(0,B.jsx)("code",{"data-testid":"merkle-root-hash",style:{backgroundColor:"#f8fafc",padding:"2px 4px",borderRadius:"3px"},children:Ke(e.root_hash)})]}),(0,B.jsx)("span",{"data-testid":"grounded-status",style:{fontSize:"12px",fontWeight:500,color:e.is_fully_grounded?"#059669":"#d97706"},children:e.is_fully_grounded?"\u5B8C\u5168\u88CF\u4ED8":"\u90E8\u5206\u88CF\u4ED8"}),i&&(0,B.jsx)("button",{type:"button","data-testid":"verify-citation-button","aria-label":"\u6697\u53F7\u5B66\u7684\u5F15\u7528\u8A3C\u660E\u3092\u518D\u691C\u8A3C",disabled:d,onClick:()=>i(),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:d?"not-allowed":"pointer",fontSize:"12px"},children:d?"\u691C\u8A3C\u4E2D...":"\u518D\u691C\u8A3C"}),(0,B.jsx)("button",{type:"button","data-testid":"toggle-proof-details","aria-label":"\u8A3C\u660E\u8A73\u7D30\u306E\u8868\u793A\u5207\u308A\u66FF\u3048","aria-expanded":s,"aria-controls":"proof-details-panel",onClick:()=>a(!s),style:{background:"none",border:"none",cursor:"pointer",color:"#2563eb",fontSize:"12px",textDecoration:"underline",padding:"2px 4px"},children:s?"\u8A73\u7D30\u3092\u9589\u3058\u308B":"\u8A73\u7D30"})]}),s&&(0,B.jsxs)("div",{id:"proof-details-panel","data-testid":"proof-details-panel",style:{marginTop:"8px",paddingTop:"8px",borderTop:"1px dashed #e2e8f0",fontSize:"12px",color:"#334155"},children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("strong",{children:"\u5B8C\u5168\u6839\u30CF\u30C3\u30B7\u30E5: "}),(0,B.jsx)("span",{"data-testid":"full-root-hash",style:{wordBreak:"break-all",fontFamily:"monospace"},children:e.root_hash??"null"})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("strong",{children:"\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: "}),(0,B.jsx)("span",{children:e.algorithm})]}),e.as_of&&(0,B.jsxs)("div",{children:[(0,B.jsx)("strong",{children:"\u6709\u52B9\u6642\u70B9 (AsOf): "}),(0,B.jsx)("span",{"data-testid":"proof-as-of",children:e.as_of})]}),e.signature&&(0,B.jsxs)("div",{children:[(0,B.jsx)("strong",{children:"\u30C7\u30B8\u30BF\u30EB\u7F72\u540D: "}),(0,B.jsx)("span",{"data-testid":"proof-signature",style:{wordBreak:"break-all",fontFamily:"monospace"},children:e.signature})]})]})]})}var Q=require("react"),b=require("react/jsx-runtime");function Ue({rules:e,onReorderRules:r,onUpdateRule:i,onDeleteRule:d,onCreateRule:s,isSubmitting:a=!1,consultedBy:u}){let[o,x]=(0,Q.useState)(!1),[g,T]=(0,Q.useState)(""),[z,h]=(0,Q.useState)(""),[$,n]=(0,Q.useState)("CONTRACT_LEGAL"),p=[...e].sort((t,S)=>t.priority-S.priority),k=(t,S)=>{let y=S==="up"?t-1:t+1,C=[...p],A=C[t];C[t]=C[y],C[y]=A,r?.(C.map(j=>j.id))};return(0,b.jsxs)("div",{"data-testid":"classification-rule-editor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,b.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u52D5\u7684\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u30EB\u30FC\u30EB\u7BA1\u7406"}),(0,b.jsx)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u4E0A\u304B\u3089\u9806\u306B\u8A55\u4FA1\u3055\u308C\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u30EB\u30FC\u30EB\u304C\u9069\u7528\u3055\u308C\u308B\u8A2D\u8A08\u3067\u3059 (\u512A\u5148\u5EA6\u9806)\u3002"}),u===null?(0,b.jsx)("p",{"data-testid":"rule-consumer-unknown",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#92400e"},children:"\u3053\u306E\u914D\u5099\u3067\u8AB0\u304C\u3053\u306E\u8868\u3092\u8AAD\u3080\u304B\u306F\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}):(0,b.jsxs)("p",{"data-testid":"rule-consumer",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#64748b"},children:["\u8AAD\u307F\u624B: ",u]})]}),s&&(0,b.jsx)("button",{type:"button","data-testid":"add-rule-button","aria-expanded":o,"aria-controls":"create-rule-form","aria-label":o?"\u65B0\u898F\u5206\u985E\u30EB\u30FC\u30EB\u306E\u8FFD\u52A0\u30D5\u30A9\u30FC\u30E0\u3092\u9589\u3058\u308B":"\u65B0\u898F\u5206\u985E\u30EB\u30FC\u30EB\u306E\u8FFD\u52A0\u30D5\u30A9\u30FC\u30E0\u3092\u958B\u304F",onClick:()=>x(!o),style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer"},children:o?"\u9589\u3058\u308B":"\u30EB\u30FC\u30EB\u8FFD\u52A0"})]}),o&&(0,b.jsxs)("form",{id:"create-rule-form","data-testid":"create-rule-form",onSubmit:t=>{t.preventDefault();let S=g.trim();S&&(s?.({rule_name:S,uri_pattern:z.trim()||null,target_domain_key:$,is_active:!0}),T(""),h(""),x(!1))},style:{padding:"12px",backgroundColor:"#f8fafc",borderRadius:"6px",marginBottom:"16px",border:"1px solid #cbd5e1"},children:[(0,b.jsx)("h3",{style:{margin:"0 0 10px 0",fontSize:"14px",color:"#1e293b"},children:"\u65B0\u898F\u30EB\u30FC\u30EB\u4F5C\u6210"}),(0,b.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"10px",marginBottom:"10px"},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:"new-rule-name-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u30EB\u30FC\u30EB\u540D"}),(0,b.jsx)("input",{id:"new-rule-name-input",type:"text","data-testid":"new-rule-name-input",placeholder:"\u4F8B: \u5951\u7D04\u66F8\u30D5\u30A9\u30EB\u30C0\u81EA\u52D5\u5206\u985E",value:g,onChange:t=>T(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"},required:!0})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:"new-rule-uri-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"URI \u30D1\u30BF\u30FC\u30F3 (glob / \u6B63\u898F\u8868\u73FE)"}),(0,b.jsx)("input",{id:"new-rule-uri-input",type:"text","data-testid":"new-rule-uri-input",placeholder:"\u4F8B: storage://contracts/**",value:z,onChange:t=>h(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:"new-rule-domain-select",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u5224\u5B9A\u5148\u30C9\u30E1\u30A4\u30F3"}),(0,b.jsxs)("select",{id:"new-rule-domain-select","data-testid":"new-rule-domain-select",value:$,onChange:t=>n(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"},children:[(0,b.jsx)("option",{value:"CONTRACT_LEGAL",children:"CONTRACT_LEGAL (\u5951\u7D04\u30FB\u898F\u7A0B)"}),(0,b.jsx)("option",{value:"FINANCIAL_REPORT",children:"FINANCIAL_REPORT (\u8CA1\u52D9\u8AF8\u8868)"}),(0,b.jsx)("option",{value:"TECHNICAL_SPEC",children:"TECHNICAL_SPEC (\u6280\u8853\u4ED5\u69D8)"}),(0,b.jsx)("option",{value:"GENERAL_DOCUMENT",children:"GENERAL_DOCUMENT (\u4E00\u822C\u6587\u66F8)"})]})]})]}),(0,b.jsx)("button",{type:"submit","data-testid":"submit-new-rule",disabled:a||!g.trim(),style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#10b981",color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:a||!g.trim()?"not-allowed":"pointer"},children:"\u4F5C\u6210\u767B\u9332"})]}),(0,b.jsx)("div",{style:{overflowX:"auto"},children:(0,b.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,b.jsx)("th",{style:{padding:"6px 8px"},children:"\u512A\u5148\u9806\u4F4D"}),(0,b.jsx)("th",{style:{padding:"6px 8px"},children:"\u30EB\u30FC\u30EB\u540D"}),(0,b.jsx)("th",{style:{padding:"6px 8px"},children:"URI \u30D1\u30BF\u30FC\u30F3"}),(0,b.jsx)("th",{style:{padding:"6px 8px"},children:"\u5224\u5B9A\u30C9\u30E1\u30A4\u30F3"}),(0,b.jsx)("th",{style:{padding:"6px 8px"},children:"\u6709\u52B9\u5316"}),d&&(0,b.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,b.jsx)("tbody",{children:p.map((t,S)=>(0,b.jsxs)("tr",{"data-testid":`rule-row-${t.id}`,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,b.jsx)("td",{style:{padding:"8px"},children:(0,b.jsxs)("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[(0,b.jsx)("span",{style:{fontWeight:700,width:"20px"},children:S+1}),r&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button","data-testid":`rule-move-up-${t.id}`,"aria-label":`${t.rule_name} \u306E\u512A\u5148\u5EA6\u3092\u4E0A\u3052\u308B`,disabled:S===0||a,onClick:()=>k(S,"up"),style:{padding:"1px 6px",borderRadius:"3px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:S===0||a?"not-allowed":"pointer",fontSize:"11px"},children:"\u25B2"}),(0,b.jsx)("button",{type:"button","data-testid":`rule-move-down-${t.id}`,"aria-label":`${t.rule_name} \u306E\u512A\u5148\u5EA6\u3092\u4E0B\u3052\u308B`,disabled:S===p.length-1||a,onClick:()=>k(S,"down"),style:{padding:"1px 6px",borderRadius:"3px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:S===p.length-1||a?"not-allowed":"pointer",fontSize:"11px"},children:"\u25BC"})]})]})}),(0,b.jsx)("td",{style:{padding:"8px",fontWeight:600},children:t.rule_name}),(0,b.jsx)("td",{style:{padding:"8px",color:"#64748b"},children:(0,b.jsx)("code",{children:t.uri_pattern??"\u4EFB\u610F (*)"})}),(0,b.jsx)("td",{style:{padding:"8px"},children:t.target_domain_key===null?(0,b.jsx)("span",{"data-testid":`rule-domain-unset-${t.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f1f5f9",color:"#64748b",fontWeight:500},children:"\u5224\u5B9A\u5148\u306A\u3057"}):(0,b.jsx)("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#e0e7ff",color:"#3730a3",fontWeight:500},children:t.target_domain_key})}),(0,b.jsxs)("td",{style:{padding:"8px"},children:[!i&&(0,b.jsx)("span",{"data-testid":`rule-active-state-${t.id}`,"data-active":t.is_active,style:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:t.is_active?"#d1fae5":"#e2e8f0",color:t.is_active?"#065f46":"#475569",fontWeight:600},children:t.is_active?"\u6709\u52B9":"\u7121\u52B9"}),i&&(0,b.jsx)("button",{type:"button",role:"switch","aria-checked":t.is_active,"aria-label":`${t.rule_name} \u306E\u6709\u52B9\u5316\u5207\u308A\u66FF\u3048`,"data-testid":`rule-active-toggle-${t.id}`,onClick:()=>i(t.id,{is_active:!t.is_active}),style:{padding:"2px 8px",borderRadius:"12px",border:"none",backgroundColor:t.is_active?"#10b981":"#cbd5e1",color:"#ffffff",cursor:"pointer",fontSize:"11px",fontWeight:600},children:t.is_active?"\u6709\u52B9":"\u7121\u52B9"})]}),d&&(0,b.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:(0,b.jsx)("button",{type:"button","data-testid":`rule-delete-${t.id}`,"aria-label":`${t.rule_name} \u3092\u524A\u9664`,disabled:a,onClick:()=>d(t.id),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #ef4444",backgroundColor:"#ffffff",color:"#ef4444",cursor:a?"not-allowed":"pointer",fontSize:"12px"},children:"\u524A\u9664"})})]},t.id))})]})})]})}var J=require("@aiquants/governance-core"),q=require("react"),I=require("react/jsx-runtime"),He=new Set(["CONFIDENTIAL","RESTRICTED"]),ee=J.ConfidentialityLevelSchema.options,pe=J.GovernedCapabilitySchema.options,Je=new Set(J.CLOUD_CAPABLE_CAPABILITIES);function te(e,r){return`${e}:${r}`}function Xe(e,r){let i=[...e??[]];return r&&!i.includes(r)&&i.push(r),i}function Ve({policies:e,promptKeys:r,onChangePolicy:i,isUpdating:d=!1,readOnly:s=!1}){let[a,u]=(0,q.useState)(null),o=(0,q.useRef)(null),x=(0,q.useRef)(null),g=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!a)return;x.current?.focus();let t=S=>{if(S.key==="Escape"){u(null),o.current?.focus();return}S.key==="Tab"&&(S.shiftKey&&document.activeElement===x.current?(S.preventDefault(),g.current?.focus()):!S.shiftKey&&document.activeElement===g.current&&(S.preventDefault(),x.current?.focus()))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a]);let T=new Map(e.map(t=>[te(t.confidentialityLevel,t.capability),t])),z=t=>{i&&i(t)},h=t=>{z({...t,isEnabled:!t.isEnabled})},$=(t,S)=>{let y={...t,allowCloudProvider:!t.allowCloudProvider};if(y.allowCloudProvider&&He.has(t.confidentialityLevel)){o.current=S,u(y);return}z(y)},n=(t,S)=>{z({...t,promptKey:S===""?null:S})},p=()=>{a&&z(a),u(null),o.current?.focus()},k=()=>{u(null),o.current?.focus()},P=ee.flatMap(t=>pe.filter(S=>!T.has(te(t,S))).map(S=>te(t,S)));return(0,I.jsxs)("div",{"data-testid":"confidentiality-policy-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,I.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,I.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u6A5F\u5BC6\u533A\u5206\u5225 \u6A5F\u80FD\u30DD\u30EA\u30B7\u30FC"}),(0,I.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u533A\u5206\u3054\u3068\u306B\u3001\u6A5F\u80FD\u3092\u52D5\u304B\u3057\u3066\u3088\u3044\u304B\u3001\u914D\u5099\u306E\u5916\u3078\u51FA\u3057\u3066\u3088\u3044\u304B\u3092\u6C7A\u3081\u307E\u3059\u3002",ee.length," \u533A\u5206 \xD7 ",pe.length," \u6A5F\u80FD\u3002"]})]}),P.length>0&&(0,I.jsxs)("div",{"data-testid":"policy-missing-rows",style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"6px",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"12px"},children:["\u672A\u8A2D\u5B9A\u306E\u7D44\u307F\u5408\u308F\u305B\u304C ",P.length," \u4EF6\u3042\u308A\u307E\u3059 (",P.join(", "),")\u3002\u8A72\u5F53\u3059\u308B\u6587\u66F8\u306E\u51E6\u7406\u306F\u8A2D\u5B9A\u304C\u89E3\u6C7A\u3067\u304D\u305A\u5931\u6557\u3057\u307E\u3059\u3002"]}),(0,I.jsxs)("table",{"data-testid":"policy-grid",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[(0,I.jsx)("thead",{children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("th",{style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:"\u6A5F\u80FD"}),ee.map(t=>(0,I.jsx)("th",{"data-testid":`policy-column-${t}`,style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:t},t))]})}),(0,I.jsx)("tbody",{children:pe.map(t=>{let S=Je.has(t);return(0,I.jsxs)("tr",{"data-testid":`policy-row-${t}`,children:[(0,I.jsxs)("th",{scope:"row",style:{textAlign:"left",padding:"8px",fontWeight:600,color:"#1e293b",borderBottom:"1px solid #f1f5f9"},children:[(0,I.jsx)("code",{children:t}),!S&&(0,I.jsx)("span",{"data-testid":`policy-no-destination-${t}`,style:{display:"block",fontSize:"10px",color:"#64748b",fontWeight:400},children:"\u914D\u5099\u5185\u3067\u5B8C\u7D50"})]}),ee.map(y=>{let C=T.get(te(y,t));return C?(0,I.jsxs)("td",{"data-testid":`policy-cell-${y}-${t}`,style:{padding:"8px",borderBottom:"1px solid #f1f5f9"},children:[(0,I.jsx)("button",{type:"button",role:"switch","aria-checked":C.isEnabled,"aria-label":`${y} \u306E ${t} \u306E\u5B9F\u884C\u53EF\u5426`,"data-testid":`policy-enabled-${y}-${t}`,"data-enabled":String(C.isEnabled),disabled:s||d,onClick:()=>h(C),style:{padding:"2px 8px",borderRadius:"12px",border:"none",backgroundColor:C.isEnabled?"#10b981":"#94a3b8",color:"#ffffff",cursor:s||d?"not-allowed":"pointer",fontSize:"11px",fontWeight:600},children:C.isEnabled?"\u5B9F\u884C":"\u505C\u6B62"}),S?(0,I.jsx)("button",{type:"button",role:"switch","aria-checked":C.allowCloudProvider,"aria-label":`${y} \u306E ${t} \u306E\u914D\u5099\u5916\u9001\u4FE1\u306E\u53EF\u5426`,"data-testid":`policy-cloud-${y}-${t}`,"data-enabled":String(C.allowCloudProvider),disabled:s||d,onClick:A=>$(C,A.currentTarget),style:{marginLeft:"6px",padding:"2px 8px",borderRadius:"12px",border:`1px solid ${C.allowCloudProvider?"#f59e0b":"#cbd5e1"}`,backgroundColor:C.allowCloudProvider?"#fffbeb":"#f8fafc",color:C.allowCloudProvider?"#b45309":"#475569",cursor:s||d?"not-allowed":"pointer",fontSize:"11px"},children:C.allowCloudProvider?"\u914D\u5099\u5916\u53EF":"\u914D\u5099\u5185\u306E\u307F"}):(0,I.jsx)("span",{"data-testid":`policy-cloud-unavailable-${y}-${t}`,style:{marginLeft:"6px",fontSize:"11px",color:"#94a3b8"},children:"\u9001\u4FE1\u306A\u3057"}),(0,I.jsx)("div",{style:{marginTop:"4px"},children:(0,I.jsxs)("select",{"data-testid":`policy-prompt-${y}-${t}`,"aria-label":`${y} \u306E ${t} \u304C\u7528\u3044\u308B\u30D7\u30ED\u30F3\u30D7\u30C8\u884C`,value:C.promptKey??"",disabled:s||d,onChange:A=>n(C,A.target.value),style:{fontSize:"10px",maxWidth:"100%",color:"#475569"},children:[(0,I.jsx)("option",{value:"",children:"\u65E2\u5B9A\u306E\u884C"}),Xe(r,C.promptKey).map(A=>(0,I.jsx)("option",{value:A,children:A},A))]})})]},y):(0,I.jsx)("td",{"data-testid":`policy-cell-${y}-${t}`,"data-missing":"true",style:{padding:"8px",color:"#b91c1c",borderBottom:"1px solid #f1f5f9"},children:"\u672A\u8A2D\u5B9A"},y)})]},t)})})]}),a&&(0,I.jsx)("div",{"data-testid":"policy-confirm-modal",role:"dialog","aria-modal":"true","aria-label":"\u914D\u5099\u5916\u9001\u4FE1\u306E\u78BA\u8A8D",style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(15, 23, 42, 0.45)"},children:(0,I.jsxs)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",maxWidth:"420px"},children:[(0,I.jsx)("h3",{style:{margin:0,fontSize:"15px",color:"#b45309"},children:"\u914D\u5099\u306E\u5916\u3078\u9001\u4FE1\u3059\u308B\u3053\u3068\u3092\u8A31\u53EF\u3057\u307E\u3059\u304B"}),(0,I.jsxs)("p",{style:{margin:"8px 0 16px 0",fontSize:"13px",color:"#334155"},children:[(0,I.jsx)("code",{children:a.confidentialityLevel})," \u306E\u6587\u66F8\u306E ",(0,I.jsx)("code",{children:a.capability})," \u304C\u3001\u914D\u5099\u306E\u5916\u306E\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u672C\u6587\u3092\u9001\u308C\u308B\u3088\u3046\u306B\u306A\u308A\u307E\u3059\u3002"]}),(0,I.jsxs)("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[(0,I.jsx)("button",{ref:x,type:"button","data-testid":"policy-confirm-cancel",onClick:k,style:{padding:"6px 14px",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u53D6\u308A\u6D88\u3059"}),(0,I.jsx)("button",{ref:g,type:"button","data-testid":"policy-confirm-accept",onClick:p,style:{padding:"6px 14px",borderRadius:"6px",border:"none",backgroundColor:"#b45309",color:"#ffffff",cursor:"pointer"},children:"\u8A31\u53EF\u3059\u308B"})]})]})})]})}var U=require("react"),N=require("react/jsx-runtime"),Ye=["ENABLE_MERKLE_CITATION_PROOF","ENABLE_GRAPH_INDEXING","ENABLE_VECTOR_INDEXING","ENABLE_REALTIME_CDC_INGESTION"],Qe=new Set(Ye);function Ze({flags:e,onToggleFlag:r,isCriticalFlag:i=a=>Qe.has(a),isUpdating:d=!1,readOnly:s=!1}){let[a,u]=(0,U.useState)(null),o=(0,U.useRef)(null),x=(0,U.useRef)(null),g=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!a)return;x.current?.focus();let n=p=>{if(p.key==="Escape"){u(null),o.current?.focus();return}p.key==="Tab"&&(p.shiftKey&&document.activeElement===x.current?(p.preventDefault(),g.current?.focus()):!p.shiftKey&&document.activeElement===g.current&&(p.preventDefault(),x.current?.focus()))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[a]);let T=(n,p,k)=>{let P=!p;i(n)?(o.current=k,u({key:n,targetValue:P})):r&&r(n,P)},z=()=>{u(null),o.current?.focus()},h=()=>{a&&r&&r(a.key,a.targetValue),u(null),o.current?.focus()},$=Object.keys(e);return(0,N.jsxs)("div",{"data-testid":"feature-flag-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,N.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,N.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u6A5F\u80FD\u30D5\u30E9\u30B0\u64CD\u4F5C\u30B9\u30A4\u30C3\u30C1\u30DC\u30FC\u30C9"}),(0,N.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u5168 ",$.length," \u4EF6\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u72B6\u614B\u3002\u91CD\u8981\u30D5\u30E9\u30B0\u306E\u5207\u308A\u66FF\u3048\u306B\u306F 2 \u6BB5\u968E\u78BA\u8A8D\u304C\u5FC5\u8981\u3067\u3059\u3002"]})]}),(0,N.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:"12px"},children:$.map(n=>{let p=!!e[n],k=i(n);return(0,N.jsxs)("div",{"data-testid":`flag-card-${n}`,style:{border:`1px solid ${p?"#10b981":"#cbd5e1"}`,borderRadius:"6px",padding:"12px",backgroundColor:p?"#ecfdf5":"#f8fafc",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,N.jsx)("code",{style:{fontSize:"12px",fontWeight:600,color:"#1e293b"},children:n}),k&&(0,N.jsx)("span",{"data-testid":`critical-badge-${n}`,style:{fontSize:"10px",padding:"1px 4px",borderRadius:"4px",backgroundColor:"#fef2f2",color:"#dc2626",fontWeight:600},children:"\u91CD\u8981"})]}),(0,N.jsxs)("div",{style:{fontSize:"11px",color:"#64748b",marginTop:"4px"},children:["\u72B6\u614B: ",p?"\u6709\u52B9 (ENABLED)":"\u7121\u52B9 (DISABLED)"]})]}),(0,N.jsx)("button",{type:"button",role:"switch","aria-checked":p,"aria-label":`${n} \u30D5\u30E9\u30B0\u306E\u5207\u308A\u66FF\u3048`,"data-testid":`flag-switch-${n}`,"data-enabled":String(p),disabled:s||d,onClick:P=>T(n,p,P.currentTarget),style:{padding:"4px 12px",borderRadius:"16px",border:"none",backgroundColor:p?"#10b981":"#94a3b8",color:"#ffffff",cursor:s||d?"not-allowed":"pointer",fontSize:"12px",fontWeight:600},children:p?"ON":"OFF"})]},n)})}),a&&(0,N.jsx)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"critical-flag-modal-title","aria-describedby":"critical-flag-modal-desc","data-testid":"critical-flag-confirm-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:(0,N.jsxs)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",maxWidth:"420px",width:"90%",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,N.jsx)("h3",{id:"critical-flag-modal-title",style:{margin:"0 0 10px 0",color:"#dc2626",fontSize:"16px"},children:"\u26A0\uFE0F \u91CD\u8981\u6A5F\u80FD\u30D5\u30E9\u30B0\u306E\u5909\u66F4\u78BA\u8A8D"}),(0,N.jsxs)("p",{id:"critical-flag-modal-desc",style:{fontSize:"13px",color:"#475569",lineHeight:1.5,margin:"0 0 16px 0"},children:["\u30D5\u30E9\u30B0 ",(0,N.jsx)("code",{children:a.key})," \u3092 ",(0,N.jsx)("strong",{children:a.targetValue?"\u6709\u52B9":"\u7121\u52B9"})," \u306B\u5207\u308A\u66FF\u3048\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u3084\u30C7\u30FC\u30BF\u6574\u5408\u6027\u306B\u76F4\u63A5\u5F71\u97FF\u3092\u53CA\u307C\u3059\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"]}),(0,N.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[(0,N.jsx)("button",{ref:x,type:"button","data-testid":"cancel-flag-toggle",onClick:z,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),(0,N.jsx)("button",{ref:g,type:"button","data-testid":"confirm-flag-toggle",onClick:h,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#dc2626",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:600},children:"\u5909\u66F4\u3092\u5B9F\u884C\u3059\u308B"})]})]})})]})}var K=require("react"),m=require("react/jsx-runtime"),et=[{field:"context_relevance",label:"\u6587\u8108\u9069\u5408\u5EA6"},{field:"groundedness",label:"\u6839\u62E0\u59A5\u5F53\u6027"},{field:"answer_relevance",label:"\u56DE\u7B54\u9069\u5408\u5EA6"},{field:"mean_answer_chars",label:"\u5E73\u5747\u56DE\u7B54\u6587\u5B57\u6570"},{field:"mean_latency_ms",label:"\u5E73\u5747\u5FDC\u7B54\u6642\u9593 (ms)"}];function ye(e){let r=e.filter(i=>i.key.trim()!=="").map(i=>[i.key.trim(),i.value]);return r.length===0?void 0:Object.fromEntries(r)}function tt(e){let r=e.filter(i=>i.key.trim()!=="").map(i=>[i.key.trim(),i.value==="on"]);return r.length===0?void 0:Object.fromEntries(r)}function ce(e,r){let i=Math.abs(e)>=100?e.toFixed(0):e.toFixed(3);return r&&e>=0?`+${i}`:i}function ue({title:e,hint:r,testId:i,rows:d,onChange:s,valueKind:a}){return(0,m.jsxs)("div",{"data-testid":i,style:{marginBottom:"12px"},children:[(0,m.jsx)("h3",{style:{margin:"0 0 2px 0",fontSize:"12px",color:"#334155"},children:e}),(0,m.jsx)("p",{style:{margin:"0 0 6px 0",fontSize:"11px",color:"#64748b"},children:r}),d.map((u,o)=>(0,m.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"4px"},children:[(0,m.jsx)("input",{type:"text","aria-label":`${e} \u306E\u9375 ${o+1}`,"data-testid":`${i}-key-${o}`,value:u.key,onChange:x=>s(d.map((g,T)=>T===o?{...g,key:x.target.value}:g)),style:{width:"220px",padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),a==="flag"?(0,m.jsxs)("select",{"aria-label":`${e} \u306E\u5024 ${o+1}`,"data-testid":`${i}-value-${o}`,value:u.value,onChange:x=>s(d.map((g,T)=>T===o?{...g,value:x.target.value}:g)),style:{padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"},children:[(0,m.jsx)("option",{value:"on",children:"\u6709\u52B9"}),(0,m.jsx)("option",{value:"off",children:"\u7121\u52B9"})]}):(0,m.jsx)("input",{type:"text","aria-label":`${e} \u306E\u5024 ${o+1}`,"data-testid":`${i}-value-${o}`,value:u.value,onChange:x=>s(d.map((g,T)=>T===o?{...g,value:x.target.value}:g)),style:{flex:1,padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,m.jsx)("button",{type:"button","data-testid":`${i}-remove-${o}`,onClick:()=>s(d.filter((x,g)=>g!==o)),style:{padding:"4px 8px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u524A\u9664"})]},o)),(0,m.jsx)("button",{type:"button","data-testid":`${i}-add`,onClick:()=>s([...d,{key:"",value:a==="flag"?"on":""}]),style:{padding:"4px 10px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u884C\u3092\u8FFD\u52A0"})]})}function ot({onSimulate:e}){let r=(0,K.useId)(),[i,d]=(0,K.useState)([]),[s,a]=(0,K.useState)([]),[u,o]=(0,K.useState)([]),[x,g]=(0,K.useState)(""),[T,z]=(0,K.useState)(!1),[h,$]=(0,K.useState)(null);if(!e)return null;let n=ye(i),p=ye(s),k=tt(u),P=x.split(",").map(C=>C.trim()).filter(C=>C!==""),t=n!==void 0||p!==void 0||k!==void 0,S=T||!t;return(0,m.jsxs)("div",{"data-testid":"governance-dry-run-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,m.jsx)("h2",{style:{margin:"0 0 4px 0",fontSize:"16px",color:"#1e293b"},children:"\u30AC\u30D0\u30CA\u30F3\u30B9 \u30C9\u30E9\u30A4\u30E9\u30F3"}),(0,m.jsx)("p",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"#64748b"},children:"\u5019\u88DC\u306E\u4E0A\u66F8\u304D\u3092\u9069\u7528\u3057\u305F\u5834\u5408\u306E\u30B4\u30FC\u30EB\u30C7\u30F3\u30D9\u30F3\u30C1\u30DE\u30FC\u30AF\u306E\u6210\u7E3E\u3092\u3001\u4FDD\u5B58\u305B\u305A\u306B\u6E2C\u308A\u307E\u3059\u3002"}),(0,m.jsx)("div",{"data-testid":"dry-run-cost-notice",style:{marginBottom:"12px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"12px",color:"#92400e"},children:"\u5B9F\u884C\u3059\u308B\u3068\u3001\u30B4\u30FC\u30EB\u30C7\u30F3\u30D9\u30F3\u30C1\u30DE\u30FC\u30AF\u306E\u5168\u8A2D\u554F\u304C\u5B9F\u969B\u306E\u30E2\u30C7\u30EB\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u9001\u3089\u308C\u307E\u3059\u3002\u8CBB\u7528\u3068\u5B9F\u884C\u6642\u9593\u304C\u767A\u751F\u3057\u3001\u9014\u4E2D\u3067\u53D6\u308A\u6D88\u3057\u3066\u3082\u9001\u4FE1\u6E08\u307F\u306E\u5206\u306F\u623B\u308A\u307E\u305B\u3093\u3002"}),(0,m.jsx)(ue,{title:"\u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u4E0A\u66F8\u304D",hint:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30AD\u30FC\u3068\u3001\u305D\u306E\u5019\u88DC\u672C\u6587\u3002",testId:"dry-run-prompt-overrides",rows:i,onChange:d,valueKind:"text"}),(0,m.jsx)(ue,{title:"\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u4E0A\u66F8\u304D",hint:"\u30D1\u30E9\u30E1\u30FC\u30BF\u30AD\u30FC\u3068\u5019\u88DC\u5024\u3002\u5024\u306F\u6587\u5B57\u5217\u3068\u3057\u3066\u9001\u3089\u308C\u307E\u3059\u3002",testId:"dry-run-parameter-overrides",rows:s,onChange:a,valueKind:"text"}),(0,m.jsx)(ue,{title:"\u6A5F\u80FD\u30D5\u30E9\u30B0\u306E\u4E0A\u66F8\u304D",hint:"\u30D5\u30E9\u30B0\u30AD\u30FC\u3068\u3001\u6709\u52B9\u30FB\u7121\u52B9\u306E\u3044\u305A\u308C\u304B\u3002",testId:"dry-run-flag-overrides",rows:u,onChange:o,valueKind:"flag"}),(0,m.jsxs)("div",{style:{marginBottom:"12px"},children:[(0,m.jsx)("label",{htmlFor:r,style:{display:"block",fontSize:"12px",color:"#334155",marginBottom:"2px"},children:"\u5BFE\u8C61\u306E\u610F\u56F3\u7A2E\u5225 (\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3001\u672A\u5165\u529B\u306A\u3089\u5168\u4EF6)"}),(0,m.jsx)("input",{id:r,"data-testid":"dry-run-intent-types",type:"text",value:x,onChange:C=>g(C.target.value),style:{width:"100%",padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}})]}),(0,m.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"12px"},children:[(0,m.jsx)("button",{type:"button","data-testid":"dry-run-submit",onClick:async()=>{z(!0),$(null);try{$(await e({...n?{promptOverrides:n}:{},...p?{parameterOverrides:p}:{},...k?{featureFlagOverrides:k}:{},...P.length>0?{intentTypes:P}:{}}))}finally{z(!1)}},disabled:S,style:{padding:"7px 14px",fontSize:"13px",borderRadius:"4px",border:"none",cursor:S?"not-allowed":"pointer",backgroundColor:S?"#cbd5e1":"#2563eb",color:"#ffffff"},children:T?"\u5B9F\u884C\u4E2D...":"\u30C9\u30E9\u30A4\u30E9\u30F3\u3092\u5B9F\u884C"}),!t&&(0,m.jsx)("span",{"data-testid":"dry-run-no-override-note",style:{fontSize:"12px",color:"#64748b"},children:"\u4E0A\u66F8\u304D\u304C 1 \u4EF6\u3082\u7121\u3044\u5B9F\u884C\u306F\u3001\u57FA\u6E96\u3092\u57FA\u6E96\u3068\u6BD4\u3079\u308B\u3060\u3051\u3067\u3059\u3002\u4E0A\u66F8\u304D\u3092 1 \u4EF6\u4EE5\u4E0A\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"})]}),h?.ok===!1&&(0,m.jsx)("div",{"data-testid":"dry-run-failure",style:{border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:h.reason}),h?.ok===!0&&(0,m.jsxs)("div",{"data-testid":"dry-run-result",children:[(0,m.jsxs)("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#334155"},children:["\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3 ",(0,m.jsx)("span",{"data-testid":"dry-run-simulation-id",children:h.result.simulation_id})," / \u8A55\u4FA1\u8A2D\u554F ",(0,m.jsx)("span",{"data-testid":"dry-run-evaluated-count",children:h.result.evaluated_questions_count.toLocaleString()})," \u4EF6 / \u5B9F\u884C\u6642\u9593"," ",Math.round(h.result.execution_time_ms).toLocaleString()," ms"]}),(0,m.jsxs)("table",{"data-testid":"dry-run-score-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[(0,m.jsx)("thead",{children:(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{style:{textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u6307\u6A19"}),(0,m.jsx)("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u9069\u7528\u524D"}),(0,m.jsx)("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u9069\u7528\u5F8C"}),(0,m.jsx)("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u5DEE\u5206"})]})}),(0,m.jsx)("tbody",{children:et.map(({field:C,label:A})=>(0,m.jsxs)("tr",{"data-testid":`dry-run-score-${C}`,children:[(0,m.jsx)("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:A}),(0,m.jsx)("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569",textAlign:"right"},children:ce(h.result.before[C],!1)}),(0,m.jsx)("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569",textAlign:"right"},children:ce(h.result.after[C],!1)}),(0,m.jsx)("td",{"data-delta-direction":h.result.delta[C]>0?"up":h.result.delta[C]<0?"down":"flat",style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",textAlign:"right",color:h.result.delta[C]<0?"#b91c1c":"#047857"},children:ce(h.result.delta[C],!0)})]},C))})]}),h.result.regressions.length===0&&h.result.improvements.length===0?(0,m.jsx)("p",{"data-testid":"dry-run-no-flips",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u5408\u5426\u304C\u53CD\u8EE2\u3057\u305F\u8A2D\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"}):(0,m.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[(0,m.jsx)(me,{testId:"dry-run-regressions",title:"\u60AA\u5316 (\u5408\u683C \u2192 \u4E0D\u5408\u683C)",flips:h.result.regressions,tone:"#b91c1c"}),(0,m.jsx)(me,{testId:"dry-run-improvements",title:"\u6539\u5584 (\u4E0D\u5408\u683C \u2192 \u5408\u683C)",flips:h.result.improvements,tone:"#047857"})]})]})]})}function me({testId:e,title:r,flips:i,tone:d}){return(0,m.jsxs)("div",{"data-testid":e,children:[(0,m.jsxs)("h3",{style:{margin:"0 0 6px 0",fontSize:"12px",color:d},children:[r," (",i.length," \u4EF6)"]}),i.length===0?(0,m.jsx)("p",{style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u8A72\u5F53\u306A\u3057"}):(0,m.jsx)("ul",{style:{margin:0,paddingLeft:"18px",fontSize:"12px",color:"#475569"},children:i.map(s=>(0,m.jsxs)("li",{"data-testid":`${e}-${s.case_id}`,children:[s.case_id," (",s.intent_type,"): ",s.before_passed?"\u5408\u683C":"\u4E0D\u5408\u683C"," \u2192 ",s.after_passed?"\u5408\u683C":"\u4E0D\u5408\u683C"]},s.case_id))})]})}var D=require("react");var ve=require("react"),L=require("react/jsx-runtime");function he({page:e,isLoading:r=!1,failure:i=null,onChangePage:d,onSelectNode:s}){let a=(0,ve.useId)(),u=e===null||e.pageSize<=0?0:e.pageSize,o=e===null||u===0?1:Math.max(1,Math.ceil(e.totalCount/u)),x=e===null?0:Math.min(Math.max(e.pageIndex,0),o-1),g=e===null||e.nodes.length===0?0:x*u+1,T=e===null||g===0?0:x*u+e.nodes.length;return(0,L.jsxs)("div",{"data-testid":"graph-node-index",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[(0,L.jsx)("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30CE\u30FC\u30C9\u7D22\u5F15"}),i!==null?(0,L.jsx)("p",{"data-testid":"node-index-failure",style:{margin:0,fontSize:"12px",color:"#b45309"},children:i}):e===null?(0,L.jsx)("p",{"data-testid":"node-index-unselected",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u30E9\u30D9\u30EB\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u30E9\u30D9\u30EB\u3092\u6301\u3064\u30CE\u30FC\u30C9\u3092\u5217\u6319\u3057\u307E\u3059\u3002"}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("p",{"data-testid":"node-index-range",id:a,"aria-live":"polite",style:{margin:"0 0 6px 0",fontSize:"11px",color:"#64748b"},children:[(0,L.jsx)("code",{children:e.label})," \u306E ",e.totalCount," \u4EF6\u4E2D ",g,"\u2013",T," \u4EF6\u76EE (",o," \u9801\u4E2D ",x+1," \u9801\u76EE)"]}),e.nodes.length===0?(0,L.jsx)("p",{"data-testid":"node-index-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:e.totalCount===0?"\u3053\u306E\u30E9\u30D9\u30EB\u3092\u6301\u3064\u30CE\u30FC\u30C9\u306F\u3042\u308A\u307E\u305B\u3093\u3002":"\u3053\u306E\u9801\u306B\u306F\u884C\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,L.jsx)("ul",{"data-testid":"node-index-list",style:{margin:0,paddingLeft:0,listStyle:"none"},children:e.nodes.map(z=>(0,L.jsxs)("li",{"data-testid":`node-index-item-${z.key}`,style:{borderBottom:"1px solid #e2e8f0",padding:"4px 0",fontSize:"12px"},children:[(0,L.jsx)("span",{style:{color:"#0f172a"},children:z.displayName===null?(0,L.jsx)("span",{"data-testid":`node-index-unnamed-${z.key}`,style:{color:"#64748b"},children:"(\u540D\u524D\u306A\u3057)"}):z.displayName}),(0,L.jsxs)("span",{style:{marginLeft:"6px",color:"#64748b",fontSize:"11px"},children:[(0,L.jsx)("code",{children:z.canonicalId??z.key})," / ",z.labels.join(", ")]}),s!==void 0&&z.canonicalId===null&&(0,L.jsx)("span",{"data-testid":`node-index-not-startable-${z.key}`,style:{marginLeft:"8px",color:"#64748b",fontSize:"11px"},children:"\u63A2\u7D22\u306E\u59CB\u70B9\u306B\u306F\u3067\u304D\u307E\u305B\u3093 (\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093)"}),s!==void 0&&z.canonicalId!==null&&(0,L.jsx)("button",{type:"button","data-testid":`node-index-start-${z.key}`,onClick:()=>s(z.canonicalId),style:{marginLeft:"8px",padding:"1px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px",cursor:"pointer"},children:"\u63A2\u7D22\u306E\u59CB\u70B9\u306B\u3059\u308B"})]},z.key))}),d!==void 0&&(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"8px"},children:[(0,L.jsx)("button",{type:"button","data-testid":"node-index-prev","aria-describedby":a,disabled:r||e.pageIndex===0,onClick:()=>d(e.pageIndex-1),style:{padding:"2px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px"},children:"\u524D\u306E\u9801"}),(0,L.jsx)("button",{type:"button","data-testid":"node-index-next","aria-describedby":a,disabled:r||e.pageIndex+1>=o,onClick:()=>d(e.pageIndex+1),style:{padding:"2px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px"},children:"\u6B21\u306E\u9801"})]})]})]})}var rt={size:640,nodeRadius:{min:10,max:34},padding:18,bundleStrength:.35,selfLoopExtent:(1+Math.sqrt(5))/2},nt=3;function F(e){let r=10**nt;return Object.is(Math.round(e*r)/r,-0)?0:Math.round(e*r)/r}function Se(e,r,i,d=rt){let s=Number.isInteger(i)&&i>0?i:e.length,a=e.slice(0,s),u=e.slice(s).map(n=>n.label),o=d.size/2,x=o-d.nodeRadius.max-d.padding,g=a.reduce((n,p)=>Math.max(n,p.count),0),T=a.map((n,p)=>{let k=-Math.PI/2+2*Math.PI*p/a.length,P=g===0?0:Math.sqrt(n.count/g);return{...n,angle:k,x:F(o+x*Math.cos(k)),y:F(o+x*Math.sin(k)),radius:F(d.nodeRadius.min+(d.nodeRadius.max-d.nodeRadius.min)*P)}}),z=new Map(T.map(n=>[n.label,n])),h=[],$=0;for(let n of r){let p=z.get(n.from),k=z.get(n.to);if(p===void 0||k===void 0){$+=1;continue}h.push({...n,isSelfLoop:p.label===k.label,path:p.label===k.label?at(p,o,d):it(p,k,o,d)})}return{size:d.size,center:o,nodes:T,edges:h,omittedLabels:u,omittedEdgeCount:$}}function it(e,r,i,d){let s=(e.x+r.x)/2,a=(e.y+r.y)/2,u=i+(s-i)*(1-d.bundleStrength),o=i+(a-i)*(1-d.bundleStrength);return`M ${e.x} ${e.y} Q ${F(u)} ${F(o)} ${r.x} ${r.y}`}function at(e,r,i){let d=Math.atan2(e.y-r,e.x-r),s=Math.PI/6,a=e.radius*i.selfLoopExtent,u={x:e.x+e.radius*Math.cos(d-s),y:e.y+e.radius*Math.sin(d-s)},o={x:e.x+e.radius*Math.cos(d+s),y:e.y+e.radius*Math.sin(d+s)},x={x:e.x+(e.radius+a)*Math.cos(d),y:e.y+(e.radius+a)*Math.sin(d)};return`M ${F(u.x)} ${F(u.y)} Q ${F(x.x)} ${F(x.y)} ${F(o.x)} ${F(o.y)}`}var E=require("react/jsx-runtime"),oe={min:1,max:4};function Ce({nodes:e,edges:r,maxLabels:i,probeFailure:d,onSelectLabel:s}){let a=Se(e,r,i),u=a.edges.reduce((o,x)=>Math.max(o,x.count),0);return(0,E.jsxs)("div",{"data-testid":"graph-topology-map",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[(0,E.jsx)("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u5168\u4F53\u30C8\u30DD\u30ED\u30B8 (\u30E9\u30D9\u30EB\u3068\u95A2\u4FC2)"}),d!==null?(0,E.jsx)("p",{"data-testid":"topology-probe-failure",style:{margin:0,fontSize:"12px",color:"#b45309"},children:d}):a.nodes.length===0?(0,E.jsx)("p",{"data-testid":"topology-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u6295\u5F71\u3055\u308C\u305F\u30CE\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("svg",{"data-testid":"topology-svg",viewBox:`0 0 ${a.size} ${a.size}`,"aria-hidden":"true",focusable:"false",style:{width:"100%",maxWidth:`${a.size}px`,height:"auto"},children:[a.edges.map(o=>(0,E.jsx)("path",{"data-testid":`topology-edge-${o.from}-${o.type}-${o.to}`,"data-self-loop":String(o.isSelfLoop),d:o.path,fill:"none",stroke:"#94a3b8",strokeWidth:u===0?oe.min:oe.min+(oe.max-oe.min)*Math.sqrt(o.count/u),strokeOpacity:.55},`${o.from}->${o.type}->${o.to}`)),a.nodes.map(o=>(0,E.jsxs)("g",{"data-testid":`topology-node-${o.label}`,"data-count":String(o.count),children:[(0,E.jsx)("circle",{cx:o.x,cy:o.y,r:o.radius,fill:"#e0e7ff",stroke:"#4338ca",strokeWidth:1.5}),(0,E.jsx)("text",{x:o.x,y:o.y+o.radius+12,textAnchor:"middle",fontSize:"11",fill:"#334155",children:o.label})]},o.label))]}),a.omittedLabels.length>0&&(0,E.jsxs)("p",{"data-testid":"topology-omitted",style:{margin:"6px 0 0 0",fontSize:"11px",color:"#b45309"},children:["\u5186\u5468\u304C\u8AAD\u3081\u306A\u304F\u306A\u308B\u305F\u3081 ",a.omittedLabels.length," \u30E9\u30D9\u30EB\u3092\u56F3\u304B\u3089\u5916\u3057\u307E\u3057\u305F: ",a.omittedLabels.join(", ")]}),a.omittedEdgeCount>0&&(0,E.jsxs)("p",{"data-testid":"topology-omitted-edges",style:{margin:"2px 0 0 0",fontSize:"11px",color:"#b45309"},children:["\u7AEF\u70B9\u304C\u56F3\u306B\u7121\u3044\u305F\u3081 ",a.omittedEdgeCount," \u672C\u306E\u95A2\u4FC2\u3092\u63CF\u3044\u3066\u3044\u307E\u305B\u3093\u3002"]}),(0,E.jsxs)("table",{"data-testid":"topology-adjacency","aria-label":"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u5168\u4F53\u30C8\u30DD\u30ED\u30B8",style:{width:"100%",borderCollapse:"collapse",fontSize:"11px",marginTop:"8px"},children:[(0,E.jsx)("caption",{style:{captionSide:"top",textAlign:"left",color:"#64748b",paddingBottom:"4px"},children:"\u30E9\u30D9\u30EB\u3068\u3001\u305D\u306E\u9593\u306E\u95A2\u4FC2"}),(0,E.jsx)("thead",{children:(0,E.jsxs)("tr",{children:[(0,E.jsx)("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u59CB\u70B9"}),(0,E.jsx)("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u95A2\u4FC2"}),(0,E.jsx)("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u7D42\u70B9"}),(0,E.jsx)("th",{scope:"col",style:{textAlign:"right",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u672C\u6570"})]})}),(0,E.jsxs)("tbody",{children:[a.nodes.map(o=>(0,E.jsxs)("tr",{"data-testid":`topology-row-${o.label}`,children:[(0,E.jsx)("th",{scope:"row",style:{textAlign:"left",padding:"3px",fontWeight:600},children:s===void 0?o.label:(0,E.jsx)("button",{type:"button","data-testid":`topology-select-${o.label}`,onClick:()=>s(o.label),style:{padding:"1px 6px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px",cursor:"pointer"},children:o.label})}),(0,E.jsxs)("td",{colSpan:2,style:{padding:"3px",color:"#64748b"},children:["\u30CE\u30FC\u30C9 ",o.count," \u4EF6"]}),(0,E.jsx)("td",{style:{padding:"3px",textAlign:"right",color:"#64748b"}})]},`node:${o.label}`)),a.edges.map(o=>(0,E.jsxs)("tr",{"data-testid":`topology-adjacency-${o.from}-${o.type}-${o.to}`,children:[(0,E.jsx)("td",{style:{padding:"3px"},children:o.from}),(0,E.jsx)("td",{style:{padding:"3px"},children:(0,E.jsx)("code",{children:o.type})}),(0,E.jsx)("td",{style:{padding:"3px"},children:o.to}),(0,E.jsx)("td",{style:{padding:"3px",textAlign:"right"},children:o.count})]},`${o.from}->${o.type}->${o.to}`))]})]})]})]})}var l=require("react/jsx-runtime"),dt="Domain_";function Re(e,r,i){let d=new Date(r).getTime(),s=new Date(i).getTime();if(Number.isNaN(d)||Number.isNaN(s)||s<=d)return r;let a=d+(s-d)*(e/100);return new Date(a).toISOString().split("T")[0]}function lt({validTimeRange:e,onTimeTravelChange:r}){let[i,d]=(0,D.useState)(e.current_simulated_time);return(0,l.jsxs)("div",{"data-testid":"bitemporal-time-slider",style:{border:"1px solid #93c5fd",borderRadius:"6px",padding:"12px",backgroundColor:"#eff6ff",marginBottom:"20px"},children:[(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[(0,l.jsx)("h3",{style:{margin:0,fontSize:"14px",color:"#1e40af"},children:"\u30D0\u30A4\u30C6\u30F3\u30DD\u30E9\u30EB\u30FB\u30BF\u30A4\u30E0\u30C8\u30E9\u30D9\u30EB\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3"}),(0,l.jsxs)("span",{"data-testid":"simulated-time-display",style:{fontWeight:600,fontSize:"13px",color:"#1d4ed8"},children:["\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u6642\u70B9: ",i]})]}),(0,l.jsx)("input",{type:"range","data-testid":"time-travel-slider-input","aria-label":"\u6709\u52B9\u6642\u70B9\u30BF\u30A4\u30E0\u30C8\u30E9\u30D9\u30EB\u30B9\u30E9\u30A4\u30C0\u30FC",min:"0",max:"100",defaultValue:"50",onChange:a=>{let u=Number.parseFloat(a.target.value),o=Re(u,e.valid_from,e.valid_until);d(o),r?.(o)},style:{width:"100%",cursor:"pointer"}}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"#64748b",marginTop:"4px"},children:[(0,l.jsxs)("span",{children:["\u904E\u53BB (\u5EC3\u6B62\u898F\u7A0B):"," ",(0,l.jsx)("strong",{"data-temporal-state":"superseded",style:{color:"#ef4444"},children:"\u8D64"})]}),(0,l.jsxs)("span",{children:["\u73FE\u5728\u6709\u52B9 (Active):"," ",(0,l.jsx)("strong",{"data-temporal-state":"active",style:{color:"#10b981"},children:"\u7DD1"})]}),(0,l.jsxs)("span",{children:["\u672A\u6765\u6539\u5B9A\u4E88\u5B9A (Pending):"," ",(0,l.jsx)("strong",{"data-temporal-state":"pending",style:{color:"#3b82f6"},children:"\u9752"})]})]})]})}function ke(e){return e===null?"\u672A\u6E2C\u5B9A":e.toLocaleString()}var re=1,ne=10;function st(e){return e===void 0?"":typeof e=="string"?e:JSON.stringify(e)}function _e(e){let r=[];for(let i of e)for(let d of Object.keys(i))r.includes(d)||r.push(d);return r}function pt({relationshipTypes:e,onTraverse:r,startNodeId:i,onStartNodeIdChange:d}){let s=(0,D.useId)(),a=(0,D.useId)(),[u,o]=(0,D.useState)([]),[x,g]=(0,D.useState)(""),[T,z]=(0,D.useState)(!1),[h,$]=(0,D.useState)(null),n=i.trim(),p=x.trim()===""?void 0:Number(x),k=p!==void 0&&(!Number.isInteger(p)||p<re||p>ne),P=T||n===""||k,t=y=>{o(C=>C.includes(y)?C.filter(A=>A!==y):[...C,y])};return(0,l.jsxs)("div",{"data-testid":"kg-traversal-panel",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[(0,l.jsx)("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u95A2\u4FC2\u306E\u8FBF\u308A (\u30B0\u30E9\u30D5\u63A2\u7D22)"}),(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",alignItems:"flex-end",marginBottom:"10px"},children:[(0,l.jsxs)("label",{htmlFor:s,style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px",color:"#475569"},children:["\u8D77\u70B9\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u306E\u6B63\u6E96 ID",(0,l.jsx)("input",{id:s,"data-testid":"kg-traversal-start-input",type:"text",value:i,onChange:y=>d(y.target.value),placeholder:"canonicalId",style:{width:"280px",padding:"6px 8px",fontSize:"13px",border:"1px solid #cbd5e1",borderRadius:"4px"}})]}),(0,l.jsxs)("label",{htmlFor:a,style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px",color:"#475569"},children:["\u6DF1\u3055 (",re,"-",ne,"\u3001\u672A\u5165\u529B\u53EF)",(0,l.jsx)("input",{id:a,"data-testid":"kg-traversal-hops-input",type:"number",min:re,max:ne,value:x,onChange:y=>g(y.target.value),style:{width:"120px",padding:"6px 8px",fontSize:"13px",border:`1px solid ${k?"#dc2626":"#cbd5e1"}`,borderRadius:"4px"}})]}),(0,l.jsx)("button",{type:"button","data-testid":"kg-traversal-submit",onClick:async()=>{z(!0),$(null);try{$(await r({startNodeId:n,...u.length>0?{edgeTypes:u}:{},...p===void 0?{}:{maxHops:p}}))}finally{z(!1)}},disabled:P,style:{padding:"7px 14px",fontSize:"13px",borderRadius:"4px",border:"none",cursor:P?"not-allowed":"pointer",backgroundColor:P?"#cbd5e1":"#2563eb",color:"#ffffff"},children:T?"\u63A2\u7D22\u4E2D...":"\u8FBF\u308B"})]}),k&&(0,l.jsxs)("p",{"data-testid":"kg-traversal-hops-error",style:{margin:"0 0 8px 0",fontSize:"12px",color:"#b91c1c"},children:["\u6DF1\u3055\u306F ",re," \u304B\u3089 ",ne," \u307E\u3067\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),e.length>0?(0,l.jsx)("div",{"data-testid":"kg-traversal-edge-types",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginBottom:"8px"},children:e.map(y=>(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:"#475569"},children:[(0,l.jsx)("input",{type:"checkbox","data-testid":`kg-traversal-edge-${y.type}`,checked:u.includes(y.type),onChange:()=>t(y.type)}),y.type]},y.type))}):(0,l.jsx)("p",{"data-testid":"kg-traversal-no-edge-types",style:{margin:"0 0 8px 0",fontSize:"12px",color:"#64748b"},children:"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u306E\u30B0\u30E9\u30D5\u306B\u73FE\u5B58\u3059\u308B\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u578B\u3092\u6E2C\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8FBF\u308B\u578B\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\u578B\u3092\u7701\u7565\u3057\u305F\u63A2\u7D22\u306F\u3001\u5B9F\u884C\u5074\u306E\u65E2\u5B9A\u306B\u5F93\u3044\u307E\u3059\u3002"}),(0,l.jsx)("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#64748b"},children:"\u6307\u5B9A\u3057\u305F\u6DF1\u3055\u306F\u3001\u914D\u5099\u306E\u4E0A\u9650 (\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF GRAPH_MAX_HOPS) \u307E\u3067\u306B\u5207\u308A\u4E0B\u3052\u3089\u308C\u307E\u3059\u3002\u3057\u305F\u304C\u3063\u3066\u7D50\u679C\u306E\u6DF1\u3055\u306F\u3001\u6307\u5B9A\u5024\u3088\u308A\u6D45\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002"}),h?.ok===!1&&(0,l.jsx)("div",{"data-testid":"kg-traversal-failure",style:{border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:h.reason}),h?.ok===!0&&(0,l.jsxs)("div",{"data-testid":"kg-traversal-results",children:[(0,l.jsxs)("p",{style:{margin:"0 0 6px 0",fontSize:"12px",color:"#334155"},children:[(0,l.jsx)("span",{"data-testid":"kg-traversal-count",children:h.count.toLocaleString()})," \u4EF6"]}),h.results.length===0?(0,l.jsx)("p",{"data-testid":"kg-traversal-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u8D77\u70B9\u304B\u3089\u8FBF\u308C\u308B\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"}):(0,l.jsxs)("table",{"data-testid":"kg-traversal-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:_e(h.results).map(y=>(0,l.jsx)("th",{scope:"col",style:{textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:y},y))})}),(0,l.jsx)("tbody",{children:h.results.map((y,C)=>(0,l.jsx)("tr",{"data-testid":`kg-traversal-row-${C}`,children:_e(h.results).map(A=>(0,l.jsx)("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:st(y[A])},A))},C))})]})]})]})}function ct({schema:e,tenantId:r,unresolvedEntities:i=[],validTimeRange:d,onTimeTravelChange:s,onResolveEntity:a,isResolving:u=!1,onTraverse:o,topologyMaxLabels:x,nodeIndexPage:g=null,nodeIndexFailure:T=null,isNodeIndexLoading:z=!1,onBrowseLabel:h}){let[$,n]=(0,D.useState)(""),p=e.probe_failure===null,k=p?e.node_labels.reduce((t,S)=>t+S.count,0):null,P=p?e.relationship_types.reduce((t,S)=>t+S.count,0):null;return(0,l.jsxs)("div",{"data-testid":"knowledge-graph-explorer",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,l.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Neo4j \u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u63A2\u7D22"}),(0,l.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u30C6\u30CA\u30F3\u30C8:"," ",(0,l.jsx)("span",{"data-testid":"kg-tenant-id",style:{fontWeight:600},children:r})," ","| \u7DCF\u30E9\u30D9\u30EB\u4ED8\u4E0E\u6570: ",ke(k)," | \u7DCF\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u6570: ",ke(P)]}),(0,l.jsx)("p",{"data-testid":"kg-count-basis",style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8"},children:"\u30E9\u30D9\u30EB\u4ED8\u4E0E\u6570\u306F\u30CE\u30FC\u30C9\u6570\u3068\u7570\u306A\u308A\u307E\u3059 (\u8907\u6570\u30E9\u30D9\u30EB\u3092\u5E2F\u3073\u308B\u30CE\u30FC\u30C9\u306F\u30E9\u30D9\u30EB\u306E\u6570\u3060\u3051\u6570\u3048\u3089\u308C\u307E\u3059)\u3002"})]})}),e.probe_failure!==null&&(0,l.jsx)("div",{"data-testid":"kg-probe-failure",style:{marginBottom:"16px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:e.probe_failure}),(0,l.jsxs)("div",{"data-testid":"kg-schema-stats",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"20px"},children:[(0,l.jsxs)("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,l.jsx)("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30CE\u30FC\u30C9\u30E9\u30D9\u30EB\u5185\u8A33"}),(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:e.node_labels.map(t=>(0,l.jsxs)("span",{"data-testid":`node-label-stat-${t.label}`,style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#e0e7ff",color:"#3730a3",fontWeight:500},children:[":",t.label," (",t.count,")"]},t.label))})]}),(0,l.jsxs)("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,l.jsx)("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u5185\u8A33"}),(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:e.relationship_types.map(t=>(0,l.jsxs)("span",{"data-testid":`rel-type-stat-${t.type}`,style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#fef3c7",color:"#92400e",fontWeight:500},children:[":",t.type," (",t.count,")"]},t.type))})]})]}),(0,l.jsx)(Ce,{nodes:e.node_labels.filter(t=>!t.label.startsWith(dt)).map(t=>({label:t.label,count:t.count})),edges:e.adjacency,maxLabels:x,probeFailure:e.probe_failure,onSelectLabel:h===void 0?void 0:t=>h(t,0)}),h&&(0,l.jsx)(he,{page:g,failure:T,isLoading:z,onChangePage:g===null?void 0:t=>h(g.label,t),onSelectNode:n}),o&&(0,l.jsx)(pt,{relationshipTypes:e.relationship_types,onTraverse:o,startNodeId:$,onStartNodeIdChange:n}),d&&(0,l.jsx)(lt,{validTimeRange:d,onTimeTravelChange:s}),(0,l.jsxs)("div",{"data-testid":"unresolved-entities-section",children:[(0,l.jsxs)("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["HITL \u672A\u89E3\u6C7A\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u627F\u8A8D\u30AD\u30E5\u30FC (",i.length," \u4EF6)"]}),i.length===0?(0,l.jsx)("p",{"data-testid":"no-unresolved-entities",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u672A\u89E3\u6C7A\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u5019\u88DC\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,l.jsx)("div",{style:{overflowX:"auto"},children:(0,l.jsxs)("table",{"data-testid":"unresolved-entities-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px"},children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u540D"}),(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px"},children:"\u30AB\u30C6\u30B4\u30EA"}),(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px"},children:"\u51FA\u73FE\u6570"}),(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px"},children:"\u5171\u8D77\u6570"}),(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px"},children:"\u63A8\u5968"}),(0,l.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,l.jsx)("tbody",{children:i.map(t=>(0,l.jsxs)("tr",{"data-testid":`entity-row-${t.id}`,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,l.jsx)("td",{style:{padding:"8px",fontWeight:600},children:t.name}),(0,l.jsx)("td",{style:{padding:"8px",color:"#475569"},children:t.category}),(0,l.jsx)("td",{style:{padding:"8px"},children:t.occurrences}),(0,l.jsx)("td",{style:{padding:"8px"},children:t.co_occurrences}),(0,l.jsx)("td",{style:{padding:"8px"},children:(0,l.jsx)("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:t.suggested_action==="promote"?"#d1fae5":"#e0e7ff",color:t.suggested_action==="promote"?"#065f46":"#3730a3"},children:t.suggested_action==="promote"?"\u6607\u683C\u63A8\u5968":"\u7D71\u5408\u63A8\u5968"})}),(0,l.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:(0,l.jsx)("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button","data-testid":`merge-entity-${t.id}`,"aria-label":`${t.name} \u3092\u65E2\u5B58\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u306B\u7D71\u5408`,disabled:u,onClick:()=>a(t.id,"merge"),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:u?"not-allowed":"pointer",fontSize:"12px"},children:"\u7D71\u5408"}),(0,l.jsx)("button",{type:"button","data-testid":`promote-entity-${t.id}`,"aria-label":`${t.name} \u3092\u65B0\u6982\u5FF5\u3068\u3057\u3066\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C`,disabled:u,onClick:()=>a(t.id,"promote"),style:{padding:"3px 8px",borderRadius:"4px",border:"none",backgroundColor:"#10b981",color:"#ffffff",cursor:u?"not-allowed":"pointer",fontSize:"12px",fontWeight:500},children:"\u6607\u683C"})]})})})]},t.id))})]})})]})]})}var O=require("react"),v=require("react/jsx-runtime"),fe=[{key:"summary_entities",name:"\u6C4E\u7528\u6587\u66F8\u8981\u7D04 & \u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u62BD\u51FA",description:"\u6587\u66F8\u306E\u30BF\u30A4\u30C8\u30EB\u3001\u8981\u7D04\u6587\u3001\u4E3B\u8981\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u3001\u30BF\u30B0\u3092\u62BD\u51FA\u3059\u308B\u6A19\u6E96\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{title:{type:"string",description:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u6B63\u898F\u5316\u30BF\u30A4\u30C8\u30EB"},summary:{type:"string",description:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5168\u4F53\u306E\u8981\u7D04"},key_entities:{type:"array",items:{type:"string"},description:"\u62BD\u51FA\u3055\u308C\u305F\u91CD\u8981\u56FA\u6709\u8868\u73FE\u30FB\u7D44\u7E54\u30FB\u4EBA\u7269\u30FB\u88FD\u54C1\u540D"},tags:{type:"array",items:{type:"string"},description:"\u5206\u985E\u30BF\u30B0\u4E00\u89A7"}},required:["title","summary","key_entities"]}},{key:"daily_report",name:"\u696D\u52D9\u65E5\u5831\u69CB\u9020\u5316\u62BD\u51FA",description:"\u696D\u52D9\u5B9F\u7E3E\u3001\u8AB2\u984C\u30FB\u6DF1\u523B\u5EA6\u30FB\u5BFE\u7B56\u3001\u7FCC\u65E5\u884C\u52D5\u4E88\u5B9A\u3092\u69CB\u9020\u5316\u62BD\u51FA\u3059\u308B\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{report_date:{type:"string",description:"\u65E5\u5831\u5BFE\u8C61\u65E5 (YYYY-MM-DD)"},achievements:{type:"array",items:{type:"string"},description:"\u5F53\u65E5\u306E\u696D\u52D9\u5B9F\u7E3E\u30FB\u9032\u6357"},issues:{type:"array",items:{type:"object",properties:{issue:{type:"string",description:"\u8AB2\u984C\u30FB\u554F\u984C\u70B9"},severity:{type:"string",enum:["LOW","MEDIUM","HIGH","CRITICAL"],description:"\u6DF1\u523B\u5EA6"},countermeasure:{type:"string",description:"\u5BFE\u5FDC\u65B9\u91DD\u30FB\u5BFE\u7B56"}},required:["issue","severity"]},description:"\u8AB2\u984C\u304A\u3088\u3073\u5BFE\u5FDC\u7B56"},next_day_plans:{type:"array",items:{type:"string"},description:"\u7FCC\u65E5\u306E\u884C\u52D5\u4E88\u5B9A"}},required:["achievements","issues","next_day_plans"]}},{key:"email_thread",name:"\u30E1\u30FC\u30EB\u30B9\u30EC\u30C3\u30C9\u8981\u7D04 & \u6C7A\u5B9A\u4E8B\u9805",description:"\u30B9\u30EC\u30C3\u30C9\u8981\u7D04\u3001\u5408\u610F\u4E8B\u9805\u3001\u62C5\u5F53\u8005\u4ED8\u304D\u30A2\u30AF\u30B7\u30E7\u30F3\u30A2\u30A4\u30C6\u30E0\u3001\u672A\u6C7A\u4E8B\u9805\u306E\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{thread_summary:{type:"string",description:"\u30B9\u30EC\u30C3\u30C9\u5168\u4F53\u306E\u6587\u8108\u30FB\u7D4C\u7DEF\u8981\u7D04"},decisions:{type:"array",items:{type:"string"},description:"\u30B9\u30EC\u30C3\u30C9\u5185\u3067\u5408\u610F\u30FB\u6C7A\u5B9A\u3055\u308C\u305F\u4E8B\u9805"},action_items:{type:"array",items:{type:"object",properties:{task:{type:"string",description:"\u30BF\u30B9\u30AF\u5185\u5BB9"},assignee:{type:"string",description:"\u62C5\u5F53\u8005"},deadline:{type:"string",description:"\u671F\u65E5 (YYYY-MM-DD \u307E\u305F\u306F\u672A\u5B9A)"}},required:["task"]},description:"\u30A2\u30AF\u30B7\u30E7\u30F3\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7"},open_questions:{type:"array",items:{type:"string"},description:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u30FB\u78BA\u8A8D\u5F85\u3061\u4E8B\u9805"}},required:["thread_summary","decisions","action_items"]}},{key:"legal_terms",name:"\u5951\u7D04\u66F8\u30FB\u6CD5\u52D9\u6761\u9805\u62BD\u51FA",description:"\u5951\u7D04\u4EF6\u540D\u3001\u5F53\u4E8B\u8005\u3001\u767A\u52B9\u30FB\u7D42\u4E86\u65E5\u3001\u5F53\u4E8B\u8005\u5225\u7FA9\u52D9\u6761\u9805\u306E\u6CD5\u52D9\u62BD\u51FA\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{contract_title:{type:"string",description:"\u5951\u7D04\u4EF6\u540D"},effective_date:{type:"string",description:"\u767A\u52B9\u65E5"},expiration_date:{type:"string",description:"\u7D42\u4E86\u65E5\u30FB\u6E80\u4E86\u65E5"},parties:{type:"array",items:{type:"string"},description:"\u5951\u7D04\u5F53\u4E8B\u8005\u4E00\u89A7"},obligations:{type:"array",items:{type:"object",properties:{clause:{type:"string",description:"\u6761\u9805\u540D\u307E\u305F\u306F\u756A\u53F7"},party:{type:"string",description:"\u7FA9\u52D9\u3092\u8CA0\u3046\u5F53\u4E8B\u8005"},obligation_text:{type:"string",description:"\u7FA9\u52D9\u5185\u5BB9\u306E\u8A73\u7D30"}},required:["clause","obligation_text"]},description:"\u5F53\u4E8B\u8005\u7FA9\u52D9\u4E00\u89A7"}},required:["contract_title","parties","obligations"]}},{key:"citation_proof",name:"\u5F15\u7528\u691C\u8A3C\u30FB\u53CD\u8A3C\u30B9\u30B3\u30A2",description:"\u5168\u4F53\u63A5\u5730\u5EA6\u30B9\u30B3\u30A2\u3001\u6839\u62E0\u30C1\u30E3\u30F3\u30AF\u4ED8\u304D\u80AF\u5B9A\u4E3B\u5F35\u3001\u53CD\u8A3C\u30FB\u672A\u63A5\u5730\u4E3B\u5F35\u306E\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{overall_groundedness:{type:"number",minimum:0,maximum:1,description:"\u8A3C\u62E0\u63A5\u5730\u30B9\u30B3\u30A2 (0-1)"},supported_claims:{type:"array",items:{type:"object",properties:{claim:{type:"string",description:"\u4E3B\u5F35\u6587"},chunk_id:{type:"string",description:"\u6839\u62E0\u30C1\u30E3\u30F3\u30AF UID"},confidence:{type:"number",description:"\u78BA\u4FE1\u5EA6"}},required:["claim","chunk_id"]}},unsupported_claims:{type:"array",items:{type:"string"},description:"\u6839\u62E0\u4E0D\u5341\u5206\u307E\u305F\u306F\u53CD\u8A3C\u3055\u308C\u305F\u4E3B\u5F35\u6587"}},required:["overall_groundedness","supported_claims"]}}],ze=0,Te=2,Ee=1;function ut(e){try{let r=new URL(e);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function Ie(e){return e?typeof e=="string"?e:JSON.stringify(e,null,2):""}function ft({templates:e,onSaveTemplate:r,isSaving:i=!1}){let d=(0,O.useId)(),s=e[0],[a,u]=(0,O.useState)(s?s.template_key:""),o=e.find(f=>f.template_key===a)??s,[x,g]=(0,O.useState)(o?o.template_text:""),[T,z]=(0,O.useState)(o?o.model_name:""),[h,$]=(0,O.useState)(o?o.temperature:0),[n,p]=(0,O.useState)(o?o.max_output_tokens:0),[k,P]=(0,O.useState)(Ie(o?.response_schema)),[t,S]=(0,O.useState)(o?.endpoint_base_url??""),[y,C]=(0,O.useState)("prompt"),A=(0,O.useMemo)(()=>{let f=k.trim();if(!f)return{valid:!0,error:null,parsed:null};try{let G=JSON.parse(f);return typeof G!="object"||G===null||Array.isArray(G)?{valid:!1,error:"JSON Schema \u306E\u30EB\u30FC\u30C8\u306F JSON \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8 (Object) \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002",parsed:null}:{valid:!0,error:null,parsed:G}}catch(G){return{valid:!1,error:G.message,parsed:null}}},[k]),j=(0,O.useMemo)(()=>{if(T.trim()==="")return{valid:!1,error:"\u63A8\u8AD6\u30E2\u30C7\u30EB\u540D\u306F\u5FC5\u9808\u3067\u3059\u3002"};if(!Number.isFinite(h)||h<ze||h>Te)return{valid:!1,error:`\u6E29\u5EA6\u306F ${ze} \u4EE5\u4E0A ${Te} \u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};if(!Number.isInteger(n)||n<Ee)return{valid:!1,error:`\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570\u306F ${Ee} \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let f=t.trim();return f!==""&&!ut(f)?{valid:!1,error:"\u5B9B\u5148\u306F http:// \u307E\u305F\u306F https:// \u3067\u59CB\u307E\u308B\u7D76\u5BFE URL \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"}:{valid:!0,error:null}},[T,h,n,t]),Z=f=>{u(f.template_key),g(f.template_text),z(f.model_name),$(f.temperature),p(f.max_output_tokens),P(Ie(f.response_schema)),S(f.endpoint_base_url??"")};if(!o)return(0,v.jsxs)("div",{"data-testid":"prompt-template-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,v.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,v.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u904B\u7528\u30B3\u30F3\u30BD\u30FC\u30EB"}),(0,v.jsx)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8\u304A\u3088\u3073\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u7DE8\u96C6\u3068 Golden Benchmark \u30C9\u30E9\u30A4\u30E9\u30F3\u4E8B\u524D\u691C\u8A3C"})]}),(0,v.jsx)("p",{"data-testid":"no-templates-message",style:{color:"#64748b",fontSize:"13px"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"})]});let X=f=>{let G=fe.find(le=>le.key===f);G?P(JSON.stringify(G.schema,null,2)):f==="empty_object"?P(JSON.stringify({type:"object",properties:{},required:[]},null,2)):f==="clear"&&P("")},V=i||!A.valid||!j.valid,de=()=>{A.valid&&j.valid&&r?.({...o,template_text:x,model_name:T.trim(),temperature:h,max_output_tokens:n,response_schema:A.parsed,endpoint_base_url:t.trim()===""?null:t.trim()})};return(0,v.jsxs)("div",{"data-testid":"prompt-template-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,v.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,v.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u904B\u7528\u30B3\u30F3\u30BD\u30FC\u30EB"}),(0,v.jsx)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8\u304A\u3088\u3073\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u7DE8\u96C6\u3068 Golden Benchmark \u30C9\u30E9\u30A4\u30E9\u30F3\u4E8B\u524D\u691C\u8A3C"})]}),(0,v.jsx)("div",{role:"tablist","aria-label":"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4E00\u89A7",style:{display:"flex",gap:"6px",marginBottom:"16px",flexWrap:"wrap"},children:e.map(f=>(0,v.jsx)("button",{id:`template-tab-${f.template_key}`,type:"button",role:"tab","data-testid":`template-tab-${f.template_key}`,"aria-selected":f.template_key===a,"aria-controls":"prompt-editor-panel",onClick:()=>Z(f),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:f.template_key===a?"#2563eb":"#f8fafc",color:f.template_key===a?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer",fontWeight:f.template_key===a?600:400},children:f.name},f.template_key))}),(0,v.jsxs)("div",{id:"prompt-editor-panel",role:"tabpanel","aria-labelledby":`template-tab-${o.template_key}`,children:[(0,v.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(160px, 1fr))",gap:"10px",marginBottom:"16px"},children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("label",{htmlFor:"prompt-model-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u63A8\u8AD6\u30E2\u30C7\u30EB"}),(0,v.jsx)("input",{id:"prompt-model-input",type:"text","data-testid":"prompt-model-input",value:T,onChange:f=>z(f.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("label",{htmlFor:"prompt-temperature-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u6E29\u5EA6 (Temperature)"}),(0,v.jsx)("input",{id:"prompt-temperature-input",type:"number",step:"0.1",min:"0",max:"2","data-testid":"prompt-temperature-input",value:h,onChange:f=>$(Number(f.target.value)),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("label",{htmlFor:"prompt-tokens-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570"}),(0,v.jsx)("input",{id:"prompt-tokens-input",type:"number",step:"128",min:"128",max:"8192","data-testid":"prompt-tokens-input",value:n,onChange:f=>p(Number(f.target.value)),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("label",{htmlFor:"prompt-endpoint-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u5B9B\u5148 (\u914D\u5099\u5185\u30D7\u30ED\u30D0\u30A4\u30C0)"}),(0,v.jsx)("input",{id:"prompt-endpoint-input",type:"url",placeholder:"https://sidecar.example:48001","data-testid":"prompt-endpoint-input",value:t,onChange:f=>S(f.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]})]}),j.error!==null&&(0,v.jsx)("div",{"data-testid":"prompt-field-error",role:"alert",style:{marginBottom:"12px",padding:"8px 10px",borderRadius:"6px",backgroundColor:"#fef2f2",border:"1px solid #ef4444",color:"#b91c1c",fontSize:"12px"},children:j.error}),(0,v.jsxs)("div",{style:{display:"flex",gap:"8px",borderBottom:"1px solid #e2e8f0",marginBottom:"12px",paddingBottom:"4px"},children:[(0,v.jsx)("button",{type:"button",onClick:()=>C("prompt"),"data-testid":"editor-tab-prompt",style:{padding:"6px 14px",border:"none",borderRadius:"4px",backgroundColor:y==="prompt"?"#e0e7ff":"transparent",color:y==="prompt"?"#3730a3":"#64748b",fontWeight:y==="prompt"?600:400,fontSize:"13px",cursor:"pointer"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u672C\u6587 (Prompt Text)"}),(0,v.jsxs)("button",{type:"button",onClick:()=>C("schema"),"data-testid":"editor-tab-schema",style:{padding:"6px 14px",border:"none",borderRadius:"4px",backgroundColor:y==="schema"?"#e0e7ff":"transparent",color:y==="schema"?"#3730a3":"#64748b",fontWeight:y==="schema"?600:400,fontSize:"13px",cursor:"pointer"},children:["\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE (JSON Schema)",A.valid&&k.trim()&&(0,v.jsx)("span",{style:{marginLeft:"6px",fontSize:"11px",backgroundColor:"#10b981",color:"#ffffff",padding:"1px 5px",borderRadius:"10px"},children:"\u8A2D\u5B9A\u6E08"}),!A.valid&&(0,v.jsx)("span",{style:{marginLeft:"6px",fontSize:"11px",backgroundColor:"#ef4444",color:"#ffffff",padding:"1px 5px",borderRadius:"10px"},children:"\u30A8\u30E9\u30FC"})]})]}),y==="prompt"&&(0,v.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,v.jsx)("label",{htmlFor:"prompt-template-textarea",style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u672C\u6587 (\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC: {{variable}})"}),(0,v.jsx)("textarea",{id:"prompt-template-textarea","data-testid":"prompt-template-textarea",value:x,onChange:f=>g(f.target.value),rows:12,style:{width:"100%",padding:"8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontFamily:"monospace",fontSize:"13px",lineHeight:1.5}})]}),y==="schema"&&(0,v.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,v.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",flexWrap:"wrap",gap:"8px"},children:[(0,v.jsx)("label",{htmlFor:"prompt-schema-textarea",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u30EC\u30B9\u30DD\u30F3\u30B9\u69CB\u9020\u5316 JSON Schema (Structured Outputs / JSON Mode \u5236\u7D04\u5B9A\u7FA9)"}),(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,v.jsx)("label",{htmlFor:d,style:{fontSize:"12px",color:"#64748b"},children:"\u30D7\u30EA\u30BB\u30C3\u30C8\u9069\u7528:"}),(0,v.jsxs)("select",{id:d,"data-testid":"schema-preset-select",defaultValue:"",onChange:f=>{f.target.value&&(X(f.target.value),f.target.value="")},style:{fontSize:"12px",padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff"},children:[(0,v.jsx)("option",{value:"",disabled:!0,children:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),fe.map(f=>(0,v.jsx)("option",{value:f.key,children:f.name},f.key)),(0,v.jsx)("option",{value:"empty_object",children:"\u7A7A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8 ({})"}),(0,v.jsx)("option",{value:"clear",children:"\u30AF\u30EA\u30A2 (\u30B9\u30AD\u30FC\u30DE\u89E3\u9664)"})]})]})]}),(0,v.jsx)("textarea",{id:"prompt-schema-textarea","data-testid":"prompt-schema-textarea",value:k,onChange:f=>P(f.target.value),rows:12,placeholder:`{
2
+ "type": "object",
3
+ "properties": {
4
+ "summary": { "type": "string" }
5
+ },
6
+ "required": ["summary"]
7
+ }`,style:{width:"100%",padding:"8px",borderRadius:"4px",border:A.valid?"1px solid #cbd5e1":"1px solid #f87171",fontFamily:"monospace",fontSize:"13px",lineHeight:1.5,backgroundColor:A.valid?"#ffffff":"#fff5f5"}}),(0,v.jsxs)("div",{style:{marginTop:"6px"},"data-testid":"schema-validation-status",children:[!k.trim()&&(0,v.jsx)("p",{"data-testid":"schema-empty-banner",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u69CB\u9020\u5316\u30B9\u30AD\u30FC\u30DE\u672A\u8A2D\u5B9A\uFF08\u81EA\u7531\u5F62\u5F0F\u30C6\u30AD\u30B9\u30C8\u307E\u305F\u306F\u30E2\u30C7\u30EB\u6A19\u6E96\u5F62\u5F0F\u3067\u51FA\u529B\uFF09"}),k.trim()&&A.valid&&(0,v.jsx)("p",{"data-testid":"schema-valid-banner",style:{margin:0,fontSize:"12px",color:"#16a34a",fontWeight:500},children:"\u2713 \u69CB\u6587\u30C1\u30A7\u30C3\u30AF\u6B63\u5E38: \u6709\u52B9\u306A JSON Schema \u3067\u3059"}),k.trim()&&!A.valid&&(0,v.jsxs)("p",{"data-testid":"schema-error-banner",style:{margin:0,fontSize:"12px",color:"#dc2626",fontWeight:500},children:["\u26A0 JSON \u69CB\u6587\u30A8\u30E9\u30FC: ",A.error]})]})]}),(0,v.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:r&&(0,v.jsx)("button",{type:"button","data-testid":"save-template-button","aria-label":"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u4FDD\u5B58",disabled:V,onClick:de,style:{padding:"8px 18px",borderRadius:"4px",border:"none",backgroundColor:V?"#94a3b8":"#10b981",color:"#ffffff",fontSize:"13px",fontWeight:600,cursor:V?"not-allowed":"pointer"},children:i?"\u4FDD\u5B58\u4E2D...":"\u672C\u756A\u66F4\u65B0\u4FDD\u5B58"})})]})]})}var ie=require("react"),w=require("react/jsx-runtime");function we(e,r){if(r==="int"){let i=Number.parseInt(String(e),10);return Number.isNaN(i)?e:i}if(r==="float"){let i=Number.parseFloat(String(e));return Number.isNaN(i)?e:i}return r==="bool"?!!e:e}function bt({parameters:e,onSaveParameter:r,onResetToDefault:i,readOnly:d=!1,isSaving:s=!1}){let[a,u]=(0,ie.useState)("all"),[o,x]=(0,ie.useState)(""),[g,T]=(0,ie.useState)({}),z=Array.from(new Set(e.map(n=>n.category))),h=e.filter(n=>{let p=a==="all"||n.category===a,k=o===""||n.key.toLowerCase().includes(o.toLowerCase())||n.description.toLowerCase().includes(o.toLowerCase());return p&&k}),$=(n,p)=>{T(k=>({...k,[n]:p}))};return(0,w.jsxs)("div",{"data-testid":"system-parameter-table",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u7BA1\u7406"}),(0,w.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u5168 ",e.length," \u4EF6\u306E\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u8A2D\u5B9A"]})]}),(0,w.jsx)("input",{type:"text","data-testid":"param-search-input","aria-label":"\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u30AD\u30FC\u307E\u305F\u306F\u8AAC\u660E\u3067\u691C\u7D22",placeholder:"\u30AD\u30FC\u307E\u305F\u306F\u8AAC\u660E\u3067\u691C\u7D22...",value:o,onChange:n=>x(n.target.value),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px",width:"220px"}})]}),(0,w.jsxs)("div",{"data-testid":"param-category-tabs",style:{display:"flex",gap:"6px",marginBottom:"16px",flexWrap:"wrap"},children:[(0,w.jsxs)("button",{type:"button","data-testid":"param-category-tab-all","aria-pressed":a==="all",onClick:()=>u("all"),style:{padding:"4px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:a==="all"?"#2563eb":"#ffffff",color:a==="all"?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer"},children:["\u3059\u3079\u3066 (",e.length,")"]}),z.map(n=>(0,w.jsx)("button",{type:"button","data-testid":`param-category-tab-${n}`,"aria-pressed":a===n,onClick:()=>u(n),style:{padding:"4px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:a===n?"#2563eb":"#ffffff",color:a===n?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer"},children:n},n))]}),(0,w.jsx)("div",{style:{overflowX:"auto"},children:(0,w.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,w.jsx)("thead",{children:(0,w.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D1\u30E9\u30E1\u30FC\u30BF\u30AD\u30FC"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u578B"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u73FE\u5728\u5024 / \u8A2D\u5B9A\u5024"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u8AAC\u660E"}),!d&&(0,w.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,w.jsx)("tbody",{children:h.map(n=>{let p=g[n.key]!==void 0?g[n.key]:n.value,k=g[n.key]!==void 0&&g[n.key]!==n.value;return(0,w.jsxs)("tr",{"data-testid":`param-row-${n.key}`,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,w.jsx)("td",{style:{padding:"8px",fontWeight:600,color:"#1e293b"},children:(0,w.jsx)("code",{children:n.key})}),(0,w.jsx)("td",{style:{padding:"8px",color:"#64748b"},children:n.data_type}),(0,w.jsx)("td",{style:{padding:"8px"},children:n.data_type==="bool"?(0,w.jsx)("button",{type:"button",role:"switch","aria-checked":!!p,"aria-label":`${n.key} \u306E\u5207\u308A\u66FF\u3048`,"data-testid":`param-input-${n.key}`,disabled:d,onClick:()=>$(n.key,!p),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:p?"#10b981":"#e2e8f0",color:p?"#ffffff":"#475569",cursor:d?"not-allowed":"pointer",fontSize:"12px"},children:String(p)}):(0,w.jsx)("input",{type:n.is_secret?"password":n.data_type==="int"||n.data_type==="float"?"number":"text","data-testid":`param-input-${n.key}`,"aria-label":`${n.key} \u306E\u5024`,disabled:d,value:String(p),onChange:P=>$(n.key,P.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:k?"1px solid #2563eb":"1px solid #cbd5e1",fontSize:"13px",width:"180px"}})}),(0,w.jsx)("td",{style:{padding:"8px",color:"#64748b"},children:n.description}),!d&&(0,w.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:(0,w.jsxs)("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[r&&(0,w.jsx)("button",{type:"button","data-testid":`save-param-${n.key}`,"aria-label":`${n.key} \u306E\u8A2D\u5B9A\u3092\u4FDD\u5B58`,disabled:s||!k,onClick:()=>r(n.key,we(p,n.data_type)),style:{padding:"4px 8px",borderRadius:"4px",border:"none",backgroundColor:k?"#2563eb":"#cbd5e1",color:"#ffffff",cursor:s||!k?"not-allowed":"pointer",fontSize:"12px"},children:"\u4FDD\u5B58"}),i&&(0,w.jsx)("button",{type:"button","data-testid":`reset-param-${n.key}`,"aria-label":`${n.key} \u3092\u65E2\u5B9A\u5024\u306B\u623B\u3059`,disabled:s,onClick:()=>i(n.key),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",color:"#64748b",cursor:s?"not-allowed":"pointer",fontSize:"12px"},children:"\u30EA\u30BB\u30C3\u30C8"})]})})]},n.key)})})]})})]})}var M=require("react"),_=require("react/jsx-runtime"),Pe="\u5168\u4F53",Ae="\u7A7A\u6B04\u3067\u5168\u4F53",$e="\u505C\u6B62\u4E2D",ae="#64748b";function Be(e){let r=e.trim();if(r==="")return null;let i=Number(r);if(!(!Number.isFinite(i)||i<=0))return i}function be(e){let r=e.trim();return r===""?null:r}function xt({vocabulary:e,references:r,unresolvedUris:i,onSaveTerm:d,onSaveReference:s,isUpdating:a=!1,readOnly:u=!1}){let[o,x]=(0,M.useState)(""),[g,T]=(0,M.useState)(""),[z,h]=(0,M.useState)(""),[$,n]=(0,M.useState)(""),[p,k]=(0,M.useState)(""),[P,t]=(0,M.useState)(""),[S,y]=(0,M.useState)(null),[C,A]=(0,M.useState)(null),[j,Z]=(0,M.useState)(null),X=(0,M.useId)(),V=(0,M.useId)(),de=new Set(i??[]),f=u||a,G=async(c,Y,Le,Oe)=>{Z(c);try{await Y(),Le()}catch(xe){Oe(xe instanceof Error?xe.message:"\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{Z(null)}},le=()=>{y(null);let c=Be(z);if(o.trim()===""){y("\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return}if(c===void 0){y("\u91CD\u307F\u306F 0 \u3088\u308A\u5927\u304D\u3044\u6570\u3092\u5165\u308C\u3066\u304F\u3060\u3055\u3044\u3002\u7A7A\u6B04\u306B\u3059\u308B\u3068\u30B5\u30FC\u30D3\u30B9\u5074\u306E\u65E2\u5B9A\u306B\u59D4\u306D\u307E\u3059\u3002");return}G("term",()=>d?.({id:null,term:o.trim(),reading:g.trim()===""?null:g.trim(),boost:c,domainKey:be($),isActive:!0}),()=>{x(""),T(""),h(""),n("")},y)},Ne=()=>{if(A(null),p.trim()===""){A("\u8CC7\u6599\u306E\u5728\u51E6\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return}G("reference",()=>s?.({id:null,fileUri:p.trim(),domainKey:be(P),isActive:!0}),()=>{k(""),t("")},A)};return(0,_.jsxs)("div",{"data-testid":"transcription-adaptation-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,_.jsx)("h2",{style:{margin:"0 0 4px",fontSize:"14px",fontWeight:600,color:"#0f172a"},children:"\u8EE2\u5199\u306E\u9069\u5FDC\u60C5\u5831"}),(0,_.jsx)("p",{style:{margin:"0 0 12px",fontSize:"11px",color:"#64748b"},children:"\u9332\u97F3\u3092\u805E\u304F\u524D\u306B\u8A8D\u8B58\u5668\u3078\u6E21\u3059\u4E88\u5099\u77E5\u8B58\u3067\u3059\u3002\u6B04\u3092\u6301\u305F\u306A\u3044\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u6E21\u3059\u3068\u3001\u305D\u306E\u533A\u5206\u306E\u8EE2\u5199\u306F\u7121\u8996\u3055\u308C\u305A\u306B\u62D2\u5426\u3055\u308C\u307E\u3059\u3002"}),(0,_.jsx)("h3",{style:{margin:"0 0 6px",fontSize:"12px",fontWeight:600,color:"#334155"},children:"\u8A9E\u5F59"}),(0,_.jsxs)("table",{"data-testid":"vocabulary-grid","aria-label":"\u8A9E\u5F59",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[(0,_.jsx)("thead",{children:(0,_.jsx)("tr",{children:["\u8A9E","\u8AAD\u307F","\u91CD\u307F","\u9818\u57DF","\u64CD\u4F5C"].map(c=>(0,_.jsx)("th",{scope:"col",style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:c},c))})}),(0,_.jsx)("tbody",{children:e.map(c=>(0,_.jsxs)("tr",{"data-testid":`vocabulary-row-${c.id}`,"data-inactive":c.isActive?void 0:"true",children:[(0,_.jsxs)("th",{scope:"row",style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:"#0f172a",fontWeight:400,textAlign:"left"},children:[c.term,!c.isActive&&(0,_.jsx)("span",{"data-testid":`vocabulary-inactive-${c.id}`,style:{marginInlineStart:"6px",padding:"1px 5px",borderRadius:"3px",backgroundColor:"#f1f5f9",color:ae,fontSize:"10px"},children:$e})]}),(0,_.jsx)("td",{"data-testid":`vocabulary-reading-${c.id}`,style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:c.reading?"#0f172a":ae},children:c.reading??"\u2014"}),(0,_.jsx)("td",{"data-testid":`vocabulary-boost-${c.id}`,style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:c.boost===null?ae:"#0f172a"},children:c.boost===null?"\u65E2\u5B9A":c.boost}),(0,_.jsx)("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:c.domainKey??Pe}),(0,_.jsx)("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:(0,_.jsx)("button",{type:"button","data-testid":`vocabulary-toggle-${c.id}`,"aria-label":`${c.term} \u3092${c.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"}`,disabled:f,onClick:()=>{d?.({...c,isActive:!c.isActive})},style:{fontSize:"11px",padding:"2px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#f8fafc",cursor:f?"not-allowed":"pointer"},children:c.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"})})]},c.id))})]}),!u&&(0,_.jsxs)("form",{style:{display:"flex",gap:"6px",alignItems:"flex-start",marginBottom:"6px"},onSubmit:c=>{c.preventDefault(),le()},children:[(0,_.jsx)("input",{"data-testid":"vocabulary-term-input","aria-label":"\u8A9E","aria-invalid":!!S,"aria-describedby":S?X:void 0,value:o,onChange:c=>x(c.target.value),placeholder:"\u56FA\u6709\u540D\u8A5E",style:{flex:2,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("input",{"data-testid":"vocabulary-reading-input","aria-label":"\u8AAD\u307F",value:g,onChange:c=>T(c.target.value),placeholder:"\u3053\u3086\u3046\u3081\u3044\u3057",style:{flex:2,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("input",{"data-testid":"vocabulary-boost-input","aria-label":"\u91CD\u307F",inputMode:"decimal","aria-invalid":!!S,"aria-describedby":S?X:void 0,value:z,onChange:c=>h(c.target.value),placeholder:"\u65E2\u5B9A",style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("input",{"data-testid":"vocabulary-domain-input","aria-label":"\u9818\u57DF",value:$,onChange:c=>n(c.target.value),placeholder:Ae,style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("button",{type:"submit","data-testid":"vocabulary-add",disabled:f||j==="term",style:{fontSize:"12px",padding:"5px 12px",borderRadius:"4px",border:"1px solid #0f172a",backgroundColor:"#0f172a",color:"#ffffff",cursor:f?"not-allowed":"pointer"},children:"\u8FFD\u52A0"})]}),S&&(0,_.jsx)("p",{"data-testid":"vocabulary-term-error",id:X,role:"alert",style:{margin:"0 0 16px",fontSize:"11px",color:"#b91c1c"},children:S}),(0,_.jsx)("h3",{style:{margin:"0 0 6px",fontSize:"12px",fontWeight:600,color:"#334155"},children:"\u53C2\u8003\u8CC7\u6599"}),(0,_.jsx)("p",{style:{margin:"0 0 6px",fontSize:"11px",color:"#64748b"},children:"\u672C\u6587\u306F\u53D6\u308A\u8FBC\u307F\u6E08\u307F\u306E\u6587\u66F8\u304B\u3089\u8AAD\u307F\u307E\u3059\u3002\u8CC7\u6599\u81EA\u8EAB\u306E\u6A5F\u5BC6\u533A\u5206\u3082\u3001\u9001\u4FE1\u5148\u306E\u53EF\u5426\u3068\u3057\u3066\u8A55\u4FA1\u3055\u308C\u307E\u3059\u3002"}),(0,_.jsxs)("table",{"data-testid":"reference-grid","aria-label":"\u53C2\u8003\u8CC7\u6599",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[(0,_.jsx)("thead",{children:(0,_.jsx)("tr",{children:["\u8CC7\u6599\u306E\u5728\u51E6","\u9818\u57DF","\u64CD\u4F5C"].map(c=>(0,_.jsx)("th",{scope:"col",style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:c},c))})}),(0,_.jsx)("tbody",{children:r.map(c=>{let Y=c.isActive&&de.has(c.fileUri);return(0,_.jsxs)("tr",{"data-testid":`reference-row-${c.id}`,"data-unresolved":Y?"true":void 0,"data-inactive":c.isActive?void 0:"true",children:[(0,_.jsxs)("th",{scope:"row",style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:Y?"#b91c1c":"#0f172a",fontWeight:400,textAlign:"left"},children:[c.fileUri,!c.isActive&&(0,_.jsx)("span",{"data-testid":`reference-inactive-${c.id}`,style:{marginInlineStart:"6px",padding:"1px 5px",borderRadius:"3px",backgroundColor:"#f1f5f9",color:ae,fontSize:"10px"},children:$e}),Y&&(0,_.jsx)("span",{"data-testid":`reference-unresolved-${c.id}`,style:{display:"block",fontSize:"11px"},children:"\u3053\u306E\u8CC7\u6599\u306B\u306F\u53D6\u308A\u8FBC\u307F\u6E08\u307F\u306E\u672C\u6587\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u3053\u306E\u72B6\u614B\u3067\u306F\u8EE2\u5199\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3002"})]}),(0,_.jsx)("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:c.domainKey??Pe}),(0,_.jsx)("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:(0,_.jsx)("button",{type:"button","data-testid":`reference-toggle-${c.id}`,"aria-label":`${c.fileUri} \u3092${c.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"}`,disabled:f,onClick:()=>{s?.({...c,isActive:!c.isActive})},style:{fontSize:"11px",padding:"2px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#f8fafc",cursor:f?"not-allowed":"pointer"},children:c.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"})})]},c.id)})})]}),!u&&(0,_.jsxs)("form",{style:{display:"flex",gap:"6px"},onSubmit:c=>{c.preventDefault(),Ne()},children:[(0,_.jsx)("input",{"data-testid":"reference-uri-input","aria-label":"\u8CC7\u6599\u306E\u5728\u51E6",value:p,onChange:c=>k(c.target.value),placeholder:"gdrive://minutes.pdf",style:{flex:4,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("input",{"data-testid":"reference-domain-input","aria-label":"\u8CC7\u6599\u306E\u9818\u57DF",value:P,onChange:c=>t(c.target.value),placeholder:Ae,style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),(0,_.jsx)("button",{type:"submit","data-testid":"reference-add",disabled:f||j==="reference",style:{fontSize:"12px",padding:"5px 12px",borderRadius:"4px",border:"1px solid #0f172a",backgroundColor:"#0f172a",color:"#ffffff",cursor:f?"not-allowed":"pointer"},children:"\u8FFD\u52A0"})]}),C&&(0,_.jsx)("p",{"data-testid":"reference-error",id:V,role:"alert",style:{margin:"6px 0 0",fontSize:"11px",color:"#b91c1c"},children:C})]})}var R=require("react/jsx-runtime");function H(e){return e===null?"\u672A\u6E2C\u5B9A":e.toLocaleString()}function W(e){return e!==null&&e>0}function gt({auditData:e,onTriggerReconcile:r,isReconciling:i=!1,reconcileResult:d=null,onRefresh:s,isRefreshing:a=!1}){let u=e.is_consistent,o=u===null?{text:"\u5224\u5B9A\u4E0D\u80FD",background:"#fef3c7",color:"#92400e"}:u?{text:"\u6574\u5408\u6027\u6B63\u5E38",background:"#d1fae5",color:"#065f46"}:{text:"\u4E0D\u6574\u5408\u691C\u77E5",background:"#fee2e2",color:"#991b1b"},x=i||u!==!1;return(0,R.jsxs)("div",{"data-testid":"tri-store-integrity-audit",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,R.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,R.jsxs)("div",{children:[(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,R.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Tri-Store \u30C7\u30FC\u30BF\u6574\u5408\u6027\u76E3\u67FB"}),(0,R.jsx)("span",{"data-testid":"audit-integrity-badge","data-consistent":String(u),style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:o.background,color:o.color,fontWeight:600},children:o.text})]}),(0,R.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u6700\u7D42\u76E3\u67FB\u65E5\u6642: ",(0,R.jsx)("span",{"data-testid":"last-audit-time",children:e.last_audit_time})]})]}),(0,R.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[s&&(0,R.jsx)("button",{type:"button","data-testid":"audit-refresh-button","aria-label":"\u6574\u5408\u6027\u76E3\u67FB\u30C7\u30FC\u30BF\u3092\u66F4\u65B0",disabled:a,onClick:s,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:a?"not-allowed":"pointer",fontSize:"13px"},children:a?"\u66F4\u65B0\u4E2D...":"\u66F4\u65B0"}),r&&(0,R.jsx)("button",{type:"button","data-testid":"trigger-reconciliation-button","aria-label":"\u5DEE\u5206\u6574\u5408\u6027\u4FEE\u5FA9\u3092\u5B9F\u884C",disabled:x,onClick:r,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:x?"#cbd5e1":"#2563eb",color:"#ffffff",cursor:x?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:i?"\u4FEE\u5FA9\u4E2D...":"\u5DEE\u5206\u6574\u5408\u6027\u4FEE\u5FA9"})]})]}),(0,R.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"10px"},children:[(0,R.jsxs)("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30DE\u30B9\u30BF\u30FC\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570 (MSSQL)"}),(0,R.jsx)("div",{"data-testid":"audit-total-files",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:e.total_files.toLocaleString()})]}),(0,R.jsxs)("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30D9\u30AF\u30C8\u30EB\u767B\u9332\u6570 (Qdrant\u30FB\u30C1\u30E3\u30F3\u30AF)"}),(0,R.jsx)("div",{"data-testid":"audit-vector-count",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:H(e.vector_indexed_count)}),(0,R.jsxs)("div",{"data-testid":"audit-vector-expected",style:{fontSize:"12px",color:"#64748b"},children:["\u6295\u5F71\u8A18\u9332: ",H(e.expected_vector_count)]})]}),(0,R.jsxs)("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30B0\u30E9\u30D5\u6295\u5F71\u30CE\u30FC\u30C9\u6570 (Neo4j\u30FB\u6587\u66F8)"}),(0,R.jsx)("div",{"data-testid":"audit-graph-count",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:H(e.graph_projected_count)}),(0,R.jsxs)("div",{"data-testid":"audit-graph-expected",style:{fontSize:"12px",color:"#64748b"},children:["\u6295\u5F71\u8A18\u9332: ",H(e.expected_graph_count)]})]}),(0,R.jsxs)("div",{style:{border:`1px solid ${W(e.orphan_vectors_count)?"#ef4444":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:W(e.orphan_vectors_count)?"#fef2f2":"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:W(e.orphan_vectors_count)?"#991b1b":"#64748b"},children:"\u5B64\u5150\u30D9\u30AF\u30C8\u30EB\u4EF6\u6570"}),(0,R.jsx)("div",{"data-testid":"audit-orphan-vectors",style:{fontSize:"20px",fontWeight:700,color:W(e.orphan_vectors_count)?"#b91c1c":"#0f172a"},children:H(e.orphan_vectors_count)})]}),(0,R.jsxs)("div",{style:{border:`1px solid ${W(e.orphan_nodes_count)?"#ef4444":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:W(e.orphan_nodes_count)?"#fef2f2":"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:W(e.orphan_nodes_count)?"#991b1b":"#64748b"},children:"\u5B64\u5150\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9\u4EF6\u6570"}),(0,R.jsx)("div",{"data-testid":"audit-orphan-nodes",style:{fontSize:"20px",fontWeight:700,color:W(e.orphan_nodes_count)?"#b91c1c":"#0f172a"},children:H(e.orphan_nodes_count)})]}),(0,R.jsxs)("div",{style:{border:`1px solid ${W(e.unresolved_policy_conflicts)?"#f59e0b":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:W(e.unresolved_policy_conflicts)?"#fffbeb":"#f8fafc"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",color:W(e.unresolved_policy_conflicts)?"#92400e":"#64748b"},children:"\u898F\u7A0B\u885D\u7A81\u672A\u89E3\u6C7A\u4EF6\u6570"}),(0,R.jsx)("div",{"data-testid":"audit-policy-conflicts",style:{fontSize:"20px",fontWeight:700,color:W(e.unresolved_policy_conflicts)?"#b45309":"#0f172a"},children:H(e.unresolved_policy_conflicts)})]})]}),d&&(0,R.jsxs)("div",{"data-testid":"audit-reconcile-result",style:{marginTop:"12px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc",fontSize:"13px",color:"#334155"},children:[(0,R.jsx)("div",{style:{fontWeight:600,marginBottom:"4px"},children:"\u76F4\u524D\u306E\u4FEE\u5FA9"}),(0,R.jsxs)("div",{"data-testid":"reconcile-purged-points",children:["\u9664\u53BB\u3057\u305F\u5B64\u5150\u30D9\u30AF\u30C8\u30EB\u70B9: ",d.purgedVectorPoints.toLocaleString()," \u4EF6"]}),(0,R.jsxs)("div",{"data-testid":"reconcile-reprojected-chunks",children:["\u518D\u6295\u5F71\u3057\u305F\u30C1\u30E3\u30F3\u30AF: ",d.reprojectedChunks.toLocaleString()," \u4EF6"]}),(0,R.jsxs)("div",{"data-testid":"reconcile-run-id",style:{fontSize:"11px",color:"#64748b"},children:["\u5B9F\u884C ID: ",d.runId||"\u672A\u6E2C\u5B9A"]})]}),e.probe_failures.length>0&&(0,R.jsxs)("div",{"data-testid":"audit-probe-failures",style:{marginTop:"12px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb"},children:[(0,R.jsx)("div",{style:{fontSize:"12px",fontWeight:600,color:"#92400e",marginBottom:"4px"},children:"\u6E2C\u5B9A\u3067\u304D\u306A\u304B\u3063\u305F\u9805\u76EE"}),(0,R.jsx)("ul",{style:{margin:0,paddingLeft:"18px",fontSize:"13px",color:"#92400e"},children:e.probe_failures.map(g=>(0,R.jsx)("li",{children:g},g))})]})]})}0&&(module.exports={CitationProofBadge,ClassificationRuleEditor,ConfidentialityPolicyBoard,FeatureFlagBoard,GovernanceDryRunConsole,KnowledgeGraphExplorer,PromptTemplateConsole,SCHEMA_PRESETS,SystemParameterTable,TranscriptionAdaptationBoard,TriStoreIntegrityAudit,computeDateFromPercent,normalizeDomain,parseBoost,parseParameterValue});