@flamingo-stack/openframe-frontend-core 0.0.813 → 0.0.814
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/build/export-map.json +1 -1
- package/dist/{chunk-GTOT4ZQV.cjs → chunk-2H7XPKKT.cjs} +2 -2
- package/dist/{chunk-5RBL7A2Y.cjs → chunk-7ERD34HQ.cjs} +539 -291
- package/dist/{chunk-JFA3VHXC.cjs → chunk-AYMKG55T.cjs} +19 -19
- package/dist/{chunk-7BJ22OH2.cjs → chunk-CVPHODOE.cjs} +32 -32
- package/dist/{chunk-PXR27MXW.cjs → chunk-D23VVC3K.cjs} +11 -11
- package/dist/{chunk-TOBROYSJ.cjs → chunk-E5VF3IXO.cjs} +4 -4
- package/dist/{chunk-EJQRX6S5.cjs → chunk-G2B6EA4J.cjs} +39 -39
- package/dist/{chunk-XWCZSEW7.cjs → chunk-G5CCYMCU.cjs} +3 -3
- package/dist/{chunk-MUH7X7ZA.cjs → chunk-IBYT5I7K.cjs} +3 -3
- package/dist/{chunk-MBU45QUB.cjs → chunk-IDEOLXY6.cjs} +109 -142
- package/dist/{chunk-FTGXZHLO.cjs → chunk-ILV243HM.cjs} +7 -7
- package/dist/{chunk-5V3CNLCB.cjs → chunk-KINBPFAC.cjs} +18 -18
- package/dist/{chunk-WKODIG3L.cjs → chunk-KNGULKOU.cjs} +10 -10
- package/dist/{chunk-2WD7XGWA.cjs → chunk-LUR2ED43.cjs} +4 -4
- package/dist/{chunk-GNGXHIBC.cjs → chunk-M6VLEXN3.cjs} +48 -48
- package/dist/{chunk-G2AN67DP.cjs → chunk-UTRRECPV.cjs} +53 -53
- package/dist/{chunk-5M5JVVSL.cjs → chunk-WJPEDREU.cjs} +6 -6
- package/dist/{chunk-OGHG6REG.cjs → chunk-ZNZ6453J.cjs} +9 -9
- package/dist/{cloud-tenants-ODZVCP5X.cjs → cloud-tenants-JSH6AQMZ.cjs} +4 -4
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-enhanced.js +8 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +34 -2
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts +93 -0
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/chat-card-disclosure.js +126 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts +5 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +82 -55
- package/dist/components/chat/entity-cards/index.d.ts +1 -0
- package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/index.js +14 -0
- package/dist/components/chat/index.cjs +19 -3
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +3 -0
- package/dist/components/chat/inline-app-link-chip.d.ts +35 -0
- package/dist/components/chat/inline-app-link-chip.d.ts.map +1 -0
- package/dist/components/chat/inline-app-link-chip.js +37 -0
- package/dist/components/chat/source-action-button.d.ts +15 -1
- package/dist/components/chat/source-action-button.d.ts.map +1 -1
- package/dist/components/chat/source-action-button.js +40 -2
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/faq/index.cjs +6 -6
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/help-center-pages/index.cjs +61 -61
- package/dist/components/index.cjs +56 -40
- package/dist/components/meeting-scheduler/index.cjs +29 -29
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.cjs +6 -6
- package/dist/components/product-demo/index.cjs +13 -13
- package/dist/components/tickets/index.cjs +9 -9
- package/dist/components/ui/index.cjs +22 -6
- package/dist/{devices-GWBR7MJD.cjs → devices-OCEOO6OW.cjs} +5 -5
- package/dist/{embeddable-chat-4RLUXHDH.cjs → embeddable-chat-YRKMPFDY.cjs} +95 -62
- package/dist/index.cjs +26 -10
- package/dist/{knowledge-ZNRITHW5.cjs → knowledge-3GEE4LPY.cjs} +5 -5
- package/dist/{logs-QN5H5JT6.cjs → logs-7GGUZSDB.cjs} +12 -12
- package/dist/{policies-SCUYEYGJ.cjs → policies-S74WTNL4.cjs} +8 -8
- package/dist/{scripts-BP7UTAG5.cjs → scripts-G4QAT4NZ.cjs} +9 -9
- package/dist/{software-update-O4BQJCJ4.cjs → software-update-IYHJABLP.cjs} +7 -7
- package/package.json +1 -1
- package/src/components/chat/chat-message-enhanced.tsx +24 -1
- package/src/components/chat/embeddable-chat.tsx +61 -1
- package/src/components/chat/entity-cards/chat-card-disclosure.tsx +233 -0
- package/src/components/chat/entity-cards/dispatch.tsx +104 -63
- package/src/components/chat/entity-cards/index.ts +9 -0
- package/src/components/chat/index.ts +1 -0
- package/src/components/chat/inline-app-link-chip.tsx +79 -0
- package/src/components/chat/source-action-button.tsx +53 -2
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
var _chunkDTKGIG4Acjs = require('../../chunk-DTKGIG4A.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZNZ6453Jcjs = require('../../chunk-ZNZ6453J.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkIDEOLXY6cjs = require('../../chunk-IDEOLXY6.cjs');
|
|
14
14
|
require('../../chunk-467T3LCG.cjs');
|
|
15
15
|
require('../../chunk-EHANO6UE.cjs');
|
|
16
16
|
require('../../chunk-IJCSQFLD.cjs');
|
|
@@ -22,11 +22,11 @@ require('../../chunk-24I6RFVU.cjs');
|
|
|
22
22
|
require('../../chunk-7Z536SPR.cjs');
|
|
23
23
|
require('../../chunk-MZ4KBSH7.cjs');
|
|
24
24
|
require('../../chunk-5SZ4ILU3.cjs');
|
|
25
|
-
require('../../chunk-
|
|
25
|
+
require('../../chunk-KINBPFAC.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunk7ERD34HQcjs = require('../../chunk-7ERD34HQ.cjs');
|
|
30
30
|
require('../../chunk-OBQ5WUNG.cjs');
|
|
31
31
|
require('../../chunk-6CZVQ72C.cjs');
|
|
32
32
|
require('../../chunk-ZRDVFADQ.cjs');
|
|
@@ -1931,9 +1931,9 @@ function ShareExperienceSection({
|
|
|
1931
1931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-h2", children: howItWorksTitle }),
|
|
1932
1932
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-h4", children: howItWorksBody })
|
|
1933
1933
|
] }),
|
|
1934
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1934
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIDEOLXY6cjs.BenefitCardGrid, { columns: 4, children: [
|
|
1935
1935
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1936
|
-
|
|
1936
|
+
_chunkIDEOLXY6cjs.BenefitCard,
|
|
1937
1937
|
{
|
|
1938
1938
|
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-12 w-12 items-center justify-center rounded-md border border-ods-border bg-ods-bg p-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMJQLBIZMcjs.G2Icon, { color: "var(--social-g2)", size: 24 }) }),
|
|
1939
1939
|
title: "G2",
|
|
@@ -1942,7 +1942,7 @@ function ShareExperienceSection({
|
|
|
1942
1942
|
}
|
|
1943
1943
|
),
|
|
1944
1944
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1945
|
-
|
|
1945
|
+
_chunkIDEOLXY6cjs.BenefitCard,
|
|
1946
1946
|
{
|
|
1947
1947
|
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-12 w-12 items-center justify-center rounded-md border border-ods-border bg-ods-bg p-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA2VKPXOBcjs.CapterraIcon, { size: 24 }) }),
|
|
1948
1948
|
title: "Capterra",
|
|
@@ -1951,7 +1951,7 @@ function ShareExperienceSection({
|
|
|
1951
1951
|
}
|
|
1952
1952
|
),
|
|
1953
1953
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1954
|
-
|
|
1954
|
+
_chunkIDEOLXY6cjs.BenefitCard,
|
|
1955
1955
|
{
|
|
1956
1956
|
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-12 w-12 items-center justify-center rounded-md border border-ods-border bg-ods-bg p-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTLKSZG3Dcjs.TrustpilotIcon, { size: 24 }) }),
|
|
1957
1957
|
title: "TrustPilot",
|
|
@@ -1960,7 +1960,7 @@ function ShareExperienceSection({
|
|
|
1960
1960
|
}
|
|
1961
1961
|
),
|
|
1962
1962
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1963
|
-
|
|
1963
|
+
_chunkIDEOLXY6cjs.BenefitCard,
|
|
1964
1964
|
{
|
|
1965
1965
|
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-12 w-12 items-center justify-center rounded-md border border-ods-border bg-ods-bg p-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkILYW6BQNcjs.GetappIcon, { size: 24 }) }),
|
|
1966
1966
|
title: "GetApp",
|
|
@@ -1969,7 +1969,7 @@ function ShareExperienceSection({
|
|
|
1969
1969
|
}
|
|
1970
1970
|
)
|
|
1971
1971
|
] }),
|
|
1972
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZNZ6453Jcjs.ContactForm, { ...DEFAULT_CONTACT_FORM_PROPS, ...contactFormProps })
|
|
1973
1973
|
] }) })
|
|
1974
1974
|
] });
|
|
1975
1975
|
}
|
|
@@ -1986,7 +1986,7 @@ function EntityQuotesPanel({ quotes, className }) {
|
|
|
1986
1986
|
// Optional per record, so the loading state draws none: the gate leaves the loaded panel out of its comparison.
|
|
1987
1987
|
// A plain block around the one panel, so the parent's spacing applies to it as it did to the panel.
|
|
1988
1988
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-loading-optional": true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1989
|
-
|
|
1989
|
+
_chunkIDEOLXY6cjs.StackedRowsPanel,
|
|
1990
1990
|
{
|
|
1991
1991
|
className,
|
|
1992
1992
|
title: `${_chunkDTKGIG4Acjs.ENTITY_QUOTES_TITLE} \xB7 ${quotes.length}`,
|
|
@@ -2024,19 +2024,19 @@ function QuoteCardTile({ quote, decorative, className, loading, ...props }) {
|
|
|
2024
2024
|
className: _chunk63A4GZMBcjs.cn.call(void 0, QUOTE_CARD_CLASS, "hover:border-ods-border-hover", className),
|
|
2025
2025
|
...props,
|
|
2026
2026
|
children: [
|
|
2027
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2027
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIDEOLXY6cjs.PersonCell, { size: "lg", name: `"${quote.text}"`, secondary: quote.attribution, avatarUrl: quote.logoUrl }),
|
|
2028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7ERD34HQcjs.CardHitLayer, { href: quote.href, label: `${quote.text}, ${quote.attribution}`, decorative })
|
|
2029
2029
|
]
|
|
2030
2030
|
}
|
|
2031
2031
|
);
|
|
2032
2032
|
}
|
|
2033
2033
|
function QuoteCardTileSkeleton({ className }) {
|
|
2034
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY6MJMPHVcjs.Card, { variant: "panel", className: _chunk63A4GZMBcjs.cn.call(void 0, QUOTE_CARD_CLASS, className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2XCORRJVcjs.LoadingRegion, { label: "Loading a customer story", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2034
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY6MJMPHVcjs.Card, { variant: "panel", className: _chunk63A4GZMBcjs.cn.call(void 0, QUOTE_CARD_CLASS, className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2XCORRJVcjs.LoadingRegion, { label: "Loading a customer story", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIDEOLXY6cjs.PersonCell, { loading: true, size: "lg" }) }) });
|
|
2035
2035
|
}
|
|
2036
2036
|
var QUOTE_STRIP_SKELETON_CARDS = 4;
|
|
2037
2037
|
function QuoteCardsStripSkeleton({ count, className }) {
|
|
2038
2038
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2039
|
-
|
|
2039
|
+
_chunk7ERD34HQcjs.CardsStrip,
|
|
2040
2040
|
{
|
|
2041
2041
|
className,
|
|
2042
2042
|
showTitle: false,
|
|
@@ -2055,7 +2055,7 @@ function QuoteCardsStrip({ quotes, loading = false, skeletonCount, className })
|
|
|
2055
2055
|
}
|
|
2056
2056
|
if (quotes.length === 0) return null;
|
|
2057
2057
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2058
|
-
|
|
2058
|
+
_chunk7ERD34HQcjs.CardsStrip,
|
|
2059
2059
|
{
|
|
2060
2060
|
className,
|
|
2061
2061
|
showTitle: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-message-enhanced.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-message-enhanced.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-message-enhanced.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-message-enhanced.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAyC5F,OAAO,KAAK,EAA8C,wBAAwB,EAAE,MAAM,SAAS,CAAC;AA8uBpG,QAAA,MAAM,2BAA2B,4FAmC/B,CAAC;AAIH,OAAO,EAAE,2BAA2B,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React, { forwardRef, memo, useEffect, useMemo, useRef } from "react";
|
|
4
4
|
import { createCardMarkerScanner } from "../../chat-protocol/card-marker.js";
|
|
5
|
+
import { useChatRuntime } from "../../contexts/chat-runtime-context.js";
|
|
5
6
|
import Link from "../../embed-shims/next-link.js";
|
|
6
7
|
import { cn } from "../../utils/cn.js";
|
|
7
8
|
import { isToday } from "../../utils/date-utils.js";
|
|
@@ -28,6 +29,7 @@ import { ContextCompactionDisplay } from "./context-compaction-display.js";
|
|
|
28
29
|
import { BlockCard } from "./entity-cards/block-card.js";
|
|
29
30
|
import { ErrorMessageDisplay } from "./error-message-display.js";
|
|
30
31
|
import { EscalationOfferMessage } from "./escalation-offer-message.js";
|
|
32
|
+
import { InlineAppLinkChip } from "./inline-app-link-chip.js";
|
|
31
33
|
import { remarkCardLinks } from "./remark-card-links.js";
|
|
32
34
|
import { remarkMentionChips } from "./remark-mention-chips.js";
|
|
33
35
|
import { remarkStripCitations } from "./remark-strip-citations.js";
|
|
@@ -38,6 +40,7 @@ import { TicketEscalatedMessage } from "./ticket-escalated-message.js";
|
|
|
38
40
|
import { TicketEventMessage } from "./ticket-event-message.js";
|
|
39
41
|
import { ToolExecutionDisplay } from "./tool-execution-display.js";
|
|
40
42
|
import { CHAT_APPEARANCE } from "./types/chat.types.js";
|
|
43
|
+
import { computeIsNewTab } from "./utils/nav-anchor-props.js";
|
|
41
44
|
const MENTION_MARKER_REGEX = /(^|[^\w@])@[a-zA-Z]+:([A-Za-z0-9_.+/=-]*[A-Za-z0-9_+/=])/g;
|
|
42
45
|
const CARD_MARKER_REGEX = createCardMarkerScanner();
|
|
43
46
|
function formatMessageTimestamp(timestamp) {
|
|
@@ -210,6 +213,7 @@ const ChatMessageEnhanced = forwardRef(
|
|
|
210
213
|
}, [renderingPlan]);
|
|
211
214
|
const renderingPlanRef = useRef(renderingPlan);
|
|
212
215
|
renderingPlanRef.current = renderingPlan;
|
|
216
|
+
const chatRuntime = useChatRuntime();
|
|
213
217
|
const cardComponentOverrides = useMemo(() => {
|
|
214
218
|
if (!hasMarkerSupport && !hasMentionSupport) return void 0;
|
|
215
219
|
return {
|
|
@@ -240,13 +244,16 @@ const ChatMessageEnhanced = forwardRef(
|
|
|
240
244
|
return /* @__PURE__ */ jsx("span", { className: "text-ods-text-secondary opacity-60", children: cardId });
|
|
241
245
|
}
|
|
242
246
|
}
|
|
247
|
+
if (typeof href === "string" && !href.startsWith("#") && chatRuntime && !computeIsNewTab(chatRuntime, href, null)) {
|
|
248
|
+
return /* @__PURE__ */ jsx(InlineAppLinkChip, { href, anchor: NavLinkAnchor, children });
|
|
249
|
+
}
|
|
243
250
|
if (typeof href === "string" && NavLinkAnchor && !href.startsWith("#")) {
|
|
244
251
|
return /* @__PURE__ */ jsx(NavLinkAnchor, { href, className: linkClassName, ...rest, children });
|
|
245
252
|
}
|
|
246
253
|
return /* @__PURE__ */ jsx(Link, { href, className: linkClassName, ...rest, children });
|
|
247
254
|
}
|
|
248
255
|
};
|
|
249
|
-
}, [hasMarkerSupport, hasMentionSupport, renderMention, NavLinkAnchor]);
|
|
256
|
+
}, [hasMarkerSupport, hasMentionSupport, renderMention, NavLinkAnchor, chatRuntime]);
|
|
250
257
|
const renderSegmentBody = (segIndex, text, isStreaming) => {
|
|
251
258
|
const parts = renderingPlan?.partsBySegment.get(segIndex);
|
|
252
259
|
if (!parts || parts.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddable-chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat/embeddable-chat.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAiF,MAAM,OAAO,CAAC;AAqBtG,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"embeddable-chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat/embeddable-chat.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAiF,MAAM,OAAO,CAAC;AAqBtG,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAY/E,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAStE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASvE,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAgC,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI9F,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAqC,UAAU,EAAwB,MAAM,yBAAyB,CAAC;AACnH,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAc,cAAc,EAAW,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAEjB,MAAM,kCAAkC,CAAC;AAwD1C,MAAM,WAAW,mBAAmB;IAClC;+DAC2D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CAAC"}
|
|
@@ -31,8 +31,10 @@ import { ActionsMenuDropdown } from "../ui/actions-menu.js";
|
|
|
31
31
|
import { Button } from "../ui/button/index.js";
|
|
32
32
|
import { Drawer, DrawerContent } from "../ui/drawer.js";
|
|
33
33
|
import { HoverDropdown } from "../ui/hover-dropdown.js";
|
|
34
|
+
import { TextHold } from "../ui/layout-hold.js";
|
|
34
35
|
import { LoadingItems } from "../ui/loading-scope.js";
|
|
35
36
|
import { CollisionBoundaryContext, PortalContainerContext } from "../ui/portal-container.js";
|
|
37
|
+
import { SKELETON_SURFACE_CLASS } from "../ui/skeleton-surface.js";
|
|
36
38
|
import { SquareAvatar } from "../ui/square-avatar.js";
|
|
37
39
|
import { ChatAppearanceContext } from "./chat-appearance-context.js";
|
|
38
40
|
import { ChatArchivePage } from "./chat-archive-page.js";
|
|
@@ -170,6 +172,17 @@ function dispatchSlashCommandAction(actionId, cmdId, ref) {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
}
|
|
175
|
+
const ONE_TEXT_LINE = "\xA0";
|
|
176
|
+
const SOURCE_CHIP_SKELETON_COUNT = 2;
|
|
177
|
+
function SourceChipSkeleton({ className }) {
|
|
178
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: cn("pointer-events-none inline-flex shrink-0 items-center", className), children: [
|
|
179
|
+
/* @__PURE__ */ jsxs("span", { className: chatChipClass({ tone: "secondary" }), children: [
|
|
180
|
+
/* @__PURE__ */ jsx("span", { className: cn(SKELETON_SURFACE_CLASS, "inline-block h-3.5 w-3.5 rounded-sm") }),
|
|
181
|
+
/* @__PURE__ */ jsx("span", { className: cn(SKELETON_SURFACE_CLASS, "w-28 rounded-sm"), children: ONE_TEXT_LINE })
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: cn(SKELETON_SURFACE_CLASS, "-mr-1 ml-1 inline-block h-5 w-5 rounded-sm") })
|
|
184
|
+
] });
|
|
185
|
+
}
|
|
173
186
|
function SourceChip({
|
|
174
187
|
src,
|
|
175
188
|
baseRoute,
|
|
@@ -322,9 +335,16 @@ function SourceChips({
|
|
|
322
335
|
baseRoute,
|
|
323
336
|
chipBasePlatform,
|
|
324
337
|
onClose,
|
|
325
|
-
onDiscuss
|
|
338
|
+
onDiscuss,
|
|
339
|
+
loading
|
|
326
340
|
}) {
|
|
327
341
|
const [expanded, setExpanded] = useState(false);
|
|
342
|
+
if (loading) {
|
|
343
|
+
return /* @__PURE__ */ jsxs("div", { "aria-hidden": true, className: "mt-2 flex flex-col gap-1.5 border-t border-ods-border pt-2", children: [
|
|
344
|
+
/* @__PURE__ */ jsx("span", { className: "uppercase text-ods-text-muted text-h6", children: /* @__PURE__ */ jsx(TextHold, { children: "Sources" }) }),
|
|
345
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-nowrap gap-1.5 overflow-hidden", children: Array.from({ length: SOURCE_CHIP_SKELETON_COUNT }, (_, i) => /* @__PURE__ */ jsx(SourceChipSkeleton, { className: i > 0 ? "max-md:hidden" : void 0 }, i)) })
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
328
348
|
if (cited.length === 0) {
|
|
329
349
|
const fallback = uncited.slice(0, FALLBACK_TOP_RETRIEVED);
|
|
330
350
|
if (fallback.length === 0) return null;
|
|
@@ -966,7 +986,19 @@ function EmbeddableChatInner({
|
|
|
966
986
|
const renderMessageSources = useCallback(
|
|
967
987
|
(message, index) => {
|
|
968
988
|
if (message.role !== "assistant") return null;
|
|
969
|
-
if (chatLoading && index === messages.length - 1)
|
|
989
|
+
if (chatLoading && index === messages.length - 1) {
|
|
990
|
+
return /* @__PURE__ */ jsx("div", { className: "pb-2", children: /* @__PURE__ */ jsx(
|
|
991
|
+
SourceChips,
|
|
992
|
+
{
|
|
993
|
+
loading: true,
|
|
994
|
+
cited: [],
|
|
995
|
+
uncited: [],
|
|
996
|
+
baseRoute: resolvedBaseRoute,
|
|
997
|
+
chipBasePlatform,
|
|
998
|
+
onClose: handleNavigationClose
|
|
999
|
+
}
|
|
1000
|
+
) });
|
|
1001
|
+
}
|
|
970
1002
|
const { cited, uncited } = splitCitedSources(message.sources, flattenAssistantContent(message.content));
|
|
971
1003
|
if (cited.length === 0 && uncited.length === 0) return null;
|
|
972
1004
|
return /* @__PURE__ */ jsx("div", { className: "pb-2", children: /* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a chat card can open below itself: ONE disclosure, with a KIND per kind of content (`CHAT_CARD_DISCLOSURE`:
|
|
3
|
+
* VIDEO today; IMAGE and the like are one entry each in `CHAT_CARD_DISCLOSURES`). A kind owns everything about its
|
|
4
|
+
* content: the action's words and icon, how to find the content on a fetched record (`fromItem`), and how to draw it.
|
|
5
|
+
*
|
|
6
|
+
* A card shows the kind's action in the footer row it already draws ("Watch video"), and the content opens below
|
|
7
|
+
* the card only when the reader asks for it, so the answer keeps its height while it loads (CU-17tkuw61kfy: the
|
|
8
|
+
* player used to be drawn the moment its card resolved, and an answer with three recordings grew by three players
|
|
9
|
+
* while it was being read). A height change the reader asked for is not a layout shift.
|
|
10
|
+
*
|
|
11
|
+
* It opens and closes like every other expander in the chat (the thinking block, tool calls, approval batches, error
|
|
12
|
+
* details): `ExpandChevron` turns, and `useCollapsible` animates the height. The content mounts on open and unmounts
|
|
13
|
+
* when the close has finished, so a closed player is not playing out of sight.
|
|
14
|
+
*
|
|
15
|
+
* The action's space never changes. A card type whose records can carry a kind's content (`disclosure` on its registry
|
|
16
|
+
* entry, `disclosure: CHAT_CARD_DISCLOSURE.VIDEO`) draws the action in its skeleton (`ChatCardDisclosureButton
|
|
17
|
+
* loading`), and a record of that type without the content keeps the slot, unseen
|
|
18
|
+
* (`useChatCardDisclosure(kind, null, { reserve: true })`).
|
|
19
|
+
*
|
|
20
|
+
* Two shapes, one state:
|
|
21
|
+
* - `useChatCardDisclosure` for a card with a footer row (the action goes in the row, the panel below the card);
|
|
22
|
+
* - `ChatCardDisclosureRow` for content with no card of its own (a `[card://video:<id>]` marker): the same action on
|
|
23
|
+
* a row of its own.
|
|
24
|
+
*/
|
|
25
|
+
import type React from 'react';
|
|
26
|
+
import { type ReactNode } from 'react';
|
|
27
|
+
import type { ChatRef } from '../chat-ref.types';
|
|
28
|
+
/** The kinds of content a chat card can open below itself. */
|
|
29
|
+
export declare const CHAT_CARD_DISCLOSURE: {
|
|
30
|
+
readonly VIDEO: "VIDEO";
|
|
31
|
+
};
|
|
32
|
+
export type ChatCardDisclosureKind = (typeof CHAT_CARD_DISCLOSURE)[keyof typeof CHAT_CARD_DISCLOSURE];
|
|
33
|
+
/**
|
|
34
|
+
* The fields of a fetched card record a kind reads. Two shapes: a ChatRef-shaped item (per-object hydration routes)
|
|
35
|
+
* carries `metadata` keys directly; a content row (public list APIs) carries its canonical columns.
|
|
36
|
+
*/
|
|
37
|
+
export interface ChatCardDisclosureSource {
|
|
38
|
+
metadata?: Record<string, unknown> | null;
|
|
39
|
+
custom_video_url?: string | null;
|
|
40
|
+
main_video_url?: string | null;
|
|
41
|
+
youtube_url?: string | null;
|
|
42
|
+
testimonial_video_url?: string | null;
|
|
43
|
+
highlight_video_url?: string | null;
|
|
44
|
+
main_video_thumbnail?: string | null;
|
|
45
|
+
highlight_video_thumbnail?: string | null;
|
|
46
|
+
featured_image?: string | null;
|
|
47
|
+
}
|
|
48
|
+
interface ChatCardDisclosureSpec {
|
|
49
|
+
/** The action while the content is closed. */
|
|
50
|
+
label: string;
|
|
51
|
+
/** The action while it is open. */
|
|
52
|
+
openLabel: string;
|
|
53
|
+
icon: React.ComponentType<{
|
|
54
|
+
className?: string;
|
|
55
|
+
}>;
|
|
56
|
+
/** This kind's content on a fetched record, as the ref its `render` draws; null when the record has none. */
|
|
57
|
+
fromItem: (item: ChatCardDisclosureSource | undefined, chatRef: ChatRef) => ChatRef | null;
|
|
58
|
+
/** The content, for the ref `fromItem` produced (or a ref that describes it on its own, e.g. a video marker). */
|
|
59
|
+
render: (chatRef: ChatRef) => ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/** Every kind of content a chat card can open. A new kind is one entry here and one in `CHAT_CARD_DISCLOSURE`. */
|
|
62
|
+
export declare const CHAT_CARD_DISCLOSURES: Record<ChatCardDisclosureKind, ChatCardDisclosureSpec>;
|
|
63
|
+
/** The first kind whose content a fetched record carries, with that content; null when it carries none. */
|
|
64
|
+
export declare function chatCardDisclosureOf(item: ChatCardDisclosureSource | undefined, chatRef: ChatRef): {
|
|
65
|
+
kind: ChatCardDisclosureKind;
|
|
66
|
+
content: ChatRef;
|
|
67
|
+
} | null;
|
|
68
|
+
/** The footer action that opens and closes a kind's content. */
|
|
69
|
+
export declare function ChatCardDisclosureButton({ kind, open, onToggle, title, loading, }: {
|
|
70
|
+
kind: ChatCardDisclosureKind;
|
|
71
|
+
open?: boolean;
|
|
72
|
+
onToggle?: () => void;
|
|
73
|
+
title?: string;
|
|
74
|
+
/** The action's loading form, drawn in the skeleton of a card that can carry this content. */
|
|
75
|
+
loading?: boolean;
|
|
76
|
+
}): React.ReactElement;
|
|
77
|
+
/**
|
|
78
|
+
* The action for a card's footer row, and the panel to draw below the card. With no content (`chatRef` null),
|
|
79
|
+
* `reserve` keeps the action's slot, unseen and unreachable, for a card type whose records can carry it.
|
|
80
|
+
*/
|
|
81
|
+
export declare function useChatCardDisclosure(kind: ChatCardDisclosureKind, chatRef: ChatRef | null, { reserve }?: {
|
|
82
|
+
reserve?: boolean;
|
|
83
|
+
}): {
|
|
84
|
+
action: ReactNode;
|
|
85
|
+
panel: ReactNode;
|
|
86
|
+
};
|
|
87
|
+
/** Content with no card of its own: the action on its own row, the panel below it once opened. */
|
|
88
|
+
export declare function ChatCardDisclosureRow({ kind, chatRef, }: {
|
|
89
|
+
kind: ChatCardDisclosureKind;
|
|
90
|
+
chatRef: ChatRef;
|
|
91
|
+
}): React.ReactElement;
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=chat-card-disclosure.d.ts.map
|
|
@@ -0,0 +1 @@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AAY,CAWrB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { PlayIcon } from "../../icons-v2-generated/media-playback/play-icon.js";
|
|
5
|
+
import { Button } from "../../ui/button/index.js";
|
|
6
|
+
import { ExpandChevron } from "../expand-chevron.js";
|
|
7
|
+
import { useCollapsible } from "../hooks/use-collapsible.js";
|
|
8
|
+
import { CARD_FOOTER_ACTION_CLASS, FooterActionSkeleton } from "../source-action-button.js";
|
|
9
|
+
import { ChatVideoEntityCard } from "./chat-video-entity-card.js";
|
|
10
|
+
const CHAT_CARD_DISCLOSURE = {
|
|
11
|
+
VIDEO: "VIDEO"
|
|
12
|
+
};
|
|
13
|
+
function pick(...values) {
|
|
14
|
+
for (const v of values) if (typeof v === "string" && v.length > 0) return v;
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
function videoFromItem(item, chatRef) {
|
|
18
|
+
const m = item?.metadata ?? {};
|
|
19
|
+
const out = {};
|
|
20
|
+
const videoUrl = pick(m.videoUrl, item?.custom_video_url, item?.main_video_url);
|
|
21
|
+
const youtubeUrl = pick(m.youtubeUrl, item?.youtube_url, item?.testimonial_video_url);
|
|
22
|
+
const highlightVideoUrl = pick(m.highlightVideoUrl, item?.highlight_video_url);
|
|
23
|
+
const videoPoster = pick(
|
|
24
|
+
m.videoPoster,
|
|
25
|
+
item?.main_video_thumbnail,
|
|
26
|
+
item?.highlight_video_thumbnail,
|
|
27
|
+
item?.featured_image
|
|
28
|
+
);
|
|
29
|
+
const highlightVideoPoster = pick(m.highlightVideoPoster, item?.highlight_video_thumbnail);
|
|
30
|
+
if (videoUrl) out.videoUrl = videoUrl;
|
|
31
|
+
if (youtubeUrl) out.youtubeUrl = youtubeUrl;
|
|
32
|
+
if (highlightVideoUrl) out.highlightVideoUrl = highlightVideoUrl;
|
|
33
|
+
if (videoPoster) out.videoPoster = videoPoster;
|
|
34
|
+
if (highlightVideoPoster) out.highlightVideoPoster = highlightVideoPoster;
|
|
35
|
+
if (!out.videoUrl && !out.youtubeUrl && !out.highlightVideoUrl) return null;
|
|
36
|
+
return { ...chatRef, metadata: { ...chatRef.metadata ?? {}, ...out } };
|
|
37
|
+
}
|
|
38
|
+
const CHAT_CARD_DISCLOSURES = {
|
|
39
|
+
VIDEO: {
|
|
40
|
+
label: "Watch video",
|
|
41
|
+
openLabel: "Hide video",
|
|
42
|
+
icon: PlayIcon,
|
|
43
|
+
fromItem: videoFromItem,
|
|
44
|
+
render: (chatRef) => /* @__PURE__ */ jsx(ChatVideoEntityCard, { chatRef })
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function chatCardDisclosureOf(item, chatRef) {
|
|
48
|
+
for (const kind of Object.values(CHAT_CARD_DISCLOSURE)) {
|
|
49
|
+
const content = CHAT_CARD_DISCLOSURES[kind].fromItem(item, chatRef);
|
|
50
|
+
if (content) return { kind, content };
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function ChatCardDisclosureButton({
|
|
55
|
+
kind,
|
|
56
|
+
open = false,
|
|
57
|
+
onToggle,
|
|
58
|
+
title,
|
|
59
|
+
loading
|
|
60
|
+
}) {
|
|
61
|
+
const spec = CHAT_CARD_DISCLOSURES[kind];
|
|
62
|
+
if (loading) return /* @__PURE__ */ jsx(FooterActionSkeleton, { label: spec.label, className: CARD_FOOTER_ACTION_CLASS });
|
|
63
|
+
const label = open ? spec.openLabel : spec.label;
|
|
64
|
+
const Icon = spec.icon;
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
Button,
|
|
67
|
+
{
|
|
68
|
+
variant: "transparent",
|
|
69
|
+
size: "small",
|
|
70
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { className: "!h-3 !w-3" }),
|
|
71
|
+
rightIcon: /* @__PURE__ */ jsx(ExpandChevron, { expanded: open, className: "!h-3 !w-3" }),
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
onToggle?.();
|
|
76
|
+
},
|
|
77
|
+
"aria-expanded": open,
|
|
78
|
+
"aria-label": title ? `${label}: ${title}` : label,
|
|
79
|
+
className: CARD_FOOTER_ACTION_CLASS,
|
|
80
|
+
children: label
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function DisclosurePanel({ open, children }) {
|
|
85
|
+
const { innerRef, containerStyle } = useCollapsible({ expanded: open });
|
|
86
|
+
return /* @__PURE__ */ jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsx("div", { ref: innerRef, children }) });
|
|
87
|
+
}
|
|
88
|
+
function useChatCardDisclosure(kind, chatRef, { reserve = false } = {}) {
|
|
89
|
+
const [open, setOpen] = useState(false);
|
|
90
|
+
const [mounted, setMounted] = useState(false);
|
|
91
|
+
if (!chatRef) {
|
|
92
|
+
return {
|
|
93
|
+
action: reserve ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, inert: true, className: "invisible", children: /* @__PURE__ */ jsx(ChatCardDisclosureButton, { kind }) }) : null,
|
|
94
|
+
panel: null
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const toggle = () => {
|
|
98
|
+
if (!open) setMounted(true);
|
|
99
|
+
setOpen((o) => !o);
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
action: /* @__PURE__ */ jsx(ChatCardDisclosureButton, { kind, open, onToggle: toggle, title: chatRef.title }),
|
|
103
|
+
panel: mounted ? /* @__PURE__ */ jsx("div", { "data-testid": "chat-card-disclosure-panel", onTransitionEnd: () => !open && setMounted(false), children: /* @__PURE__ */ jsx(DisclosurePanel, { open, children: CHAT_CARD_DISCLOSURES[kind].render(chatRef) }) }) : null
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function ChatCardDisclosureRow({
|
|
107
|
+
kind,
|
|
108
|
+
chatRef
|
|
109
|
+
}) {
|
|
110
|
+
const { action, panel } = useChatCardDisclosure(kind, chatRef);
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid min-w-0 grid-cols-1 gap-3", children: [
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-0.5", children: [
|
|
113
|
+
action,
|
|
114
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-ods-text-secondary text-h6", children: chatRef.title })
|
|
115
|
+
] }),
|
|
116
|
+
panel
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
CHAT_CARD_DISCLOSURE,
|
|
121
|
+
CHAT_CARD_DISCLOSURES,
|
|
122
|
+
ChatCardDisclosureButton,
|
|
123
|
+
ChatCardDisclosureRow,
|
|
124
|
+
chatCardDisclosureOf,
|
|
125
|
+
useChatCardDisclosure
|
|
126
|
+
};
|
|
@@ -30,6 +30,7 @@ import type React from 'react';
|
|
|
30
30
|
import type { LoadedProductReleaseCardProps } from '../../shared/product-release/product-release-card';
|
|
31
31
|
import type { ChatRef } from '../chat-ref.types';
|
|
32
32
|
import type { BaseProgramItem, ProgramConfig } from '../types/entities/program-types';
|
|
33
|
+
import { type ChatCardDisclosureKind } from './chat-card-disclosure';
|
|
33
34
|
/**
|
|
34
35
|
* A hydrated entity row as returned by `useChatCardItem` (the per-type list /
|
|
35
36
|
* entity-refs APIs). Row shapes differ per document type, so this declares
|
|
@@ -191,6 +192,10 @@ interface ChatCardRegistryEntry {
|
|
|
191
192
|
contentRefType?: string;
|
|
192
193
|
/** Required whenever `contentRefType` is set. */
|
|
193
194
|
skeleton?: () => React.ReactNode;
|
|
195
|
+
/** The kind of content this type's records can open below the card (`CHAT_CARD_DISCLOSURE.VIDEO`): the card's
|
|
196
|
+
* footer row keeps that action's slot loading and loaded, with or without the content on a record, so the row
|
|
197
|
+
* never changes height. */
|
|
198
|
+
disclosure?: ChatCardDisclosureKind;
|
|
194
199
|
/** `item` is the fetched row (`undefined` only on the ref-only render
|
|
195
200
|
* path — `deleted_data` / `video`). */
|
|
196
201
|
render: (item: ChatCardItem | undefined, chatRef: ChatRef, opts: ChatCardRenderOptions) => React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/entity-cards/dispatch.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwD/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAMvG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/entity-cards/dispatch.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwD/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAMvG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAYtF,OAAO,EAIL,KAAK,sBAAsB,EAI5B,MAAM,wBAAwB,CAAC;AAqBhC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAA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