@athenaintel/react 0.9.18 → 0.9.19

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/index.d.ts CHANGED
@@ -48,8 +48,10 @@ export declare interface AssetPanelState {
48
48
  autoOpenedAssets: Map<string, number>;
49
49
  registerAssetPanelHost: () => void;
50
50
  unregisterAssetPanelHost: () => void;
51
- openAsset: (assetId: string, meta?: AssetTabMeta) => void;
52
- updateTabMeta: (assetId: string, meta: AssetTabMeta) => void;
51
+ openAsset: (assetId: string, meta?: {
52
+ name?: string;
53
+ type?: AssetType;
54
+ }) => void;
53
55
  closeTab: (assetId: string) => void;
54
56
  setActiveTab: (assetId: string) => void;
55
57
  setViewMode: (mode: ViewMode) => void;
@@ -65,13 +67,6 @@ export declare interface AssetTab {
65
67
  id: string;
66
68
  name: string | null;
67
69
  type: AssetType;
68
- embedSearchParams: Record<string, string> | null;
69
- }
70
-
71
- declare interface AssetTabMeta {
72
- name?: string | null;
73
- type?: AssetType;
74
- embedSearchParams?: Record<string, string> | null;
75
70
  }
76
71
 
77
72
  export declare type AssetType = 'presentation' | 'spreadsheet' | 'document' | 'notebook' | 'unknown';
@@ -151,8 +146,6 @@ export declare interface AthenaCitationLinkMetadata {
151
146
  assetId: string;
152
147
  assetIds: string[];
153
148
  assetType: AssetType | null;
154
- assetName: string | null;
155
- embedSearchParams: Record<string, string>;
156
149
  }
157
150
 
158
151
  /**
@@ -593,8 +586,6 @@ export declare interface ParsedAthenaCitationLink {
593
586
  assetId: string;
594
587
  assetIds: string[];
595
588
  assetType: AssetType | null;
596
- assetName: string | null;
597
- embedSearchParams: Record<string, string>;
598
589
  }
599
590
 
600
591
  declare interface QuoteContextValue {
@@ -1027,15 +1018,12 @@ export declare function useAssetEmbed(assetId: string | null, options?: UseAsset
1027
1018
  export declare interface UseAssetEmbedOptions {
1028
1019
  readOnly?: boolean;
1029
1020
  expiresInSeconds?: number;
1030
- embedSearchParams?: Record<string, string> | null;
1031
1021
  }
1032
1022
 
1033
1023
  export declare interface UseAssetEmbedResult {
1034
1024
  embedUrl: string | null;
1035
1025
  isLoading: boolean;
1036
1026
  error: string | null;
1037
- assetTitle: string | null;
1038
- assetType: AssetType | null;
1039
1027
  }
1040
1028
 
1041
1029
  export declare const useAssetPanelStore: UseBoundStore<Omit<StoreApi<AssetPanelState>, "setState" | "persist"> & {
package/dist/index.js CHANGED
@@ -24299,6 +24299,22 @@ const useAthenaRuntime = (config2) => {
24299
24299
  tokenRef.current = token;
24300
24300
  const apiKeyRef = useRef(apiKey);
24301
24301
  apiKeyRef.current = apiKey;
24302
+ const runConfigRef = useRef({
24303
+ enabledTools,
24304
+ agent: agent2,
24305
+ model,
24306
+ workbench,
24307
+ knowledgeBase,
24308
+ systemPrompt
24309
+ });
24310
+ runConfigRef.current = {
24311
+ enabledTools,
24312
+ agent: agent2,
24313
+ model,
24314
+ workbench,
24315
+ knowledgeBase,
24316
+ systemPrompt
24317
+ };
24302
24318
  const isExistingThread = !!threadIdProp;
24303
24319
  const runtime = useAssistantTransportRuntime({
24304
24320
  initialState: { messages: [] },
@@ -24397,16 +24413,17 @@ const useAthenaRuntime = (config2) => {
24397
24413
  return true;
24398
24414
  },
24399
24415
  get runConfig() {
24416
+ const currentRunConfig = runConfigRef.current;
24400
24417
  return {
24401
24418
  custom: {
24402
- enabled_tools: enabledTools,
24403
- agent: agent2,
24404
- model,
24419
+ enabled_tools: currentRunConfig.enabledTools,
24420
+ agent: currentRunConfig.agent,
24421
+ model: currentRunConfig.model,
24405
24422
  effort_dial_duration: -1,
24406
24423
  plan_mode_enabled: false,
24407
- workbench,
24408
- knowledge_base: knowledgeBase,
24409
- ...systemPrompt ? { system_prompt: systemPrompt } : {}
24424
+ workbench: currentRunConfig.workbench,
24425
+ knowledge_base: currentRunConfig.knowledgeBase,
24426
+ ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {}
24410
24427
  },
24411
24428
  persistToolInvocationLogs: true
24412
24429
  };
@@ -58878,39 +58895,17 @@ const useAssetPanelStore = create()(
58878
58895
  const existing = s.tabs.find((t) => t.id === assetId);
58879
58896
  if (existing) {
58880
58897
  const tabs = meta ? s.tabs.map(
58881
- (t) => t.id === assetId ? {
58882
- ...t,
58883
- name: meta.name ?? t.name,
58884
- type: meta.type ?? t.type,
58885
- embedSearchParams: meta.embedSearchParams ?? t.embedSearchParams
58886
- } : t
58898
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
58887
58899
  ) : s.tabs;
58888
58900
  return { isOpen: true, tabs, activeTabId: assetId };
58889
58901
  }
58890
58902
  const newTab = {
58891
58903
  id: assetId,
58892
58904
  name: (meta == null ? void 0 : meta.name) ?? null,
58893
- type: (meta == null ? void 0 : meta.type) ?? "unknown",
58894
- embedSearchParams: (meta == null ? void 0 : meta.embedSearchParams) ?? null
58905
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
58895
58906
  };
58896
58907
  return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
58897
58908
  }),
58898
- updateTabMeta: (assetId, meta) => set2((s) => {
58899
- const existing = s.tabs.find((t) => t.id === assetId);
58900
- if (!existing) {
58901
- return {};
58902
- }
58903
- return {
58904
- tabs: s.tabs.map(
58905
- (t) => t.id === assetId ? {
58906
- ...t,
58907
- name: meta.name ?? t.name,
58908
- type: meta.type ?? t.type,
58909
- embedSearchParams: meta.embedSearchParams ?? t.embedSearchParams
58910
- } : t
58911
- )
58912
- };
58913
- }),
58914
58909
  closeTab: (assetId) => set2((s) => {
58915
58910
  var _a2;
58916
58911
  const tabs = s.tabs.filter((t) => t.id !== assetId);
@@ -58968,43 +58963,13 @@ const ASSET_TYPE_ALIASES = {
58968
58963
  super_document: "document"
58969
58964
  };
58970
58965
  const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
58971
- const normalizeAssetType$1 = (value) => {
58966
+ const normalizeAssetType = (value) => {
58972
58967
  if (!value) {
58973
58968
  return null;
58974
58969
  }
58975
58970
  const normalizedValue = value.trim().replace(/^athena\//, "").toLowerCase().replace(/-/g, "_");
58976
58971
  return ASSET_TYPE_ALIASES[normalizedValue] ?? null;
58977
58972
  };
58978
- const isLikelyAssetId = (value) => !!value && /^(asset|thread|project|collection)_[a-z0-9-]+$/i.test(value.trim());
58979
- const sanitizeDisplayName = (value) => {
58980
- if (!value) {
58981
- return null;
58982
- }
58983
- const trimmedValue = value.trim();
58984
- if (!trimmedValue) {
58985
- return null;
58986
- }
58987
- if (trimmedValue.startsWith('"') && trimmedValue.endsWith('"') || trimmedValue.startsWith("'") && trimmedValue.endsWith("'")) {
58988
- return trimmedValue.slice(1, -1).trim() || null;
58989
- }
58990
- return trimmedValue;
58991
- };
58992
- const getCitationDisplayName = ({
58993
- assetName,
58994
- linkText
58995
- }) => {
58996
- const sanitizedAssetName = sanitizeDisplayName(assetName);
58997
- const sanitizedLinkText = sanitizeDisplayName(linkText);
58998
- const genericLinkTextPattern = /^(this|that|the)\s+asset$/i;
58999
- if (sanitizedAssetName && !isLikelyAssetId(sanitizedAssetName)) {
59000
- return sanitizedAssetName;
59001
- }
59002
- if (sanitizedLinkText && !genericLinkTextPattern.test(sanitizedLinkText)) {
59003
- return sanitizedLinkText;
59004
- }
59005
- return sanitizedAssetName ?? sanitizedLinkText;
59006
- };
59007
- const getEmbedSearchParams = (url) => Object.fromEntries(url.searchParams.entries());
59008
58973
  const getOrigin = (value) => {
59009
58974
  if (!value) {
59010
58975
  return null;
@@ -59086,11 +59051,7 @@ const parseAthenaCitationLink = ({
59086
59051
  url,
59087
59052
  assetId,
59088
59053
  assetIds,
59089
- assetType: normalizeAssetType$1(
59090
- url.searchParams.get("asset_type") ?? url.searchParams.get("assetType") ?? url.searchParams.get("type")
59091
- ),
59092
- assetName: sanitizeDisplayName(url.searchParams.get("name")),
59093
- embedSearchParams: getEmbedSearchParams(url)
59054
+ assetType: normalizeAssetType(url.searchParams.get("asset_type") ?? url.searchParams.get("type"))
59094
59055
  };
59095
59056
  };
59096
59057
  const isAthenaCitationUrl = ({
@@ -59138,19 +59099,12 @@ const useAthenaLinkClickHandler = () => {
59138
59099
  const citationMetadata = citationLink ? {
59139
59100
  assetId: citationLink.assetId,
59140
59101
  assetIds: citationLink.assetIds,
59141
- assetType: citationLink.assetType,
59142
- assetName: citationLink.assetName,
59143
- embedSearchParams: citationLink.embedSearchParams
59102
+ assetType: citationLink.assetType
59144
59103
  } : null;
59145
59104
  const openInAssetPanel = citationLink ? () => {
59146
- const displayName = getCitationDisplayName({
59147
- assetName: citationLink.assetName,
59148
- linkText: trimmedLinkText
59149
- });
59150
59105
  openAsset(citationLink.assetId, {
59151
- name: displayName ?? void 0,
59152
- type: citationLink.assetType ?? void 0,
59153
- embedSearchParams: citationLink.embedSearchParams
59106
+ name: trimmedLinkText ?? void 0,
59107
+ type: citationLink.assetType ?? void 0
59154
59108
  });
59155
59109
  } : void 0;
59156
59110
  const context2 = {
@@ -63590,12 +63544,6 @@ function extractAssetId(result) {
63590
63544
  if (typeof id === "string" && id.startsWith("asset_")) return id;
63591
63545
  return null;
63592
63546
  }
63593
- function extractAssetTitle(result) {
63594
- const data = normalizeResult(result);
63595
- if (!data) return null;
63596
- const title = data.assetTitle ?? data.asset_title ?? data.title ?? data.name;
63597
- return typeof title === "string" && title.trim().length > 0 ? title.trim() : null;
63598
- }
63599
63547
  function resetAssetAutoOpen() {
63600
63548
  useAssetPanelStore.getState().resetAutoOpen();
63601
63549
  }
@@ -64315,7 +64263,6 @@ const OpenAssetToolUIImpl = ({
64315
64263
  const typedArgs = args;
64316
64264
  const argsAssetId = (typedArgs == null ? void 0 : typedArgs.asset_id) ?? (typedArgs == null ? void 0 : typedArgs.assetId) ?? "";
64317
64265
  const resultAssetId = extractAssetId(result);
64318
- const resultAssetTitle = extractAssetTitle(result);
64319
64266
  const assetId = resultAssetId ?? (argsAssetId.startsWith("asset_") ? argsAssetId : null);
64320
64267
  const isRunning = (status == null ? void 0 : status.type) === "running";
64321
64268
  const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
@@ -64327,10 +64274,10 @@ const OpenAssetToolUIImpl = ({
64327
64274
  if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
64328
64275
  const store = useAssetPanelStore.getState();
64329
64276
  if (store.markAutoOpened(assetId)) {
64330
- store.openAsset(assetId, { name: resultAssetTitle ?? void 0 });
64277
+ store.openAsset(assetId);
64331
64278
  }
64332
64279
  }
64333
- }, [isComplete, isCancelled, assetId, resultAssetTitle]);
64280
+ }, [isComplete, isCancelled, assetId]);
64334
64281
  return /* @__PURE__ */ jsx(
64335
64282
  ToolCard,
64336
64283
  {
@@ -64346,7 +64293,7 @@ const OpenAssetToolUIImpl = ({
64346
64293
  "button",
64347
64294
  {
64348
64295
  type: "button",
64349
- onClick: () => openAsset(assetId, { name: resultAssetTitle ?? void 0 }),
64296
+ onClick: () => openAsset(assetId),
64350
64297
  className: "flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
64351
64298
  children: [
64352
64299
  /* @__PURE__ */ jsx(ExternalLink, { className: "size-3" }),
@@ -64957,7 +64904,9 @@ const AthenaChat = ({
64957
64904
  {
64958
64905
  turnAnchor: "top",
64959
64906
  className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
64907
+ "data-aui-thread-viewport": "",
64960
64908
  children: [
64909
+ /* @__PURE__ */ jsx(ThreadScrollToTop, {}),
64961
64910
  /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
64962
64911
  /* @__PURE__ */ jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
64963
64912
  welcomeSubtext && /* @__PURE__ */ jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-lg delay-75 duration-200", children: welcomeSubtext }),
@@ -65003,6 +64952,50 @@ const ThreadLoadingOverlay = () => {
65003
64952
  if (!remoteId || timedOut) return null;
65004
64953
  return /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
65005
64954
  };
64955
+ const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
64956
+ const useScrollToTop = () => {
64957
+ const [isAtTop, setIsAtTop] = useState(true);
64958
+ const [buttonEl, setButtonEl] = useState(null);
64959
+ const containerRef = useCallback((node) => {
64960
+ setButtonEl(node);
64961
+ }, []);
64962
+ const getViewport = useCallback(() => {
64963
+ if (!buttonEl) return null;
64964
+ return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`);
64965
+ }, [buttonEl]);
64966
+ useEffect(() => {
64967
+ const viewport = getViewport();
64968
+ if (!viewport) return;
64969
+ const handleScroll2 = () => {
64970
+ setIsAtTop(viewport.scrollTop <= 50);
64971
+ };
64972
+ handleScroll2();
64973
+ viewport.addEventListener("scroll", handleScroll2, { passive: true });
64974
+ return () => viewport.removeEventListener("scroll", handleScroll2);
64975
+ }, [getViewport]);
64976
+ const handleClick2 = useCallback(() => {
64977
+ const viewport = getViewport();
64978
+ if (!viewport) return;
64979
+ viewport.scrollTo({ top: 0, behavior: "smooth" });
64980
+ }, [getViewport]);
64981
+ return { isAtTop, containerRef, handleClick: handleClick2 };
64982
+ };
64983
+ const ThreadScrollToTop = () => {
64984
+ const { isAtTop, containerRef, handleClick: handleClick2 } = useScrollToTop();
64985
+ const isEmpty3 = useAuiState((s) => s.thread.isEmpty);
64986
+ if (isEmpty3) return null;
64987
+ return /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center", children: /* @__PURE__ */ jsx(
64988
+ TooltipIconButton,
64989
+ {
64990
+ ref: containerRef,
64991
+ tooltip: "Scroll to top",
64992
+ variant: "outline",
64993
+ className: cn("aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent", isAtTop && "invisible"),
64994
+ onClick: handleClick2,
64995
+ children: /* @__PURE__ */ jsx(ArrowUp, {})
64996
+ }
64997
+ ) });
64998
+ };
65006
64999
  const ThreadScrollToBottom = () => /* @__PURE__ */ jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(
65007
65000
  TooltipIconButton,
65008
65001
  {
@@ -65271,67 +65264,14 @@ const AthenaUserMessage = ({
65271
65264
  children: /* @__PURE__ */ jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsx(MessagePrimitiveParts, { components: { Text: TextComponent } }) })
65272
65265
  }
65273
65266
  );
65274
- const EMBED_ASSET_TYPE_ALIASES = {
65275
- document: "document",
65276
- image: "document",
65277
- notebook: "notebook",
65278
- pdf: "document",
65279
- powerpoint_deck: "presentation",
65280
- presentation: "presentation",
65281
- puck_presentation: "presentation",
65282
- sheet: "spreadsheet",
65283
- spreadsheet: "spreadsheet",
65284
- super_document: "document"
65285
- };
65286
65267
  const embedCache = /* @__PURE__ */ new Map();
65287
- const normalizeAssetType = (value) => {
65288
- if (!value) {
65289
- return null;
65290
- }
65291
- const normalizedValue = value.trim().replace(/^athena\//, "").toLowerCase().replace(/-/g, "_");
65292
- return EMBED_ASSET_TYPE_ALIASES[normalizedValue] ?? null;
65293
- };
65294
- const getEmbedSearchParamsCacheKey = (embedSearchParams) => {
65295
- if (!embedSearchParams || Object.keys(embedSearchParams).length === 0) {
65296
- return "{}";
65297
- }
65298
- const sortedEntries = Object.entries(embedSearchParams).sort(
65299
- ([left], [right]) => left.localeCompare(right)
65300
- );
65301
- return JSON.stringify(Object.fromEntries(sortedEntries));
65302
- };
65303
- const appendEmbedSearchParams = ({
65304
- embedUrl,
65305
- embedSearchParams
65306
- }) => {
65307
- if (!embedSearchParams || Object.keys(embedSearchParams).length === 0) {
65308
- return embedUrl;
65309
- }
65310
- const url = new URL(embedUrl);
65311
- for (const [key, value] of Object.entries(embedSearchParams)) {
65312
- if (!value) {
65313
- continue;
65314
- }
65315
- url.searchParams.set(key, value);
65316
- }
65317
- return url.toString();
65318
- };
65319
65268
  function useAssetEmbed(assetId, options = {
65320
65269
  backendUrl: ""
65321
65270
  }) {
65322
- const {
65323
- readOnly = false,
65324
- expiresInSeconds = 60 * 60 * 24 * 30,
65325
- backendUrl,
65326
- apiKey,
65327
- token,
65328
- embedSearchParams
65329
- } = options;
65271
+ const { readOnly = false, expiresInSeconds = 60 * 60 * 24 * 30, backendUrl, apiKey, token } = options;
65330
65272
  const [embedUrl, setEmbedUrl] = useState(null);
65331
65273
  const [isLoading, setIsLoading] = useState(false);
65332
65274
  const [error2, setError] = useState(null);
65333
- const [assetTitle, setAssetTitle] = useState(null);
65334
- const [assetType, setAssetType] = useState(null);
65335
65275
  const abortRef = useRef(null);
65336
65276
  useEffect(() => {
65337
65277
  var _a2;
@@ -65339,18 +65279,14 @@ function useAssetEmbed(assetId, options = {
65339
65279
  setEmbedUrl(null);
65340
65280
  setIsLoading(false);
65341
65281
  setError(null);
65342
- setAssetTitle(null);
65343
- setAssetType(null);
65344
65282
  return;
65345
65283
  }
65346
- const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}:${getEmbedSearchParamsCacheKey(embedSearchParams)}`;
65284
+ const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`;
65347
65285
  const cached = embedCache.get(cacheKey);
65348
65286
  if (cached && cached.expiresAt > Date.now() / 1e3) {
65349
65287
  setEmbedUrl(cached.url);
65350
65288
  setIsLoading(false);
65351
65289
  setError(null);
65352
- setAssetTitle(cached.assetTitle);
65353
- setAssetType(cached.assetType);
65354
65290
  return;
65355
65291
  }
65356
65292
  const apiBaseUrl = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
@@ -65358,14 +65294,11 @@ function useAssetEmbed(assetId, options = {
65358
65294
  (_a2 = abortRef.current) == null ? void 0 : _a2.abort();
65359
65295
  const controller = new AbortController();
65360
65296
  abortRef.current = controller;
65361
- setEmbedUrl(null);
65362
65297
  setIsLoading(true);
65363
65298
  setError(null);
65364
- setAssetTitle(null);
65365
- setAssetType(null);
65366
65299
  const headers = { "Content-Type": "application/json" };
65367
65300
  if (token) {
65368
- headers.Authorization = `Bearer ${token}`;
65301
+ headers["Authorization"] = `Bearer ${token}`;
65369
65302
  } else if (apiKey) {
65370
65303
  headers["X-API-KEY"] = apiKey;
65371
65304
  }
@@ -65385,31 +65318,17 @@ function useAssetEmbed(assetId, options = {
65385
65318
  }
65386
65319
  return res.json();
65387
65320
  }).then((data) => {
65388
- const resolvedAssetType = normalizeAssetType(data.athena_converted_type) ?? normalizeAssetType(data.athena_original_type);
65389
- const resolvedEmbedUrl = appendEmbedSearchParams({
65390
- embedUrl: data.embed_url,
65391
- embedSearchParams
65392
- });
65393
- embedCache.set(cacheKey, {
65394
- url: resolvedEmbedUrl,
65395
- expiresAt: data.expires_at,
65396
- assetTitle: data.title ?? null,
65397
- assetType: resolvedAssetType
65398
- });
65399
- setEmbedUrl(resolvedEmbedUrl);
65400
- setAssetTitle(data.title ?? null);
65401
- setAssetType(resolvedAssetType);
65321
+ embedCache.set(`${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`, { url: data.embed_url, expiresAt: data.expires_at });
65322
+ setEmbedUrl(data.embed_url);
65402
65323
  setIsLoading(false);
65403
65324
  }).catch((err) => {
65404
- if (err.name === "AbortError") {
65405
- return;
65406
- }
65325
+ if (err.name === "AbortError") return;
65407
65326
  setError(err.message);
65408
65327
  setIsLoading(false);
65409
65328
  });
65410
65329
  return () => controller.abort();
65411
- }, [assetId, readOnly, expiresInSeconds, backendUrl, apiKey, token, embedSearchParams]);
65412
- return { embedUrl, isLoading, error: error2, assetTitle, assetType };
65330
+ }, [assetId, readOnly, expiresInSeconds, backendUrl, apiKey, token]);
65331
+ return { embedUrl, isLoading, error: error2 };
65413
65332
  }
65414
65333
  const ASSET_TYPE_CONFIG = {
65415
65334
  presentation: { icon: Presentation, label: "Presentation" },
@@ -65419,28 +65338,13 @@ const ASSET_TYPE_CONFIG = {
65419
65338
  unknown: { icon: File$1, label: "Asset" }
65420
65339
  };
65421
65340
  const AssetIframe = memo(
65422
- ({ tabId, tabName, tabType, embedSearchParams }) => {
65341
+ ({ tabId, tabName }) => {
65423
65342
  const { backendUrl, apiKey, token } = useAthenaConfig();
65424
- const { embedUrl, isLoading, error: error2, assetTitle, assetType } = useAssetEmbed(tabId, {
65343
+ const { embedUrl, isLoading, error: error2 } = useAssetEmbed(tabId, {
65425
65344
  backendUrl,
65426
65345
  apiKey,
65427
- token,
65428
- embedSearchParams
65346
+ token
65429
65347
  });
65430
- useEffect(() => {
65431
- if (!assetTitle && !assetType) {
65432
- return;
65433
- }
65434
- const nextName = assetTitle ?? tabName;
65435
- const nextType = assetType ?? tabType;
65436
- if (nextName === tabName && nextType === tabType) {
65437
- return;
65438
- }
65439
- useAssetPanelStore.getState().updateTabMeta(tabId, {
65440
- name: nextName ?? void 0,
65441
- type: nextType
65442
- });
65443
- }, [assetTitle, assetType, tabId, tabName, tabType]);
65444
65348
  if (isLoading) {
65445
65349
  return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
65446
65350
  /* @__PURE__ */ jsx(LoaderCircle, { className: "mx-auto size-6 animate-spin text-muted-foreground" }),
@@ -65502,7 +65406,7 @@ const PanelContent = ({
65502
65406
  return /* @__PURE__ */ jsx(
65503
65407
  "div",
65504
65408
  {
65505
- className: cn("flex-1 overflow-hidden", isTiled && gridClass, isTiled && "gap-px bg-border/60"),
65409
+ className: `flex-1 overflow-hidden ${isTiled ? `${gridClass} gap-px bg-border/60` : ""}`,
65506
65410
  children: tabs.map((tab) => {
65507
65411
  const isActive2 = tab.id === activeTabId;
65508
65412
  const config2 = ASSET_TYPE_CONFIG[tab.type];
@@ -65525,15 +65429,7 @@ const PanelContent = ({
65525
65429
  }
65526
65430
  )
65527
65431
  ] }),
65528
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
65529
- AssetIframe,
65530
- {
65531
- tabId: tab.id,
65532
- tabName: tab.name,
65533
- tabType: tab.type,
65534
- embedSearchParams: tab.embedSearchParams
65535
- }
65536
- ) })
65432
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(AssetIframe, { tabId: tab.id, tabName: tab.name }) })
65537
65433
  ]
65538
65434
  },
65539
65435
  tab.id
@@ -65543,15 +65439,7 @@ const PanelContent = ({
65543
65439
  "div",
65544
65440
  {
65545
65441
  className: isActive2 ? "h-full w-full" : "hidden",
65546
- children: /* @__PURE__ */ jsx(
65547
- AssetIframe,
65548
- {
65549
- tabId: tab.id,
65550
- tabName: tab.name,
65551
- tabType: tab.type,
65552
- embedSearchParams: tab.embedSearchParams
65553
- }
65554
- )
65442
+ children: /* @__PURE__ */ jsx(AssetIframe, { tabId: tab.id, tabName: tab.name })
65555
65443
  },
65556
65444
  tab.id
65557
65445
  );
@@ -65569,10 +65457,7 @@ const TabBar = () => {
65569
65457
  return /* @__PURE__ */ jsxs(
65570
65458
  "div",
65571
65459
  {
65572
- className: cn(
65573
- "group flex max-w-[180px] shrink-0 cursor-pointer items-center gap-1.5 border-r border-border/40 px-3 py-1.5 text-xs",
65574
- isActive2 ? "border-b-2 border-b-primary bg-background text-foreground" : "text-muted-foreground hover:bg-background/50 hover:text-foreground"
65575
- ),
65460
+ className: `group flex max-w-[180px] shrink-0 cursor-pointer items-center gap-1.5 border-r border-border/40 px-3 py-1.5 text-xs ${isActive2 ? "border-b-2 border-b-primary bg-background text-foreground" : "text-muted-foreground hover:bg-background/50 hover:text-foreground"}`,
65576
65461
  onClick: () => setActiveTab(tab.id),
65577
65462
  children: [
65578
65463
  /* @__PURE__ */ jsx(TypeIcon, { className: "size-3 shrink-0" }),
@@ -65614,10 +65499,7 @@ const PanelHeader = ({ fullscreen }) => {
65614
65499
  "button",
65615
65500
  {
65616
65501
  onClick: () => setViewMode(isTiled ? "tabs" : "tiled"),
65617
- className: cn(
65618
- "flex size-7 items-center justify-center rounded-lg transition-colors",
65619
- isTiled ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground"
65620
- ),
65502
+ className: `flex size-7 items-center justify-center rounded-lg transition-colors ${isTiled ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground"}`,
65621
65503
  title: isTiled ? "Switch to tabs" : "Tile all assets",
65622
65504
  children: isTiled ? /* @__PURE__ */ jsx(Layers, { className: "size-3.5" }) : /* @__PURE__ */ jsx(LayoutGrid, { className: "size-3.5" })
65623
65505
  }