@athenaintel/react 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/index.cjs +376 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +108 -2
- package/dist/index.js +376 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24723,6 +24723,34 @@ const resolveTokenOverride = ({
|
|
|
24723
24723
|
}
|
|
24724
24724
|
return token;
|
|
24725
24725
|
};
|
|
24726
|
+
const useAthenaConfigValue = ({
|
|
24727
|
+
backendUrl,
|
|
24728
|
+
appUrl,
|
|
24729
|
+
apiKey,
|
|
24730
|
+
token,
|
|
24731
|
+
linkClicks,
|
|
24732
|
+
citationLinks
|
|
24733
|
+
}) => {
|
|
24734
|
+
const linkClicksRef = useRef(linkClicks);
|
|
24735
|
+
linkClicksRef.current = linkClicks;
|
|
24736
|
+
const citationLinksRef = useRef(citationLinks);
|
|
24737
|
+
citationLinksRef.current = citationLinks;
|
|
24738
|
+
return useMemo(
|
|
24739
|
+
() => ({
|
|
24740
|
+
backendUrl,
|
|
24741
|
+
appUrl,
|
|
24742
|
+
apiKey,
|
|
24743
|
+
token,
|
|
24744
|
+
get linkClicks() {
|
|
24745
|
+
return linkClicksRef.current;
|
|
24746
|
+
},
|
|
24747
|
+
get citationLinks() {
|
|
24748
|
+
return citationLinksRef.current;
|
|
24749
|
+
}
|
|
24750
|
+
}),
|
|
24751
|
+
[backendUrl, appUrl, apiKey, token]
|
|
24752
|
+
);
|
|
24753
|
+
};
|
|
24726
24754
|
function AthenaStandalone({
|
|
24727
24755
|
children,
|
|
24728
24756
|
apiUrl,
|
|
@@ -24738,7 +24766,9 @@ function AthenaStandalone({
|
|
|
24738
24766
|
workbench,
|
|
24739
24767
|
knowledgeBase,
|
|
24740
24768
|
systemPrompt,
|
|
24741
|
-
threadId
|
|
24769
|
+
threadId,
|
|
24770
|
+
linkClicks,
|
|
24771
|
+
citationLinks
|
|
24742
24772
|
}) {
|
|
24743
24773
|
const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24744
24774
|
const aui = useAui({ tools: auiTools });
|
|
@@ -24756,10 +24786,14 @@ function AthenaStandalone({
|
|
|
24756
24786
|
systemPrompt,
|
|
24757
24787
|
threadId
|
|
24758
24788
|
});
|
|
24759
|
-
const athenaConfig =
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24789
|
+
const athenaConfig = useAthenaConfigValue({
|
|
24790
|
+
backendUrl,
|
|
24791
|
+
appUrl,
|
|
24792
|
+
apiKey,
|
|
24793
|
+
token,
|
|
24794
|
+
linkClicks,
|
|
24795
|
+
citationLinks
|
|
24796
|
+
});
|
|
24763
24797
|
return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) });
|
|
24764
24798
|
}
|
|
24765
24799
|
function useAthenaRuntimeHook(config2) {
|
|
@@ -24793,7 +24827,9 @@ function AthenaWithThreadList({
|
|
|
24793
24827
|
frontendTools,
|
|
24794
24828
|
workbench,
|
|
24795
24829
|
knowledgeBase,
|
|
24796
|
-
systemPrompt
|
|
24830
|
+
systemPrompt,
|
|
24831
|
+
linkClicks,
|
|
24832
|
+
citationLinks
|
|
24797
24833
|
}) {
|
|
24798
24834
|
const adapter = useAthenaThreadListAdapter({
|
|
24799
24835
|
backendUrl,
|
|
@@ -24854,10 +24890,14 @@ function AthenaWithThreadList({
|
|
|
24854
24890
|
}, [authRefreshKey, handleRefresh]);
|
|
24855
24891
|
const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24856
24892
|
const aui = useAui({ tools: auiTools });
|
|
24857
|
-
const athenaConfig =
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24893
|
+
const athenaConfig = useAthenaConfigValue({
|
|
24894
|
+
backendUrl,
|
|
24895
|
+
appUrl,
|
|
24896
|
+
apiKey,
|
|
24897
|
+
token,
|
|
24898
|
+
linkClicks,
|
|
24899
|
+
citationLinks
|
|
24900
|
+
});
|
|
24861
24901
|
return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) }) });
|
|
24862
24902
|
}
|
|
24863
24903
|
function AthenaProvider({
|
|
@@ -24878,7 +24918,9 @@ function AthenaProvider({
|
|
|
24878
24918
|
systemPrompt,
|
|
24879
24919
|
threadId: threadIdProp,
|
|
24880
24920
|
enableThreadList = false,
|
|
24881
|
-
theme
|
|
24921
|
+
theme,
|
|
24922
|
+
linkClicks,
|
|
24923
|
+
citationLinks
|
|
24882
24924
|
}) {
|
|
24883
24925
|
const frontendToolNames = useMemo(() => Object.keys(frontendTools), [frontendTools]);
|
|
24884
24926
|
const themeStyleVars = useMemo(() => theme ? themeToStyleVars(theme) : void 0, [theme]);
|
|
@@ -24918,6 +24960,8 @@ function AthenaProvider({
|
|
|
24918
24960
|
workbench,
|
|
24919
24961
|
knowledgeBase,
|
|
24920
24962
|
systemPrompt,
|
|
24963
|
+
linkClicks,
|
|
24964
|
+
citationLinks,
|
|
24921
24965
|
children
|
|
24922
24966
|
}
|
|
24923
24967
|
);
|
|
@@ -24939,6 +24983,8 @@ function AthenaProvider({
|
|
|
24939
24983
|
knowledgeBase,
|
|
24940
24984
|
systemPrompt,
|
|
24941
24985
|
threadId: threadIdProp,
|
|
24986
|
+
linkClicks,
|
|
24987
|
+
citationLinks,
|
|
24942
24988
|
children
|
|
24943
24989
|
}
|
|
24944
24990
|
);
|
|
@@ -58597,6 +58643,257 @@ const MentionExtension = Node3.create({
|
|
|
58597
58643
|
};
|
|
58598
58644
|
}
|
|
58599
58645
|
});
|
|
58646
|
+
const useAssetPanelStore = create((set2, get2) => ({
|
|
58647
|
+
isOpen: false,
|
|
58648
|
+
tabs: [],
|
|
58649
|
+
activeTabId: null,
|
|
58650
|
+
viewMode: "tabs",
|
|
58651
|
+
isFullscreen: false,
|
|
58652
|
+
assetPanelHostCount: 0,
|
|
58653
|
+
autoOpenGeneration: 0,
|
|
58654
|
+
autoOpenedAssets: /* @__PURE__ */ new Map(),
|
|
58655
|
+
registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
|
|
58656
|
+
unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
|
|
58657
|
+
openAsset: (assetId, meta) => set2((s) => {
|
|
58658
|
+
const existing = s.tabs.find((t) => t.id === assetId);
|
|
58659
|
+
if (existing) {
|
|
58660
|
+
const tabs = meta ? s.tabs.map(
|
|
58661
|
+
(t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
|
|
58662
|
+
) : s.tabs;
|
|
58663
|
+
return { isOpen: true, tabs, activeTabId: assetId };
|
|
58664
|
+
}
|
|
58665
|
+
const newTab = {
|
|
58666
|
+
id: assetId,
|
|
58667
|
+
name: (meta == null ? void 0 : meta.name) ?? null,
|
|
58668
|
+
type: (meta == null ? void 0 : meta.type) ?? "unknown"
|
|
58669
|
+
};
|
|
58670
|
+
return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
|
|
58671
|
+
}),
|
|
58672
|
+
closeTab: (assetId) => set2((s) => {
|
|
58673
|
+
var _a2;
|
|
58674
|
+
const tabs = s.tabs.filter((t) => t.id !== assetId);
|
|
58675
|
+
if (tabs.length === 0) {
|
|
58676
|
+
return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
|
|
58677
|
+
}
|
|
58678
|
+
const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
|
|
58679
|
+
return { tabs, activeTabId };
|
|
58680
|
+
}),
|
|
58681
|
+
setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
|
|
58682
|
+
setViewMode: (mode) => set2({ viewMode: mode }),
|
|
58683
|
+
closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
|
|
58684
|
+
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
|
|
58685
|
+
resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
|
|
58686
|
+
markAutoOpened: (assetId) => {
|
|
58687
|
+
const state = get2();
|
|
58688
|
+
if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
|
|
58689
|
+
return false;
|
|
58690
|
+
}
|
|
58691
|
+
state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
|
|
58692
|
+
return true;
|
|
58693
|
+
}
|
|
58694
|
+
}));
|
|
58695
|
+
const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
|
|
58696
|
+
const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
|
|
58697
|
+
const ASSET_TYPE_ALIASES = {
|
|
58698
|
+
document: "document",
|
|
58699
|
+
notebook: "notebook",
|
|
58700
|
+
pdf: "document",
|
|
58701
|
+
powerpoint: "presentation",
|
|
58702
|
+
presentation: "presentation",
|
|
58703
|
+
puck_presentation: "presentation",
|
|
58704
|
+
sheet: "spreadsheet",
|
|
58705
|
+
spreadsheet: "spreadsheet",
|
|
58706
|
+
super_document: "document"
|
|
58707
|
+
};
|
|
58708
|
+
const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
|
|
58709
|
+
const normalizeAssetType = (value) => {
|
|
58710
|
+
if (!value) {
|
|
58711
|
+
return null;
|
|
58712
|
+
}
|
|
58713
|
+
const normalizedValue = value.trim().replace(/^athena\//, "").toLowerCase().replace(/-/g, "_");
|
|
58714
|
+
return ASSET_TYPE_ALIASES[normalizedValue] ?? null;
|
|
58715
|
+
};
|
|
58716
|
+
const getOrigin = (value) => {
|
|
58717
|
+
if (!value) {
|
|
58718
|
+
return null;
|
|
58719
|
+
}
|
|
58720
|
+
try {
|
|
58721
|
+
return new URL(value).origin;
|
|
58722
|
+
} catch {
|
|
58723
|
+
return null;
|
|
58724
|
+
}
|
|
58725
|
+
};
|
|
58726
|
+
const getCurrentOrigin = () => {
|
|
58727
|
+
if (typeof window === "undefined") {
|
|
58728
|
+
return null;
|
|
58729
|
+
}
|
|
58730
|
+
return window.location.origin;
|
|
58731
|
+
};
|
|
58732
|
+
const parseUrl = ({
|
|
58733
|
+
href,
|
|
58734
|
+
appUrl
|
|
58735
|
+
}) => {
|
|
58736
|
+
const fallbackBase = appUrl ?? getCurrentOrigin() ?? "https://app.athenaintel.com";
|
|
58737
|
+
try {
|
|
58738
|
+
return new URL(href, fallbackBase);
|
|
58739
|
+
} catch {
|
|
58740
|
+
return null;
|
|
58741
|
+
}
|
|
58742
|
+
};
|
|
58743
|
+
const isAthenaAppUrl = ({
|
|
58744
|
+
url,
|
|
58745
|
+
appUrl
|
|
58746
|
+
}) => {
|
|
58747
|
+
const hostname = url.hostname.toLowerCase();
|
|
58748
|
+
if (ATHENA_APP_HOSTNAMES.has(hostname) || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX)) {
|
|
58749
|
+
return true;
|
|
58750
|
+
}
|
|
58751
|
+
const configuredOrigin = getOrigin(appUrl);
|
|
58752
|
+
if (configuredOrigin && url.origin === configuredOrigin) {
|
|
58753
|
+
return true;
|
|
58754
|
+
}
|
|
58755
|
+
const currentOrigin = getCurrentOrigin();
|
|
58756
|
+
return !!currentOrigin && url.origin === currentOrigin;
|
|
58757
|
+
};
|
|
58758
|
+
const parseAthenaCitationLink = ({
|
|
58759
|
+
href,
|
|
58760
|
+
appUrl
|
|
58761
|
+
}) => {
|
|
58762
|
+
const url = parseUrl({ href, appUrl });
|
|
58763
|
+
if (!url || !isAthenaAppUrl({ url, appUrl }) || !isAthenaSpacesPath(url)) {
|
|
58764
|
+
return null;
|
|
58765
|
+
}
|
|
58766
|
+
const assetIdsParam = url.searchParams.get("asset_ids");
|
|
58767
|
+
if (!assetIdsParam) {
|
|
58768
|
+
return null;
|
|
58769
|
+
}
|
|
58770
|
+
const assetIds = assetIdsParam.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
58771
|
+
const assetId = assetIds[0];
|
|
58772
|
+
if (!assetId) {
|
|
58773
|
+
return null;
|
|
58774
|
+
}
|
|
58775
|
+
return {
|
|
58776
|
+
url,
|
|
58777
|
+
assetId,
|
|
58778
|
+
assetIds,
|
|
58779
|
+
assetType: normalizeAssetType(url.searchParams.get("asset_type") ?? url.searchParams.get("type"))
|
|
58780
|
+
};
|
|
58781
|
+
};
|
|
58782
|
+
const isAthenaCitationUrl = ({
|
|
58783
|
+
href,
|
|
58784
|
+
appUrl
|
|
58785
|
+
}) => parseAthenaCitationLink({ href, appUrl }) !== null;
|
|
58786
|
+
const resolveAthenaLink = ({
|
|
58787
|
+
href,
|
|
58788
|
+
appUrl
|
|
58789
|
+
}) => {
|
|
58790
|
+
const url = parseUrl({ href, appUrl });
|
|
58791
|
+
if (!url) {
|
|
58792
|
+
return null;
|
|
58793
|
+
}
|
|
58794
|
+
const citation = parseAthenaCitationLink({ href, appUrl });
|
|
58795
|
+
if (citation) {
|
|
58796
|
+
return {
|
|
58797
|
+
url: citation.url,
|
|
58798
|
+
kind: "athena-citation",
|
|
58799
|
+
citation
|
|
58800
|
+
};
|
|
58801
|
+
}
|
|
58802
|
+
return {
|
|
58803
|
+
url,
|
|
58804
|
+
kind: isAthenaAppUrl({ url, appUrl }) ? "athena-app" : "external",
|
|
58805
|
+
citation: null
|
|
58806
|
+
};
|
|
58807
|
+
};
|
|
58808
|
+
const useAthenaLinkClickHandler = () => {
|
|
58809
|
+
const openAsset = useAssetPanelStore((state) => state.openAsset);
|
|
58810
|
+
const isAssetPanelAvailable = useAssetPanelStore((state) => state.assetPanelHostCount > 0);
|
|
58811
|
+
const athenaConfig = useContext(AthenaContext);
|
|
58812
|
+
const appUrl = athenaConfig == null ? void 0 : athenaConfig.appUrl;
|
|
58813
|
+
return useCallback(
|
|
58814
|
+
({ href, linkText, target, nativeEvent }) => {
|
|
58815
|
+
var _a2, _b;
|
|
58816
|
+
const resolvedLink = resolveAthenaLink({ href, appUrl });
|
|
58817
|
+
if (!resolvedLink) {
|
|
58818
|
+
return false;
|
|
58819
|
+
}
|
|
58820
|
+
const linkClicks = athenaConfig == null ? void 0 : athenaConfig.linkClicks;
|
|
58821
|
+
const citationLinks = athenaConfig == null ? void 0 : athenaConfig.citationLinks;
|
|
58822
|
+
const trimmedLinkText = (linkText == null ? void 0 : linkText.trim()) || null;
|
|
58823
|
+
const citationLink = resolvedLink.citation;
|
|
58824
|
+
const citationMetadata = citationLink ? {
|
|
58825
|
+
assetId: citationLink.assetId,
|
|
58826
|
+
assetIds: citationLink.assetIds,
|
|
58827
|
+
assetType: citationLink.assetType
|
|
58828
|
+
} : null;
|
|
58829
|
+
const openInAssetPanel = citationLink ? () => {
|
|
58830
|
+
openAsset(citationLink.assetId, {
|
|
58831
|
+
name: trimmedLinkText ?? void 0,
|
|
58832
|
+
type: citationLink.assetType ?? void 0
|
|
58833
|
+
});
|
|
58834
|
+
} : void 0;
|
|
58835
|
+
const context2 = {
|
|
58836
|
+
href,
|
|
58837
|
+
url: resolvedLink.url,
|
|
58838
|
+
target: target ?? null,
|
|
58839
|
+
linkText: trimmedLinkText,
|
|
58840
|
+
isAssetPanelAvailable,
|
|
58841
|
+
kind: resolvedLink.kind,
|
|
58842
|
+
citation: citationMetadata,
|
|
58843
|
+
nativeEvent: nativeEvent ?? null,
|
|
58844
|
+
openInAssetPanel,
|
|
58845
|
+
openInBrowser: (nextTarget) => {
|
|
58846
|
+
var _a3;
|
|
58847
|
+
(_a3 = window.open(resolvedLink.url.toString(), nextTarget ?? target ?? "_blank")) == null ? void 0 : _a3.focus();
|
|
58848
|
+
}
|
|
58849
|
+
};
|
|
58850
|
+
if (((_a2 = linkClicks == null ? void 0 : linkClicks.onClick) == null ? void 0 : _a2.call(linkClicks, context2)) === true) {
|
|
58851
|
+
nativeEvent == null ? void 0 : nativeEvent.preventDefault();
|
|
58852
|
+
return true;
|
|
58853
|
+
}
|
|
58854
|
+
if (!citationLink || !openInAssetPanel || !citationMetadata) {
|
|
58855
|
+
return false;
|
|
58856
|
+
}
|
|
58857
|
+
const citationContext = {
|
|
58858
|
+
...context2,
|
|
58859
|
+
kind: "athena-citation",
|
|
58860
|
+
citation: citationMetadata,
|
|
58861
|
+
assetId: citationMetadata.assetId,
|
|
58862
|
+
assetIds: citationMetadata.assetIds,
|
|
58863
|
+
assetType: citationMetadata.assetType,
|
|
58864
|
+
openInAssetPanel
|
|
58865
|
+
};
|
|
58866
|
+
if (((_b = citationLinks == null ? void 0 : citationLinks.onClick) == null ? void 0 : _b.call(citationLinks, citationContext)) === true) {
|
|
58867
|
+
nativeEvent == null ? void 0 : nativeEvent.preventDefault();
|
|
58868
|
+
return true;
|
|
58869
|
+
}
|
|
58870
|
+
if (((linkClicks == null ? void 0 : linkClicks.interceptAthenaCitations) ?? (citationLinks == null ? void 0 : citationLinks.interceptAthenaCitations)) === false) {
|
|
58871
|
+
return false;
|
|
58872
|
+
}
|
|
58873
|
+
if (!isAssetPanelAvailable) {
|
|
58874
|
+
return false;
|
|
58875
|
+
}
|
|
58876
|
+
citationContext.openInAssetPanel();
|
|
58877
|
+
nativeEvent == null ? void 0 : nativeEvent.preventDefault();
|
|
58878
|
+
return true;
|
|
58879
|
+
},
|
|
58880
|
+
[appUrl, athenaConfig, isAssetPanelAvailable, openAsset]
|
|
58881
|
+
);
|
|
58882
|
+
};
|
|
58883
|
+
const useAthenaCitationLinkHandler = () => {
|
|
58884
|
+
const athenaConfig = useContext(AthenaContext);
|
|
58885
|
+
const appUrl = athenaConfig == null ? void 0 : athenaConfig.appUrl;
|
|
58886
|
+
const handleLinkClick = useAthenaLinkClickHandler();
|
|
58887
|
+
return useCallback(
|
|
58888
|
+
(input) => {
|
|
58889
|
+
if (!parseAthenaCitationLink({ href: input.href, appUrl })) {
|
|
58890
|
+
return false;
|
|
58891
|
+
}
|
|
58892
|
+
return handleLinkClick(input);
|
|
58893
|
+
},
|
|
58894
|
+
[appUrl, handleLinkClick]
|
|
58895
|
+
);
|
|
58896
|
+
};
|
|
58600
58897
|
const extensions = [
|
|
58601
58898
|
index_default$2.configure({
|
|
58602
58899
|
codeBlock: {
|
|
@@ -58606,7 +58903,7 @@ const extensions = [
|
|
|
58606
58903
|
}
|
|
58607
58904
|
}),
|
|
58608
58905
|
index_default$3.configure({
|
|
58609
|
-
openOnClick:
|
|
58906
|
+
openOnClick: false,
|
|
58610
58907
|
autolink: true,
|
|
58611
58908
|
HTMLAttributes: {
|
|
58612
58909
|
class: "text-primary underline",
|
|
@@ -58634,6 +58931,9 @@ const extensions = [
|
|
|
58634
58931
|
MentionExtension
|
|
58635
58932
|
];
|
|
58636
58933
|
const TiptapText = ({ text: text2 }) => {
|
|
58934
|
+
const handleLinkClick = useAthenaLinkClickHandler();
|
|
58935
|
+
const handleLinkClickRef = useRef(handleLinkClick);
|
|
58936
|
+
handleLinkClickRef.current = handleLinkClick;
|
|
58637
58937
|
const editor = useEditor({
|
|
58638
58938
|
immediatelyRender: true,
|
|
58639
58939
|
extensions,
|
|
@@ -58642,6 +58942,32 @@ const TiptapText = ({ text: text2 }) => {
|
|
|
58642
58942
|
editorProps: {
|
|
58643
58943
|
attributes: {
|
|
58644
58944
|
class: "prose prose-sm dark:prose-invert max-w-none focus:outline-none"
|
|
58945
|
+
},
|
|
58946
|
+
handleClick: (_view, _pos, event) => {
|
|
58947
|
+
var _a2;
|
|
58948
|
+
if (event.button !== 0) {
|
|
58949
|
+
return false;
|
|
58950
|
+
}
|
|
58951
|
+
const target = event.target;
|
|
58952
|
+
const targetElement = target instanceof HTMLElement ? target : target instanceof Node ? target.parentElement : null;
|
|
58953
|
+
if (!targetElement) {
|
|
58954
|
+
return false;
|
|
58955
|
+
}
|
|
58956
|
+
const link2 = targetElement.closest("a[href]");
|
|
58957
|
+
if (!(link2 instanceof HTMLAnchorElement)) {
|
|
58958
|
+
return false;
|
|
58959
|
+
}
|
|
58960
|
+
if (handleLinkClickRef.current({
|
|
58961
|
+
href: link2.getAttribute("href") ?? link2.href,
|
|
58962
|
+
linkText: link2.textContent,
|
|
58963
|
+
target: link2.target,
|
|
58964
|
+
nativeEvent: event
|
|
58965
|
+
})) {
|
|
58966
|
+
return true;
|
|
58967
|
+
}
|
|
58968
|
+
event.preventDefault();
|
|
58969
|
+
(_a2 = window.open(link2.href, link2.target || "_blank")) == null ? void 0 : _a2.focus();
|
|
58970
|
+
return true;
|
|
58645
58971
|
}
|
|
58646
58972
|
}
|
|
58647
58973
|
});
|
|
@@ -61740,52 +62066,6 @@ function CollapsibleTrigger({ ...props }) {
|
|
|
61740
62066
|
function CollapsibleContent({ ...props }) {
|
|
61741
62067
|
return /* @__PURE__ */ jsx(CollapsibleContent$1, { "data-slot": "collapsible-content", ...props });
|
|
61742
62068
|
}
|
|
61743
|
-
const useAssetPanelStore = create((set2, get2) => ({
|
|
61744
|
-
isOpen: false,
|
|
61745
|
-
tabs: [],
|
|
61746
|
-
activeTabId: null,
|
|
61747
|
-
viewMode: "tabs",
|
|
61748
|
-
isFullscreen: false,
|
|
61749
|
-
autoOpenGeneration: 0,
|
|
61750
|
-
autoOpenedAssets: /* @__PURE__ */ new Map(),
|
|
61751
|
-
openAsset: (assetId, meta) => set2((s) => {
|
|
61752
|
-
const existing = s.tabs.find((t) => t.id === assetId);
|
|
61753
|
-
if (existing) {
|
|
61754
|
-
const tabs = meta ? s.tabs.map(
|
|
61755
|
-
(t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
|
|
61756
|
-
) : s.tabs;
|
|
61757
|
-
return { isOpen: true, tabs, activeTabId: assetId };
|
|
61758
|
-
}
|
|
61759
|
-
const newTab = {
|
|
61760
|
-
id: assetId,
|
|
61761
|
-
name: (meta == null ? void 0 : meta.name) ?? null,
|
|
61762
|
-
type: (meta == null ? void 0 : meta.type) ?? "unknown"
|
|
61763
|
-
};
|
|
61764
|
-
return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
|
|
61765
|
-
}),
|
|
61766
|
-
closeTab: (assetId) => set2((s) => {
|
|
61767
|
-
var _a2;
|
|
61768
|
-
const tabs = s.tabs.filter((t) => t.id !== assetId);
|
|
61769
|
-
if (tabs.length === 0) {
|
|
61770
|
-
return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
|
|
61771
|
-
}
|
|
61772
|
-
const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
|
|
61773
|
-
return { tabs, activeTabId };
|
|
61774
|
-
}),
|
|
61775
|
-
setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
|
|
61776
|
-
setViewMode: (mode) => set2({ viewMode: mode }),
|
|
61777
|
-
closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
|
|
61778
|
-
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
|
|
61779
|
-
resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
|
|
61780
|
-
markAutoOpened: (assetId) => {
|
|
61781
|
-
const state = get2();
|
|
61782
|
-
if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
|
|
61783
|
-
return false;
|
|
61784
|
-
}
|
|
61785
|
-
state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
|
|
61786
|
-
return true;
|
|
61787
|
-
}
|
|
61788
|
-
}));
|
|
61789
62069
|
const ANIMATION_DURATION = 200;
|
|
61790
62070
|
const TOOL_META = {
|
|
61791
62071
|
// Search & Browse
|
|
@@ -64411,10 +64691,7 @@ const AthenaReasoningPart = ({
|
|
|
64411
64691
|
]
|
|
64412
64692
|
}
|
|
64413
64693
|
) }),
|
|
64414
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */
|
|
64415
|
-
text2,
|
|
64416
|
-
/* @__PURE__ */ jsx("span", { className: "mt-2 inline-block shimmer text-sm text-muted-foreground", children: "Thinking..." })
|
|
64417
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
|
|
64694
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
|
|
64418
64695
|
]
|
|
64419
64696
|
}
|
|
64420
64697
|
);
|
|
@@ -64623,9 +64900,27 @@ const AssetIframe = memo(
|
|
|
64623
64900
|
}
|
|
64624
64901
|
);
|
|
64625
64902
|
AssetIframe.displayName = "AssetIframe";
|
|
64626
|
-
const PanelContent = (
|
|
64627
|
-
|
|
64903
|
+
const PanelContent = ({
|
|
64904
|
+
manageAssetPanelHostRegistration
|
|
64905
|
+
}) => {
|
|
64906
|
+
const {
|
|
64907
|
+
tabs,
|
|
64908
|
+
activeTabId,
|
|
64909
|
+
viewMode,
|
|
64910
|
+
closeTab,
|
|
64911
|
+
registerAssetPanelHost,
|
|
64912
|
+
unregisterAssetPanelHost
|
|
64913
|
+
} = useAssetPanelStore();
|
|
64628
64914
|
const isTiled = viewMode === "tiled" && tabs.length >= 2;
|
|
64915
|
+
useEffect(() => {
|
|
64916
|
+
if (!manageAssetPanelHostRegistration) {
|
|
64917
|
+
return;
|
|
64918
|
+
}
|
|
64919
|
+
registerAssetPanelHost();
|
|
64920
|
+
return () => {
|
|
64921
|
+
unregisterAssetPanelHost();
|
|
64922
|
+
};
|
|
64923
|
+
}, [manageAssetPanelHostRegistration, registerAssetPanelHost, unregisterAssetPanelHost]);
|
|
64629
64924
|
const gridClass = useMemo(() => {
|
|
64630
64925
|
const n = tabs.length;
|
|
64631
64926
|
if (n <= 1) return "";
|
|
@@ -64755,12 +65050,14 @@ const PanelHeader = ({ fullscreen }) => {
|
|
|
64755
65050
|
)
|
|
64756
65051
|
] });
|
|
64757
65052
|
};
|
|
64758
|
-
const AssetPanel = (
|
|
65053
|
+
const AssetPanel = ({
|
|
65054
|
+
manageAssetPanelHostRegistration = true
|
|
65055
|
+
}) => {
|
|
64759
65056
|
const isFullscreen = useAssetPanelStore((s) => s.isFullscreen);
|
|
64760
65057
|
const content = /* @__PURE__ */ jsxs(Fragment$2, { children: [
|
|
64761
65058
|
/* @__PURE__ */ jsx(PanelHeader, { fullscreen: isFullscreen }),
|
|
64762
65059
|
/* @__PURE__ */ jsx(TabBar, {}),
|
|
64763
|
-
/* @__PURE__ */ jsx(PanelContent, {})
|
|
65060
|
+
/* @__PURE__ */ jsx(PanelContent, { manageAssetPanelHostRegistration })
|
|
64764
65061
|
] });
|
|
64765
65062
|
if (isFullscreen) {
|
|
64766
65063
|
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 flex flex-col bg-background", children: content });
|
|
@@ -64773,9 +65070,17 @@ const AthenaLayout = ({
|
|
|
64773
65070
|
minPercent = 25
|
|
64774
65071
|
}) => {
|
|
64775
65072
|
const isOpen = useAssetPanelStore((s) => s.isOpen);
|
|
65073
|
+
const registerAssetPanelHost = useAssetPanelStore((s) => s.registerAssetPanelHost);
|
|
65074
|
+
const unregisterAssetPanelHost = useAssetPanelStore((s) => s.unregisterAssetPanelHost);
|
|
64776
65075
|
const [chatPercent, setChatPercent] = useState(defaultChatPercent);
|
|
64777
65076
|
const containerRef = useRef(null);
|
|
64778
65077
|
const dragging = useRef(false);
|
|
65078
|
+
useEffect(() => {
|
|
65079
|
+
registerAssetPanelHost();
|
|
65080
|
+
return () => {
|
|
65081
|
+
unregisterAssetPanelHost();
|
|
65082
|
+
};
|
|
65083
|
+
}, [registerAssetPanelHost, unregisterAssetPanelHost]);
|
|
64779
65084
|
const onPointerDown = useCallback(
|
|
64780
65085
|
(e) => {
|
|
64781
65086
|
e.preventDefault();
|
|
@@ -64817,7 +65122,7 @@ const AthenaLayout = ({
|
|
|
64817
65122
|
onPointerUp
|
|
64818
65123
|
}
|
|
64819
65124
|
),
|
|
64820
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx(AssetPanel, {}) })
|
|
65125
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx(AssetPanel, { manageAssetPanelHostRegistration: false }) })
|
|
64821
65126
|
] });
|
|
64822
65127
|
};
|
|
64823
65128
|
function ThreadList({ className }) {
|
|
@@ -65014,7 +65319,9 @@ export {
|
|
|
65014
65319
|
createAssetToolUI,
|
|
65015
65320
|
formatToolName,
|
|
65016
65321
|
getAssetInfo,
|
|
65322
|
+
isAthenaCitationUrl,
|
|
65017
65323
|
normalizeResult,
|
|
65324
|
+
parseAthenaCitationLink,
|
|
65018
65325
|
resetAssetAutoOpen,
|
|
65019
65326
|
themeToStyleVars,
|
|
65020
65327
|
themes,
|
|
@@ -65023,7 +65330,9 @@ export {
|
|
|
65023
65330
|
useAppendToComposer,
|
|
65024
65331
|
useAssetEmbed,
|
|
65025
65332
|
useAssetPanelStore,
|
|
65333
|
+
useAthenaCitationLinkHandler,
|
|
65026
65334
|
useAthenaConfig,
|
|
65335
|
+
useAthenaLinkClickHandler,
|
|
65027
65336
|
useAthenaRuntime,
|
|
65028
65337
|
useComposerAttachment,
|
|
65029
65338
|
useFileUpload,
|