pxengine 0.1.88 → 0.1.90

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.cjs CHANGED
@@ -336,6 +336,7 @@ __export(index_exports, {
336
336
  TopPostsGrid: () => TopPostsGrid,
337
337
  VideoAtom: () => VideoAtom,
338
338
  WebSearchJobCard: () => WebSearchJobCard,
339
+ WidgetThemeContext: () => WidgetThemeContext,
339
340
  cn: () => cn,
340
341
  defaultFetchSelections: () => defaultFetchSelections,
341
342
  defaultPersistSelection: () => defaultPersistSelection,
@@ -347,12 +348,13 @@ __export(index_exports, {
347
348
  submitWidgetToAgent: () => submitWidgetToAgent,
348
349
  th: () => th,
349
350
  useCreatorWidgetPolling: () => useCreatorWidgetPolling,
351
+ useWidgetTheme: () => useWidgetTheme,
350
352
  withAlpha: () => withAlpha
351
353
  });
352
354
  module.exports = __toCommonJS(index_exports);
353
355
 
354
356
  // src/render/PXEngineRenderer.tsx
355
- var import_react93 = __toESM(require("react"), 1);
357
+ var import_react94 = __toESM(require("react"), 1);
356
358
 
357
359
  // src/atoms/index.ts
358
360
  var atoms_exports = {};
@@ -33964,14 +33966,22 @@ __export(molecules_exports, {
33964
33966
  TimelineCard: () => TimelineCard,
33965
33967
  TopPostsGrid: () => TopPostsGrid,
33966
33968
  WebSearchJobCard: () => WebSearchJobCard,
33969
+ WidgetThemeContext: () => WidgetThemeContext,
33967
33970
  defaultFetchSelections: () => defaultFetchSelections,
33968
33971
  defaultPersistSelection: () => defaultPersistSelection,
33969
33972
  th: () => th,
33970
33973
  useCreatorWidgetPolling: () => useCreatorWidgetPolling,
33974
+ useWidgetTheme: () => useWidgetTheme,
33971
33975
  withAlpha: () => withAlpha
33972
33976
  });
33973
33977
 
33974
33978
  // src/molecules/generic/widgetTheme.ts
33979
+ var import_react54 = require("react");
33980
+ var WidgetThemeContext = (0, import_react54.createContext)(void 0);
33981
+ function useWidgetTheme(explicit) {
33982
+ const ctx = (0, import_react54.useContext)(WidgetThemeContext);
33983
+ return explicit ?? ctx;
33984
+ }
33975
33985
  function withAlpha(color, alpha) {
33976
33986
  const hex = color.replace("#", "");
33977
33987
  if (hex.length === 6) {
@@ -33984,13 +33994,22 @@ function withAlpha(color, alpha) {
33984
33994
  }
33985
33995
  function th(theme) {
33986
33996
  const T = theme ?? {};
33997
+ const shape = {
33998
+ ...typeof T.borderWidth === "number" && { borderWidth: T.borderWidth },
33999
+ ...typeof T.radius === "number" && { borderRadius: T.radius },
34000
+ ...T.shadow && { boxShadow: T.shadow },
34001
+ ...T.fontFamily && { fontFamily: T.fontFamily }
34002
+ };
33987
34003
  const root = {
33988
34004
  ...T.background && { backgroundColor: T.background },
33989
- ...T.border && { borderColor: T.border }
34005
+ ...T.border && { borderColor: T.border },
34006
+ ...shape
33990
34007
  };
33991
34008
  const surface = {
33992
34009
  ...T.surface && { backgroundColor: T.surface },
33993
- ...T.border && { borderColor: T.border }
34010
+ ...T.border && { borderColor: T.border },
34011
+ ...typeof T.borderWidth === "number" && { borderWidth: T.borderWidth },
34012
+ ...typeof T.radius === "number" && { borderRadius: Math.max(0, T.radius - 4) }
33994
34013
  };
33995
34014
  const text = {
33996
34015
  ...T.text && { color: T.text }
@@ -34007,14 +34026,35 @@ function th(theme) {
34007
34026
  const accentBorder = {
34008
34027
  ...T.accent && { borderColor: T.accent }
34009
34028
  };
34029
+ const accentText = {
34030
+ ...T.accentForeground && { color: T.accentForeground }
34031
+ };
34010
34032
  const accentSubtle = (alpha = 0.12) => ({
34011
34033
  ...T.accent && { backgroundColor: withAlpha(T.accent, alpha) }
34012
34034
  });
34013
- return { root, surface, text, muted, accent, accentBg, accentBorder, accentSubtle };
34035
+ const semantic = (kind) => ({
34036
+ ...T[kind] && { color: T[kind] }
34037
+ });
34038
+ const gradientBg = {
34039
+ ...T.gradient && { backgroundImage: T.gradient }
34040
+ };
34041
+ return {
34042
+ root,
34043
+ surface,
34044
+ text,
34045
+ muted,
34046
+ accent,
34047
+ accentBg,
34048
+ accentBorder,
34049
+ accentText,
34050
+ accentSubtle,
34051
+ semantic,
34052
+ gradientBg
34053
+ };
34014
34054
  }
34015
34055
 
34016
34056
  // src/molecules/generic/EditableField/EditableField.tsx
34017
- var import_react54 = __toESM(require("react"), 1);
34057
+ var import_react55 = __toESM(require("react"), 1);
34018
34058
 
34019
34059
  // src/components/ui/hover-card.tsx
34020
34060
  var React82 = __toESM(require("react"), 1);
@@ -34333,7 +34373,7 @@ function Spinner({ className, ...props }) {
34333
34373
 
34334
34374
  // src/molecules/generic/EditableField/EditableField.tsx
34335
34375
  var import_jsx_runtime94 = require("react/jsx-runtime");
34336
- var EditableField = import_react54.default.memo(
34376
+ var EditableField = import_react55.default.memo(
34337
34377
  ({
34338
34378
  label,
34339
34379
  value,
@@ -34353,12 +34393,12 @@ var EditableField = import_react54.default.memo(
34353
34393
  ...rest
34354
34394
  }) => {
34355
34395
  void rest;
34356
- const [localValue, setLocalValue] = (0, import_react54.useState)(value);
34357
- const inputRef = (0, import_react54.useRef)(null);
34358
- (0, import_react54.useEffect)(() => {
34396
+ const [localValue, setLocalValue] = (0, import_react55.useState)(value);
34397
+ const inputRef = (0, import_react55.useRef)(null);
34398
+ (0, import_react55.useEffect)(() => {
34359
34399
  setLocalValue(value);
34360
34400
  }, [value, isEditingProp]);
34361
- (0, import_react54.useEffect)(() => {
34401
+ (0, import_react55.useEffect)(() => {
34362
34402
  if (isEditingProp) {
34363
34403
  setTimeout(() => inputRef.current?.focus(), 0);
34364
34404
  }
@@ -34545,9 +34585,9 @@ var EditableField = import_react54.default.memo(
34545
34585
  EditableField.displayName = "EditableField";
34546
34586
 
34547
34587
  // src/molecules/generic/ActionButton/ActionButton.tsx
34548
- var import_react55 = __toESM(require("react"), 1);
34588
+ var import_react56 = __toESM(require("react"), 1);
34549
34589
  var import_jsx_runtime95 = require("react/jsx-runtime");
34550
- var ActionButton = import_react55.default.memo(
34590
+ var ActionButton = import_react56.default.memo(
34551
34591
  ({
34552
34592
  label,
34553
34593
  secondaryLabel,
@@ -34562,13 +34602,13 @@ var ActionButton = import_react55.default.memo(
34562
34602
  className,
34563
34603
  showCountdown = true
34564
34604
  }) => {
34565
- const [timeLeft, setTimeLeft] = (0, import_react55.useState)(countdownProp || 0);
34566
- (0, import_react55.useEffect)(() => {
34605
+ const [timeLeft, setTimeLeft] = (0, import_react56.useState)(countdownProp || 0);
34606
+ (0, import_react56.useEffect)(() => {
34567
34607
  if (countdownProp !== void 0) {
34568
34608
  setTimeLeft(countdownProp);
34569
34609
  }
34570
34610
  }, [countdownProp]);
34571
- (0, import_react55.useEffect)(() => {
34611
+ (0, import_react56.useEffect)(() => {
34572
34612
  if (countdownProp === void 0 || countdownProp <= 0 || isPaused || isLoading || disabled) {
34573
34613
  return;
34574
34614
  }
@@ -34637,9 +34677,9 @@ var ActionButton = import_react55.default.memo(
34637
34677
  ActionButton.displayName = "ActionButton";
34638
34678
 
34639
34679
  // src/molecules/generic/FormCard/FormCard.tsx
34640
- var import_react56 = __toESM(require("react"), 1);
34680
+ var import_react57 = __toESM(require("react"), 1);
34641
34681
  var import_jsx_runtime96 = require("react/jsx-runtime");
34642
- var FormCard = import_react56.default.memo(
34682
+ var FormCard = import_react57.default.memo(
34643
34683
  ({
34644
34684
  title,
34645
34685
  fields,
@@ -34660,12 +34700,12 @@ var FormCard = import_react56.default.memo(
34660
34700
  footer,
34661
34701
  shouldStopPropagation = true
34662
34702
  }) => {
34663
- const [copied, setCopied] = (0, import_react56.useState)(false);
34664
- const [internalEditingFields, setInternalEditingFields] = (0, import_react56.useState)({});
34665
- const [internalSavingFields, setInternalSavingFields] = (0, import_react56.useState)({});
34666
- const [internalData, setInternalData] = (0, import_react56.useState)(data);
34667
- const [userEditedFields, setUserEditedFields] = (0, import_react56.useState)({});
34668
- import_react56.default.useEffect(() => {
34703
+ const [copied, setCopied] = (0, import_react57.useState)(false);
34704
+ const [internalEditingFields, setInternalEditingFields] = (0, import_react57.useState)({});
34705
+ const [internalSavingFields, setInternalSavingFields] = (0, import_react57.useState)({});
34706
+ const [internalData, setInternalData] = (0, import_react57.useState)(data);
34707
+ const [userEditedFields, setUserEditedFields] = (0, import_react57.useState)({});
34708
+ import_react57.default.useEffect(() => {
34669
34709
  setInternalData((prev) => {
34670
34710
  const newData = { ...data };
34671
34711
  Object.keys(userEditedFields).forEach((key) => {
@@ -34824,7 +34864,7 @@ var FormCard = import_react56.default.memo(
34824
34864
  FormCard.displayName = "FormCard";
34825
34865
 
34826
34866
  // src/molecules/generic/DynamicFormCard/DynamicFormCard.tsx
34827
- var import_react57 = __toESM(require("react"), 1);
34867
+ var import_react58 = __toESM(require("react"), 1);
34828
34868
 
34829
34869
  // src/lib/field-utils.ts
34830
34870
  function normalizeLabel(key) {
@@ -34900,7 +34940,7 @@ function generateFieldsFromPropDefinitions(propDefs, data) {
34900
34940
 
34901
34941
  // src/molecules/generic/DynamicFormCard/DynamicFormCard.tsx
34902
34942
  var import_jsx_runtime97 = require("react/jsx-runtime");
34903
- var DynamicFormCard = import_react57.default.memo(
34943
+ var DynamicFormCard = import_react58.default.memo(
34904
34944
  ({
34905
34945
  data = {},
34906
34946
  fields: providedFields,
@@ -34913,7 +34953,7 @@ var DynamicFormCard = import_react57.default.memo(
34913
34953
  showTimeline = true,
34914
34954
  ...rest
34915
34955
  }) => {
34916
- const fields = (0, import_react57.useMemo)(
34956
+ const fields = (0, import_react58.useMemo)(
34917
34957
  () => providedFields ?? generateFieldsFromData(data),
34918
34958
  [providedFields, data]
34919
34959
  );
@@ -35176,10 +35216,10 @@ var FilterBar = ({ filters, showSearch = true, className, onFilterToggle, onSear
35176
35216
  };
35177
35217
 
35178
35218
  // src/molecules/generic/FileUpload/FileUpload.tsx
35179
- var import_react58 = __toESM(require("react"), 1);
35219
+ var import_react59 = __toESM(require("react"), 1);
35180
35220
  var import_jsx_runtime102 = require("react/jsx-runtime");
35181
35221
  var FileUpload = ({ title, accept, multiple, className, style, onFilesSelected }) => {
35182
- const [isDragging, setIsDragging] = import_react58.default.useState(false);
35222
+ const [isDragging, setIsDragging] = import_react59.default.useState(false);
35183
35223
  const hasPxVars = style && Object.keys(style).some((k) => k.startsWith("--px-"));
35184
35224
  const wrapperStyle = {
35185
35225
  ...hasPxVars && {
@@ -35339,7 +35379,7 @@ var DataGrid = ({
35339
35379
  };
35340
35380
 
35341
35381
  // src/molecules/generic/StepWizard/StepWizard.tsx
35342
- var import_react59 = __toESM(require("react"), 1);
35382
+ var import_react60 = __toESM(require("react"), 1);
35343
35383
  var import_jsx_runtime105 = require("react/jsx-runtime");
35344
35384
  var StepWizard = ({
35345
35385
  steps,
@@ -35350,7 +35390,7 @@ var StepWizard = ({
35350
35390
  const isCompleted = i < currentStep;
35351
35391
  const isActive = i === currentStep;
35352
35392
  const isLast = i === steps.length - 1;
35353
- return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_react59.default.Fragment, { children: [
35393
+ return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_react60.default.Fragment, { children: [
35354
35394
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex flex-col items-center relative group", children: [
35355
35395
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35356
35396
  "div",
@@ -35449,10 +35489,10 @@ var NotificationList = ({
35449
35489
  };
35450
35490
 
35451
35491
  // src/molecules/generic/SocialPostCard/SocialPostCard.tsx
35452
- var import_react61 = require("react");
35492
+ var import_react62 = require("react");
35453
35493
 
35454
35494
  // src/molecules/generic/SocialPostCard/PlatformPost.tsx
35455
- var import_react60 = require("react");
35495
+ var import_react61 = require("react");
35456
35496
  var import_jsx_runtime107 = require("react/jsx-runtime");
35457
35497
  var PLATFORM_STYLES = {
35458
35498
  twitter: {
@@ -35478,8 +35518,8 @@ var PLATFORM_STYLES = {
35478
35518
  }
35479
35519
  };
35480
35520
  var PlatformPost = ({ post, loading, className }) => {
35481
- const [copied, setCopied] = (0, import_react60.useState)(false);
35482
- const [caption, setCaption] = (0, import_react60.useState)(post.caption);
35521
+ const [copied, setCopied] = (0, import_react61.useState)(false);
35522
+ const [caption, setCaption] = (0, import_react61.useState)(post.caption);
35483
35523
  const style = PLATFORM_STYLES[post.platform] || PLATFORM_STYLES.twitter;
35484
35524
  const charCount = caption.length;
35485
35525
  const isOverLimit = charCount > post.character_limit;
@@ -35608,7 +35648,7 @@ var SocialPostCard = ({
35608
35648
  sendMessage: _sendMessage
35609
35649
  }) => {
35610
35650
  const initialSelected = posts?.map((p) => p.platform) || ALL_PLATFORMS.slice();
35611
- const [selectedPlatforms, setSelectedPlatforms] = (0, import_react61.useState)(initialSelected);
35651
+ const [selectedPlatforms, setSelectedPlatforms] = (0, import_react62.useState)(initialSelected);
35612
35652
  const togglePlatform = (platform) => {
35613
35653
  setSelectedPlatforms((prev) => {
35614
35654
  if (prev.includes(platform)) {
@@ -36744,9 +36784,9 @@ var GoogleSheetsListCard = ({
36744
36784
  };
36745
36785
 
36746
36786
  // src/molecules/generic/RecommendationCard/RecommendationCard.tsx
36747
- var import_react62 = __toESM(require("react"), 1);
36787
+ var import_react63 = __toESM(require("react"), 1);
36748
36788
  var import_jsx_runtime121 = require("react/jsx-runtime");
36749
- var RecommendationCard = import_react62.default.memo(
36789
+ var RecommendationCard = import_react63.default.memo(
36750
36790
  ({
36751
36791
  question,
36752
36792
  recommended,
@@ -36758,11 +36798,11 @@ var RecommendationCard = import_react62.default.memo(
36758
36798
  className,
36759
36799
  onAction
36760
36800
  }) => {
36761
- const [mode, setMode] = import_react62.default.useState(
36801
+ const [mode, setMode] = import_react63.default.useState(
36762
36802
  "recommended"
36763
36803
  );
36764
- const [customText, setCustomText] = import_react62.default.useState("");
36765
- const [isSubmitted, setIsSubmitted] = import_react62.default.useState(false);
36804
+ const [customText, setCustomText] = import_react63.default.useState("");
36805
+ const [isSubmitted, setIsSubmitted] = import_react63.default.useState(false);
36766
36806
  const isInteractive = isLatestMessage && !disabled && !isSubmitted;
36767
36807
  const handleModeChange = (newMode) => {
36768
36808
  if (isInteractive) {
@@ -36909,9 +36949,9 @@ var RecommendationCard = import_react62.default.memo(
36909
36949
  RecommendationCard.displayName = "RecommendationCard";
36910
36950
 
36911
36951
  // src/molecules/generic/ConfirmationCard/ConfirmationCard.tsx
36912
- var import_react63 = __toESM(require("react"), 1);
36952
+ var import_react64 = __toESM(require("react"), 1);
36913
36953
  var import_jsx_runtime122 = require("react/jsx-runtime");
36914
- var ConfirmationCard = import_react63.default.memo(
36954
+ var ConfirmationCard = import_react64.default.memo(
36915
36955
  ({
36916
36956
  title,
36917
36957
  description,
@@ -36924,8 +36964,8 @@ var ConfirmationCard = import_react63.default.memo(
36924
36964
  className,
36925
36965
  onAction
36926
36966
  }) => {
36927
- const [isSubmitted, setIsSubmitted] = import_react63.default.useState(false);
36928
- const [choice, setChoice] = import_react63.default.useState(null);
36967
+ const [isSubmitted, setIsSubmitted] = import_react64.default.useState(false);
36968
+ const [choice, setChoice] = import_react64.default.useState(null);
36929
36969
  const isInteractive = isLatestMessage && !disabled && !isSubmitted;
36930
36970
  const handleConfirm = (e) => {
36931
36971
  e.preventDefault();
@@ -36994,7 +37034,7 @@ var ConfirmationCard = import_react63.default.memo(
36994
37034
  ConfirmationCard.displayName = "ConfirmationCard";
36995
37035
 
36996
37036
  // src/molecules/generic/InputWidget/InputWidget.tsx
36997
- var import_react64 = __toESM(require("react"), 1);
37037
+ var import_react65 = __toESM(require("react"), 1);
36998
37038
 
36999
37039
  // src/lib/run-sse.ts
37000
37040
  var INPUT_ATOM_NAMES = /* @__PURE__ */ new Set([
@@ -37116,7 +37156,7 @@ var InputWidget = ({
37116
37156
  onAction,
37117
37157
  isSubmitting = false
37118
37158
  }) => {
37119
- const [values, setValues] = import_react64.default.useState(() => {
37159
+ const [values, setValues] = import_react65.default.useState(() => {
37120
37160
  const initial = {};
37121
37161
  for (const f of fields) {
37122
37162
  initial[f.key] = f.defaultValue ?? defaultForKind(f.kind);
@@ -37372,7 +37412,7 @@ function stringifyValue(value, atomName, props) {
37372
37412
  }
37373
37413
 
37374
37414
  // src/molecules/generic/KPIStatsCard/KPIStatsCard.tsx
37375
- var import_react65 = __toESM(require("react"), 1);
37415
+ var import_react66 = __toESM(require("react"), 1);
37376
37416
  var import_jsx_runtime124 = require("react/jsx-runtime");
37377
37417
  var TrendBadge = ({ item }) => {
37378
37418
  if (!item.delta && item.trend === void 0) return null;
@@ -37389,7 +37429,7 @@ var TrendBadge = ({ item }) => {
37389
37429
  item.delta
37390
37430
  ] });
37391
37431
  };
37392
- var KPIStatsCard = import_react65.default.memo(
37432
+ var KPIStatsCard = import_react66.default.memo(
37393
37433
  ({ title, subtitle, stats, items, theme, className, onAction: _onAction }) => {
37394
37434
  const s = th(theme);
37395
37435
  const displayStats = stats || items || [];
@@ -37449,7 +37489,7 @@ var KPIStatsCard = import_react65.default.memo(
37449
37489
  KPIStatsCard.displayName = "KPIStatsCard";
37450
37490
 
37451
37491
  // src/molecules/generic/ApprovalCard/ApprovalCard.tsx
37452
- var import_react66 = __toESM(require("react"), 1);
37492
+ var import_react67 = __toESM(require("react"), 1);
37453
37493
  var import_jsx_runtime125 = require("react/jsx-runtime");
37454
37494
  var STATUS_CONFIG2 = {
37455
37495
  pending: { label: "Pending Review", icon: Clock, className: "text-yellow-400 bg-yellow-500/10 border-yellow-500/20" },
@@ -37457,7 +37497,7 @@ var STATUS_CONFIG2 = {
37457
37497
  rejected: { label: "Rejected", icon: CircleX, className: "text-rose-400 bg-rose-500/10 border-rose-500/20" },
37458
37498
  changes_requested: { label: "Changes Requested", icon: MessageSquare, className: "text-blue-400 bg-blue-500/10 border-blue-500/20" }
37459
37499
  };
37460
- var ApprovalCard = import_react66.default.memo(
37500
+ var ApprovalCard = import_react67.default.memo(
37461
37501
  ({
37462
37502
  title,
37463
37503
  description,
@@ -37475,9 +37515,9 @@ var ApprovalCard = import_react66.default.memo(
37475
37515
  onAction
37476
37516
  }) => {
37477
37517
  const s = th(theme);
37478
- const [status, setStatus] = import_react66.default.useState(propStatus || "pending");
37479
- const [isSubmitted, setIsSubmitted] = import_react66.default.useState(!!propStatus && propStatus !== "pending");
37480
- import_react66.default.useEffect(() => {
37518
+ const [status, setStatus] = import_react67.default.useState(propStatus || "pending");
37519
+ const [isSubmitted, setIsSubmitted] = import_react67.default.useState(!!propStatus && propStatus !== "pending");
37520
+ import_react67.default.useEffect(() => {
37481
37521
  if (propStatus) {
37482
37522
  setStatus(propStatus);
37483
37523
  setIsSubmitted(propStatus !== "pending");
@@ -37565,7 +37605,7 @@ var ApprovalCard = import_react66.default.memo(
37565
37605
  ApprovalCard.displayName = "ApprovalCard";
37566
37606
 
37567
37607
  // src/molecules/generic/TimelineCard/TimelineCard.tsx
37568
- var import_react67 = __toESM(require("react"), 1);
37608
+ var import_react68 = __toESM(require("react"), 1);
37569
37609
  var import_jsx_runtime126 = require("react/jsx-runtime");
37570
37610
  var StepDot = ({ step, accentColor }) => {
37571
37611
  if (step.status === "completed") return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-emerald-500/20 ring-2 ring-emerald-500/40", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Check, { className: "h-3 w-3 text-emerald-400", strokeWidth: 2.5 }) });
@@ -37583,7 +37623,7 @@ var StepDot = ({ step, accentColor }) => {
37583
37623
  }
37584
37624
  return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gray400/20 ring-2 ring-gray400/20", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Circle, { className: "h-2.5 w-2.5 text-cardText/20" }) });
37585
37625
  };
37586
- var TimelineCard = import_react67.default.memo(
37626
+ var TimelineCard = import_react68.default.memo(
37587
37627
  ({ title, steps, milestones, theme, className, onAction: _onAction }) => {
37588
37628
  const s = th(theme);
37589
37629
  const displaySteps = steps || milestones || [];
@@ -37641,9 +37681,9 @@ var TimelineCard = import_react67.default.memo(
37641
37681
  TimelineCard.displayName = "TimelineCard";
37642
37682
 
37643
37683
  // src/molecules/generic/FeedbackRatingCard/FeedbackRatingCard.tsx
37644
- var import_react68 = __toESM(require("react"), 1);
37684
+ var import_react69 = __toESM(require("react"), 1);
37645
37685
  var import_jsx_runtime127 = require("react/jsx-runtime");
37646
- var FeedbackRatingCard = import_react68.default.memo(
37686
+ var FeedbackRatingCard = import_react69.default.memo(
37647
37687
  ({
37648
37688
  question,
37649
37689
  max_rating = 5,
@@ -37659,10 +37699,10 @@ var FeedbackRatingCard = import_react68.default.memo(
37659
37699
  onAction
37660
37700
  }) => {
37661
37701
  const s = th(theme);
37662
- const [rating, setRating] = import_react68.default.useState(0);
37663
- const [hovered, setHovered] = import_react68.default.useState(0);
37664
- const [comment, setComment] = import_react68.default.useState("");
37665
- const [isSubmitted, setIsSubmitted] = import_react68.default.useState(false);
37702
+ const [rating, setRating] = import_react69.default.useState(0);
37703
+ const [hovered, setHovered] = import_react69.default.useState(0);
37704
+ const [comment, setComment] = import_react69.default.useState("");
37705
+ const [isSubmitted, setIsSubmitted] = import_react69.default.useState(false);
37666
37706
  const isInteractive = isLatestMessage && !disabled && !isSubmitted;
37667
37707
  const stars = Array.from({ length: max_rating }, (_, i) => i + 1);
37668
37708
  const handleSubmit = (e) => {
@@ -37741,9 +37781,9 @@ Feedback: ${comment}` : `Rating: ${rating}/${max_rating} ${label}`;
37741
37781
  FeedbackRatingCard.displayName = "FeedbackRatingCard";
37742
37782
 
37743
37783
  // src/molecules/generic/DataTableCard/DataTableCard.tsx
37744
- var import_react69 = __toESM(require("react"), 1);
37784
+ var import_react70 = __toESM(require("react"), 1);
37745
37785
  var import_jsx_runtime128 = require("react/jsx-runtime");
37746
- var DataTableCard = import_react69.default.memo(
37786
+ var DataTableCard = import_react70.default.memo(
37747
37787
  ({ title, caption, columns, rows, highlight_column, theme, className, onAction: _onAction }) => {
37748
37788
  const s = th(theme);
37749
37789
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: cn("w-full rounded-[16px] border border-gray400 bg-cardSurface overflow-hidden", className), style: s.root, children: [
@@ -37793,9 +37833,9 @@ var DataTableCard = import_react69.default.memo(
37793
37833
  DataTableCard.displayName = "DataTableCard";
37794
37834
 
37795
37835
  // src/molecules/generic/ChecklistCard/ChecklistCard.tsx
37796
- var import_react70 = __toESM(require("react"), 1);
37836
+ var import_react71 = __toESM(require("react"), 1);
37797
37837
  var import_jsx_runtime129 = require("react/jsx-runtime");
37798
- var ChecklistCard = import_react70.default.memo(
37838
+ var ChecklistCard = import_react71.default.memo(
37799
37839
  ({
37800
37840
  title,
37801
37841
  description,
@@ -37812,10 +37852,10 @@ var ChecklistCard = import_react70.default.memo(
37812
37852
  }) => {
37813
37853
  const s = th(theme);
37814
37854
  const source = items || tasks || [];
37815
- const [checked, setChecked] = import_react70.default.useState(
37855
+ const [checked, setChecked] = import_react71.default.useState(
37816
37856
  () => new Set(source.filter((i) => i.checked).map((i) => i.id))
37817
37857
  );
37818
- const [isSubmitted, setIsSubmitted] = import_react70.default.useState(false);
37858
+ const [isSubmitted, setIsSubmitted] = import_react71.default.useState(false);
37819
37859
  const isInteractive = isLatestMessage && !disabled && !isSubmitted;
37820
37860
  const toggle = (id) => {
37821
37861
  if (!isInteractive) return;
@@ -37928,9 +37968,9 @@ var ChecklistCard = import_react70.default.memo(
37928
37968
  ChecklistCard.displayName = "ChecklistCard";
37929
37969
 
37930
37970
  // src/molecules/generic/PollCard/PollCard.tsx
37931
- var import_react71 = __toESM(require("react"), 1);
37971
+ var import_react72 = __toESM(require("react"), 1);
37932
37972
  var import_jsx_runtime130 = require("react/jsx-runtime");
37933
- var PollCard = import_react71.default.memo(
37973
+ var PollCard = import_react72.default.memo(
37934
37974
  ({
37935
37975
  question,
37936
37976
  options,
@@ -37947,9 +37987,9 @@ var PollCard = import_react71.default.memo(
37947
37987
  }) => {
37948
37988
  const s = th(theme);
37949
37989
  const source = options || choices || [];
37950
- const [selected, setSelected] = import_react71.default.useState(/* @__PURE__ */ new Set());
37951
- const [hasVoted, setHasVoted] = import_react71.default.useState(false);
37952
- const [voteCounts, setVoteCounts] = import_react71.default.useState(
37990
+ const [selected, setSelected] = import_react72.default.useState(/* @__PURE__ */ new Set());
37991
+ const [hasVoted, setHasVoted] = import_react72.default.useState(false);
37992
+ const [voteCounts, setVoteCounts] = import_react72.default.useState(
37953
37993
  () => Object.fromEntries(source.map((o) => [o.id, o.votes ?? 0]))
37954
37994
  );
37955
37995
  const isInteractive = isLatestMessage && !disabled && !hasVoted;
@@ -38088,7 +38128,7 @@ Selected: ${labels.join(", ")}`);
38088
38128
  PollCard.displayName = "PollCard";
38089
38129
 
38090
38130
  // src/molecules/generic/CalendarEventCard/CalendarEventCard.tsx
38091
- var import_react72 = __toESM(require("react"), 1);
38131
+ var import_react73 = __toESM(require("react"), 1);
38092
38132
  var import_jsx_runtime131 = require("react/jsx-runtime");
38093
38133
  var STATUS_STYLES = {
38094
38134
  upcoming: { label: "Upcoming", className: "text-blue-400 bg-blue-500/10 border-blue-500/20", dot: "bg-blue-400" },
@@ -38109,7 +38149,7 @@ function AvatarInitials({ name }) {
38109
38149
  }
38110
38150
  );
38111
38151
  }
38112
- var CalendarEventCard = import_react72.default.memo(
38152
+ var CalendarEventCard = import_react73.default.memo(
38113
38153
  ({
38114
38154
  title,
38115
38155
  date,
@@ -38126,7 +38166,7 @@ var CalendarEventCard = import_react72.default.memo(
38126
38166
  }) => {
38127
38167
  const s = th(theme);
38128
38168
  const cfg = STATUS_STYLES[status];
38129
- const parsedDate = import_react72.default.useMemo(() => {
38169
+ const parsedDate = import_react73.default.useMemo(() => {
38130
38170
  try {
38131
38171
  const d = new Date(date);
38132
38172
  if (isNaN(d.getTime())) {
@@ -38212,7 +38252,7 @@ var CalendarEventCard = import_react72.default.memo(
38212
38252
  CalendarEventCard.displayName = "CalendarEventCard";
38213
38253
 
38214
38254
  // src/molecules/generic/BudgetAllocCard/BudgetAllocCard.tsx
38215
- var import_react73 = __toESM(require("react"), 1);
38255
+ var import_react74 = __toESM(require("react"), 1);
38216
38256
  var import_jsx_runtime132 = require("react/jsx-runtime");
38217
38257
  var PALETTE = [
38218
38258
  "#BFAD82",
@@ -38238,7 +38278,7 @@ function formatAmount(amount, currency) {
38238
38278
  if (amount >= 1e3) return `${currency}${(amount / 1e3).toFixed(0)}K`;
38239
38279
  return `${currency}${amount.toLocaleString()}`;
38240
38280
  }
38241
- var BudgetAllocCard = import_react73.default.memo(
38281
+ var BudgetAllocCard = import_react74.default.memo(
38242
38282
  ({
38243
38283
  title,
38244
38284
  currency = "$",
@@ -38355,7 +38395,7 @@ var BudgetAllocCard = import_react73.default.memo(
38355
38395
  BudgetAllocCard.displayName = "BudgetAllocCard";
38356
38396
 
38357
38397
  // src/molecules/generic/ComparisonCard/ComparisonCard.tsx
38358
- var import_react74 = __toESM(require("react"), 1);
38398
+ var import_react75 = __toESM(require("react"), 1);
38359
38399
  var import_jsx_runtime133 = require("react/jsx-runtime");
38360
38400
  var BADGE_COLORS = {
38361
38401
  gold: "text-gold border-gold/30 bg-gold/10",
@@ -38363,7 +38403,7 @@ var BADGE_COLORS = {
38363
38403
  emerald: "text-emerald-400 border-emerald-500/30 bg-emerald-500/10",
38364
38404
  violet: "text-violet-400 border-violet-500/30 bg-violet-500/10"
38365
38405
  };
38366
- var ComparisonCard = import_react74.default.memo(
38406
+ var ComparisonCard = import_react75.default.memo(
38367
38407
  ({
38368
38408
  title,
38369
38409
  description,
@@ -38378,8 +38418,8 @@ var ComparisonCard = import_react74.default.memo(
38378
38418
  onAction
38379
38419
  }) => {
38380
38420
  const s = th(theme);
38381
- const [selected, setSelected] = import_react74.default.useState(null);
38382
- const [isSubmitted, setIsSubmitted] = import_react74.default.useState(false);
38421
+ const [selected, setSelected] = import_react75.default.useState(null);
38422
+ const [isSubmitted, setIsSubmitted] = import_react75.default.useState(false);
38383
38423
  const isInteractive = isLatestMessage && !disabled && !isSubmitted;
38384
38424
  const handleSelect = (opt) => (e) => {
38385
38425
  e.preventDefault();
@@ -38974,7 +39014,7 @@ var NextStepCard = ({
38974
39014
  ] });
38975
39015
 
38976
39016
  // src/molecules/generic/PresentationJobCard/PresentationJobCard.tsx
38977
- var import_react75 = require("react");
39017
+ var import_react76 = require("react");
38978
39018
  var import_jsx_runtime147 = require("react/jsx-runtime");
38979
39019
  var DownloadIcon = () => /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: [
38980
39020
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
@@ -39031,7 +39071,7 @@ var FORMATS = [
39031
39071
  var ExportModal = ({ formats, title, onClose }) => {
39032
39072
  const available = FORMATS.filter((f) => formats[f.key]);
39033
39073
  const filename = title.replace(/[^a-z0-9]/gi, "-").toLowerCase();
39034
- const [downloadingKey, setDownloadingKey] = (0, import_react75.useState)(null);
39074
+ const [downloadingKey, setDownloadingKey] = (0, import_react76.useState)(null);
39035
39075
  const handleDownload = async (fmtKey, url, ext) => {
39036
39076
  if (downloadingKey) return;
39037
39077
  const downloadName = `${filename}${ext}`;
@@ -39099,10 +39139,10 @@ var ExportModal = ({ formats, title, onClose }) => {
39099
39139
  ] });
39100
39140
  };
39101
39141
  var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) => {
39102
- const [currentSlide, setCurrentSlide] = (0, import_react75.useState)(initialSlide);
39103
- const [iframeReady, setIframeReady] = (0, import_react75.useState)(false);
39104
- const iframeRef = (0, import_react75.useRef)(null);
39105
- (0, import_react75.useEffect)(() => {
39142
+ const [currentSlide, setCurrentSlide] = (0, import_react76.useState)(initialSlide);
39143
+ const [iframeReady, setIframeReady] = (0, import_react76.useState)(false);
39144
+ const iframeRef = (0, import_react76.useRef)(null);
39145
+ (0, import_react76.useEffect)(() => {
39106
39146
  const onKey = (e) => {
39107
39147
  if (e.key === "Escape") onClose();
39108
39148
  };
@@ -39120,7 +39160,7 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
39120
39160
  window.removeEventListener("message", onMsg);
39121
39161
  };
39122
39162
  }, [onClose, iframeReady]);
39123
- (0, import_react75.useEffect)(() => {
39163
+ (0, import_react76.useEffect)(() => {
39124
39164
  document.body.style.overflow = "hidden";
39125
39165
  return () => {
39126
39166
  document.body.style.overflow = "";
@@ -39207,6 +39247,7 @@ var PresentationJobCard = ({
39207
39247
  slide_count: initialSlideCount,
39208
39248
  formats: initialFormats = {},
39209
39249
  error: initialError,
39250
+ progress: initialProgress,
39210
39251
  pollUrl,
39211
39252
  authToken,
39212
39253
  shareUrl,
@@ -39214,24 +39255,46 @@ var PresentationJobCard = ({
39214
39255
  onComplete,
39215
39256
  onFailed
39216
39257
  }) => {
39217
- const [status, setStatus] = (0, import_react75.useState)(initialStatus);
39218
- const [title, setTitle] = (0, import_react75.useState)(initialTitle);
39219
- const [slideCount, setSlideCount] = (0, import_react75.useState)(initialSlideCount ?? 0);
39220
- const [formats, setFormats] = (0, import_react75.useState)(initialFormats);
39221
- const [error, setError] = (0, import_react75.useState)(initialError);
39222
- const [showExport, setShowExport] = (0, import_react75.useState)(false);
39223
- const [showFullscreen, setShowFullscreen] = (0, import_react75.useState)(false);
39224
- const [copied, setCopied] = (0, import_react75.useState)(false);
39225
- const [currentSlide, setCurrentSlide] = (0, import_react75.useState)(1);
39226
- const [previewScale, setPreviewScale] = (0, import_react75.useState)(1);
39227
- const [iframeReady, setIframeReady] = (0, import_react75.useState)(false);
39228
- const intervalRef = (0, import_react75.useRef)(null);
39229
- const previewRef = (0, import_react75.useRef)(null);
39230
- const iframeRef = (0, import_react75.useRef)(null);
39231
- const updateScale = (0, import_react75.useCallback)(() => {
39258
+ const [status, setStatus] = (0, import_react76.useState)(initialStatus);
39259
+ const [title, setTitle] = (0, import_react76.useState)(initialTitle);
39260
+ const [slideCount, setSlideCount] = (0, import_react76.useState)(initialSlideCount ?? 0);
39261
+ const [formats, setFormats] = (0, import_react76.useState)(initialFormats);
39262
+ const [error, setError] = (0, import_react76.useState)(initialError);
39263
+ const [progress, setProgress] = (0, import_react76.useState)(initialProgress);
39264
+ const [showExport, setShowExport] = (0, import_react76.useState)(false);
39265
+ const [showFullscreen, setShowFullscreen] = (0, import_react76.useState)(false);
39266
+ const [copied, setCopied] = (0, import_react76.useState)(false);
39267
+ const [currentSlide, setCurrentSlide] = (0, import_react76.useState)(1);
39268
+ const [previewScale, setPreviewScale] = (0, import_react76.useState)(1);
39269
+ const [iframeReady, setIframeReady] = (0, import_react76.useState)(false);
39270
+ const intervalRef = (0, import_react76.useRef)(null);
39271
+ const previewRef = (0, import_react76.useRef)(null);
39272
+ const iframeRef = (0, import_react76.useRef)(null);
39273
+ (0, import_react76.useEffect)(() => {
39274
+ setStatus(initialStatus);
39275
+ }, [initialStatus]);
39276
+ const progressPct = initialProgress?.percentage;
39277
+ const progressStep = initialProgress?.current_step;
39278
+ (0, import_react76.useEffect)(() => {
39279
+ if (initialProgress) setProgress(initialProgress);
39280
+ }, [progressPct, progressStep]);
39281
+ (0, import_react76.useEffect)(() => {
39282
+ if (initialError) setError(initialError);
39283
+ }, [initialError]);
39284
+ (0, import_react76.useEffect)(() => {
39285
+ if (initialSlideCount !== void 0) setSlideCount(initialSlideCount);
39286
+ }, [initialSlideCount]);
39287
+ const htmlUrl = initialFormats?.html_url;
39288
+ (0, import_react76.useEffect)(() => {
39289
+ if (initialFormats) setFormats(initialFormats);
39290
+ }, [htmlUrl]);
39291
+ (0, import_react76.useEffect)(() => {
39292
+ if (initialTitle) setTitle(initialTitle);
39293
+ }, [initialTitle]);
39294
+ const updateScale = (0, import_react76.useCallback)(() => {
39232
39295
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
39233
39296
  }, []);
39234
- (0, import_react75.useEffect)(() => {
39297
+ (0, import_react76.useEffect)(() => {
39235
39298
  updateScale();
39236
39299
  setIframeReady(false);
39237
39300
  if (typeof ResizeObserver === "undefined") return;
@@ -39239,7 +39302,7 @@ var PresentationJobCard = ({
39239
39302
  if (previewRef.current) ro.observe(previewRef.current);
39240
39303
  return () => ro.disconnect();
39241
39304
  }, [updateScale, formats.html_url]);
39242
- (0, import_react75.useEffect)(() => {
39305
+ (0, import_react76.useEffect)(() => {
39243
39306
  const handler = (e) => {
39244
39307
  if (e.data?.type === "slideChanged") {
39245
39308
  setCurrentSlide(e.data.slide);
@@ -39264,12 +39327,12 @@ var PresentationJobCard = ({
39264
39327
  iframe.contentWindow.postMessage({ type: command }, "*");
39265
39328
  };
39266
39329
  const isTerminal = status === "complete" || status === "failed";
39267
- const onCompleteRef = (0, import_react75.useRef)(onComplete);
39268
- const onFailedRef = (0, import_react75.useRef)(onFailed);
39269
- const hasNotifiedRef = (0, import_react75.useRef)(false);
39330
+ const onCompleteRef = (0, import_react76.useRef)(onComplete);
39331
+ const onFailedRef = (0, import_react76.useRef)(onFailed);
39332
+ const hasNotifiedRef = (0, import_react76.useRef)(false);
39270
39333
  onCompleteRef.current = onComplete;
39271
39334
  onFailedRef.current = onFailed;
39272
- (0, import_react75.useEffect)(() => {
39335
+ (0, import_react76.useEffect)(() => {
39273
39336
  if (isTerminal || !pollUrl) return;
39274
39337
  const poll = async () => {
39275
39338
  try {
@@ -39282,6 +39345,9 @@ var PresentationJobCard = ({
39282
39345
  const data = await res.json();
39283
39346
  const newStatus = data.status;
39284
39347
  setStatus(newStatus);
39348
+ if (data.progress) {
39349
+ setProgress(data.progress);
39350
+ }
39285
39351
  if (newStatus === "complete" && data.output) {
39286
39352
  const newTitle = data.output.title || initialTitle;
39287
39353
  const newSlideCount = data.output.slide_count || 0;
@@ -39315,7 +39381,7 @@ var PresentationJobCard = ({
39315
39381
  if (intervalRef.current) clearInterval(intervalRef.current);
39316
39382
  };
39317
39383
  }, [isTerminal, pollUrl, authToken, initialTitle]);
39318
- (0, import_react75.useEffect)(() => {
39384
+ (0, import_react76.useEffect)(() => {
39319
39385
  if (isTerminal && intervalRef.current) {
39320
39386
  clearInterval(intervalRef.current);
39321
39387
  intervalRef.current = null;
@@ -39333,14 +39399,93 @@ var PresentationJobCard = ({
39333
39399
  }
39334
39400
  };
39335
39401
  if (status === "pending" || status === "running") {
39336
- return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative overflow-hidden rounded-xl border border-zinc-200/70 dark:border-zinc-800/70 bg-zinc-100 dark:bg-zinc-900 aspect-[16/9]", children: [
39337
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "absolute inset-0 p-[8%] flex flex-col justify-center", children: [
39338
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[18px] w-[42%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse mb-3" }),
39339
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[11px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mb-2", style: { animationDelay: "120ms" } }),
39340
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[11px] w-[52%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "240ms" } })
39402
+ const pct = progress?.percentage ?? 0;
39403
+ const step = progress?.current_step ?? "Starting...";
39404
+ const details = progress?.details;
39405
+ const slidesCompleted = details?.slides_completed ?? 0;
39406
+ const slidesTotal = details?.slides_total ?? 0;
39407
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39408
+ const getPhaseIcon = () => {
39409
+ switch (phase) {
39410
+ case "ai_generation":
39411
+ return "\u{1F3A8}";
39412
+ case "processing":
39413
+ return "\u2699\uFE0F";
39414
+ case "uploading":
39415
+ return "\u2601\uFE0F";
39416
+ default:
39417
+ return "\u2728";
39418
+ }
39419
+ };
39420
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: cn("w-full", className), children: [
39421
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39422
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39423
+ "div",
39424
+ {
39425
+ className: "h-[3px] bg-gradient-to-r from-indigo-500 via-purple-500 to-indigo-500 bg-[length:200%_100%] animate-[gradient-shift_2s_ease-in-out_infinite]",
39426
+ style: {
39427
+ backgroundSize: "200% 100%",
39428
+ animation: "gradient-shift 2s ease-in-out infinite"
39429
+ }
39430
+ }
39431
+ ),
39432
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "p-5", children: [
39433
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-start gap-3", children: [
39434
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "w-10 h-10 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "text-lg", children: getPhaseIcon() }) }),
39435
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex-1 min-w-0", children: [
39436
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Creating Presentation" }),
39437
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39438
+ slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation",
39439
+ " \xB7 In progress"
39440
+ ] })
39441
+ ] })
39442
+ ] }),
39443
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "mt-4 space-y-3", children: [
39444
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative", children: [
39445
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39446
+ "div",
39447
+ {
39448
+ className: "h-full bg-gradient-to-r from-indigo-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39449
+ style: { width: `${Math.max(pct, 2)}%` }
39450
+ }
39451
+ ) }),
39452
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39453
+ pct,
39454
+ "%"
39455
+ ] })
39456
+ ] }),
39457
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-2", children: [
39458
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-pulse" }),
39459
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "text-xs text-zinc-400", children: step })
39460
+ ] }),
39461
+ phase === "ai_generation" && slidesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-2 pt-1", children: [
39462
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex gap-1", children: Array.from({ length: slidesTotal }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39463
+ "div",
39464
+ {
39465
+ className: cn(
39466
+ "w-6 h-1.5 rounded-full transition-all duration-300",
39467
+ i < slidesCompleted ? "bg-indigo-500" : i === slidesCompleted ? "bg-indigo-500/50 animate-pulse" : "bg-zinc-700"
39468
+ )
39469
+ },
39470
+ i
39471
+ )) }),
39472
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "text-xs text-zinc-500 ml-1", children: [
39473
+ slidesCompleted,
39474
+ "/",
39475
+ slidesTotal,
39476
+ " slides"
39477
+ ] })
39478
+ ] })
39479
+ ] })
39480
+ ] })
39341
39481
  ] }),
39342
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent" })
39343
- ] }) });
39482
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("style", { children: `
39483
+ @keyframes gradient-shift {
39484
+ 0%, 100% { background-position: 0% 50%; }
39485
+ 50% { background-position: 100% 50%; }
39486
+ }
39487
+ ` })
39488
+ ] });
39344
39489
  }
39345
39490
  if (status === "failed") {
39346
39491
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-start gap-3", children: [
@@ -39494,7 +39639,7 @@ var PresentationJobCard = ({
39494
39639
  };
39495
39640
 
39496
39641
  // src/molecules/generic/ResearchReportJobCard/ResearchReportJobCard.tsx
39497
- var import_react76 = require("react");
39642
+ var import_react77 = require("react");
39498
39643
  var import_jsx_runtime148 = require("react/jsx-runtime");
39499
39644
  var DEFAULT_THEME = {
39500
39645
  primary: "#8b5cf6",
@@ -39524,14 +39669,14 @@ var ExpandIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("svg", {
39524
39669
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
39525
39670
  ] });
39526
39671
  var FullscreenPreviewModal = ({ url, title, onClose }) => {
39527
- (0, import_react76.useEffect)(() => {
39672
+ (0, import_react77.useEffect)(() => {
39528
39673
  const onKey = (e) => {
39529
39674
  if (e.key === "Escape") onClose();
39530
39675
  };
39531
39676
  document.addEventListener("keydown", onKey);
39532
39677
  return () => document.removeEventListener("keydown", onKey);
39533
39678
  }, [onClose]);
39534
- (0, import_react76.useEffect)(() => {
39679
+ (0, import_react77.useEffect)(() => {
39535
39680
  document.body.style.overflow = "hidden";
39536
39681
  return () => {
39537
39682
  document.body.style.overflow = "";
@@ -39581,6 +39726,7 @@ var ResearchReportJobCard = (props) => {
39581
39726
  html_url: initialHtmlUrl,
39582
39727
  theme: initialTheme,
39583
39728
  error: initialError,
39729
+ progress: initialProgress,
39584
39730
  pollUrl,
39585
39731
  authToken,
39586
39732
  className,
@@ -39589,72 +39735,79 @@ var ResearchReportJobCard = (props) => {
39589
39735
  compact = false
39590
39736
  } = props;
39591
39737
  const inferredStatus = initialStatus ?? (initialHtmlUrl ? "complete" : void 0);
39592
- const [status, setStatus] = (0, import_react76.useState)(inferredStatus);
39593
- const [title, setTitle] = (0, import_react76.useState)(initialTitle);
39594
- const [depth, setDepth] = (0, import_react76.useState)(initialDepth || "");
39595
- const [sectionCount, setSectionCount] = (0, import_react76.useState)(initialSectionCount ?? 0);
39596
- const [sourceCount, setSourceCount] = (0, import_react76.useState)(initialSourceCount ?? 0);
39597
- const [wordCount, setWordCount] = (0, import_react76.useState)(initialWordCount ?? 0);
39598
- const [summary, setSummary] = (0, import_react76.useState)(initialSummary || "");
39599
- const [htmlUrl, setHtmlUrl] = (0, import_react76.useState)(initialHtmlUrl || "");
39600
- const [theme, setTheme] = (0, import_react76.useState)(initialTheme || DEFAULT_THEME);
39601
- const [error, setError] = (0, import_react76.useState)(initialError);
39602
- const [showPreview, setShowPreview] = (0, import_react76.useState)(false);
39603
- const [previewScale, setPreviewScale] = (0, import_react76.useState)(1);
39604
- const previewRef = (0, import_react76.useRef)(null);
39605
- const intervalRef = (0, import_react76.useRef)(null);
39606
- const onCompleteRef = (0, import_react76.useRef)(onComplete);
39607
- const onFailedRef = (0, import_react76.useRef)(onFailed);
39608
- const hasNotifiedRef = (0, import_react76.useRef)(false);
39738
+ const [status, setStatus] = (0, import_react77.useState)(inferredStatus);
39739
+ const [title, setTitle] = (0, import_react77.useState)(initialTitle);
39740
+ const [depth, setDepth] = (0, import_react77.useState)(initialDepth || "");
39741
+ const [sectionCount, setSectionCount] = (0, import_react77.useState)(initialSectionCount ?? 0);
39742
+ const [sourceCount, setSourceCount] = (0, import_react77.useState)(initialSourceCount ?? 0);
39743
+ const [wordCount, setWordCount] = (0, import_react77.useState)(initialWordCount ?? 0);
39744
+ const [summary, setSummary] = (0, import_react77.useState)(initialSummary || "");
39745
+ const [htmlUrl, setHtmlUrl] = (0, import_react77.useState)(initialHtmlUrl || "");
39746
+ const [theme, setTheme] = (0, import_react77.useState)(initialTheme || DEFAULT_THEME);
39747
+ const [error, setError] = (0, import_react77.useState)(initialError);
39748
+ const [progress, setProgress] = (0, import_react77.useState)(initialProgress);
39749
+ const [showPreview, setShowPreview] = (0, import_react77.useState)(false);
39750
+ const [previewScale, setPreviewScale] = (0, import_react77.useState)(1);
39751
+ const previewRef = (0, import_react77.useRef)(null);
39752
+ const intervalRef = (0, import_react77.useRef)(null);
39753
+ const onCompleteRef = (0, import_react77.useRef)(onComplete);
39754
+ const onFailedRef = (0, import_react77.useRef)(onFailed);
39755
+ const hasNotifiedRef = (0, import_react77.useRef)(false);
39609
39756
  onCompleteRef.current = onComplete;
39610
39757
  onFailedRef.current = onFailed;
39611
- (0, import_react76.useEffect)(() => {
39758
+ (0, import_react77.useEffect)(() => {
39612
39759
  const newStatus = initialStatus ?? (initialHtmlUrl ? "complete" : void 0);
39613
39760
  setStatus(newStatus);
39614
39761
  }, [initialStatus, initialHtmlUrl]);
39615
- (0, import_react76.useEffect)(() => {
39762
+ (0, import_react77.useEffect)(() => {
39616
39763
  if (initialTitle) setTitle(initialTitle);
39617
39764
  }, [initialTitle]);
39618
- (0, import_react76.useEffect)(() => {
39765
+ (0, import_react77.useEffect)(() => {
39619
39766
  if (initialHtmlUrl) setHtmlUrl(initialHtmlUrl);
39620
39767
  }, [initialHtmlUrl]);
39621
- (0, import_react76.useEffect)(() => {
39768
+ (0, import_react77.useEffect)(() => {
39622
39769
  if (initialDepth) setDepth(initialDepth);
39623
39770
  }, [initialDepth]);
39624
- (0, import_react76.useEffect)(() => {
39771
+ (0, import_react77.useEffect)(() => {
39625
39772
  if (initialSectionCount !== void 0) setSectionCount(initialSectionCount);
39626
39773
  }, [initialSectionCount]);
39627
- (0, import_react76.useEffect)(() => {
39774
+ (0, import_react77.useEffect)(() => {
39628
39775
  if (initialSourceCount !== void 0) setSourceCount(initialSourceCount);
39629
39776
  }, [initialSourceCount]);
39630
- (0, import_react76.useEffect)(() => {
39777
+ (0, import_react77.useEffect)(() => {
39631
39778
  if (initialWordCount !== void 0) setWordCount(initialWordCount);
39632
39779
  }, [initialWordCount]);
39633
- (0, import_react76.useEffect)(() => {
39780
+ (0, import_react77.useEffect)(() => {
39634
39781
  if (initialSummary) setSummary(initialSummary);
39635
39782
  }, [initialSummary]);
39636
- (0, import_react76.useEffect)(() => {
39783
+ const themePrimary = initialTheme?.primary;
39784
+ (0, import_react77.useEffect)(() => {
39637
39785
  if (initialTheme) setTheme(initialTheme);
39638
- }, [initialTheme]);
39639
- (0, import_react76.useEffect)(() => {
39786
+ }, [themePrimary]);
39787
+ (0, import_react77.useEffect)(() => {
39640
39788
  if (initialError) setError(initialError);
39641
39789
  }, [initialError]);
39790
+ const progressPct = initialProgress?.percentage;
39791
+ const progressStep = initialProgress?.current_step;
39792
+ (0, import_react77.useEffect)(() => {
39793
+ if (initialProgress) setProgress(initialProgress);
39794
+ }, [progressPct, progressStep]);
39642
39795
  const isTerminal = status === "complete" || status === "failed";
39643
39796
  const primaryColor = theme?.primary || DEFAULT_THEME.primary;
39644
39797
  const hasHTML = Boolean(htmlUrl);
39645
- const updateScale = (0, import_react76.useCallback)(() => {
39798
+ const updateScale = (0, import_react77.useCallback)(() => {
39646
39799
  if (previewRef.current) {
39647
39800
  setPreviewScale(previewRef.current.offsetWidth / 800);
39648
39801
  }
39649
39802
  }, []);
39650
- (0, import_react76.useEffect)(() => {
39803
+ (0, import_react77.useEffect)(() => {
39651
39804
  updateScale();
39652
39805
  if (typeof ResizeObserver === "undefined") return;
39653
39806
  const ro = new ResizeObserver(updateScale);
39654
39807
  if (previewRef.current) ro.observe(previewRef.current);
39655
39808
  return () => ro.disconnect();
39656
39809
  }, [updateScale, htmlUrl]);
39657
- (0, import_react76.useEffect)(() => {
39810
+ (0, import_react77.useEffect)(() => {
39658
39811
  if (isTerminal || !pollUrl) return;
39659
39812
  const poll = async () => {
39660
39813
  try {
@@ -39667,6 +39820,9 @@ var ResearchReportJobCard = (props) => {
39667
39820
  const data = await res.json();
39668
39821
  const newStatus = data.status;
39669
39822
  setStatus(newStatus);
39823
+ if (data.progress) {
39824
+ setProgress(data.progress);
39825
+ }
39670
39826
  if (newStatus === "complete" && data.output) {
39671
39827
  const output = data.output;
39672
39828
  setTitle(output.title || initialTitle);
@@ -39701,7 +39857,7 @@ var ResearchReportJobCard = (props) => {
39701
39857
  if (intervalRef.current) clearInterval(intervalRef.current);
39702
39858
  };
39703
39859
  }, [isTerminal, pollUrl, authToken, initialTitle]);
39704
- (0, import_react76.useEffect)(() => {
39860
+ (0, import_react77.useEffect)(() => {
39705
39861
  if (isTerminal && intervalRef.current) {
39706
39862
  clearInterval(intervalRef.current);
39707
39863
  intervalRef.current = null;
@@ -39712,27 +39868,96 @@ var ResearchReportJobCard = (props) => {
39712
39868
  return count.toString();
39713
39869
  };
39714
39870
  if (!status || status === "pending" || status === "running") {
39715
- return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "relative overflow-hidden rounded-2xl border border-zinc-200/70 dark:border-zinc-800 bg-zinc-100 dark:bg-zinc-900", children: [
39716
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[3px] bg-gradient-to-r from-zinc-300 dark:from-zinc-700 via-zinc-200 dark:via-zinc-600 to-zinc-300 dark:to-zinc-700 animate-pulse" }),
39717
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "p-5", children: [
39718
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [
39719
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-10 h-10 rounded-xl bg-zinc-200 dark:bg-zinc-800 animate-pulse flex-shrink-0" }),
39720
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex-1 min-w-0", children: [
39721
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[14px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-700 animate-pulse" }),
39722
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[10px] w-[45%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mt-2", style: { animationDelay: "80ms" } })
39871
+ const pct = progress?.percentage ?? 0;
39872
+ const step = progress?.current_step ?? "Starting...";
39873
+ const details = progress?.details;
39874
+ const searchesCompleted = details?.searches_completed ?? 0;
39875
+ const searchesTotal = details?.searches_total ?? 0;
39876
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39877
+ const getPhaseIcon = () => {
39878
+ switch (phase) {
39879
+ case "ai_generation":
39880
+ return "\u{1F50D}";
39881
+ case "processing":
39882
+ return "\u{1F4DD}";
39883
+ case "uploading":
39884
+ return "\u2601\uFE0F";
39885
+ default:
39886
+ return "\u2728";
39887
+ }
39888
+ };
39889
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: cn("w-full", className), children: [
39890
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39891
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39892
+ "div",
39893
+ {
39894
+ className: "h-[3px] bg-gradient-to-r from-violet-500 via-purple-500 to-violet-500",
39895
+ style: {
39896
+ backgroundSize: "200% 100%",
39897
+ animation: "gradient-shift 2s ease-in-out infinite"
39898
+ }
39899
+ }
39900
+ ),
39901
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "p-5", children: [
39902
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [
39903
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-10 h-10 rounded-xl bg-violet-500/10 border border-violet-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-lg", children: getPhaseIcon() }) }),
39904
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex-1 min-w-0", children: [
39905
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating Research Report" }),
39906
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39907
+ depth && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "capitalize", children: depth }),
39908
+ depth && " \xB7 ",
39909
+ "In progress"
39910
+ ] })
39911
+ ] })
39723
39912
  ] }),
39724
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-1.5 flex-shrink-0", children: [
39725
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-[72px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
39726
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-[88px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-700 animate-pulse", style: { animationDelay: "160ms" } })
39913
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "mt-4 space-y-3", children: [
39914
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "relative", children: [
39915
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39916
+ "div",
39917
+ {
39918
+ className: "h-full bg-gradient-to-r from-violet-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39919
+ style: { width: `${Math.max(pct, 2)}%` }
39920
+ }
39921
+ ) }),
39922
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39923
+ pct,
39924
+ "%"
39925
+ ] })
39926
+ ] }),
39927
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-2", children: [
39928
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-2 h-2 rounded-full bg-violet-500 animate-pulse" }),
39929
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-xs text-zinc-400", children: step })
39930
+ ] }),
39931
+ phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "pt-1", children: [
39932
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center justify-between mb-1.5", children: [
39933
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
39934
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
39935
+ searchesCompleted,
39936
+ "/",
39937
+ searchesTotal
39938
+ ] })
39939
+ ] }),
39940
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "flex gap-1", children: Array.from({ length: Math.min(searchesTotal, 20) }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39941
+ "div",
39942
+ {
39943
+ className: cn(
39944
+ "flex-1 h-1 rounded-full transition-all duration-300",
39945
+ i < searchesCompleted ? "bg-violet-500" : i === searchesCompleted ? "bg-violet-500/50 animate-pulse" : "bg-zinc-700"
39946
+ )
39947
+ },
39948
+ i
39949
+ )) })
39950
+ ] })
39727
39951
  ] })
39728
- ] }),
39729
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "mt-4 flex items-center gap-2", children: [
39730
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-2 h-2 rounded-full bg-amber-500/60 animate-pulse" }),
39731
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[10px] w-[120px] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "200ms" } })
39732
39952
  ] })
39733
39953
  ] }),
39734
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent" })
39735
- ] }) });
39954
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("style", { children: `
39955
+ @keyframes gradient-shift {
39956
+ 0%, 100% { background-position: 0% 50%; }
39957
+ 50% { background-position: 100% 50%; }
39958
+ }
39959
+ ` })
39960
+ ] });
39736
39961
  }
39737
39962
  if (status === "failed") {
39738
39963
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [
@@ -39903,7 +40128,7 @@ var ResearchReportJobCard = (props) => {
39903
40128
  };
39904
40129
 
39905
40130
  // src/molecules/generic/WebSearchJobCard/WebSearchJobCard.tsx
39906
- var import_react77 = require("react");
40131
+ var import_react78 = require("react");
39907
40132
  var import_jsx_runtime149 = require("react/jsx-runtime");
39908
40133
  var SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39909
40134
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
@@ -39924,6 +40149,7 @@ var WebSearchJobCard = ({
39924
40149
  summary: initialSummary,
39925
40150
  results: initialResults,
39926
40151
  error: initialError,
40152
+ progress: initialProgress,
39927
40153
  pollUrl,
39928
40154
  authToken,
39929
40155
  className,
@@ -39931,45 +40157,51 @@ var WebSearchJobCard = ({
39931
40157
  onFailed,
39932
40158
  compact = false
39933
40159
  }) => {
39934
- const [status, setStatus] = (0, import_react77.useState)(initialStatus);
39935
- const [query, setQuery] = (0, import_react77.useState)(initialQuery || initialTitle || "");
39936
- const [resultCount, setResultCount] = (0, import_react77.useState)(initialResultCount ?? 0);
39937
- const [searchCount, setSearchCount] = (0, import_react77.useState)(initialSearchCount ?? 0);
39938
- const [summary, setSummary] = (0, import_react77.useState)(initialSummary || "");
39939
- const [results, setResults] = (0, import_react77.useState)(initialResults || []);
39940
- const [error, setError] = (0, import_react77.useState)(initialError);
39941
- const intervalRef = (0, import_react77.useRef)(null);
39942
- const onCompleteRef = (0, import_react77.useRef)(onComplete);
39943
- const onFailedRef = (0, import_react77.useRef)(onFailed);
39944
- const hasNotifiedRef = (0, import_react77.useRef)(false);
40160
+ const [status, setStatus] = (0, import_react78.useState)(initialStatus);
40161
+ const [query, setQuery] = (0, import_react78.useState)(initialQuery || initialTitle || "");
40162
+ const [resultCount, setResultCount] = (0, import_react78.useState)(initialResultCount ?? 0);
40163
+ const [searchCount, setSearchCount] = (0, import_react78.useState)(initialSearchCount ?? 0);
40164
+ const [summary, setSummary] = (0, import_react78.useState)(initialSummary || "");
40165
+ const [results, setResults] = (0, import_react78.useState)(initialResults || []);
40166
+ const [error, setError] = (0, import_react78.useState)(initialError);
40167
+ const [progress, setProgress] = (0, import_react78.useState)(initialProgress);
40168
+ const intervalRef = (0, import_react78.useRef)(null);
40169
+ const onCompleteRef = (0, import_react78.useRef)(onComplete);
40170
+ const onFailedRef = (0, import_react78.useRef)(onFailed);
40171
+ const hasNotifiedRef = (0, import_react78.useRef)(false);
39945
40172
  onCompleteRef.current = onComplete;
39946
40173
  onFailedRef.current = onFailed;
39947
- (0, import_react77.useEffect)(() => {
40174
+ (0, import_react78.useEffect)(() => {
39948
40175
  setStatus(initialStatus);
39949
40176
  }, [initialStatus]);
39950
- (0, import_react77.useEffect)(() => {
40177
+ (0, import_react78.useEffect)(() => {
39951
40178
  if (initialQuery) setQuery(initialQuery);
39952
40179
  }, [initialQuery]);
39953
- (0, import_react77.useEffect)(() => {
40180
+ (0, import_react78.useEffect)(() => {
39954
40181
  if (initialTitle && !initialQuery) setQuery(initialTitle);
39955
40182
  }, [initialTitle, initialQuery]);
39956
- (0, import_react77.useEffect)(() => {
40183
+ (0, import_react78.useEffect)(() => {
39957
40184
  if (initialResultCount !== void 0) setResultCount(initialResultCount);
39958
40185
  }, [initialResultCount]);
39959
- (0, import_react77.useEffect)(() => {
40186
+ (0, import_react78.useEffect)(() => {
39960
40187
  if (initialSearchCount !== void 0) setSearchCount(initialSearchCount);
39961
40188
  }, [initialSearchCount]);
39962
- (0, import_react77.useEffect)(() => {
40189
+ (0, import_react78.useEffect)(() => {
39963
40190
  if (initialSummary) setSummary(initialSummary);
39964
40191
  }, [initialSummary]);
39965
- (0, import_react77.useEffect)(() => {
40192
+ (0, import_react78.useEffect)(() => {
39966
40193
  if (initialResults) setResults(initialResults);
39967
40194
  }, [initialResults]);
39968
- (0, import_react77.useEffect)(() => {
40195
+ (0, import_react78.useEffect)(() => {
39969
40196
  if (initialError) setError(initialError);
39970
40197
  }, [initialError]);
40198
+ const progressPct = initialProgress?.percentage;
40199
+ const progressStep = initialProgress?.current_step;
40200
+ (0, import_react78.useEffect)(() => {
40201
+ if (initialProgress) setProgress(initialProgress);
40202
+ }, [progressPct, progressStep]);
39971
40203
  const isTerminal = status === "complete" || status === "failed";
39972
- (0, import_react77.useEffect)(() => {
40204
+ (0, import_react78.useEffect)(() => {
39973
40205
  if (isTerminal || !pollUrl) return;
39974
40206
  const poll = async () => {
39975
40207
  try {
@@ -39980,6 +40212,9 @@ var WebSearchJobCard = ({
39980
40212
  const data = await res.json();
39981
40213
  const newStatus = data.status;
39982
40214
  setStatus(newStatus);
40215
+ if (data.progress) {
40216
+ setProgress(data.progress);
40217
+ }
39983
40218
  if (newStatus === "complete" && data.output) {
39984
40219
  const output = data.output;
39985
40220
  setQuery(output.query || "");
@@ -40009,38 +40244,94 @@ var WebSearchJobCard = ({
40009
40244
  if (intervalRef.current) clearInterval(intervalRef.current);
40010
40245
  };
40011
40246
  }, [isTerminal, pollUrl, authToken]);
40012
- (0, import_react77.useEffect)(() => {
40247
+ (0, import_react78.useEffect)(() => {
40013
40248
  if (isTerminal && intervalRef.current) {
40014
40249
  clearInterval(intervalRef.current);
40015
40250
  intervalRef.current = null;
40016
40251
  }
40017
40252
  }, [isTerminal]);
40018
40253
  if (status === "pending" || status === "running") {
40019
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "relative overflow-hidden rounded-xl border border-zinc-200/70 dark:border-zinc-800/70 bg-zinc-100 dark:bg-zinc-900", children: [
40020
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "p-5 space-y-3", children: [
40021
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center gap-3", children: [
40022
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "w-10 h-10 rounded-xl bg-zinc-300 dark:bg-zinc-700 animate-pulse flex-shrink-0" }),
40023
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex-1 space-y-2", children: [
40024
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[13px] w-[60%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse" }),
40025
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[10px] w-[25%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "80ms" } })
40254
+ const pct = progress?.percentage ?? 0;
40255
+ const step = progress?.current_step ?? "Starting web search...";
40256
+ const details = progress?.details;
40257
+ const searchesCompleted = details?.searches_completed ?? 0;
40258
+ const searchesTotal = details?.searches_total ?? 0;
40259
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
40260
+ const getPhaseIcon = () => {
40261
+ switch (phase) {
40262
+ case "ai_generation":
40263
+ return "\u{1F50D}";
40264
+ case "processing":
40265
+ return "\u2699\uFE0F";
40266
+ case "uploading":
40267
+ return "\u2601\uFE0F";
40268
+ default:
40269
+ return "\u2728";
40270
+ }
40271
+ };
40272
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
40273
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
40274
+ "div",
40275
+ {
40276
+ className: "h-[3px]",
40277
+ style: {
40278
+ background: "linear-gradient(90deg, #d97706, #f59e0b, #d97706)",
40279
+ backgroundSize: "200% 100%",
40280
+ animation: "gradient-shift 2s ease-in-out infinite"
40281
+ }
40282
+ }
40283
+ ),
40284
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "p-5", children: [
40285
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-start gap-3", children: [
40286
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "w-10 h-10 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-lg", children: getPhaseIcon() }) }),
40287
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex-1 min-w-0", children: [
40288
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: query || initialTitle || "Web Search" }),
40289
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5", children: "In progress" })
40026
40290
  ] })
40027
40291
  ] }),
40028
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[9px] w-[85%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
40029
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[9px] w-[70%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "160ms" } }),
40030
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "space-y-2 pt-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
40031
- "div",
40032
- {
40033
- className: "rounded-xl border border-zinc-200 dark:border-zinc-800 p-3 space-y-1.5",
40034
- children: [
40035
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[10px] w-[65%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse", style: { animationDelay: `${200 + i * 80}ms` } }),
40036
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[8px] w-[18%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${240 + i * 80}ms` } }),
40037
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-[8px] w-[90%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${280 + i * 80}ms` } })
40038
- ]
40039
- },
40040
- i
40041
- )) })
40042
- ] }),
40043
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent" })
40292
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "mt-4 space-y-3", children: [
40293
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "relative", children: [
40294
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
40295
+ "div",
40296
+ {
40297
+ className: "h-full rounded-full transition-all duration-500 ease-out",
40298
+ style: {
40299
+ width: `${Math.max(pct, 2)}%`,
40300
+ background: "linear-gradient(90deg, #d97706, #f59e0b)"
40301
+ }
40302
+ }
40303
+ ) }),
40304
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
40305
+ pct,
40306
+ "%"
40307
+ ] })
40308
+ ] }),
40309
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center gap-2", children: [
40310
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "w-2 h-2 rounded-full bg-amber-500 animate-pulse flex-shrink-0" }),
40311
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-xs text-zinc-400", children: step })
40312
+ ] }),
40313
+ phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "pt-1", children: [
40314
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center justify-between mb-1.5", children: [
40315
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
40316
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
40317
+ searchesCompleted,
40318
+ "/",
40319
+ searchesTotal
40320
+ ] })
40321
+ ] }),
40322
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "flex gap-1", children: Array.from({ length: Math.min(searchesTotal, 20) }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
40323
+ "div",
40324
+ {
40325
+ className: cn(
40326
+ "flex-1 h-1 rounded-full transition-all duration-300",
40327
+ i < searchesCompleted ? "bg-amber-500" : i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40328
+ )
40329
+ },
40330
+ i
40331
+ )) })
40332
+ ] })
40333
+ ] })
40334
+ ] })
40044
40335
  ] }) });
40045
40336
  }
40046
40337
  if (status === "failed") {
@@ -40097,10 +40388,10 @@ var WebSearchJobCard = ({
40097
40388
  };
40098
40389
 
40099
40390
  // src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx
40100
- var import_react79 = __toESM(require("react"), 1);
40391
+ var import_react80 = __toESM(require("react"), 1);
40101
40392
 
40102
40393
  // src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx
40103
- var import_react78 = require("react");
40394
+ var import_react79 = require("react");
40104
40395
 
40105
40396
  // src/lib/countries.ts
40106
40397
  var countries = [
@@ -40312,10 +40603,10 @@ var CountrySelectEdit = ({
40312
40603
  value,
40313
40604
  onChange
40314
40605
  }) => {
40315
- const [isDropdownOpen, setIsDropdownOpen] = (0, import_react78.useState)(false);
40316
- const [searchTerm, setSearchTerm] = (0, import_react78.useState)("");
40317
- const dropdownRef = (0, import_react78.useRef)(null);
40318
- (0, import_react78.useEffect)(() => {
40606
+ const [isDropdownOpen, setIsDropdownOpen] = (0, import_react79.useState)(false);
40607
+ const [searchTerm, setSearchTerm] = (0, import_react79.useState)("");
40608
+ const dropdownRef = (0, import_react79.useRef)(null);
40609
+ (0, import_react79.useEffect)(() => {
40319
40610
  const handleClickOutside = (event) => {
40320
40611
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
40321
40612
  setIsDropdownOpen(false);
@@ -40324,7 +40615,7 @@ var CountrySelectEdit = ({
40324
40615
  document.addEventListener("mousedown", handleClickOutside);
40325
40616
  return () => document.removeEventListener("mousedown", handleClickOutside);
40326
40617
  }, []);
40327
- const inputValue = (0, import_react78.useMemo)(() => {
40618
+ const inputValue = (0, import_react79.useMemo)(() => {
40328
40619
  if (Array.isArray(value)) return value;
40329
40620
  if (typeof value === "string" && value.trim() !== "") {
40330
40621
  const foundCountry = countries.find(
@@ -40425,7 +40716,7 @@ var CountrySelectEdit = ({
40425
40716
  ] });
40426
40717
  };
40427
40718
  var CountrySelectDisplay = ({ value }) => {
40428
- const displayValues = (0, import_react78.useMemo)(() => {
40719
+ const displayValues = (0, import_react79.useMemo)(() => {
40429
40720
  if (Array.isArray(value)) return value;
40430
40721
  if (typeof value === "string" && value.trim() !== "") return [value];
40431
40722
  return [];
@@ -40601,7 +40892,7 @@ var PlatformSelectEdit = ({
40601
40892
  value,
40602
40893
  onChange
40603
40894
  }) => {
40604
- const selectedPlatforms = (0, import_react78.useMemo)(() => {
40895
+ const selectedPlatforms = (0, import_react79.useMemo)(() => {
40605
40896
  if (Array.isArray(value)) return value;
40606
40897
  if (typeof value === "string" && value.trim() !== "") {
40607
40898
  return value.split(",").map((s) => s.trim()).filter(Boolean);
@@ -40620,7 +40911,7 @@ var PlatformSelectEdit = ({
40620
40911
  onChange([...selectedPlatforms, platform]);
40621
40912
  }
40622
40913
  };
40623
- const options = (0, import_react78.useMemo)(() => {
40914
+ const options = (0, import_react79.useMemo)(() => {
40624
40915
  return DEFAULT_PLATFORMS;
40625
40916
  }, []);
40626
40917
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex flex-wrap gap-4 py-2", children: options.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(
@@ -40646,7 +40937,7 @@ var PlatformSelectEdit = ({
40646
40937
  )) });
40647
40938
  };
40648
40939
  var PlatformSelectDisplay = ({ value }) => {
40649
- const displayValues = (0, import_react78.useMemo)(() => {
40940
+ const displayValues = (0, import_react79.useMemo)(() => {
40650
40941
  if (Array.isArray(value)) return value;
40651
40942
  if (typeof value === "string" && value.trim() !== "") {
40652
40943
  return value.split(",").map((s) => s.trim()).filter(Boolean);
@@ -40806,7 +41097,7 @@ function buildCampaignSeedFields(data) {
40806
41097
  return generated;
40807
41098
  });
40808
41099
  }
40809
- var CampaignSeedCard = import_react79.default.memo(
41100
+ var CampaignSeedCard = import_react80.default.memo(
40810
41101
  ({
40811
41102
  selectionStatus,
40812
41103
  isLatestMessage = true,
@@ -40818,7 +41109,7 @@ var CampaignSeedCard = import_react79.default.memo(
40818
41109
  sendMessage,
40819
41110
  ...formCardProps
40820
41111
  }) => {
40821
- const fields = (0, import_react79.useMemo)(() => {
41112
+ const fields = (0, import_react80.useMemo)(() => {
40822
41113
  return providedFields || buildCampaignSeedFields(data);
40823
41114
  }, [providedFields, data]);
40824
41115
  const handleProceed = () => {
@@ -40852,7 +41143,7 @@ var CampaignSeedCard = import_react79.default.memo(
40852
41143
  CampaignSeedCard.displayName = "CampaignSeedCard";
40853
41144
 
40854
41145
  // src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx
40855
- var import_react80 = __toESM(require("react"), 1);
41146
+ var import_react81 = __toESM(require("react"), 1);
40856
41147
  var import_jsx_runtime152 = require("react/jsx-runtime");
40857
41148
  var ObjectDisplay2 = ({ value }) => {
40858
41149
  if (!value || typeof value !== "object") return null;
@@ -40968,7 +41259,7 @@ function buildSearchSpecFields(data) {
40968
41259
  return generated;
40969
41260
  });
40970
41261
  }
40971
- var SearchSpecCard = import_react80.default.memo(
41262
+ var SearchSpecCard = import_react81.default.memo(
40972
41263
  ({
40973
41264
  selectionStatus,
40974
41265
  isLatestMessage = true,
@@ -40982,7 +41273,7 @@ var SearchSpecCard = import_react80.default.memo(
40982
41273
  ...formCardProps
40983
41274
  }) => {
40984
41275
  const resolvedData = data || specData;
40985
- const fields = (0, import_react80.useMemo)(() => {
41276
+ const fields = (0, import_react81.useMemo)(() => {
40986
41277
  return providedFields || buildSearchSpecFields(resolvedData ?? {});
40987
41278
  }, [providedFields, resolvedData]);
40988
41279
  const handleProceed = () => {
@@ -41018,7 +41309,7 @@ var SearchSpecCard = import_react80.default.memo(
41018
41309
  SearchSpecCard.displayName = "SearchSpecCard";
41019
41310
 
41020
41311
  // src/molecules/creator-discovery/MCQCard/MCQCard.tsx
41021
- var import_react81 = __toESM(require("react"), 1);
41312
+ var import_react82 = __toESM(require("react"), 1);
41022
41313
 
41023
41314
  // src/molecules/creator-discovery/MCQCard/defaultFetchers.ts
41024
41315
  function getBackendOrigin() {
@@ -41119,7 +41410,7 @@ async function defaultPersistSelection(sessionId, questionKey, value) {
41119
41410
 
41120
41411
  // src/molecules/creator-discovery/MCQCard/MCQCard.tsx
41121
41412
  var import_jsx_runtime153 = require("react/jsx-runtime");
41122
- var MCQCard = import_react81.default.memo(
41413
+ var MCQCard = import_react82.default.memo(
41123
41414
  ({
41124
41415
  question,
41125
41416
  options,
@@ -41144,16 +41435,16 @@ var MCQCard = import_react81.default.memo(
41144
41435
  const resolvedOptions = options || allProps.Options || allProps.opts || {};
41145
41436
  const resolvedRecommended = recommended || allProps.Recommended || allProps.rec;
41146
41437
  console.log("[MCQCard] FULL PROPS:", { allProps, resolvedQuestion, resolvedOptions: Object.keys(resolvedOptions || {}), resolvedRecommended });
41147
- const [selectedOption, setSelectedOption] = import_react81.default.useState(propsSelectedOption);
41148
- const [isProceeded, setIsProceeded] = import_react81.default.useState(false);
41149
- const fetchedSessionRef = import_react81.default.useRef("");
41150
- import_react81.default.useEffect(() => {
41438
+ const [selectedOption, setSelectedOption] = import_react82.default.useState(propsSelectedOption);
41439
+ const [isProceeded, setIsProceeded] = import_react82.default.useState(false);
41440
+ const fetchedSessionRef = import_react82.default.useRef("");
41441
+ import_react82.default.useEffect(() => {
41151
41442
  if (propsSelectedOption) {
41152
41443
  setSelectedOption(propsSelectedOption);
41153
41444
  setIsProceeded(true);
41154
41445
  }
41155
41446
  }, [propsSelectedOption]);
41156
- const buildQuestionKey = import_react81.default.useCallback((sid, question2) => {
41447
+ const buildQuestionKey = import_react82.default.useCallback((sid, question2) => {
41157
41448
  let hash = 2166136261;
41158
41449
  for (let i = 0; i < question2.length; i++) {
41159
41450
  hash ^= question2.charCodeAt(i);
@@ -41161,7 +41452,7 @@ var MCQCard = import_react81.default.memo(
41161
41452
  }
41162
41453
  return `mcq_${sid}_${hash.toString(36)}`;
41163
41454
  }, []);
41164
- import_react81.default.useEffect(() => {
41455
+ import_react82.default.useEffect(() => {
41165
41456
  if (!sessionId || !resolvedQuestion) return;
41166
41457
  const fetchKey = `${sessionId}::${resolvedQuestion}`;
41167
41458
  if (fetchedSessionRef.current === fetchKey) return;
@@ -41767,9 +42058,9 @@ var CreatorActionHeader = ({
41767
42058
  };
41768
42059
 
41769
42060
  // src/molecules/creator-discovery/CreatorSearchBox/CreatorSearch.tsx
41770
- var import_react82 = __toESM(require("react"), 1);
42061
+ var import_react83 = __toESM(require("react"), 1);
41771
42062
  var import_jsx_runtime164 = require("react/jsx-runtime");
41772
- var CreatorSearch = import_react82.default.memo(
42063
+ var CreatorSearch = import_react83.default.memo(
41773
42064
  ({
41774
42065
  selectionStatus,
41775
42066
  isLatestMessage = true,
@@ -41778,7 +42069,7 @@ var CreatorSearch = import_react82.default.memo(
41778
42069
  data,
41779
42070
  ...formCardProps
41780
42071
  }) => {
41781
- const fields = (0, import_react82.useMemo)(() => {
42072
+ const fields = (0, import_react83.useMemo)(() => {
41782
42073
  const baseFields = providedFields || generateFieldsFromData(data);
41783
42074
  return baseFields.map((field) => {
41784
42075
  if (field.key === "platforms") {
@@ -41858,10 +42149,10 @@ var CreatorSearch = import_react82.default.memo(
41858
42149
  CreatorSearch.displayName = "CreatorSearch";
41859
42150
 
41860
42151
  // src/molecules/creator-discovery/CampaignConceptCard/CampaignConceptCard.tsx
41861
- var import_react83 = __toESM(require("react"), 1);
42152
+ var import_react84 = __toESM(require("react"), 1);
41862
42153
  var import_framer_motion = require("framer-motion");
41863
42154
  var import_jsx_runtime165 = require("react/jsx-runtime");
41864
- var CampaignConceptCard = import_react83.default.memo(
42155
+ var CampaignConceptCard = import_react84.default.memo(
41865
42156
  ({
41866
42157
  index,
41867
42158
  isRecommended,
@@ -41877,7 +42168,7 @@ var CampaignConceptCard = import_react83.default.memo(
41877
42168
  onAction,
41878
42169
  ...formCardProps
41879
42170
  }) => {
41880
- const [internalIsOpen, setInternalIsOpen] = (0, import_react83.useState)(false);
42171
+ const [internalIsOpen, setInternalIsOpen] = (0, import_react84.useState)(false);
41881
42172
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
41882
42173
  const handleToggle = () => {
41883
42174
  if (onToggle) {
@@ -41896,7 +42187,7 @@ var CampaignConceptCard = import_react83.default.memo(
41896
42187
  });
41897
42188
  };
41898
42189
  const effectiveIsLatest = isLatestMessage && !hasUserResponded;
41899
- const fields = (0, import_react83.useMemo)(() => {
42190
+ const fields = (0, import_react84.useMemo)(() => {
41900
42191
  const baseFields = providedFields || generateFieldsFromData(data);
41901
42192
  const FIELD_ORDER = [
41902
42193
  "description",
@@ -42208,14 +42499,14 @@ var CampaignConceptCard = import_react83.default.memo(
42208
42499
  CampaignConceptCard.displayName = "CampaignConceptCard";
42209
42500
 
42210
42501
  // src/molecules/creator-discovery/CreatorWidget/CreatorWidget.tsx
42211
- var import_react91 = require("react");
42502
+ var import_react92 = require("react");
42212
42503
 
42213
42504
  // src/molecules/creator-discovery/CreatorWidget/CreatorImageList.tsx
42214
- var import_react84 = require("react");
42505
+ var import_react85 = require("react");
42215
42506
  var import_jsx_runtime166 = require("react/jsx-runtime");
42216
42507
  function useMediaQuery(query) {
42217
- const [matches, setMatches] = (0, import_react84.useState)(false);
42218
- (0, import_react84.useEffect)(() => {
42508
+ const [matches, setMatches] = (0, import_react85.useState)(false);
42509
+ (0, import_react85.useEffect)(() => {
42219
42510
  const media = window.matchMedia(query);
42220
42511
  const listener = () => setMatches(media.matches);
42221
42512
  listener();
@@ -42298,7 +42589,7 @@ function CreatorImageList({
42298
42589
  }
42299
42590
 
42300
42591
  // src/molecules/creator-discovery/CreatorWidget/CreatorProgressBar.tsx
42301
- var import_react85 = require("react");
42592
+ var import_react86 = require("react");
42302
42593
  var import_framer_motion2 = require("framer-motion");
42303
42594
  var import_jsx_runtime167 = require("react/jsx-runtime");
42304
42595
  function truncateName(name, maxLength) {
@@ -42306,8 +42597,8 @@ function truncateName(name, maxLength) {
42306
42597
  return name.substring(0, maxLength) + "...";
42307
42598
  }
42308
42599
  function ProgressBar({ overallPercentage }) {
42309
- const [showTooltip, setShowTooltip] = (0, import_react85.useState)(true);
42310
- (0, import_react85.useEffect)(() => {
42600
+ const [showTooltip, setShowTooltip] = (0, import_react86.useState)(true);
42601
+ (0, import_react86.useEffect)(() => {
42311
42602
  if (overallPercentage && overallPercentage >= 100) {
42312
42603
  setShowTooltip(false);
42313
42604
  }
@@ -42467,7 +42758,7 @@ function CreatorCompactView({
42467
42758
  }
42468
42759
 
42469
42760
  // src/molecules/creator-discovery/CreatorWidget/CreatorExpandedPanel.tsx
42470
- var import_react89 = require("react");
42761
+ var import_react90 = require("react");
42471
42762
  var import_react_dom2 = __toESM(require("react-dom"), 1);
42472
42763
  var import_framer_motion5 = require("framer-motion");
42473
42764
 
@@ -42953,7 +43244,7 @@ function getPlatformIconColor(platform) {
42953
43244
  }
42954
43245
 
42955
43246
  // src/molecules/creator-discovery/CreatorWidget/PostCard.tsx
42956
- var import_react86 = require("react");
43247
+ var import_react87 = require("react");
42957
43248
  var import_jsx_runtime172 = require("react/jsx-runtime");
42958
43249
  var formatFollowerCount = (count) => {
42959
43250
  if (count >= 1e6) {
@@ -42967,8 +43258,8 @@ var formatFollowerCount = (count) => {
42967
43258
  return Math.floor(count).toString();
42968
43259
  };
42969
43260
  function PostCard({ post, platformUsername }) {
42970
- const [expanded, setExpanded] = (0, import_react86.useState)(false);
42971
- const [errored, setErrored] = (0, import_react86.useState)(false);
43261
+ const [expanded, setExpanded] = (0, import_react87.useState)(false);
43262
+ const [errored, setErrored] = (0, import_react87.useState)(false);
42972
43263
  const thumbnail = post.thumbnail_url || post.thumbnail || post.image || "";
42973
43264
  const likes = post.engagement?.likes ?? post.likes ?? null;
42974
43265
  const comments = post.engagement?.comments ?? post.comments ?? null;
@@ -43109,7 +43400,7 @@ function PlatformMetricsBanner({
43109
43400
  return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
43110
43401
  "div",
43111
43402
  {
43112
- className: "\r\n grid grid-cols-1 gap-3 rounded-xl py-4 px-4 shadow-sm\r\n md:flex md:overflow-x-auto md:gap-6 md:rounded-l-xl md:py-4 md:px-4 md:items-center md:gap-0 md:px-0 md:ml-8\r\n ",
43403
+ className: "\n grid grid-cols-1 gap-3 rounded-xl py-4 px-4 shadow-sm\n md:flex md:overflow-x-auto md:gap-6 md:rounded-l-xl md:py-4 md:px-4 md:items-center md:gap-0 md:px-0 md:ml-8\n ",
43113
43404
  style: { backgroundColor: bgColor },
43114
43405
  children: [
43115
43406
  /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-col items-center md:min-w-0", children: [
@@ -43177,7 +43468,7 @@ function PlatformPostsSection({
43177
43468
  }
43178
43469
 
43179
43470
  // src/molecules/creator-discovery/CreatorWidget/BrandCollaborationsList.tsx
43180
- var import_react87 = require("react");
43471
+ var import_react88 = require("react");
43181
43472
  var import_react_dom = __toESM(require("react-dom"), 1);
43182
43473
  var import_framer_motion3 = require("framer-motion");
43183
43474
  var import_jsx_runtime174 = require("react/jsx-runtime");
@@ -43379,8 +43670,8 @@ function BrandMentionDetails({
43379
43670
  function BrandCollaborationsList({
43380
43671
  brandBreakdown
43381
43672
  }) {
43382
- const [openDetails, setOpenDetails] = (0, import_react87.useState)(false);
43383
- const [selectedBrand, setSelectedBrand] = (0, import_react87.useState)("");
43673
+ const [openDetails, setOpenDetails] = (0, import_react88.useState)(false);
43674
+ const [selectedBrand, setSelectedBrand] = (0, import_react88.useState)("");
43384
43675
  if (!brandBreakdown?.insights?.brandBreakdown || brandBreakdown.insights.brandBreakdown.length === 0) {
43385
43676
  return null;
43386
43677
  }
@@ -43439,7 +43730,7 @@ function BrandCollaborationsList({
43439
43730
  }
43440
43731
 
43441
43732
  // src/molecules/creator-discovery/CreatorWidget/CreatorGridView.tsx
43442
- var import_react88 = require("react");
43733
+ var import_react89 = require("react");
43443
43734
  var import_framer_motion4 = require("framer-motion");
43444
43735
  var import_jsx_runtime175 = require("react/jsx-runtime");
43445
43736
  var formatFollowerCount3 = (count) => {
@@ -43488,25 +43779,25 @@ var itemsExplanation = [
43488
43779
  { key: "brandSafety", label: "Brand Safety" }
43489
43780
  ];
43490
43781
  function CreatorGridViewCard({ creator }) {
43491
- const [isExpanded, setIsExpanded] = (0, import_react88.useState)(false);
43492
- const [showFullDescription, setShowFullDescription] = (0, import_react88.useState)(false);
43493
- const [isDescriptionOverflowing, setIsDescriptionOverflowing] = (0, import_react88.useState)(false);
43494
- const descriptionRef = (0, import_react88.useRef)(null);
43495
- const cardRef = (0, import_react88.useRef)(null);
43496
- const checkDescriptionOverflow = (0, import_react88.useCallback)(() => {
43782
+ const [isExpanded, setIsExpanded] = (0, import_react89.useState)(false);
43783
+ const [showFullDescription, setShowFullDescription] = (0, import_react89.useState)(false);
43784
+ const [isDescriptionOverflowing, setIsDescriptionOverflowing] = (0, import_react89.useState)(false);
43785
+ const descriptionRef = (0, import_react89.useRef)(null);
43786
+ const cardRef = (0, import_react89.useRef)(null);
43787
+ const checkDescriptionOverflow = (0, import_react89.useCallback)(() => {
43497
43788
  const el = descriptionRef.current;
43498
43789
  if (!el) return;
43499
43790
  setIsDescriptionOverflowing(el.scrollHeight > el.clientHeight + 1);
43500
43791
  }, []);
43501
- (0, import_react88.useEffect)(() => {
43792
+ (0, import_react89.useEffect)(() => {
43502
43793
  checkDescriptionOverflow();
43503
43794
  }, [checkDescriptionOverflow, isExpanded, showFullDescription]);
43504
- (0, import_react88.useEffect)(() => {
43795
+ (0, import_react89.useEffect)(() => {
43505
43796
  const onResize = () => checkDescriptionOverflow();
43506
43797
  window.addEventListener("resize", onResize);
43507
43798
  return () => window.removeEventListener("resize", onResize);
43508
43799
  }, [checkDescriptionOverflow]);
43509
- const platformStats = (0, import_react88.useMemo)(() => {
43800
+ const platformStats = (0, import_react89.useMemo)(() => {
43510
43801
  return [
43511
43802
  {
43512
43803
  platform: "instagram",
@@ -43924,7 +44215,7 @@ function BrandMentionPerformance({ creator }) {
43924
44215
  ] });
43925
44216
  }
43926
44217
  function CreatorFitSummary({ creator, showBrandPerformance }) {
43927
- const [contentExpanded, setContentExpanded] = (0, import_react89.useState)(false);
44218
+ const [contentExpanded, setContentExpanded] = (0, import_react90.useState)(false);
43928
44219
  const hasDeepAnalysis = creator?.sentiment?.deepAnalysis?.deepAnalysis;
43929
44220
  const title = hasDeepAnalysis ? "CREATOR DEEP ANALYSIS" : "CREATOR FIT SUMMARY";
43930
44221
  const content = hasDeepAnalysis ? creator.sentiment.deepAnalysis.deepAnalysis : creator?.sentiment?.aiReasoning || "No data available.";
@@ -43944,7 +44235,7 @@ function CreatorFitSummary({ creator, showBrandPerformance }) {
43944
44235
  ] });
43945
44236
  }
43946
44237
  function ProfileSection({ creator, isValidationComplete }) {
43947
- const [descriptionExpanded, setDescriptionExpanded] = (0, import_react89.useState)(false);
44238
+ const [descriptionExpanded, setDescriptionExpanded] = (0, import_react90.useState)(false);
43948
44239
  const username = creator.platformMetrics?.instagramMetrics?.username ? `@${creator.platformMetrics.instagramMetrics.username}` : creator.platformMetrics?.youtubeMetrics?.channelName ? `@${creator.platformMetrics.youtubeMetrics.channelName}` : creator.platformMetrics?.tiktokMetrics?.username ? `@${creator.platformMetrics.tiktokMetrics.username}` : "";
43949
44240
  const iso2 = normalizeToIso2(creator.country);
43950
44241
  const meta = codeToMeta[iso2];
@@ -44034,7 +44325,7 @@ function CreatorCard({
44034
44325
  creator,
44035
44326
  isValidationComplete
44036
44327
  }) {
44037
- const [detailsExpanded, setDetailsExpanded] = (0, import_react89.useState)(false);
44328
+ const [detailsExpanded, setDetailsExpanded] = (0, import_react90.useState)(false);
44038
44329
  const hasValidBrandMention = (() => {
44039
44330
  const insights = creator?.brandCollaborations?.insights;
44040
44331
  if (!insights) return false;
@@ -44076,7 +44367,7 @@ function CreatorDisplay({
44076
44367
  creators,
44077
44368
  isValidationComplete
44078
44369
  }) {
44079
- const [viewMode, setViewMode] = (0, import_react89.useState)("list");
44370
+ const [viewMode, setViewMode] = (0, import_react90.useState)("list");
44080
44371
  return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "px-4", children: [
44081
44372
  /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "flex justify-end items-center my-3 gap-1", children: [
44082
44373
  /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("span", { className: "text-xs text-gray600 mr-2", children: [
@@ -44157,10 +44448,10 @@ function CreatorExpandedPanel({
44157
44448
  searchSpec,
44158
44449
  fetchCreatorDetails
44159
44450
  }) {
44160
- const [creators, setCreators] = (0, import_react89.useState)([]);
44161
- const [loading, setLoading] = (0, import_react89.useState)(false);
44451
+ const [creators, setCreators] = (0, import_react90.useState)([]);
44452
+ const [loading, setLoading] = (0, import_react90.useState)(false);
44162
44453
  const fetcher = fetchCreatorDetails ?? defaultFetchCreatorDetails;
44163
- const loadCreators = (0, import_react89.useCallback)(async () => {
44454
+ const loadCreators = (0, import_react90.useCallback)(async () => {
44164
44455
  if (!creatorIds.length) return;
44165
44456
  setLoading(true);
44166
44457
  try {
@@ -44172,7 +44463,7 @@ function CreatorExpandedPanel({
44172
44463
  setLoading(false);
44173
44464
  }
44174
44465
  }, [creatorIds, sessionId, version, fetcher]);
44175
- (0, import_react89.useEffect)(() => {
44466
+ (0, import_react90.useEffect)(() => {
44176
44467
  if (isOpen && creatorIds.length > 0) {
44177
44468
  loadCreators();
44178
44469
  }
@@ -44226,7 +44517,7 @@ function CreatorExpandedPanel({
44226
44517
  }
44227
44518
 
44228
44519
  // src/molecules/creator-discovery/CreatorWidget/useCreatorWidgetPolling.ts
44229
- var import_react90 = require("react");
44520
+ var import_react91 = require("react");
44230
44521
  var DEFAULT_POLLING_CONFIG = {
44231
44522
  pollInterval: 5e3,
44232
44523
  maxDuration: 15 * 60 * 1e3,
@@ -44243,22 +44534,22 @@ function useCreatorWidgetPolling({
44243
44534
  }) {
44244
44535
  const fetchVersions = fetchVersionsProp ?? defaultFetchVersions;
44245
44536
  const fetchStatus = fetchStatusProp ?? defaultFetchStatus;
44246
- const config = (0, import_react90.useMemo)(
44537
+ const config = (0, import_react91.useMemo)(
44247
44538
  () => ({ ...DEFAULT_POLLING_CONFIG, ...pollingConfig }),
44248
44539
  [pollingConfig]
44249
44540
  );
44250
- const [versionData, setVersionData] = (0, import_react90.useState)(null);
44251
- const [totalVersions, setTotalVersions] = (0, import_react90.useState)(0);
44252
- const [selectedVersion, setSelectedVersion] = (0, import_react90.useState)();
44253
- const [isLoadingVersion, setIsLoadingVersion] = (0, import_react90.useState)(false);
44254
- const [isValidationComplete, setIsValidationComplete] = (0, import_react90.useState)(false);
44255
- const [versionStatus, setVersionStatus] = (0, import_react90.useState)("checking");
44256
- const [statusDetails, setStatusDetails] = (0, import_react90.useState)();
44257
- const [timeDisplay, setTimeDisplay] = (0, import_react90.useState)("");
44258
- const [loadingStatus, setLoadingStatus] = (0, import_react90.useState)(true);
44259
- const remainingTimeRef = (0, import_react90.useRef)(0);
44541
+ const [versionData, setVersionData] = (0, import_react91.useState)(null);
44542
+ const [totalVersions, setTotalVersions] = (0, import_react91.useState)(0);
44543
+ const [selectedVersion, setSelectedVersion] = (0, import_react91.useState)();
44544
+ const [isLoadingVersion, setIsLoadingVersion] = (0, import_react91.useState)(false);
44545
+ const [isValidationComplete, setIsValidationComplete] = (0, import_react91.useState)(false);
44546
+ const [versionStatus, setVersionStatus] = (0, import_react91.useState)("checking");
44547
+ const [statusDetails, setStatusDetails] = (0, import_react91.useState)();
44548
+ const [timeDisplay, setTimeDisplay] = (0, import_react91.useState)("");
44549
+ const [loadingStatus, setLoadingStatus] = (0, import_react91.useState)(true);
44550
+ const remainingTimeRef = (0, import_react91.useRef)(0);
44260
44551
  const requestedVersion = selectedVersion ?? currentVersion ?? versionData?.currentVersion;
44261
- const fetchVersionData = (0, import_react90.useCallback)(async () => {
44552
+ const fetchVersionData = (0, import_react91.useCallback)(async () => {
44262
44553
  if (!sessionId) return;
44263
44554
  if (!versionData) setIsLoadingVersion(true);
44264
44555
  try {
@@ -44279,17 +44570,17 @@ function useCreatorWidgetPolling({
44279
44570
  setIsLoadingVersion(false);
44280
44571
  }
44281
44572
  }, [sessionId, requestedVersion, isValidationComplete, fetchVersions, versionData]);
44282
- (0, import_react90.useEffect)(() => {
44573
+ (0, import_react91.useEffect)(() => {
44283
44574
  fetchVersionData();
44284
44575
  }, [sessionId, requestedVersion, isValidationComplete]);
44285
- (0, import_react90.useEffect)(() => {
44576
+ (0, import_react91.useEffect)(() => {
44286
44577
  if (totalVersions > 0 || !sessionId) return;
44287
44578
  const interval = setInterval(() => {
44288
44579
  if (totalVersions === 0) fetchVersionData();
44289
44580
  }, config.pollInterval);
44290
44581
  return () => clearInterval(interval);
44291
44582
  }, [totalVersions, sessionId, fetchVersionData, config.pollInterval]);
44292
- (0, import_react90.useEffect)(() => {
44583
+ (0, import_react91.useEffect)(() => {
44293
44584
  if (!selectedVersion && !requestedVersion) return;
44294
44585
  const activeVersion = selectedVersion ?? requestedVersion;
44295
44586
  let isMounted = true;
@@ -44372,7 +44663,7 @@ function useCreatorWidgetPolling({
44372
44663
  stopPolling();
44373
44664
  };
44374
44665
  }, [selectedVersion, requestedVersion, sessionId]);
44375
- const versionNumbers = (0, import_react90.useMemo)(() => {
44666
+ const versionNumbers = (0, import_react91.useMemo)(() => {
44376
44667
  if (!totalVersions) return [];
44377
44668
  return Array.from({ length: totalVersions }, (_, i) => i + 1);
44378
44669
  }, [totalVersions]);
@@ -44412,7 +44703,7 @@ function CreatorWidgetInner({
44412
44703
  onAction,
44413
44704
  className
44414
44705
  }) {
44415
- const [isExpanded, setIsExpanded] = (0, import_react91.useState)(false);
44706
+ const [isExpanded, setIsExpanded] = (0, import_react92.useState)(false);
44416
44707
  const {
44417
44708
  versionNumbers,
44418
44709
  selectedVersion,
@@ -44433,11 +44724,11 @@ function CreatorWidgetInner({
44433
44724
  pollingConfig,
44434
44725
  onStatusChange
44435
44726
  });
44436
- const handleVersionSelect = (0, import_react91.useCallback)(
44727
+ const handleVersionSelect = (0, import_react92.useCallback)(
44437
44728
  (version) => setSelectedVersion(version),
44438
44729
  [setSelectedVersion]
44439
44730
  );
44440
- const handleViewCreators = (0, import_react91.useCallback)(() => {
44731
+ const handleViewCreators = (0, import_react92.useCallback)(() => {
44441
44732
  setIsExpanded(true);
44442
44733
  onAction?.({
44443
44734
  type: "view-creators",
@@ -44478,7 +44769,7 @@ function CreatorWidgetInner({
44478
44769
  )
44479
44770
  ] });
44480
44771
  }
44481
- var CreatorWidget = (0, import_react91.memo)(CreatorWidgetInner);
44772
+ var CreatorWidget = (0, import_react92.memo)(CreatorWidgetInner);
44482
44773
 
44483
44774
  // src/components/ui/index.ts
44484
44775
  var ui_exports = {};
@@ -44935,7 +45226,7 @@ function EmptyContent({ className, ...props }) {
44935
45226
  }
44936
45227
 
44937
45228
  // src/components/ui/field.tsx
44938
- var import_react92 = require("react");
45229
+ var import_react93 = require("react");
44939
45230
  var import_class_variance_authority10 = require("class-variance-authority");
44940
45231
  var import_jsx_runtime180 = require("react/jsx-runtime");
44941
45232
  function FieldSet({ className, ...props }) {
@@ -45118,7 +45409,7 @@ function FieldError({
45118
45409
  errors,
45119
45410
  ...props
45120
45411
  }) {
45121
- const content = (0, import_react92.useMemo)(() => {
45412
+ const content = (0, import_react93.useMemo)(() => {
45122
45413
  if (children) {
45123
45414
  return children;
45124
45415
  }
@@ -46155,6 +46446,7 @@ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
46155
46446
 
46156
46447
  // src/render/PXEngineRenderer.tsx
46157
46448
  var import_jsx_runtime187 = require("react/jsx-runtime");
46449
+ var MOLECULE_REFS = new Set(Object.values(molecules_exports));
46158
46450
  var CONTEXT_DEPENDENT_COMPONENTS = /* @__PURE__ */ new Set([
46159
46451
  // Form components - require FormField + FormItem context
46160
46452
  "FormLabel",
@@ -46348,18 +46640,21 @@ var normalizeProps = (props) => {
46348
46640
  var PXEngineRenderer = ({
46349
46641
  schema,
46350
46642
  onAction,
46351
- disabled
46643
+ disabled,
46644
+ theme
46352
46645
  }) => {
46646
+ const contextTheme = import_react94.default.useContext(WidgetThemeContext);
46647
+ const effectiveTheme = theme ?? contextTheme;
46353
46648
  if (!schema) return null;
46354
46649
  const root = schema.root || schema;
46355
46650
  const renderRecursive = (component, index) => {
46356
46651
  if (Array.isArray(component)) {
46357
- return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react93.default.Fragment, { children: component.map((child, idx) => renderRecursive(child, idx)) }, index !== void 0 ? `array-${index}` : "array-root");
46652
+ return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react94.default.Fragment, { children: component.map((child, idx) => renderRecursive(child, idx)) }, index !== void 0 ? `array-${index}` : "array-root");
46358
46653
  }
46359
46654
  if (typeof component === "string" || typeof component === "number") {
46360
46655
  return component;
46361
46656
  }
46362
- if (import_react93.default.isValidElement(component)) {
46657
+ if (import_react94.default.isValidElement(component)) {
46363
46658
  return component;
46364
46659
  }
46365
46660
  if (!component || typeof component !== "object") return null;
@@ -46439,6 +46734,9 @@ var PXEngineRenderer = ({
46439
46734
  "ResizableAtom"
46440
46735
  ]);
46441
46736
  const isAtomWithRenderProp = ATOMS_WITH_RENDER.has(atomName);
46737
+ if (effectiveTheme && finalProps.theme === void 0 && MOLECULE_REFS.has(TargetComponent)) {
46738
+ finalProps.theme = effectiveTheme;
46739
+ }
46442
46740
  const finalStyle = { ...dynamicStyle, ...finalProps.style || {} };
46443
46741
  if (isAtomWithRenderProp) {
46444
46742
  return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
@@ -46465,7 +46763,7 @@ var PXEngineRenderer = ({
46465
46763
  );
46466
46764
  }
46467
46765
  };
46468
- return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "px-engine-root relative w-full h-full", children: renderRecursive(root) });
46766
+ return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(WidgetThemeContext.Provider, { value: effectiveTheme, children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "px-engine-root relative w-full h-full", children: renderRecursive(root) }) });
46469
46767
  };
46470
46768
  // Annotate the CommonJS export names for ESM import in node:
46471
46769
  0 && (module.exports = {
@@ -46775,6 +47073,7 @@ var PXEngineRenderer = ({
46775
47073
  TopPostsGrid,
46776
47074
  VideoAtom,
46777
47075
  WebSearchJobCard,
47076
+ WidgetThemeContext,
46778
47077
  cn,
46779
47078
  defaultFetchSelections,
46780
47079
  defaultPersistSelection,
@@ -46786,6 +47085,7 @@ var PXEngineRenderer = ({
46786
47085
  submitWidgetToAgent,
46787
47086
  th,
46788
47087
  useCreatorWidgetPolling,
47088
+ useWidgetTheme,
46789
47089
  withAlpha
46790
47090
  });
46791
47091
  /*! Bundled license information: