@redocly/replay 0.27.0-next.3 → 0.27.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/replay-AiChatProvider-BGXsZqW2.js +6 -0
- package/dist/replay-AiChatProvider-CVvR1kSd.js +1004 -0
- package/dist/replay-AiChatSqliteDBStorage-BFHRKFlk.js +88 -0
- package/dist/replay-AiChatSqliteDBStorage-DVJ9f2EK.js +1 -0
- package/dist/replay-AiPanel-CynVcVmm.js +2873 -0
- package/dist/replay-AiPanel-qVp_s4gD.js +849 -0
- package/dist/replay-HistorySqliteDBStorage-BrILW8Fu.js +1 -0
- package/dist/replay-HistorySqliteDBStorage-CtF6-vY8.js +113 -0
- package/dist/replay-SqliteDBStorage-CSz7NYH4.js +2857 -0
- package/dist/replay-SqliteDBStorage-eRBPh4E8.js +14 -0
- package/dist/replay-StepContextSqliteDBStorage-BSepLyBI.js +1 -0
- package/dist/replay-StepContextSqliteDBStorage-BfAAKDwA.js +83 -0
- package/dist/replay-agent-loop-C60p47KY.js +1 -0
- package/dist/replay-agent-loop-CEZz1kj-.js +1533 -0
- package/dist/replay-ai-chat-mappers-BAHU6JIc.js +99 -0
- package/dist/replay-ai-chat-mappers-Dqg-QVZy.js +1 -0
- package/dist/replay-ai-message-parts.schema-BBdjwldJ.js +1 -0
- package/dist/replay-ai-message-parts.schema-E9u9-nqr.js +60 -0
- package/dist/replay-create-model-C2NQtDcL.js +38224 -0
- package/dist/replay-create-model-CUL-l-eX.js +104 -0
- package/dist/replay-db-C4jAfGtc.js +64 -0
- package/dist/replay-db-Dw-X2WGx.js +306 -0
- package/dist/replay-defaults-CzR6jw9a.js +32 -0
- package/dist/replay-defaults-DVvOnvnR.js +27 -0
- package/dist/replay-external-resolver-DAkLV0nr.js +34 -0
- package/dist/replay-external-resolver-DN_PWq_2.js +2 -0
- package/dist/replay-history.schema-5ce6X0R1.js +28 -0
- package/dist/replay-history.schema-miM3Etuf.js +1 -0
- package/dist/replay-index-BmX1FPBL.js +6877 -0
- package/dist/replay-index-DR1uVBvc.js +503 -0
- package/dist/replay-index-DSKZHOXq.js +1 -0
- package/dist/{replay-index-gw_CfN4i.js → replay-index-DT5gdiBA.js} +1 -1
- package/dist/replay-index-O_Pq5an3.js +92924 -0
- package/dist/{replay-index-CiP3e-cc.js → replay-index-m00jnWFr.js} +6 -6
- package/dist/replay-index-qZlgEmbq.js +1 -0
- package/dist/replay-index-rRWvC2pp.js +1 -0
- package/dist/replay-indexes-CfsvVMi_.js +1242 -0
- package/dist/replay-indexes-Dqjl8m6C.js +1 -0
- package/dist/replay-lint-CcVVykW7.js +33217 -0
- package/dist/replay-lint-ON47l7Vu.js +184 -0
- package/dist/{replay-lint-graphql-DV4sCSe6.js → replay-lint-graphql-5cGt2KR_.js} +5 -5
- package/dist/{replay-lint-graphql-Cbptkd8N.js → replay-lint-graphql-DlD7bblx.js} +2 -2
- package/dist/replay-resolve-BTzo-fSv.js +47 -0
- package/dist/replay-resolve-Ca3DUbGq.js +3683 -0
- package/dist/{replay-respect-run-ChMawzhr.js → replay-respect-run-BtC2agF9.js} +54 -54
- package/dist/{replay-respect-run-BscBAlnT.js → replay-respect-run-eSRzH2dk.js} +447 -447
- package/dist/replay-step-context.schema-BuuXkAck.js +1 -0
- package/dist/replay-step-context.schema-DBk4jufr.js +21 -0
- package/dist/{replay-tauri-path-BMmQuI9X.js → replay-tauri-path-C-oxFOHe.js} +4 -4
- package/dist/{replay-tauri-path-kR-IXn3X.js → replay-tauri-path-CKcvIl_h.js} +1 -1
- package/dist/replay-useAiChatQueries-CVTxcu2Z.js +192 -0
- package/dist/replay-useAiChatQueries-vdKvbmp2.js +3413 -0
- package/dist/replay-validate-key-CwIopif3.js +28 -0
- package/dist/replay-validate-key-VkgZoK1f.js +1 -0
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +2 -0
- package/dist/replay.js +21 -21
- package/package.json +22 -25
- package/dist/replay-index-CUY_5IyO.js +0 -8308
- package/dist/replay-index-CUdCFVnz.js +0 -178626
- package/dist/replay-index-D8qtqDhF.js +0 -1
- package/dist/replay-index-DgjC0DLq.js +0 -1
|
@@ -0,0 +1,849 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),V=require("styled-components"),g=require("@redocly/theme"),f=require("./replay-index-BmX1FPBL.js"),x=require("./replay-useAiChatQueries-CVTxcu2Z.js"),R=require("./replay-db-C4jAfGtc.js");require("@tanstack/react-query");const Be=require("react-router-dom"),Fe=e=>e&&e.__esModule?e:{default:e},s=Fe(V),U=s.default.div`
|
|
2
|
+
width: var(--search-ai-thinking-dot-size);
|
|
3
|
+
height: var(--search-ai-thinking-dot-size);
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
background: var(--search-ai-thinking-dot-color);
|
|
6
|
+
animation: bounce 1.4s infinite ease-in-out;
|
|
7
|
+
|
|
8
|
+
&:nth-child(1) {
|
|
9
|
+
animation-delay: -0.32s;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:nth-child(2) {
|
|
13
|
+
animation-delay: -0.16s;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:nth-child(3) {
|
|
17
|
+
animation-delay: 0s;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes bounce {
|
|
21
|
+
0%,
|
|
22
|
+
80%,
|
|
23
|
+
100% {
|
|
24
|
+
opacity: 0.2;
|
|
25
|
+
transform: scale(0.8);
|
|
26
|
+
}
|
|
27
|
+
40% {
|
|
28
|
+
opacity: 1;
|
|
29
|
+
transform: scale(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,Ce=280;function te(){const[e,t]=h.useState(()=>f.getSemanticSearchService().getIndexingActivityState().inProgress);return h.useEffect(()=>f.getSemanticSearchService().subscribe("indexing-activity",r=>{t(r.inProgress)}),[]),i.jsx(Ge,{$open:e,children:i.jsx(Ue,{children:i.jsx(We,{$open:e,"aria-hidden":!e,children:i.jsx(g.Tooltip,{tip:"We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",placement:"top",width:"240px",arrowPosition:"left",children:i.jsxs(qe,{role:"status","aria-live":"polite","aria-label":"Indexing in progress...",children:[i.jsx("div",{children:i.jsx(U,{})}),i.jsx(Ye,{children:"Indexing in progress..."})]})})})})})}const Ge=s.default.div`
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
|
|
35
|
+
transition: grid-template-rows ${Ce}ms ease-out;
|
|
36
|
+
`,Ue=s.default.div`
|
|
37
|
+
min-height: 0;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
`,We=s.default.div`
|
|
40
|
+
opacity: ${({$open:e})=>e?1:0};
|
|
41
|
+
transition: opacity ${Ce}ms ease-out;
|
|
42
|
+
pointer-events: ${({$open:e})=>e?"auto":"none"};
|
|
43
|
+
padding: var(--spacing-xs);
|
|
44
|
+
padding-top: var(--spacing-xxs);
|
|
45
|
+
`,qe=s.default.div`
|
|
46
|
+
width: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: var(--spacing-xxs);
|
|
50
|
+
background: var(--layer-color);
|
|
51
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
52
|
+
border-radius: var(--border-radius);
|
|
53
|
+
font-size: var(--font-size-sm);
|
|
54
|
+
line-height: var(--line-height-sm);
|
|
55
|
+
`,Ye=s.default.div`
|
|
56
|
+
flex: 1;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
`,Ke=e=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"M13.0094 7.61066L3.38435 2.79816C3.30892 2.76043 3.22418 2.74532 3.14035 2.75463C3.05652 2.76394 2.97717 2.79729 2.91186 2.85066C2.84948 2.90294 2.80292 2.97158 2.77742 3.04886C2.75191 3.12615 2.74847 3.20902 2.76748 3.28816L3.92685 7.56253H8.87498V8.43753H3.92685L2.74998 12.6988C2.73214 12.7649 2.73006 12.8342 2.7439 12.9013C2.75774 12.9683 2.78712 13.0312 2.82968 13.0848C2.87223 13.1384 2.92677 13.1813 2.98891 13.21C3.05106 13.2387 3.11907 13.2524 3.18748 13.25C3.25597 13.2496 3.3234 13.2331 3.38435 13.2019L13.0094 8.38941C13.081 8.35269 13.1412 8.29692 13.1832 8.22821C13.2252 8.15951 13.2474 8.08055 13.2474 8.00003C13.2474 7.91951 13.2252 7.84056 13.1832 7.77185C13.1412 7.70315 13.081 7.64737 13.0094 7.61066Z",fill:"white"})}),Je=s.default(Ke).attrs({"data-component-name":"icons/SendIcon/SendIcon"})`
|
|
59
|
+
path {
|
|
60
|
+
fill: ${({color:e})=>f.getCssColorVariable(e)};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
height: ${({size:e})=>e||"16px"};
|
|
64
|
+
width: ${({size:e})=>e||"16px"};
|
|
65
|
+
`,Ze=e=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...e,children:i.jsx("path",{d:"M10.5 3.5V10.5H3.5V3.5H10.5ZM10.5 2.625H3.5C3.26794 2.625 3.04538 2.71719 2.88128 2.88128C2.71719 3.04538 2.625 3.26794 2.625 3.5V10.5C2.625 10.7321 2.71719 10.9546 2.88128 11.1187C3.04538 11.2828 3.26794 11.375 3.5 11.375H10.5C10.7321 11.375 10.9546 11.2828 11.1187 11.1187C11.2828 10.9546 11.375 10.7321 11.375 10.5V3.5C11.375 3.26794 11.2828 3.04538 11.1187 2.88128C10.9546 2.71719 10.7321 2.625 10.5 2.625Z"})}),Xe=s.default(Ze).attrs({"data-component-name":"icons/StopIcon/StopIcon"})`
|
|
66
|
+
path {
|
|
67
|
+
fill: ${({color:e})=>f.getCssColorVariable(e)};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
height: ${({size:e})=>e||"16px"};
|
|
71
|
+
width: ${({size:e})=>e||"16px"};
|
|
72
|
+
`;function Qe({placeholder:e="Ask anything...",className:t,disabled:n,isStreaming:r=!1,onStop:o,modelSelector:a,value:l,onValueChange:d,onSubmit:c,textareaRef:u}){const p=l.trim(),v=!n&&p.length>0&&!r,m=!n&&p.length>0,w=j=>{d(j.target.value)},y=()=>{!p||n||r||c()},A=()=>{!r||!o||o()},C=j=>{j.key==="Enter"&&!j.shiftKey&&!j.nativeEvent.isComposing&&(j.preventDefault(),r&&o?A():y())};return i.jsxs(et,{className:t,$isActive:m,children:[i.jsx(tt,{ref:u,rows:1,maxLength:g.AI_SEARCH_MAX_MESSAGE_LENGTH,placeholder:e,value:l,disabled:n,spellCheck:!1,onChange:w,onKeyDown:C}),i.jsxs(nt,{children:[a,r&&o?i.jsx(ot,{type:"button",size:"small","aria-label":"Stop generating",icon:i.jsx(Xe,{color:"var(--icon-color-on-color)"}),onClick:A}):i.jsx(rt,{type:"button",size:"small","aria-label":"Send message",icon:i.jsx(Je,{color:"var(--icon-color-on-color)"}),onClick:y,disabled:!v})]})]})}const et=s.default.div`
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: var(--spacing-xs);
|
|
76
|
+
width: 100%;
|
|
77
|
+
padding: var(--spacing-xs);
|
|
78
|
+
border: var(--search-ai-conversation-input-border, 1px solid var(--border-color-secondary));
|
|
79
|
+
border-radius: var(--search-ai-conversation-input-border-radius, var(--border-radius-lg));
|
|
80
|
+
background-color: var(--layer-color);
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
|
|
83
|
+
&:hover,
|
|
84
|
+
&:focus-within {
|
|
85
|
+
border-color: transparent;
|
|
86
|
+
background:
|
|
87
|
+
linear-gradient(var(--layer-color), var(--layer-color)) padding-box,
|
|
88
|
+
var(--replay-ai-gradient-soft) border-box;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
${({$isActive:e})=>e&&V.css`
|
|
92
|
+
border-color: transparent;
|
|
93
|
+
background:
|
|
94
|
+
linear-gradient(var(--layer-color), var(--layer-color)) padding-box,
|
|
95
|
+
var(--replay-ai-gradient-soft) border-box;
|
|
96
|
+
`}
|
|
97
|
+
`,tt=s.default.textarea`
|
|
98
|
+
max-height: 150px;
|
|
99
|
+
min-height: var(--search-ai-conversation-input-min-height);
|
|
100
|
+
|
|
101
|
+
resize: none;
|
|
102
|
+
border: none;
|
|
103
|
+
outline: none;
|
|
104
|
+
padding: 0;
|
|
105
|
+
font-family: var(--font-family-base);
|
|
106
|
+
font-size: var(--font-size-base);
|
|
107
|
+
line-height: var(--line-height-base);
|
|
108
|
+
color: var(--text-color-primary);
|
|
109
|
+
caret-color: var(--text-color-primary);
|
|
110
|
+
background-color: transparent;
|
|
111
|
+
field-sizing: content;
|
|
112
|
+
|
|
113
|
+
&::placeholder {
|
|
114
|
+
color: var(--text-color-helper);
|
|
115
|
+
text-indent: 2px;
|
|
116
|
+
}
|
|
117
|
+
`,nt=s.default.div`
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: var(--spacing-xs);
|
|
122
|
+
`,rt=s.default(g.Button)`
|
|
123
|
+
box-sizing: border-box;
|
|
124
|
+
background: var(--search-ai-gradient);
|
|
125
|
+
|
|
126
|
+
&:disabled {
|
|
127
|
+
background: var(--replay-ai-gradient-disabled);
|
|
128
|
+
border: var(--replay-ai-send-button-disabled-border);
|
|
129
|
+
width: 24px;
|
|
130
|
+
height: 24px;
|
|
131
|
+
}
|
|
132
|
+
`,ot=s.default(g.Button)`
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
background: var(--color-warm-grey-9);
|
|
135
|
+
border-radius: var(--border-radius-xxl);
|
|
136
|
+
`,it=new Set(["collection","workflow","step","operation","workflow-run"]);function Ae(e){return`replay://step?${new URLSearchParams({collectionId:e.collectionId.trim(),workflowId:e.workflowId.trim(),stepId:e.stepId.trim()}).toString()}`}function M(e,t){const n=e.get(t);if(n==null)return null;const r=n.trim();return r.length>0?r:null}function at(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="replay:")return null;const n=t.hostname.toLowerCase();if(!it.has(n))return null;const r=t.searchParams;switch(n){case"collection":{const o=M(r,"collectionId");return o?{kind:"collection",collectionId:o}:null}case"workflow":{const o=M(r,"collectionId"),a=M(r,"workflowId");return!o||!a?null:{kind:"workflow",collectionId:o,workflowId:a}}case"step":{const o=M(r,"collectionId"),a=M(r,"workflowId"),l=M(r,"stepId");return!o||!a||!l?null:{kind:"step",collectionId:o,workflowId:a,stepId:l}}case"operation":{const o=M(r,"operationId");return o?{kind:"operation",operationId:o}:null}case"workflow-run":{const o=M(r,"collectionId"),a=M(r,"workflowId");return!o||!a?null:{kind:"workflow-run",collectionId:o,workflowId:a}}default:return null}}function st(e,t,n){switch(n.kind){case"collection":t.openCollectionTab({collectionId:n.collectionId,activeTabName:f.TAB_NAMES.COLLECTION_SETTINGS});break;case"workflow":t.openWorkflowTab({collectionId:n.collectionId,workflowId:n.workflowId,activeTabName:f.TAB_NAMES.WORKFLOW_SETTINGS});break;case"step":t.openStepTabFromCollection({collectionId:n.collectionId,workflowId:n.workflowId,stepId:n.stepId,state:f.TabState.Normal});break;case"workflow-run":t.openWorkflowRunTab({collectionId:n.collectionId,workflowId:n.workflowId});break;case"operation":{const r=x.resolveOperation(e,n.operationId);if(!r.ok){console.warn("[executeReplayChatLink] Operation not resolved",{operationId:n.operationId,message:r.message});return}x.openOrFocusOperationEditorTab(e,x.operationListItemToCollectionOperation(r.value),t);break}}}function lt(e,t,n){const r=at(n);r&&st(e,t,r)}function je(){const e=f.useGlobalStore(),{getApiOperation:t}=f.useApiOperation(),{handleTabChange:n,addNewTab:r,openCollectionTab:o,openWorkflowTab:a,openStepTabFromCollection:l,openWorkflowRunTab:d}=f.useTabHandlers();return h.useCallback(c=>{const u=c.target;if(!(u instanceof Element))return;const p=u.closest("a[href]");if(!(p instanceof HTMLAnchorElement))return;const v=p.getAttribute("href");v?.startsWith("replay:")&&(c.preventDefault(),c.stopPropagation(),lt(e,{getApiOperation:t,handleTabChange:n,addNewTab:r,openCollectionTab:o,openWorkflowTab:a,openStepTabFromCollection:l,openWorkflowRunTab:d},v))},[e,t,n,r,o,a,l,d])}class ct{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const a=this.castInput(t,r),l=this.castInput(n,r),d=this.removeEmpty(this.tokenize(a,r)),c=this.removeEmpty(this.tokenize(l,r));return this.diffWithOptionsObj(d,c,r,o)}diffWithOptionsObj(t,n,r,o){var a;const l=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},d=n.length,c=t.length;let u=1,p=d+c;r.maxEditLength!=null&&(p=Math.min(p,r.maxEditLength));const v=(a=r.timeout)!==null&&a!==void 0?a:1/0,m=Date.now()+v,w=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(w[0],n,t,0,r);if(w[0].oldPos+1>=c&&y+1>=d)return l(this.buildValues(w[0].lastComponent,n,t));let A=-1/0,C=1/0;const j=()=>{for(let b=Math.max(A,-u);b<=Math.min(C,u);b+=2){let I;const N=w[b-1],P=w[b+1];N&&(w[b-1]=void 0);let _=!1;if(P){const F=P.oldPos-b;_=P&&0<=F&&F<d}const B=N&&N.oldPos+1<c;if(!_&&!B){w[b]=void 0;continue}if(!B||_&&N.oldPos<P.oldPos?I=this.addToPath(P,!0,!1,0,r):I=this.addToPath(N,!1,!0,1,r),y=this.extractCommon(I,n,t,b,r),I.oldPos+1>=c&&y+1>=d)return l(this.buildValues(I.lastComponent,n,t))||!0;w[b]=I,I.oldPos+1>=c&&(C=Math.min(C,b-1)),y+1>=d&&(A=Math.max(A,b+1))}u++};if(o)(function b(){setTimeout(function(){if(u>p||Date.now()>m)return o(void 0);j()||b()},0)})();else for(;u<=p&&Date.now()<=m;){const b=j();if(b)return b}}addToPath(t,n,r,o,a){const l=t.lastComponent;return l&&!a.oneChangePerToken&&l.added===n&&l.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:r,previousComponent:l.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:l}}}extractCommon(t,n,r,o,a){const l=n.length,d=r.length;let c=t.oldPos,u=c-o,p=0;for(;u+1<l&&c+1<d&&this.equals(r[c+1],n[u+1],a);)u++,c++,p++,a.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return p&&!a.oneChangePerToken&&(t.lastComponent={count:p,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let a;for(;t;)o.push(t),a=t.previousComponent,delete t.previousComponent,t=a;o.reverse();const l=o.length;let d=0,c=0,u=0;for(;d<l;d++){const p=o[d];if(p.removed)p.value=this.join(r.slice(u,u+p.count)),u+=p.count;else{if(!p.added&&this.useLongestToken){let v=n.slice(c,c+p.count);v=v.map(function(m,w){const y=r[u+w];return y.length>m.length?y:m}),p.value=this.join(v)}else p.value=this.join(n.slice(c,c+p.count));c+=p.count,p.added||(u+=p.count)}}return o}}class dt extends ct{constructor(){super(...arguments),this.tokenize=pt}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
137
|
+
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
138
|
+
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
139
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
140
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const ut=new dt;function ft(e,t,n){return ut.diff(e,t,n)}function pt(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
141
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const a=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=a:n.push(a)}return n}const ht=500;function gt(e,t){const n=xt(e,t);if(n.length===0)return[];const r=[];let o=0;for(;o<n.length;){let a=o;const l=n[o].type==="context";for(;a<n.length&&n[a].type==="context"===l;)a++;const d=n.slice(o,a);r.push({start:o,end:a,rows:d,hasAdditions:d.some(c=>c.type==="add"),hasRemovals:d.some(c=>c.type==="remove")}),o=a}return r}function xt(e,t){if(e===void 0)return t===void 0?[]:z(t,"add");if(t===void 0)return z(e,"remove");if(e===t)return z(t,"context");const n=vt(e,t);return n?n.flatMap(r=>z(r.value,r.added?"add":r.removed?"remove":"context")):[...z(e,"remove"),...z(t,"add")]}function vt(e,t){try{return ft(e,t,{timeout:ht})}catch{return}}function z(e,t){const n=e.split(`
|
|
142
|
+
`);return n.length>1&&n[n.length-1]===""&&n.pop(),n.map(r=>({type:t,text:r}))}const ne=1,re=e=>e&&e.hasAdditions!==e.hasRemovals,oe=e=>e&&(e.hasAdditions||e.hasRemovals);function mt(e,t,n){if(e.hasAdditions||e.hasRemovals)return G(e.rows);const r=n[t-1],o=n[t+1],a=re(r)?ne:0,l=re(o)?ne:0;if(a+l>=e.rows.length)return G(e.rows);const d=e.rows.slice(0,a),c=l>0?e.rows.slice(-l):[],u=[];return u.push(...G(d)),oe(r)&&oe(o)&&u.push({kind:"separator"}),u.push(...G(c)),u}function G(e){return e.map(t=>({kind:"row",row:t}))}const yt=200;function ie({oldValue:e,newValue:t}){const n=h.useMemo(()=>gt(e,t),[e,t]),r=h.useMemo(()=>n.flatMap(mt),[n]);return h.useMemo(()=>n.some(a=>a.hasAdditions||a.hasRemovals),[n])?i.jsx(wt,{$maxHeight:yt,children:r.map((a,l)=>{if(a.kind==="separator")return i.jsx(kt,{children:i.jsx(ae,{children:"···"})},l);const{row:d}=a,c=bt(d.type);return i.jsxs(c,{children:[i.jsxs(Tt,{children:[d.type==="remove"&&i.jsx(g.SubtractIcon,{size:"12px"}),d.type==="add"&&i.jsx(g.AddIcon,{size:"12px"})]}),i.jsx(ae,{children:d.text===""?" ":d.text})]},l)})}):null}function bt(e){return e==="remove"?Ct:e==="add"?At:jt}const wt=s.default.div`
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
width: 100%;
|
|
146
|
+
min-width: 0;
|
|
147
|
+
max-height: ${({$maxHeight:e})=>e}px;
|
|
148
|
+
overflow-y: auto;
|
|
149
|
+
border-radius: var(--border-radius);
|
|
150
|
+
&::-webkit-scrollbar-track {
|
|
151
|
+
margin: var(--spacing-xxs) 0;
|
|
152
|
+
}
|
|
153
|
+
`,J=s.default.div`
|
|
154
|
+
display: flex;
|
|
155
|
+
font-size: var(--font-size-sm);
|
|
156
|
+
line-height: var(--line-height-sm);
|
|
157
|
+
font-weight: var(--font-weight-regular);
|
|
158
|
+
padding-right: var(--spacing-xxs);
|
|
159
|
+
`,Ct=s.default(J)`
|
|
160
|
+
background: var(--admonition-danger-bg-color);
|
|
161
|
+
color: var(--color-raspberry-7);
|
|
162
|
+
`,At=s.default(J)`
|
|
163
|
+
background: var(--admonition-success-bg-color);
|
|
164
|
+
color: var(--color-green-7);
|
|
165
|
+
`,jt=s.default(J)`
|
|
166
|
+
background: transparent;
|
|
167
|
+
color: var(--text-color-secondary);
|
|
168
|
+
`,Tt=s.default.span`
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
min-width: 16px;
|
|
173
|
+
height: 20px;
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
`,ae=s.default.span`
|
|
176
|
+
width: 100%;
|
|
177
|
+
min-width: 0;
|
|
178
|
+
line-height: var(--line-height-sm);
|
|
179
|
+
font-size: var(--font-size-sm);
|
|
180
|
+
font-weight: var(--font-weight-regular);
|
|
181
|
+
white-space: pre-wrap;
|
|
182
|
+
word-break: break-all;
|
|
183
|
+
`,kt=s.default(J)`
|
|
184
|
+
user-select: none;
|
|
185
|
+
`,St=e=>typeof e!="object"||e===null?!1:"kind"in e&&e.kind==="batch"?"changes"in e?Array.isArray(e.changes)&&e.changes.every(se):!1:se(e);function se(e){return typeof e!="object"||e===null||!("id"in e)||!("target"in e)||!("included"in e)||!("kind"in e)?!1:e.kind==="single"}const It={approveLabel:"Approve",denyLabel:"Deny"};function Et(e,t){const n=k(t,"action");if(n){const o=x.TOOL_APPROVAL_ACTION_BUTTON_LABELS[n];if(o)return o}const r=x.TOOL_APPROVAL_BUTTON_LABELS[e];return r||It}function k(e,t){if(!e||typeof e!="object")return null;const n=e.payload;if(!n||typeof n!="object")return null;const r=n[t];return typeof r!="string"?null:r.trim()||null}function le(e,t){if(!(typeof t>"u"))return e?`${e}: ${t}`:t}function Pt(e){return e?"changes"in e?Array.isArray(e.changes)?e.changes.map(t=>!t||typeof t!="object"||!("approved"in t)?!1:t.approved===!0):[]:[]:[]}function Lt(e,t){if(!e||typeof e!="object")return;const n=q(e,f.REPLAY_MESSAGE_METADATA_NS),r=q(n,f.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY);if(!(t in r))return;const o=r[t];if(Array.isArray(o)&&o.length!==0&&o.every(St))return o}function Te(e,t){return x.isToolApprovalPart(e)&&x.isApprovalRequested(e)&&e.toolCallId===t}function Ot(e,t,n){const r=e.parts.map(c=>Te(c,t)?{...c,input:Rt(c.input,n)}:c),o=e.metadata&&typeof e.metadata=="object"?e.metadata:{},a=q(o,f.REPLAY_MESSAGE_METADATA_NS),d={...q(a,f.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY),[t]:f.cloneObject(n)};return{...e,parts:r,metadata:{...o,[f.REPLAY_MESSAGE_METADATA_NS]:{...a,[f.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY]:d}}}}function q(e,t){const n=e[t];return typeof n=="object"&&n!==null?n:{}}function Rt(e,t){if(!e||!("changes"in e)||!Array.isArray(e.changes))return e;const{changes:n,...r}=e;return{...r,changes:n.map((o,a)=>({...o,approved:t[a]?.included??!1}))}}function _t({preview:e,isIncluded:t,onToggle:n,readOnly:r}){if(e.kind==="batch")return i.jsx(ce,{isIncluded:t,onToggle:n,readOnly:r,primaryLabel:e.target.type,children:i.jsx(Ut,{children:e.changes.map(d=>i.jsx(ie,{oldValue:le(d.target.key,d.oldValue),newValue:le(d.target.key,d.newValue)},d.id))})});const{target:o,oldValue:a,newValue:l}=e;return i.jsx(ce,{isIncluded:t,onToggle:n,readOnly:r,primaryLabel:o.key??o.type,categoryLabel:o.key?o.type:void 0,children:i.jsx(ie,{oldValue:a,newValue:l})})}function ce({isIncluded:e,onToggle:t,readOnly:n,primaryLabel:r,categoryLabel:o,children:a}){return i.jsxs(Mt,{$dimmed:n&&!e,children:[i.jsxs(Nt,{children:[n?i.jsx(Bt,{children:e?i.jsx(Ft,{size:"16px"}):i.jsx(Gt,{size:"16px"})}):i.jsxs(Ht,{children:[i.jsx(zt,{checked:e}),i.jsx(Vt,{type:"checkbox",checked:e,onChange:t})]}),i.jsx(Dt,{children:r}),o?i.jsx($t,{children:o}):null]}),a]})}const Mt=s.default.div`
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
gap: var(--spacing-xs);
|
|
189
|
+
min-width: 0;
|
|
190
|
+
padding: var(--spacing-xs);
|
|
191
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
192
|
+
box-sizing: border-box;
|
|
193
|
+
opacity: ${({$dimmed:e})=>e?.4:1};
|
|
194
|
+
&:last-child {
|
|
195
|
+
border-bottom: none;
|
|
196
|
+
}
|
|
197
|
+
`,Nt=s.default.div`
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: var(--spacing-xs);
|
|
201
|
+
min-width: 0;
|
|
202
|
+
`,Dt=s.default.span`
|
|
203
|
+
flex: 1;
|
|
204
|
+
min-width: 0;
|
|
205
|
+
color: var(--text-color-primary);
|
|
206
|
+
font-size: var(--font-size-sm);
|
|
207
|
+
font-weight: var(--font-weight-medium);
|
|
208
|
+
line-height: var(--line-height-sm);
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
text-overflow: ellipsis;
|
|
211
|
+
white-space: nowrap;
|
|
212
|
+
`,$t=s.default.span`
|
|
213
|
+
flex-shrink: 0;
|
|
214
|
+
font-family: var(--code-block-font-family, var(--font-family-monospace, monospace));
|
|
215
|
+
font-size: var(--font-size-sm);
|
|
216
|
+
font-weight: var(--font-weight-regular);
|
|
217
|
+
line-height: var(--line-height-sm);
|
|
218
|
+
color: var(--text-color-secondary);
|
|
219
|
+
`,zt=s.default(g.CheckboxIcon).attrs({"aria-hidden":!0})`
|
|
220
|
+
--checkbox-border-color: var(--color-blueberry-6);
|
|
221
|
+
--checkbox-box-color: var(--color-blueberry-6);
|
|
222
|
+
--checkbox-box-color-active: var(--color-blueberry-6);
|
|
223
|
+
`,Ht=s.default.span`
|
|
224
|
+
position: relative;
|
|
225
|
+
display: inline-flex;
|
|
226
|
+
flex-shrink: 0;
|
|
227
|
+
width: 16px;
|
|
228
|
+
height: 16px;
|
|
229
|
+
`,Vt=s.default.input`
|
|
230
|
+
position: absolute;
|
|
231
|
+
inset: 0;
|
|
232
|
+
width: 16px;
|
|
233
|
+
height: 16px;
|
|
234
|
+
margin: 0;
|
|
235
|
+
opacity: 0;
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
`,Bt=s.default.span`
|
|
238
|
+
display: inline-flex;
|
|
239
|
+
flex-shrink: 0;
|
|
240
|
+
width: 16px;
|
|
241
|
+
height: 16px;
|
|
242
|
+
align-items: center;
|
|
243
|
+
justify-content: center;
|
|
244
|
+
`,Ft=s.default(g.CheckmarkFilledIcon)`
|
|
245
|
+
color: var(--color-success-base);
|
|
246
|
+
`,Gt=s.default(g.CloseFilledIcon)`
|
|
247
|
+
color: var(--text-color-description);
|
|
248
|
+
`,Ut=s.default.div`
|
|
249
|
+
display: flex;
|
|
250
|
+
flex-direction: column;
|
|
251
|
+
gap: var(--spacing-xxs);
|
|
252
|
+
min-width: 0;
|
|
253
|
+
`;function ke({previews:e,handleToggle:t,readOnly:n}){return e.length===0?null:i.jsx(Wt,{children:e.map((r,o)=>i.jsx(_t,{preview:r,isIncluded:r.included,onToggle:t?()=>t(o):void 0,readOnly:n},r.id))})}const Wt=s.default.div`
|
|
254
|
+
display: flex;
|
|
255
|
+
flex-direction: column;
|
|
256
|
+
`,qt={update_step:Jt,update_security:Zt,run_request:en,web_search:tn,manage_environment:Xt,manage_collection:Qt};function Yt(e,t){const n=qt[e];return n?n(t):Kt(e)}function Kt(e){return[{kind:"text",text:e.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}]}function Jt(e){return Se(e,"Update step")}function Zt(e){return Se(e,"Update security")}function Se(e,t){const{collectionId:n,workflowId:r,stepId:o}=nn(e);return!n||!r||!o?S(t):Ie(`${t} `,Ae({collectionId:n,workflowId:r,stepId:o}),o)}function S(e){return[{kind:"text",text:e}]}function L(e,t){return t?`${e} "${t}"`:e}function Ie(e,t,n){return[{kind:"text",text:e},{kind:"link",href:t,label:n}]}function Xt(e){const t=k(e,"action"),n=k(e,"environment"),r=n?` in environment "${n}"`:"";switch(t){case"add_environment":return S(L("Add environment",n));case"set_active_environment":return S(n?`Switch active environment to ${n}`:"Switch active environment");case"upsert_input":return S(L("Set input",k(e,"name"))+r);case"remove_input":return S(L("Remove input",k(e,"inputName"))+r);case"upsert_server":return S(L("Set server",k(e,"apiId"))+r);case"remove_server":return S(L("Remove server",k(e,"apiId"))+r);default:return S("Manage environment")}}function Qt(e){switch(k(e,"action")){case"create_collection":return S(L("Create collection",k(e,"title")));case"delete_collection":return S(L("Delete collection",k(e,"collectionId")));case"create_workflow":return S(L("Create workflow",k(e,"name")));case"delete_workflow":return S(L("Delete workflow",k(e,"workflowId")));case"create_step":return S(L("Create step",k(e,"stepName")));case"delete_step":{const n=k(e,"collectionId"),r=k(e,"workflowId"),o=k(e,"stepId");return!n||!r||!o?S("Delete step"):Ie("Delete step ",Ae({collectionId:n,workflowId:r,stepId:o}),o)}case"save_tab_to_collection":return S(L("Save tab as step",k(e,"newStepName")));default:return S("Manage collection")}}function en(){return[{kind:"text",text:"Run current request"}]}function tn(e){return[{kind:"text",text:"Search the web at "},{kind:"link",href:e.url,label:e.url}]}function nn(e){return{collectionId:X(e,"collectionId"),workflowId:X(e,"workflowId"),stepId:X(e,"stepId")}}function X(e,t){if(!e||!(t in e))return null;const n=e[t];return typeof n=="string"&&n.trim()||null}function Ee({toolName:e,input:t}){const n=Yt(e,t),r=je();return i.jsx(rn,{onClick:r,children:i.jsx(on,{children:n.map((o,a)=>o.kind==="text"?i.jsx("span",{children:o.text},a):i.jsx(an,{href:o.href,children:o.label},a))})})}const rn=s.default.div`
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
gap: 0;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
262
|
+
|
|
263
|
+
&:not(:last-child) {
|
|
264
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
265
|
+
}
|
|
266
|
+
`,on=s.default.span`
|
|
267
|
+
font-family: var(--font-family-base);
|
|
268
|
+
font-size: var(--font-size-sm);
|
|
269
|
+
font-weight: var(--font-weight-regular);
|
|
270
|
+
line-height: var(--line-height-sm);
|
|
271
|
+
color: var(--text-color-primary);
|
|
272
|
+
`,an=s.default.a`
|
|
273
|
+
color: var(--link-color-primary);
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
text-decoration: none;
|
|
276
|
+
|
|
277
|
+
&:hover {
|
|
278
|
+
color: var(--link-color-primary, var(--text-color-link));
|
|
279
|
+
}
|
|
280
|
+
`;function T({id:e,targetType:t,targetKey:n,oldValue:r,newValue:o}){return{kind:"single",id:e,target:n===void 0?{type:t}:{type:t,key:n},oldValue:r,newValue:o,included:!0}}function D(e,t){return T({id:e,targetType:t,oldValue:void 0,newValue:void 0})}function H({data:e,baseId:t,targetType:n,batchTargetKey:r,getOldValue:o,getNewValue:a=(d,c)=>String(c??""),resolveTargetKey:l=d=>d}){const d=Object.entries(e).filter(([,p])=>p!==void 0);if(d.length===0)return D(t,n);if(d.length>=2){const p=d.map(([m,w])=>T({id:`${t}:${m}`,targetType:n,targetKey:l(m),oldValue:o(m),newValue:a(m,w)}));return{kind:"batch",id:t,target:r!==void 0?{type:n,key:r}:{type:n},changes:p,included:!0}}const[c,u]=d[0];return T({id:t,targetType:n,targetKey:l(c),oldValue:o(c),newValue:a(c,u)})}function sn({store:e,input:t}){if(!ln(t))return[];const n=new Map,r=o=>{const a=n.get(o);if(a)return a;const l=x.resolveStepOrDraft(e,t.collectionId,t.workflowId,o),d=l.ok?l.value:null,c=d?Array.from(d.security.get({noproxy:!0})):[];return n.set(o,c),c};return t.changes.map((o,a)=>{const l=o.stepId?.trim(),d=l||t.stepId;return cn(r(d),o,a,l)})}function ln(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.collectionId=="string"&&typeof t.workflowId=="string"&&typeof t.stepId=="string"&&Array.isArray(t.changes)&&t.changes.length>0}function $(e,t){return e?t?`${e}: ${t}`:e:t}function cn(e,t,n,r){const o=`security[${n}]`;switch(t.action){case x.CHANGE_ACTION.ADD:{const{type:a,schemeId:l,data:d}=t;return!d||Object.keys(d).length===0?T({id:o,targetType:a,targetKey:$(r,l),oldValue:void 0,newValue:a}):H({data:d,baseId:o,targetType:a,batchTargetKey:$(r,l),getOldValue:()=>{},resolveTargetKey:c=>$(r,c)})}case x.CHANGE_ACTION.UPDATE:{const{type:a,schemeId:l,data:d}=t,c=t.index!==void 0?e[t.index]:void 0;return!d||Object.keys(d).length===0?T({id:o,targetType:a,targetKey:$(r,l),oldValue:ue(c),newValue:a}):H({data:d,baseId:o,targetType:a,batchTargetKey:$(r,l),getOldValue:u=>c?dn(c,u):void 0,resolveTargetKey:u=>$(r,u)})}case x.CHANGE_ACTION.REMOVE:{const a=x.resolveRemovalTarget(e,t),l=a.ok?a.entry:void 0;return T({id:o,targetType:l?.securityType??"Security",targetKey:$(r,Le(l)),oldValue:ue(l),newValue:void 0})}}}function dn(e,t){switch(e.securityType){case f.SecurityTypes.NoAuth:return;case f.SecurityTypes.OAuth2:return de(e[f.SecurityTypes.OAuth2],t);case f.SecurityTypes.OpenIDConnect:{const n=e[f.SecurityTypes.OpenIDConnect];return t==="openIdConnectUrl"?n.openIdConnectUrl||void 0:t==="userInfoUrl"?n.userInfoUrl||void 0:de(n,t)}default:{const n=e[e.securityType];return Pe(n,t)}}}function de(e,t){if(t==="grantType")return e.grantType||void 0;if(!e.grantType)return;const n=e[e.grantType];return Pe(n,t)}function Pe(e,t){const n=e[t];return n!==void 0&&n!==""?String(n):void 0}function ue(e){if(!e||e.securityType===f.SecurityTypes.NoAuth)return;const t=Le(e);return t?`${e.securityType} (${t})`:e.securityType}function Le(e){return!e||e.securityType===f.SecurityTypes.NoAuth?void 0:e[e.securityType]?.schemeName||void 0}function un({store:e,input:t}){if(!fn(t))return[];const n=x.resolveStepOrDraft(e,t.collectionId,t.workflowId,t.stepId),r=n.ok?n.value:null;return t.changes.map((o,a)=>pn(r,o,a))}function fn(e){return typeof e!="object"||e===null?!1:"collectionId"in e&&"workflowId"in e&&"stepId"in e&&"changes"in e&&Array.isArray(e.changes)&&e.changes.length>0&&typeof e.collectionId=="string"&&typeof e.workflowId=="string"&&typeof e.stepId=="string"}function pn(e,t,n){const r=t.id??`${t.field}[${n}]`;switch(t.field){case"method":case"url":case"description":return hn(e,t,r);case"parameters":return gn(e,t,r);case"outputs":return xn(e,t,r);case"body":return vn(e,t,r);case"successCriteria":return mn(e,t,r)}}function hn(e,t,n){const r=g.capitalize(t.field);switch(t.action){case x.CHANGE_ACTION.ADD:return T({id:n,targetType:r,oldValue:void 0,newValue:t.data});case x.CHANGE_ACTION.UPDATE:return T({id:n,targetType:r,oldValue:fe(e,t.field),newValue:t.data});case x.CHANGE_ACTION.REMOVE:return T({id:n,targetType:r,oldValue:fe(e,t.field),newValue:void 0})}}function gn(e,t,n){switch(t.action){case x.CHANGE_ACTION.ADD:{if(!t.data)return D(n,"parameter");const{in:r,name:o,value:a}=t.data;return T({id:n,targetType:g.capitalize(r),targetKey:o,oldValue:void 0,newValue:a})}case x.CHANGE_ACTION.UPDATE:{if(!t.id&&!t.data?.name)return D(n,"parameter");const r=pe(e,t),o=t.data?.in??r?.in??"parameter";return T({id:n,targetType:g.capitalize(o),targetKey:t.data?.name??r?.key,oldValue:r?r.value??"":void 0,newValue:t.data?.value})}case x.CHANGE_ACTION.REMOVE:{if(!t.id&&!t.data?.name)return D(n,"parameter");const r=pe(e,t),o=t.data?.in??r?.in??"parameter";return T({id:n,targetType:g.capitalize(o),targetKey:r?.key??t.data?.name,oldValue:r?r.value??"":void 0,newValue:void 0})}}}function xn(e,t,n){switch(t.action){case x.CHANGE_ACTION.ADD:return t.data?T({id:n,targetType:"Output",targetKey:t.data.name,oldValue:void 0,newValue:t.data.expression}):T({id:n,targetType:"Output",oldValue:void 0,newValue:void 0});case x.CHANGE_ACTION.UPDATE:{if(!t.data)return T({id:n,targetType:"Output",oldValue:void 0,newValue:void 0});const r=t.id&&e?ge(e,t.id):void 0;return T({id:n,targetType:"Output",targetKey:t.data.name,oldValue:r?.value,newValue:t.data.expression})}case x.CHANGE_ACTION.REMOVE:{if(!t.id&&!t.data?.name)return D(n,"Output");let r=t.id&&e?ge(e,t.id):void 0;return!r&&e&&t.data?.name&&(r=wn(e,t.data.name)),T({id:n,targetType:"Output",targetKey:r?.key??t.data?.name,oldValue:r?.value,newValue:void 0})}}}function vn(e,t,n){const{data:r}=t;switch(t.action){case x.CHANGE_ACTION.ADD:return H({data:r,baseId:n,targetType:"Body",getOldValue:()=>{},getNewValue:o=>o==="content"?Q(r.content,r.contentType):K(r[o]),resolveTargetKey:o=>o==="content"?void 0:o});case x.CHANGE_ACTION.UPDATE:{const o=e?.requestBody.type.get(),a=r.contentType??o;return H({data:r,baseId:n,targetType:"Body",getOldValue:l=>{if(e){if(l==="content")return Q(e.requestBody.content.get(),o)||void 0;if(l==="contentType")return o}},getNewValue:l=>l==="content"?Q(r.content,a):K(r[l]),resolveTargetKey:l=>l==="content"?void 0:l})}case x.CHANGE_ACTION.REMOVE:{const o=e?f.toCompactJson({contentType:e.requestBody.type.get(),content:e.requestBody.content.get()}):void 0;return T({id:n,targetType:"Body",oldValue:o,newValue:void 0})}}}function mn(e,t,n){switch(t.action){case x.CHANGE_ACTION.ADD:return t.data?H({data:t.data,baseId:n,targetType:"successCriteria",getOldValue:()=>{},getNewValue:r=>K(t.data[r])}):D(n,"successCriteria");case x.CHANGE_ACTION.UPDATE:{if(!t.data)return D(n,"successCriteria");const r=typeof t.id=="string"&&e?he(e,t.id):void 0;return H({data:t.data,baseId:n,targetType:"successCriteria",getOldValue:o=>{if(r){if(o==="condition")return r.condition;if(o==="context")return r.context??void 0;if(o==="type")return r.type}},getNewValue:o=>K(t.data[o])})}case x.CHANGE_ACTION.REMOVE:{if(typeof t.id!="string")return D(n,"successCriteria");const r=e?he(e,t.id):void 0;return T({id:n,targetType:"successCriteria",targetKey:r?.condition,oldValue:r?f.toCompactJson(r):void 0,newValue:void 0})}}}function fe(e,t){if(e)switch(t){case"method":return e.xOperation.ornull?.method.get();case"url":return e.xOperation.ornull?.url.get();case"description":return e.description.get()}}function pe(e,t){let n=t.id&&e?yn(e,t.id):null;return!n&&e&&t.data?.name&&(n=bn(e,t.data.name)),n}function Oe(e,t){for(const n of["path","query","header","cookie"]){const r=e.parameters[x.LOCATION_TO_FIELD[n]].get().find(o=>f.isInlineRequestParameter(o)&&t(o));if(r)return r}return null}function yn(e,t){return Oe(e,n=>n.id===t)}function bn(e,t){return Oe(e,n=>n.key===t)}function he(e,t){return e.successCriteria.get().find(n=>n.condition===t)}function Re(e,t){for(const n of e.outputs.get())if(t(n))return{key:Y(n.key),value:Y(n.value)}}function ge(e,t){return Re(e,n=>Y(n.id)===t)}function wn(e,t){return Re(e,n=>Y(n.key)===t)}function Y(e){return typeof e=="string"?e:e.get()}function K(e){return e==null?"":typeof e=="string"?e:f.toCompactJson(e)}function Q(e,t){if(!e||t!==f.TextContentType.JSON)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const Cn={update_security:sn,update_step:un};function _e(e,t){const n=f.useGlobalStore(),r=h.useMemo(()=>{const c=e?Cn[e]:void 0;if(!c)return[];try{return c({store:n,input:t})}catch(u){return console.error("Unable to build change previews",u),[]}},[e,n,t]),[o,a]=h.useState(()=>Object.fromEntries(r.map(c=>[c.id,c.included]))),l=h.useMemo(()=>r.map(c=>({...c,included:o[c.id]??c.included})),[r,o]),d=h.useCallback(c=>{a(typeof c=="function"?u=>{const p=r.map(v=>({...v,included:u[v.id]??v.included}));return Object.fromEntries(c(p).map(v=>[v.id,v.included]))}:Object.fromEntries(c.map(u=>[u.id,u.included])))},[r]);return{previews:l,setPreviews:d}}function An({toolCallId:e,toolName:t,input:n,onApprove:r,onDeny:o}){const{updateMessages:a}=x.useAiConversationContext(),{previews:l,setPreviews:d}=_e(t,n),{includedCount:c,totalCount:u}=h.useMemo(()=>({includedCount:l.filter(y=>y.included).length,totalCount:l.length}),[l]),{approveLabel:p,denyLabel:v}=h.useMemo(()=>Et(t,n),[t,n]),m=h.useCallback(()=>{a(y=>{const A=[];for(let C=0;C<y.length;C++){const j=y[C],{parts:b}=j,I=j.role==="assistant",N=b.some(P=>Te(P,e));if(I&&N){const P=Ot(j,e,l);A.push({index:C,message:P})}}return A}),r()},[l,r,a,e]),w=h.useCallback(y=>{d(A=>A.map((C,j)=>j===y?{...C,included:!C.included}:C))},[d]);return i.jsxs(jn,{children:[i.jsx(Ee,{toolName:t,input:n}),l.length?i.jsx(Tn,{children:i.jsx(ke,{previews:l,handleToggle:w})}):null,l.length?i.jsx(f.Divider,{}):null,i.jsxs(kn,{children:[u>1?i.jsxs(Sn,{children:[c," of ",u," selected"]}):null,i.jsx(In,{size:"small",variant:"secondary",onClick:o,children:v}),i.jsx(En,{size:"small",variant:"primary",onClick:m,disabled:u>0?c===0:!1,children:p})]})]})}const jn=s.default.div`
|
|
281
|
+
display: flex;
|
|
282
|
+
color: var(--text-color-primary);
|
|
283
|
+
flex-direction: column;
|
|
284
|
+
gap: var(--spacing-xs);
|
|
285
|
+
width: 100%;
|
|
286
|
+
min-width: 0;
|
|
287
|
+
border-radius: var(--border-radius-md, 10px);
|
|
288
|
+
border: 1px solid var(--border-color-secondary);
|
|
289
|
+
background: var(--layer-color);
|
|
290
|
+
line-height: var(--line-height-sm);
|
|
291
|
+
`,Tn=s.default.div`
|
|
292
|
+
display: flex;
|
|
293
|
+
flex-direction: column;
|
|
294
|
+
gap: var(--spacing-xs);
|
|
295
|
+
min-width: 0;
|
|
296
|
+
`,kn=s.default.div`
|
|
297
|
+
display: flex;
|
|
298
|
+
flex-wrap: wrap;
|
|
299
|
+
justify-content: flex-end;
|
|
300
|
+
align-items: center;
|
|
301
|
+
padding: 0 var(--spacing-sm) var(--spacing-xs) var(--spacing-sm);
|
|
302
|
+
gap: var(--spacing-xxs);
|
|
303
|
+
`,Sn=s.default.span`
|
|
304
|
+
flex: 1;
|
|
305
|
+
font-size: var(--font-size-sm);
|
|
306
|
+
font-weight: var(--font-weight-regular);
|
|
307
|
+
line-height: var(--line-height-sm);
|
|
308
|
+
color: var(--text-color-secondary);
|
|
309
|
+
`,In=s.default(g.Button)`
|
|
310
|
+
background: none;
|
|
311
|
+
`,En=s.default(g.Button)`
|
|
312
|
+
border: 1px solid var(--button-bg-color);
|
|
313
|
+
padding-top: 0;
|
|
314
|
+
padding-bottom: 0;
|
|
315
|
+
&:disabled {
|
|
316
|
+
border: 1px solid var(--button-border-color-disabled);
|
|
317
|
+
}
|
|
318
|
+
`;function Pn({approvalId:e,toolCallId:t,toolName:n,input:r}){const{addToolApprovalResponse:o}=x.useAiConversationContext(),a=h.useCallback(()=>{o({id:e,approved:!0})},[e,o]),l=h.useCallback(()=>{o({id:e,approved:!1})},[e,o]);return i.jsx(An,{onApprove:a,onDeny:l,toolCallId:t,toolName:n,input:r})}function Ln({toolName:e,toolCallId:t,input:n,isDenied:r,messageMetadata:o,onUndo:a}){const l=h.useMemo(()=>Lt(o,t),[o,t]),{previews:d}=_e(l?void 0:e,n),c=h.useMemo(()=>{const m=l??d;if(r)return m.map(y=>({...y,included:!1}));const w=Pt(n);return m.map((y,A)=>({...y,included:w[A]??y.included}))},[l,d,n,r]);if(c.length===0)return null;const u=c.filter(m=>m.included).length,v=u===0?"Nothing applied":`${u} ${u===1?"change":"changes"} applied`;return i.jsxs(On,{children:[i.jsx(Ee,{toolName:e,input:n}),i.jsx(Rn,{children:i.jsx(ke,{previews:c,readOnly:!0})}),i.jsx(f.Divider,{}),i.jsxs(_n,{children:[i.jsx(Mn,{children:v}),a?i.jsx(Nn,{size:"small",variant:"outlined",onClick:a,children:"Undo"}):null]})]})}const On=s.default.div`
|
|
319
|
+
display: flex;
|
|
320
|
+
color: var(--text-color-primary);
|
|
321
|
+
flex-direction: column;
|
|
322
|
+
width: 100%;
|
|
323
|
+
min-width: 0;
|
|
324
|
+
border-radius: var(--border-radius-md, 10px);
|
|
325
|
+
border: 1px solid var(--border-color-secondary);
|
|
326
|
+
background: var(--layer-color);
|
|
327
|
+
line-height: var(--line-height-sm);
|
|
328
|
+
`,Rn=s.default.div`
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
min-width: 0;
|
|
332
|
+
`,_n=s.default.div`
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: space-between;
|
|
335
|
+
align-items: center;
|
|
336
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
337
|
+
gap: var(--spacing-xs);
|
|
338
|
+
`,Mn=s.default.span`
|
|
339
|
+
font-size: var(--font-size-sm);
|
|
340
|
+
font-weight: var(--font-weight-regular);
|
|
341
|
+
line-height: var(--line-height-sm);
|
|
342
|
+
color: var(--text-color-secondary);
|
|
343
|
+
`,Nn=s.default(g.Button)`
|
|
344
|
+
padding-top: 0;
|
|
345
|
+
padding-bottom: 0;
|
|
346
|
+
`;function Dn({items:e,isLast:t}){const[n,r]=h.useState(t),o=h.useCallback(()=>{r(l=>!l)},[]),a=h.useMemo(()=>e.filter(l=>l.kind==="action"),[e]);return i.jsxs(zn,{children:[i.jsxs(Hn,{type:"button",onClick:o,"aria-expanded":n,children:[i.jsx(Vn,{children:n?i.jsx(g.ChevronDownIcon,{size:"12px",color:"var(--icon-color-additional)"}):i.jsx(g.ChevronRightIcon,{size:"12px",color:"var(--icon-color-additional)"})}),i.jsxs(Bn,{children:[a.length," ",a.length===1?"action":"actions"]})]}),n&&i.jsx(Fn,{children:a.map((l,d)=>i.jsx($n,{text:l.text},d))})]})}function $n({text:e}){return i.jsxs(Gn,{children:[i.jsxs(Un,{children:[i.jsx(Wn,{"aria-hidden":!0}),i.jsx(qn,{children:i.jsx(Yn,{"aria-hidden":!0})}),i.jsx(Me,{"aria-hidden":!0})]}),i.jsx(Kn,{children:e})]})}const zn=s.default.div`
|
|
347
|
+
display: flex;
|
|
348
|
+
flex-direction: column;
|
|
349
|
+
width: 100%;
|
|
350
|
+
min-width: 0;
|
|
351
|
+
`,Hn=s.default.button`
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
user-select: none;
|
|
356
|
+
width: fit-content;
|
|
357
|
+
padding: 0;
|
|
358
|
+
`,Vn=s.default.span`
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
flex-shrink: 0;
|
|
362
|
+
`,Bn=s.default.span`
|
|
363
|
+
font-size: var(--font-size-sm);
|
|
364
|
+
font-weight: var(--font-weight-regular);
|
|
365
|
+
line-height: var(--line-height-sm);
|
|
366
|
+
color: var(--text-color-description);
|
|
367
|
+
`,Fn=s.default.div`
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: column;
|
|
370
|
+
gap: 0;
|
|
371
|
+
`,Me=s.default.span`
|
|
372
|
+
display: block;
|
|
373
|
+
width: 1px;
|
|
374
|
+
flex-shrink: 0;
|
|
375
|
+
align-self: center;
|
|
376
|
+
background: var(--border-color-secondary);
|
|
377
|
+
flex: 1 1 auto;
|
|
378
|
+
min-height: 8px;
|
|
379
|
+
`,Gn=s.default.div`
|
|
380
|
+
display: flex;
|
|
381
|
+
flex-direction: row;
|
|
382
|
+
align-items: stretch;
|
|
383
|
+
gap: var(--spacing-xxs);
|
|
384
|
+
min-width: 0;
|
|
385
|
+
|
|
386
|
+
&:last-child {
|
|
387
|
+
${Me} {
|
|
388
|
+
display: none;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
`,Un=s.default.div`
|
|
392
|
+
display: flex;
|
|
393
|
+
flex-direction: column;
|
|
394
|
+
align-items: center;
|
|
395
|
+
box-sizing: border-box;
|
|
396
|
+
width: 12px;
|
|
397
|
+
flex: 0 0 auto;
|
|
398
|
+
align-self: stretch;
|
|
399
|
+
min-height: 0;
|
|
400
|
+
`,Wn=s.default.span`
|
|
401
|
+
display: block;
|
|
402
|
+
width: 1px;
|
|
403
|
+
height: 4px;
|
|
404
|
+
flex: 0 0 auto;
|
|
405
|
+
flex-shrink: 0;
|
|
406
|
+
background: var(--border-color-secondary);
|
|
407
|
+
`,qn=s.default.div`
|
|
408
|
+
width: 12px;
|
|
409
|
+
height: 12px;
|
|
410
|
+
flex: 0 0 auto;
|
|
411
|
+
flex-shrink: 0;
|
|
412
|
+
display: flex;
|
|
413
|
+
align-items: center;
|
|
414
|
+
justify-content: center;
|
|
415
|
+
`,Yn=s.default.span`
|
|
416
|
+
width: 4px;
|
|
417
|
+
height: 4px;
|
|
418
|
+
flex-shrink: 0;
|
|
419
|
+
border-radius: 50%;
|
|
420
|
+
box-sizing: border-box;
|
|
421
|
+
border: 1px solid var(--border-color-secondary);
|
|
422
|
+
background: transparent;
|
|
423
|
+
`,Kn=s.default.span`
|
|
424
|
+
flex: 1;
|
|
425
|
+
min-width: 0;
|
|
426
|
+
align-self: flex-start;
|
|
427
|
+
font-size: var(--font-size-sm);
|
|
428
|
+
font-weight: var(--font-weight-regular);
|
|
429
|
+
line-height: var(--line-height-sm);
|
|
430
|
+
color: var(--text-color-helper);
|
|
431
|
+
`;function Jn({items:e,messageMetadata:t}){return i.jsx(Xn,{children:e.map((n,r)=>{if(n.kind==="reasoning-block"){const l=r===e.length-1;return i.jsx(Dn,{items:n.items,isLast:l},n.key)}if(n.kind==="text")return i.jsx(Zn,{rawMarkdown:n.text},n.key);const{part:o}=n,a=x.parseToolName(o.type);return a&&x.isApprovalRequested(o)?i.jsx(Pn,{approvalId:o.approval.id,toolCallId:o.toolCallId,toolName:a,input:o.input},n.key):a&&x.isApprovalSettled(o)?i.jsx(Ln,{toolName:a,toolCallId:o.toolCallId,input:o.input,isDenied:o.state==="output-denied",messageMetadata:t},n.key):null})})}function Zn({rawMarkdown:e}){const t=je();return i.jsx(Qn,{onClick:t,children:i.jsx(f.Markdown,{rawMarkdown:e,parser:f.markdownParserMarked})})}const Xn=s.default.div`
|
|
432
|
+
display: flex;
|
|
433
|
+
flex-direction: column;
|
|
434
|
+
gap: var(--spacing-xs);
|
|
435
|
+
`,Qn=s.default.div`
|
|
436
|
+
white-space: normal;
|
|
437
|
+
|
|
438
|
+
max-width: 100%;
|
|
439
|
+
overflow: hidden;
|
|
440
|
+
|
|
441
|
+
p:first-child {
|
|
442
|
+
margin-top: 0;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
p:last-child {
|
|
446
|
+
margin-bottom: 0;
|
|
447
|
+
}
|
|
448
|
+
`,Ne=s.default.div`
|
|
449
|
+
font-family: var(--font-family-base);
|
|
450
|
+
font-size: var(--font-size-sm);
|
|
451
|
+
line-height: var(--line-height-sm);
|
|
452
|
+
color: var(--text-color-primary);
|
|
453
|
+
`;function er(){return i.jsxs(tr,{children:[i.jsx(U,{}),i.jsx(U,{}),i.jsx(U,{})]})}const tr=s.default.div`
|
|
454
|
+
display: flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
justify-content: space-between;
|
|
457
|
+
width: 24px;
|
|
458
|
+
height: 24px;
|
|
459
|
+
`;function nr(){return i.jsxs(rr,{children:[i.jsx(er,{}),i.jsx(or,{children:"Thinking"})]})}const rr=s.default.div`
|
|
460
|
+
display: flex;
|
|
461
|
+
align-items: center;
|
|
462
|
+
gap: var(--spacing-xxs);
|
|
463
|
+
`,or=s.default.span`
|
|
464
|
+
font-family: var(--font-family-base);
|
|
465
|
+
font-size: var(--font-size-sm);
|
|
466
|
+
line-height: var(--line-height-sm);
|
|
467
|
+
color: var(--text-color-helper);
|
|
468
|
+
`;function ir({items:e}){return i.jsx(h.Fragment,{children:e.map(t=>t.kind!=="text"?null:i.jsx(Ne,{children:t.text},t.key))})}const ar="Something went wrong. Please try again.";function sr(e){const t=e?.message?.trim();return t||ar}function lr({message:e,isLastMessage:t}){const{chatStatus:n,chatError:r}=x.useAiConversationContext(),{role:o,parts:a}=e,l=o===R.MESSAGE_ROLE.ASSISTANT,d=h.useMemo(()=>x.getContentItems(a),[a]),c=d.length>0,u=n==="error"&&t&&l&&!c;return!c&&!u?null:i.jsx(De,{$role:o,children:i.jsx(dr,{isFailedEmptyAssistant:u,chatError:r,isAssistant:l,contentItems:d,messageMetadata:e.metadata})})}function cr(){return i.jsx(De,{$role:R.MESSAGE_ROLE.ASSISTANT,children:i.jsx(ee,{children:i.jsx(nr,{})})})}function dr({isFailedEmptyAssistant:e,chatError:t,isAssistant:n,contentItems:r,messageMetadata:o}){return e?i.jsx(ee,{children:i.jsx(Ne,{children:sr(t)})}):i.jsx(ee,{children:n?i.jsx(Jn,{items:r,messageMetadata:o}):i.jsx(ir,{items:r})})}const De=s.default.div`
|
|
469
|
+
display: flex;
|
|
470
|
+
flex-direction: column;
|
|
471
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
472
|
+
gap: var(--spacing-xxs);
|
|
473
|
+
min-width: 0;
|
|
474
|
+
width: ${({$role:e})=>e===R.MESSAGE_ROLE.ASSISTANT?"100%":"fit-content"};
|
|
475
|
+
border-radius: ${({$role:e})=>e===R.MESSAGE_ROLE.USER?"6px 0px 6px 6px":"0px 6px 6px 6px"};
|
|
476
|
+
background: ${({$role:e})=>e===R.MESSAGE_ROLE.USER?"var(--replay-ai-user-message-gradient)":"transparent"};
|
|
477
|
+
border: none;
|
|
478
|
+
color: var(--text-color-primary);
|
|
479
|
+
box-sizing: border-box;
|
|
480
|
+
word-wrap: break-word;
|
|
481
|
+
white-space: pre-wrap;
|
|
482
|
+
max-width: 100%;
|
|
483
|
+
`,ee=s.default.div`
|
|
484
|
+
display: flex;
|
|
485
|
+
flex-direction: column;
|
|
486
|
+
gap: var(--spacing-xxs);
|
|
487
|
+
min-width: 0;
|
|
488
|
+
width: 100%;
|
|
489
|
+
`;function ur(){const{messages:e,isStreaming:t}=x.useAiConversationContext(),n=e.at(-1),r=h.useMemo(()=>{const o=n?.role===R.MESSAGE_ROLE.ASSISTANT,a=n?.parts.at(-1)?.type==="text";return t&&!(o&&a)},[t,n?.parts,n?.role]);return i.jsxs(fr,{children:[e.map((o,a)=>i.jsx(xe,{$role:o.role,children:i.jsx(ve,{$role:o.role,children:i.jsx(lr,{message:o,isLastMessage:a===e.length-1})})},o.id)),r&&i.jsx(xe,{$role:R.MESSAGE_ROLE.ASSISTANT,children:i.jsx(ve,{$role:R.MESSAGE_ROLE.ASSISTANT,children:i.jsx(cr,{})})})]})}const fr=s.default.div`
|
|
490
|
+
display: flex;
|
|
491
|
+
flex-direction: column;
|
|
492
|
+
gap: var(--spacing-xs);
|
|
493
|
+
width: 100%;
|
|
494
|
+
`,xe=s.default.div`
|
|
495
|
+
display: flex;
|
|
496
|
+
width: 100%;
|
|
497
|
+
justify-content: ${({$role:e})=>e===R.MESSAGE_ROLE.USER?"flex-end":"flex-start"};
|
|
498
|
+
`,ve=s.default.div`
|
|
499
|
+
display: flex;
|
|
500
|
+
flex-direction: column;
|
|
501
|
+
align-items: ${({$role:e})=>e===R.MESSAGE_ROLE.USER?"flex-end":"stretch"};
|
|
502
|
+
gap: var(--spacing-xs);
|
|
503
|
+
min-width: 0;
|
|
504
|
+
width: 100%;
|
|
505
|
+
max-width: 100%;
|
|
506
|
+
`;function pr(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}const $e=s.default.div`
|
|
507
|
+
display: flex;
|
|
508
|
+
flex-direction: column;
|
|
509
|
+
flex: 1;
|
|
510
|
+
width: 100%;
|
|
511
|
+
overflow: auto;
|
|
512
|
+
padding: var(--spacing-xs);
|
|
513
|
+
`,hr=e=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...e,children:[i.jsx("path",{d:"M12.1683 8.65224C13.4439 7.91782 13.4439 6.08176 12.1683 5.34733L8.48891 3.22903L5.13033 6.57817C5.03961 6.66863 5.03961 6.8153 5.13033 6.90577L8.81674 10.5818L12.1683 8.65224Z",fill:"url(#replay-icon-gradient)"}),i.jsx("path",{d:"M7.56707 11.3013L3.81522 13.4613C2.53957 14.1957 0.945007 13.2777 0.945007 11.8088L0.945008 2.19072C0.945008 0.721872 2.53957 -0.196157 3.81522 0.538267L7.23924 2.50957L4.14475 5.59536C3.5097 6.22861 3.5097 7.25532 4.14475 7.88858L7.56707 11.3013Z",fill:"url(#replay-icon-gradient)"}),i.jsx("defs",{children:i.jsxs("linearGradient",{id:"replay-icon-gradient",x1:"12.0947",y1:"10.9627",x2:"1.65018",y2:"0.120816",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#C361FF"}),i.jsx("stop",{offset:"0.411322",stopColor:"#9461FF"}),i.jsx("stop",{offset:"0.73777",stopColor:"#207DFF"}),i.jsx("stop",{offset:"1",stopColor:"#1DA8F6"})]})})]}),gr=s.default(hr)`
|
|
514
|
+
height: ${({size:e})=>e||"14px"};
|
|
515
|
+
width: ${({size:e})=>e||"14px"};
|
|
516
|
+
`;function xr(e){const t="var(--font-size-base)";switch(e){case f.REUNITE_AI_PROVIDER:return i.jsx(gr,{size:t});case f.AI_PROVIDERS.OPENAI:return i.jsx(g.ChatGptIcon,{size:t,color:"var(--text-color-primary)"});case f.AI_PROVIDERS.GEMINI:return i.jsx(g.GeminiIcon,{size:t});case f.AI_PROVIDERS.ANTHROPIC:return i.jsx(g.ClaudeIcon,{size:t,color:"var(--replay-claude-icon-color)"})}}function vr({models:e,selectedModelId:t,placement:n,onModelSelect:r,onSettingsOpen:o}){const a=e.find(v=>v.id===t),l=a?.label??"Replay AI",d=a?.id,c=e.filter(v=>v.provider===f.REUNITE_AI_PROVIDER),u=e.filter(v=>v.provider!==f.REUNITE_AI_PROVIDER),p=c.length>0&&u.length>0;return i.jsx(wr,{children:i.jsx(Cr,{trigger:i.jsx(mr,{label:l}),placement:n,alignment:"start",withArrow:!0,children:i.jsxs(Ar,{children:[i.jsxs(kr,{children:[c.map(v=>i.jsx(me,{model:v,activeModelId:d,onModelSelect:r},v.id)),p&&i.jsx(ye,{"aria-hidden":!0}),u.length>0&&i.jsx(i.Fragment,{children:u.map(v=>i.jsx(me,{model:v,activeModelId:d,onModelSelect:r},v.id))})]}),o&&e.length>0&&i.jsx(ye,{"aria-hidden":!0}),o&&i.jsx(Sr,{prefix:i.jsx(g.SettingsCogIcon,{size:"var(--font-size-base)",color:"var(--text-color-secondary)"}),content:"Manage models",onAction:()=>o("ai-providers")})]})})})}function mr({label:e,icon:t,onClick:n,onKeyDown:r}){return i.jsxs(yr,{onClick:n,onKeyDown:r,children:[i.jsx(br,{children:e}),t]})}function me({model:e,activeModelId:t,onModelSelect:n}){const r=e.id===t;return i.jsx(g.DropdownMenuItem,{prefix:xr(e.provider),suffix:r?i.jsx(Tr,{size:"var(--font-size-base)",color:"var(--text-color-primary)"}):void 0,onAction:()=>n(e.id),active:r,children:i.jsx(jr,{children:e.label})})}const yr=s.default.div`
|
|
517
|
+
display: flex;
|
|
518
|
+
align-items: center;
|
|
519
|
+
min-width: 0;
|
|
520
|
+
gap: var(--spacing-xxs);
|
|
521
|
+
height: 24px;
|
|
522
|
+
padding: 0 var(--spacing-xs);
|
|
523
|
+
border-radius: var(--border-radius);
|
|
524
|
+
background: var(--bg-color-active);
|
|
525
|
+
cursor: pointer;
|
|
526
|
+
user-select: none;
|
|
527
|
+
|
|
528
|
+
&:hover {
|
|
529
|
+
background: var(--layer-color-active);
|
|
530
|
+
}
|
|
531
|
+
`,br=s.default.span`
|
|
532
|
+
overflow: hidden;
|
|
533
|
+
text-overflow: ellipsis;
|
|
534
|
+
font-family: var(--font-family-base);
|
|
535
|
+
font-size: var(--font-size-base);
|
|
536
|
+
font-weight: var(--font-weight-regular);
|
|
537
|
+
line-height: var(--line-height-base);
|
|
538
|
+
color: var(--text-color-primary);
|
|
539
|
+
white-space: nowrap;
|
|
540
|
+
`,wr=s.default.div`
|
|
541
|
+
--dropdown-menu-padding-top: 0;
|
|
542
|
+
|
|
543
|
+
min-width: 0;
|
|
544
|
+
flex: 1;
|
|
545
|
+
position: relative;
|
|
546
|
+
`,Cr=s.default(g.Dropdown)`
|
|
547
|
+
width: 100%;
|
|
548
|
+
min-width: 0;
|
|
549
|
+
flex: 1;
|
|
550
|
+
|
|
551
|
+
> :last-child {
|
|
552
|
+
width: 100%;
|
|
553
|
+
max-width: 200px;
|
|
554
|
+
}
|
|
555
|
+
`,Ar=s.default(g.DropdownMenu)`
|
|
556
|
+
--dropdown-menu-item-gap: calc(var(--spacing-unit) / 2);
|
|
557
|
+
--dropdown-menu-item-padding-vertical: var(--spacing-xxs);
|
|
558
|
+
--dropdown-menu-item-padding-horizontal: var(--spacing-xs);
|
|
559
|
+
|
|
560
|
+
padding: var(--spacing-xxs);
|
|
561
|
+
margin: 5px 0;
|
|
562
|
+
border-radius: var(--border-radius-lg);
|
|
563
|
+
background: var(--bg-color);
|
|
564
|
+
`,jr=s.default.span`
|
|
565
|
+
flex: 1;
|
|
566
|
+
min-width: 0;
|
|
567
|
+
overflow: hidden;
|
|
568
|
+
text-overflow: ellipsis;
|
|
569
|
+
white-space: nowrap;
|
|
570
|
+
`,Tr=s.default(g.CheckmarkIcon)`
|
|
571
|
+
margin-left: var(--spacing-xxs);
|
|
572
|
+
`,ye=s.default.li`
|
|
573
|
+
flex-shrink: 0;
|
|
574
|
+
list-style: none;
|
|
575
|
+
width: 100%;
|
|
576
|
+
height: 1px;
|
|
577
|
+
margin: 0;
|
|
578
|
+
background: var(--border-color-secondary);
|
|
579
|
+
`,kr=s.default.li`
|
|
580
|
+
display: flex;
|
|
581
|
+
flex-direction: column;
|
|
582
|
+
gap: var(--dropdown-menu-item-gap);
|
|
583
|
+
list-style: none;
|
|
584
|
+
min-height: 0;
|
|
585
|
+
overflow-y: auto;
|
|
586
|
+
`,Sr=s.default(g.DropdownMenuItem)`
|
|
587
|
+
flex-shrink: 0;
|
|
588
|
+
`;function Ir(){const{chatId:e,isLoading:t,pendingComposerPreset:n,clearPendingComposerPreset:r,availableModels:o,selectedModelId:a,selectModel:l,onSettingsOpen:d}=f.useAiChatContext(),{messages:c,isStreaming:u,sendMessage:p,stopGeneration:v}=x.useAiConversationContext(),{isOpen:m}=f.useAiPanel(),[w,y]=h.useState(""),A=h.useRef(null),C=h.useRef(null),j=h.useRef(!0),b=c.length>0,I=pr(c.length),P=I!==void 0&&I>0&&!b,_=h.useCallback((E="smooth")=>{C.current&&C.current.scrollTo({top:C.current.scrollHeight,behavior:E})},[]),B=h.useCallback(()=>{const E=C.current;if(!E)return;E.scrollHeight-E.scrollTop-E.clientHeight<50&&(j.current=!0)},[]);h.useEffect(()=>{const E=C.current;if(!E)return;const Z=Ve=>{Ve.deltaY<0&&(j.current=!1)};return E.addEventListener("wheel",Z,{passive:!0}),()=>E.removeEventListener("wheel",Z)},[]);const F=h.useCallback(async()=>{w&&(y(""),j.current=!0,await p(w),A.current&&requestAnimationFrame(()=>A.current?.focus()))},[p,w]);return h.useEffect(()=>{m&&(A.current&&A.current.focus(),j.current=!0,_())},[m,c.length,_]),h.useEffect(()=>{u&&j.current&&_()}),h.useEffect(function(){m&&A.current&&(A.current.focus(),_("instant"))},[e,m,_]),h.useEffect(function(){!m||n===null||(y(n),r())},[m,n,r]),i.jsxs($e,{children:[i.jsx(Er,{ref:C,$isExpanded:t||b,$isAnimated:u||P,onScroll:B,children:t?i.jsx(Pr,{children:i.jsx(f.StyledSpinner,{size:"20px"})}):i.jsx(ur,{})}),i.jsx(Qe,{value:w,onValueChange:y,onSubmit:F,isStreaming:u,onStop:v,textareaRef:A,modelSelector:i.jsx(vr,{models:o,selectedModelId:a,placement:b?"top":"bottom",onModelSelect:l,onSettingsOpen:d})})]})}const Er=s.default.div`
|
|
589
|
+
flex: ${({$isExpanded:e})=>e?1:0};
|
|
590
|
+
width: 100%;
|
|
591
|
+
overflow: auto;
|
|
592
|
+
padding-bottom: ${e=>e.$isExpanded?"var(--spacing-xs)":"0"};
|
|
593
|
+
transition-property: flex;
|
|
594
|
+
transition-duration: ${e=>e.$isAnimated?"var(--replay-transition-duration)":"0s"};
|
|
595
|
+
transition-timing-function: var(--replay-transition-timing-function);
|
|
596
|
+
`,Pr=s.default.div`
|
|
597
|
+
display: flex;
|
|
598
|
+
justify-content: center;
|
|
599
|
+
height: 100%;
|
|
600
|
+
padding-top: var(--spacing-lg);
|
|
601
|
+
`,O={TODAY:"today",YESTERDAY:"yesterday",LAST_WEEK:"last_week",LAST_MONTH:"last_month",OLDER:"older"},Lr={[O.TODAY]:"Today",[O.YESTERDAY]:"Yesterday",[O.LAST_WEEK]:"Last 7 days",[O.LAST_MONTH]:"Last 30 days",[O.OLDER]:"Older"};function Or(e,t=Date.now()){const n=f.dayjs(e).startOf("day"),r=f.dayjs(t).startOf("day"),o=f.dayjs(t).subtract(1,"day").startOf("day"),a=f.dayjs(t).subtract(7,"day").startOf("day"),l=f.dayjs(t).subtract(30,"day").startOf("day");return n.isSame(r,"day")?O.TODAY:n.isSame(o,"day")?O.YESTERDAY:!n.isBefore(a,"day")&&n.isBefore(o,"day")?O.LAST_WEEK:!n.isBefore(l,"day")&&n.isBefore(a,"day")?O.LAST_MONTH:O.OLDER}function Rr(e){const t=[];for(const n of e){const r=Or(n.updatedAt),o=t[t.length-1];!o||o.bucket!==r?t.push({bucket:r,chats:[n]}):o.chats.push(n)}return t}function _r(e){const{scrollRef:t,sentinelRef:n,hasNextPage:r,isFetchingNextPage:o,fetchNextPage:a,observerResetKey:l}=e;h.useLayoutEffect(()=>{const d=t.current,c=n.current;if(!d||!c)return;const u=new IntersectionObserver(p=>{const v=p[0];v&&v.isIntersecting&&r&&(o||a())},{root:d,rootMargin:"80px"});return u.observe(c),()=>{u.disconnect()}},[l,a,r,o,t,n])}const ze=s.default($e)`
|
|
602
|
+
gap: var(--spacing-xxs);
|
|
603
|
+
user-select: none;
|
|
604
|
+
`,Mr=s.default.div`
|
|
605
|
+
display: flex;
|
|
606
|
+
flex-direction: column;
|
|
607
|
+
gap: var(--spacing-xs);
|
|
608
|
+
`,Nr=s.default.div`
|
|
609
|
+
display: flex;
|
|
610
|
+
flex-direction: column;
|
|
611
|
+
gap: var(--spacing-xxs);
|
|
612
|
+
`,Dr=s.default(ze)`
|
|
613
|
+
display: flex;
|
|
614
|
+
flex-grow: 1;
|
|
615
|
+
align-items: center;
|
|
616
|
+
flex-direction: column;
|
|
617
|
+
padding: var(--spacing-md);
|
|
618
|
+
`,$r=s.default.div`
|
|
619
|
+
display: flex;
|
|
620
|
+
flex-grow: 1;
|
|
621
|
+
align-items: center;
|
|
622
|
+
justify-content: center;
|
|
623
|
+
`,zr=s.default.div`
|
|
624
|
+
display: flex;
|
|
625
|
+
flex-direction: column;
|
|
626
|
+
align-items: center;
|
|
627
|
+
max-width: 75%;
|
|
628
|
+
gap: var(--spacing-xxs);
|
|
629
|
+
`,Hr=s.default.div`
|
|
630
|
+
display: flex;
|
|
631
|
+
justify-content: center;
|
|
632
|
+
padding: var(--spacing-xs);
|
|
633
|
+
`,Vr=s.default(g.Typography)`
|
|
634
|
+
padding-left: var(--spacing-xs);
|
|
635
|
+
font-size: var(--font-size-sm);
|
|
636
|
+
color: var(--color-warm-grey-7);
|
|
637
|
+
`,Br=s.default.div`
|
|
638
|
+
display: flex;
|
|
639
|
+
flex-grow: 1;
|
|
640
|
+
|
|
641
|
+
.tooltip-expanded {
|
|
642
|
+
flex-grow: 1;
|
|
643
|
+
min-width: 0;
|
|
644
|
+
}
|
|
645
|
+
`,Fr=s.default.div`
|
|
646
|
+
display: flex;
|
|
647
|
+
align-items: center;
|
|
648
|
+
justify-content: space-between;
|
|
649
|
+
flex-grow: 1;
|
|
650
|
+
min-width: 0;
|
|
651
|
+
border-radius: var(--border-radius);
|
|
652
|
+
padding: calc(var(--spacing-xxs) / 2) var(--spacing-xs);
|
|
653
|
+
gap: calc(var(--spacing-xxs) * 2.5);
|
|
654
|
+
cursor: pointer;
|
|
655
|
+
|
|
656
|
+
${g.Button} {
|
|
657
|
+
display: none;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
&:focus-within,
|
|
661
|
+
&:hover {
|
|
662
|
+
background-color: var(--color-hover-base);
|
|
663
|
+
|
|
664
|
+
${g.Button} {
|
|
665
|
+
display: inline-flex;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
`,Gr=s.default(g.Typography)`
|
|
669
|
+
overflow: hidden;
|
|
670
|
+
white-space: nowrap;
|
|
671
|
+
text-overflow: ellipsis;
|
|
672
|
+
`,Ur=s.default.div`
|
|
673
|
+
height: 1px;
|
|
674
|
+
flex-shrink: 0;
|
|
675
|
+
`;function Wr(e){const{chat:t,onSelect:n,onRemove:r}=e;return i.jsx(Br,{children:i.jsx(g.Tooltip,{tip:f.dayjs(t.updatedAt).format("MMM DD, YYYY, hh:mm:ss A"),className:"expanded",children:i.jsxs(Fr,{role:"button",onClick:()=>n?.(t.id),children:[i.jsx(Gr,{children:t.title??"New chat"}),i.jsx(g.Button,{variant:"ghost",size:"small",tone:"danger",icon:i.jsx(g.TrashCanIcon,{}),onClick:o=>{o.stopPropagation(),r?.(t.id)}})]})})})}function qr(e){const{group:t,onChatSelect:n,onChatRemove:r}=e;return i.jsxs(Nr,{children:[i.jsx(Vr,{children:Lr[t.bucket]}),t.chats.map(o=>i.jsx(Wr,{chat:o,onSelect:n,onRemove:r},o.id))]})}function Yr(){return i.jsx($r,{children:i.jsxs(zr,{children:[i.jsx(g.Typography,{textAlign:"center",fontWeight:"var(--font-weight-semibold)",children:"No chat history"}),i.jsx(g.Typography,{textAlign:"center",children:"Ask questions or let the assistant take action for you."})]})})}function Kr(){return i.jsx(Dr,{children:i.jsx(f.StyledSpinner,{})})}const Jr=50;function Zr(e){const{onChatSelect:t,onChatRemove:n}=e,r=h.useRef(null),o=h.useRef(null),{data:a,isPending:l,hasNextPage:d,isFetchingNextPage:c,fetchNextPage:u}=x.useInfiniteChatHistory(Jr),p=h.useMemo(()=>(a?.pages??[]).flatMap(m=>m.items),[a?.pages]),v=h.useMemo(()=>Rr(p),[p]);return _r({scrollRef:r,sentinelRef:o,hasNextPage:d,isFetchingNextPage:c,fetchNextPage:u,observerResetKey:a?.pages.length}),l&&!a?i.jsx(Kr,{}):p.length===0?i.jsx(Yr,{}):i.jsxs(ze,{ref:r,children:[i.jsx(Mr,{children:v.map(m=>i.jsx(qr,{group:m,onChatSelect:t,onChatRemove:n},`${m.bucket}-${m.chats[0]?.id??""}`))}),d&&i.jsx(Ur,{ref:o,"aria-hidden":!0}),c&&i.jsx(Hr,{children:i.jsx(f.StyledSpinner,{})})]})}const Xr=h.createContext(null);function Qr(e){const t=h.useContext(Xr);if(t?.components){const{LinkComponent:l}=t.components;return i.jsx(l,{...e})}const{external:n,languageInsensitive:r,innerRef:o,...a}=e;return i.jsx(Be.Link,{ref:o,...a})}const eo=()=>V.keyframes`
|
|
676
|
+
0% {
|
|
677
|
+
color: var(--button-content-color);
|
|
678
|
+
background-color: var(--button-bg-color-active);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
50% {
|
|
682
|
+
background-color: var(--button-bg-color);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
100% {
|
|
686
|
+
color: var(--button-content-color);
|
|
687
|
+
background-color: var(--button-bg-color-active);
|
|
688
|
+
}
|
|
689
|
+
`,to=s.default(Qr)`
|
|
690
|
+
text-decoration: none;
|
|
691
|
+
&:focus-visible {
|
|
692
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
693
|
+
}
|
|
694
|
+
border-radius: var(--button-border-radius);
|
|
695
|
+
`;function no({variant:e="secondary",tone:t="default",size:n="medium",extraClass:r="",className:o=""}){return["button",r,`button-tone-${t}`,`button-variant-${e}`,`button-size-${n}`,o].filter(l=>l).join(" ").trim()}const ro=s.default.button`
|
|
696
|
+
width: ${({$fullWidth:e})=>e?"100%":"auto"};
|
|
697
|
+
|
|
698
|
+
display: inline-flex;
|
|
699
|
+
align-items: center;
|
|
700
|
+
justify-content: center;
|
|
701
|
+
gap: var(--button-gap);
|
|
702
|
+
margin: var(--button-margin);
|
|
703
|
+
cursor: pointer;
|
|
704
|
+
text-wrap: var(--button-text-wrap);
|
|
705
|
+
|
|
706
|
+
color: var(--button-color);
|
|
707
|
+
background-color: var(--button-bg-color);
|
|
708
|
+
border: var(--button-border-width) var(--button-border-style) var(--button-border-color);
|
|
709
|
+
box-shadow: var(--button-box-shadow);
|
|
710
|
+
backdrop-filter: var(--button-backdrop-filter, none);
|
|
711
|
+
|
|
712
|
+
font-weight: var(--button-font-weight);
|
|
713
|
+
font-size: var(--button-font-size);
|
|
714
|
+
line-height: var(--button-line-height);
|
|
715
|
+
padding: ${({$icon:e,$iconPosition:t,$iconOnly:n})=>e?`var(--button-icon-${n?"":`${t||"left"}-`}padding)`:"var(--button-padding)"};
|
|
716
|
+
border-radius: var(--button-border-radius);
|
|
717
|
+
|
|
718
|
+
svg {
|
|
719
|
+
width: var(--button-icon-size);
|
|
720
|
+
height: var(--button-icon-size);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
&:hover {
|
|
724
|
+
background-color: var(--button-bg-color-hover);
|
|
725
|
+
color: var(--button-color-hover);
|
|
726
|
+
border-color: var(--button-border-color-hover);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
&:active,
|
|
730
|
+
&.active {
|
|
731
|
+
background-color: var(--button-bg-color-active);
|
|
732
|
+
border-color: var(--button-border-color-active);
|
|
733
|
+
color: var(--button-color-active);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
&:focus-visible {
|
|
737
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
&.button-tone-danger {
|
|
741
|
+
color: var(--button-content-color-danger);
|
|
742
|
+
border-color: var(--button-border-color-danger);
|
|
743
|
+
background-color: var(--button-bg-color-danger);
|
|
744
|
+
|
|
745
|
+
&:hover {
|
|
746
|
+
color: var(--button-content-color-danger-hover);
|
|
747
|
+
border-color: var(--button-border-color-danger-hover);
|
|
748
|
+
background-color: var(--button-bg-color-danger-hover);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
&:active {
|
|
752
|
+
color: var(--button-content-color-danger-pressed);
|
|
753
|
+
border-color: var(--button-border-color-danger-pressed);
|
|
754
|
+
background-color: var(--button-bg-color-danger-pressed);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
&:disabled {
|
|
759
|
+
pointer-events: none;
|
|
760
|
+
background-color: var(--button-bg-color-disabled);
|
|
761
|
+
color: var(--button-content-color-disabled);
|
|
762
|
+
border-color: var(--button-border-color-disabled);
|
|
763
|
+
border-width: var(--button-border-width-disabled);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
${({$variant:e,$size:t})=>(e==="link"||e==="ghost")&&t==="small"&&V.css`
|
|
767
|
+
--button-font-size: var(--font-size-sm);
|
|
768
|
+
--button-line-height: var(--line-height-sm);
|
|
769
|
+
--button-icon-padding: var(--button-icon-padding-small) !important;
|
|
770
|
+
`}
|
|
771
|
+
|
|
772
|
+
${({$blinking:e})=>e&&V.css`
|
|
773
|
+
pointer-events: none;
|
|
774
|
+
animation: ${eo()} 1.2s infinite;
|
|
775
|
+
`}
|
|
776
|
+
`,oo=e=>{const{languageInsensitive:t,fullWidth:n,blinking:r,iconPosition:o,icon:a,children:l,variant:d,tone:c,size:u,extraClass:p,to:v,external:m,className:w,...y}=e,A="tabIndex"in e?e.tabIndex:e.to?-1:void 0,C=i.jsxs(ro,{"data-component-name":"Button/Button",...y,className:no({variant:d,tone:c,size:u,extraClass:p,className:w}),$fullWidth:n,$blinking:r,$iconPosition:o,$icon:a,$iconOnly:!l&&a!=null,$variant:d,$size:u,tabIndex:A,children:[a&&o!=="right"&&a,l,a&&o==="right"&&a]});return v?i.jsx(to,{to:v,external:m,languageInsensitive:t,onClick:e.onClick,children:C}):C},W=s.default(oo)``;function io(){const e=h.useRef(null),[t,n]=h.useState(!1);return h.useLayoutEffect(()=>{if(!e.current)return;const r=e.current;function o(){n(r.scrollWidth>r.clientWidth)}o();const a=new ResizeObserver(o);return a.observe(r),()=>a.disconnect()},[]),{ref:e,value:t}}function ao(e){const{ref:t,value:n}=io();return i.jsx(so,{children:i.jsx(g.Tooltip,{tip:e.value,className:"no-overflow",disabled:!n,children:i.jsx(lo,{ref:t,children:e.value})})})}const so=s.default.div`
|
|
777
|
+
overflow: hidden;
|
|
778
|
+
.tooltip-no-overflow {
|
|
779
|
+
overflow: hidden;
|
|
780
|
+
}
|
|
781
|
+
`,lo=s.default.div`
|
|
782
|
+
color: var(--text-color-primary);
|
|
783
|
+
font-size: var(--font-size-base);
|
|
784
|
+
line-height: var(--line-height-base);
|
|
785
|
+
overflow: hidden;
|
|
786
|
+
white-space: nowrap;
|
|
787
|
+
text-overflow: ellipsis;
|
|
788
|
+
user-select: none;
|
|
789
|
+
`;function He(e){const{children:t,buttons:n}=e;return i.jsxs(co,{children:[i.jsx(uo,{children:t}),n&&i.jsx(fo,{children:n})]})}const co=s.default.div`
|
|
790
|
+
display: flex;
|
|
791
|
+
flex-direction: row;
|
|
792
|
+
align-items: center;
|
|
793
|
+
padding: var(--spacing-xs);
|
|
794
|
+
gap: var(--spacing-xs);
|
|
795
|
+
width: 100%;
|
|
796
|
+
flex-shrink: 0;
|
|
797
|
+
`,uo=s.default.div`
|
|
798
|
+
display: flex;
|
|
799
|
+
align-items: center;
|
|
800
|
+
gap: var(--spacing-xs);
|
|
801
|
+
min-width: 0;
|
|
802
|
+
flex: 1;
|
|
803
|
+
`,fo=s.default.div`
|
|
804
|
+
display: flex;
|
|
805
|
+
align-items: center;
|
|
806
|
+
gap: 2px;
|
|
807
|
+
`;function po(e){const{title:t,onCreateNewChat:n,onViewHistory:r,onClose:o}=e,a=i.jsxs(i.Fragment,{children:[i.jsx(g.Tooltip,{tip:"New chat",children:i.jsx(W,{size:"small",variant:"text","aria-label":"Create new chat",onClick:n,icon:i.jsx(g.NewChatIcon,{})})}),i.jsx(g.Tooltip,{tip:"Chat history",children:i.jsx(W,{size:"small",variant:"text","aria-label":"View chat history",onClick:r,icon:i.jsx(g.RecentlyViewedIcon,{})})}),i.jsx(go,{children:i.jsx(f.VerticalDivider,{})}),i.jsx(g.Tooltip,{tip:"Close",arrowPosition:"left",children:i.jsx(W,{variant:"text",size:"small","aria-label":"Close panel",icon:i.jsx(g.CloseIcon,{}),onClick:o})})]});return i.jsxs(He,{buttons:a,children:[i.jsx(ho,{children:i.jsx(g.AiStarsGradientIcon,{size:"14px"})}),i.jsx(ao,{value:t})]})}const ho=s.default.div`
|
|
808
|
+
display: flex;
|
|
809
|
+
`,go=s.default.div`
|
|
810
|
+
display: flex;
|
|
811
|
+
height: 14px;
|
|
812
|
+
`,xo=new Set(["color","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","marginBottom","marginTop","textAlign"]),vo=s.default.span.withConfig({shouldForwardProp:e=>!xo.has(e)}).attrs({"data-component-name":"Typography/Typography"})`
|
|
813
|
+
color: ${({color:e})=>e||"var(--text-color-primary)"};
|
|
814
|
+
font-family: ${({fontFamily:e})=>e||"var(--font-family-base)"};
|
|
815
|
+
font-size: ${({fontSize:e})=>e||"var(--font-size-base)"};
|
|
816
|
+
font-style: ${({fontStyle:e})=>e};
|
|
817
|
+
font-weight: ${({fontWeight:e})=>e||"var(--font-weight-regular)"};
|
|
818
|
+
line-height: ${({lineHeight:e})=>e||"var(--line-height-base)"};
|
|
819
|
+
letter-spacing: ${({letterSpacing:e})=>e};
|
|
820
|
+
margin-bottom: ${({marginBottom:e})=>e};
|
|
821
|
+
margin-top: ${({marginTop:e})=>e};
|
|
822
|
+
text-align: ${({textAlign:e})=>e};
|
|
823
|
+
`;function mo(e){const{onReturnFromHistory:t}=e;return i.jsxs(He,{children:[i.jsx(W,{size:"small",variant:"text","aria-label":"Return to chat",onClick:t,icon:i.jsx(g.ArrowLeftIcon,{})}),i.jsx(yo,{children:i.jsx(vo,{children:"Chat history"})})]})}const yo=s.default.div`
|
|
824
|
+
user-select: none;
|
|
825
|
+
`;function bo(){const[e,t]=h.useState(x.AI_TAB.CHAT),n=f.useAiPanel(),r=f.useAiChatContext(),o=()=>{t(x.AI_TAB.HISTORY)},a=()=>{t(x.AI_TAB.CHAT)},l=async d=>{r.selectChat(d),t(x.AI_TAB.CHAT)};return i.jsxs(wo,{children:[i.jsxs(be,{isActive:e===x.AI_TAB.CHAT,children:[i.jsx(po,{title:r.title,onCreateNewChat:r.createNewChat,onViewHistory:o,onClose:n.closePanel}),i.jsx(Ir,{}),i.jsx(we,{children:i.jsx(te,{})})]}),i.jsxs(be,{isActive:e===x.AI_TAB.HISTORY,isSliding:!0,children:[i.jsx(mo,{onReturnFromHistory:a}),i.jsx(Zr,{onChatSelect:l,onChatRemove:r.removeChat}),i.jsx(we,{children:i.jsx(te,{})})]})]})}function be(e){const{children:t,isActive:n,isSliding:r=!1}=e,o=i.jsx(Co,{inert:!n,children:t});return r?i.jsx(Ao,{$isExpanded:n,children:o}):o}const wo=s.default.div`
|
|
826
|
+
position: relative;
|
|
827
|
+
height: 100%;
|
|
828
|
+
overflow: clip;
|
|
829
|
+
`,Co=s.default.div`
|
|
830
|
+
display: flex;
|
|
831
|
+
height: 100%;
|
|
832
|
+
flex-direction: column;
|
|
833
|
+
align-items: flex-start;
|
|
834
|
+
border-radius: var(--border-radius-md);
|
|
835
|
+
background: var(--bg-color);
|
|
836
|
+
margin-left: var(--spacing-xxs);
|
|
837
|
+
`,Ao=s.default.div`
|
|
838
|
+
position: absolute;
|
|
839
|
+
inset: 0;
|
|
840
|
+
transform: translateX(${e=>e.$isExpanded?"0%":"100%"});
|
|
841
|
+
transition-property: transform;
|
|
842
|
+
transition-duration: 400ms;
|
|
843
|
+
transition-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
|
|
844
|
+
@media (prefers-reduced-motion: reduce) {
|
|
845
|
+
transition-duration: 0ms;
|
|
846
|
+
}
|
|
847
|
+
`,we=s.default.div`
|
|
848
|
+
width: 100%;
|
|
849
|
+
`;exports.AiPanel=bo;
|