@ixo/editor 1.27.1 → 2.0.0

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.
@@ -8177,7 +8177,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
8177
8177
  return "gray";
8178
8178
  }
8179
8179
  };
8180
- const getStatusColor = (status2) => {
8180
+ const getStatusColor2 = (status2) => {
8181
8181
  switch (status2) {
8182
8182
  case "success":
8183
8183
  return "green";
@@ -8276,7 +8276,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
8276
8276
  },
8277
8277
  isLoading ? "Sending..." : "Execute"
8278
8278
  );
8279
- return /* @__PURE__ */ React102.createElement(BaseContainer, null, /* @__PURE__ */ React102.createElement(Stack74, { gap: "md" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("square-check", block.props.icon), /* @__PURE__ */ React102.createElement(Stack74, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React102.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React102.createElement(Badge13, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React102.createElement(Text48, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request"), status !== "idle" && /* @__PURE__ */ React102.createElement(Badge13, { size: "xs", variant: "dot", color: getStatusColor(status) }, status)), /* @__PURE__ */ React102.createElement(
8279
+ return /* @__PURE__ */ React102.createElement(BaseContainer, null, /* @__PURE__ */ React102.createElement(Stack74, { gap: "md" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("square-check", block.props.icon), /* @__PURE__ */ React102.createElement(Stack74, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React102.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React102.createElement(Badge13, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React102.createElement(Text48, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request"), status !== "idle" && /* @__PURE__ */ React102.createElement(Badge13, { size: "xs", variant: "dot", color: getStatusColor2(status) }, status)), /* @__PURE__ */ React102.createElement(
8280
8280
  Text48,
8281
8281
  {
8282
8282
  size: "xs",
@@ -9323,7 +9323,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
9323
9323
  return "gray";
9324
9324
  }
9325
9325
  };
9326
- const getStatusColor = (status2) => {
9326
+ const getStatusColor2 = (status2) => {
9327
9327
  switch (status2) {
9328
9328
  case "sent":
9329
9329
  return "green";
@@ -9401,7 +9401,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
9401
9401
  },
9402
9402
  isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
9403
9403
  );
9404
- return /* @__PURE__ */ React115.createElement(BaseContainer, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("bell", block.props.icon), /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React115.createElement(Badge15, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React115.createElement(Text57, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React115.createElement(Badge15, { size: "xs", variant: "dot", color: getStatusColor(status) }, status)), /* @__PURE__ */ React115.createElement(Text57, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, to.length > 0 ? `To: ${to.slice(0, 2).join(", ")}${to.length > 2 ? ` +${to.length - 2} more` : ""}` : "No recipients"), block.props.description && /* @__PURE__ */ React115.createElement(Text57, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React115.createElement(Tooltip7, { label: isDisabled.message, position: "left", withArrow: true }, sendButton) : sendButton, /* @__PURE__ */ React115.createElement(ActionIcon13, { variant: "subtle", onClick: () => setShowDetails(!showDetails) }, showDetails ? /* @__PURE__ */ React115.createElement(IconChevronUp3, { size: 16 }) : /* @__PURE__ */ React115.createElement(IconChevronDown4, { size: 16 })))), status === "failed" && block.props.errorMessage && /* @__PURE__ */ React115.createElement(Alert12, { color: "red", icon: /* @__PURE__ */ React115.createElement(IconX3, { size: 16 }), title: "Failed to send", styles: { message: { fontSize: "12px" } } }, block.props.errorMessage), status === "sent" && block.props.messageId && /* @__PURE__ */ React115.createElement(Alert12, { color: "green", icon: /* @__PURE__ */ React115.createElement(IconCheck, { size: 16 }), title: "Sent successfully", styles: { message: { fontSize: "12px" } } }, "Message ID: ", block.props.messageId, block.props.sentAt && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement("br", null), "Sent at: ", new Date(block.props.sentAt).toLocaleString())), /* @__PURE__ */ React115.createElement(Collapse4, { in: showDetails }, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, channel === "email" && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs" }, /* @__PURE__ */ React115.createElement(Text57, { size: "xs", fw: 600, c: "dimmed" }, "Recipients:"), /* @__PURE__ */ React115.createElement(Code3, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
9404
+ return /* @__PURE__ */ React115.createElement(BaseContainer, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("bell", block.props.icon), /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React115.createElement(Badge15, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React115.createElement(Text57, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React115.createElement(Badge15, { size: "xs", variant: "dot", color: getStatusColor2(status) }, status)), /* @__PURE__ */ React115.createElement(Text57, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, to.length > 0 ? `To: ${to.slice(0, 2).join(", ")}${to.length > 2 ? ` +${to.length - 2} more` : ""}` : "No recipients"), block.props.description && /* @__PURE__ */ React115.createElement(Text57, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React115.createElement(Tooltip7, { label: isDisabled.message, position: "left", withArrow: true }, sendButton) : sendButton, /* @__PURE__ */ React115.createElement(ActionIcon13, { variant: "subtle", onClick: () => setShowDetails(!showDetails) }, showDetails ? /* @__PURE__ */ React115.createElement(IconChevronUp3, { size: 16 }) : /* @__PURE__ */ React115.createElement(IconChevronDown4, { size: 16 })))), status === "failed" && block.props.errorMessage && /* @__PURE__ */ React115.createElement(Alert12, { color: "red", icon: /* @__PURE__ */ React115.createElement(IconX3, { size: 16 }), title: "Failed to send", styles: { message: { fontSize: "12px" } } }, block.props.errorMessage), status === "sent" && block.props.messageId && /* @__PURE__ */ React115.createElement(Alert12, { color: "green", icon: /* @__PURE__ */ React115.createElement(IconCheck, { size: 16 }), title: "Sent successfully", styles: { message: { fontSize: "12px" } } }, "Message ID: ", block.props.messageId, block.props.sentAt && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement("br", null), "Sent at: ", new Date(block.props.sentAt).toLocaleString())), /* @__PURE__ */ React115.createElement(Collapse4, { in: showDetails }, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, channel === "email" && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs" }, /* @__PURE__ */ React115.createElement(Text57, { size: "xs", fw: 600, c: "dimmed" }, "Recipients:"), /* @__PURE__ */ React115.createElement(Code3, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
9405
9405
  {
9406
9406
  to: to.filter((e) => e.trim() !== ""),
9407
9407
  ...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
@@ -9556,7 +9556,7 @@ var CollectionSelector = ({
9556
9556
  const newSelected = currentSelections.includes(collectionId) ? currentSelections.filter((id) => id !== collectionId) : [...currentSelections, collectionId];
9557
9557
  onCollectionsChange(newSelected);
9558
9558
  };
9559
- const getCollectionName = (collection) => {
9559
+ const getCollectionName2 = (collection) => {
9560
9560
  if (!collection) return "Unnamed Collection";
9561
9561
  return collection.protocol?.profile?.name || collection.name || "Unnamed Collection";
9562
9562
  };
@@ -9577,7 +9577,7 @@ var CollectionSelector = ({
9577
9577
  Checkbox10,
9578
9578
  {
9579
9579
  key: collection.id,
9580
- label: /* @__PURE__ */ React118.createElement(Stack84, { gap: 2 }, /* @__PURE__ */ React118.createElement(Text58, { size: "sm", fw: 500 }, getCollectionName(collection)), /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed", style: { fontFamily: "monospace" } }, "ID: ", collection.id), collection.description && /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed" }, collection.description)),
9580
+ label: /* @__PURE__ */ React118.createElement(Stack84, { gap: 2 }, /* @__PURE__ */ React118.createElement(Text58, { size: "sm", fw: 500 }, getCollectionName2(collection)), /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed", style: { fontFamily: "monospace" } }, "ID: ", collection.id), collection.description && /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed" }, collection.description)),
9581
9581
  checked: selectedCollections?.includes(collection.id) ?? false,
9582
9582
  onChange: () => handleToggleCollection(collection.id)
9583
9583
  }
@@ -9744,16 +9744,178 @@ var ClaimTemplateView = ({ editor, block }) => {
9744
9744
  };
9745
9745
 
9746
9746
  // src/mantine/blocks/claim/flow/FlowView.tsx
9747
- import React124, { useState as useState35, useEffect as useEffect24, useMemo as useMemo23, useCallback as useCallback23, useRef as useRef5 } from "react";
9747
+ import React124, { useMemo as useMemo25 } from "react";
9748
9748
  import { Stack as Stack88, Text as Text62, Loader as Loader11, Center as Center5, Alert as Alert15, Title as Title11, Flex as Flex22, ActionIcon as ActionIcon16 } from "@mantine/core";
9749
+
9750
+ // src/mantine/hooks/useCurrentUser.ts
9751
+ import { useState as useState33, useEffect as useEffect22, useRef as useRef4 } from "react";
9752
+ function useCurrentUser() {
9753
+ const { getCurrentUser } = useBlocknoteHandlers();
9754
+ const getCurrentUserRef = useRef4(getCurrentUser);
9755
+ useEffect22(() => {
9756
+ getCurrentUserRef.current = getCurrentUser;
9757
+ }, [getCurrentUser]);
9758
+ const [userAddress, setUserAddress] = useState33("");
9759
+ useEffect22(() => {
9760
+ const fetchUserAddress = () => {
9761
+ try {
9762
+ const user = getCurrentUserRef.current();
9763
+ setUserAddress(user?.address || "");
9764
+ } catch (err) {
9765
+ setUserAddress("");
9766
+ }
9767
+ };
9768
+ fetchUserAddress();
9769
+ }, []);
9770
+ return userAddress;
9771
+ }
9772
+
9773
+ // src/mantine/hooks/useCollections.ts
9774
+ import { useState as useState34, useEffect as useEffect23, useCallback as useCallback22, useRef as useRef5, useMemo as useMemo21 } from "react";
9775
+ function useCollections(did, selectedCollectionIds, block, editor) {
9776
+ const { getClaimCollections } = useBlocknoteHandlers();
9777
+ const getClaimCollectionsRef = useRef5(getClaimCollections);
9778
+ useEffect23(() => {
9779
+ getClaimCollectionsRef.current = getClaimCollections;
9780
+ }, [getClaimCollections]);
9781
+ const [collections, setCollections] = useState34([]);
9782
+ const [loading, setLoading] = useState34(false);
9783
+ const [error, setError] = useState34(null);
9784
+ const adminAddressUpdatedRef = useRef5(false);
9785
+ const selectedCollectionIdsStr = useMemo21(() => JSON.stringify(selectedCollectionIds.sort()), [selectedCollectionIds]);
9786
+ const fetchCollections = useCallback22(async () => {
9787
+ if (!did || selectedCollectionIds.length === 0) {
9788
+ setCollections([]);
9789
+ return;
9790
+ }
9791
+ if (loading) {
9792
+ return;
9793
+ }
9794
+ setLoading(true);
9795
+ setError(null);
9796
+ try {
9797
+ const response = await getClaimCollectionsRef.current({ deedDid: did });
9798
+ const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
9799
+ const currentAdminAddress = block.props.adminAddress || "";
9800
+ if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
9801
+ adminAddressUpdatedRef.current = true;
9802
+ editor.updateBlock(block, {
9803
+ props: {
9804
+ ...block.props,
9805
+ adminAddress: fetchedAdminAddress
9806
+ }
9807
+ });
9808
+ }
9809
+ const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
9810
+ setCollections(selectedCollections);
9811
+ } catch (err) {
9812
+ setError(err instanceof Error ? err.message : "Failed to fetch collections");
9813
+ setCollections([]);
9814
+ } finally {
9815
+ setLoading(false);
9816
+ }
9817
+ }, [did, selectedCollectionIdsStr]);
9818
+ useEffect23(() => {
9819
+ fetchCollections();
9820
+ }, [fetchCollections]);
9821
+ return { collections, loading, error, refetch: fetchCollections };
9822
+ }
9823
+
9824
+ // src/mantine/blocks/claim/flow/FlowView.tsx
9749
9825
  import { IconSettings as IconSettings3, IconRefresh as IconRefresh2, IconAlertCircle as IconAlertCircle3 } from "@tabler/icons-react";
9750
9826
 
9751
9827
  // src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
9752
- import React123, { useMemo as useMemo22, useState as useState34, useEffect as useEffect23, useRef as useRef4 } from "react";
9828
+ import React123, { useMemo as useMemo24 } from "react";
9753
9829
  import { Stack as Stack87, Text as Text61, ActionIcon as ActionIcon15, Tooltip as Tooltip8, Loader as Loader10, Center as Center4 } from "@mantine/core";
9754
9830
 
9831
+ // src/mantine/hooks/useUserRoles.ts
9832
+ import { useState as useState35, useEffect as useEffect24, useMemo as useMemo22, useRef as useRef6 } from "react";
9833
+
9834
+ // src/mantine/hooks/utils.ts
9835
+ function isClientFulfillmentError(error) {
9836
+ const message = error instanceof Error ? error.message : String(error ?? "");
9837
+ return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
9838
+ }
9839
+
9840
+ // src/mantine/hooks/useUserRoles.ts
9841
+ function useUserRoles(collections, userAddress, adminAddress, deedId) {
9842
+ const { getUserRoles } = useBlocknoteHandlers();
9843
+ const getUserRolesRef = useRef6(getUserRoles);
9844
+ useEffect24(() => {
9845
+ getUserRolesRef.current = getUserRoles;
9846
+ }, [getUserRoles]);
9847
+ const [userRoles, setUserRoles] = useState35({});
9848
+ const [loading, setLoading] = useState35(true);
9849
+ const failedRequestKeyRef = useRef6(null);
9850
+ const collectionIdsKey = useMemo22(
9851
+ () => collections.map((c) => c.id).sort().join("|"),
9852
+ [collections]
9853
+ );
9854
+ const requestKey = useMemo22(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
9855
+ useEffect24(() => {
9856
+ let isMounted = true;
9857
+ const setEmptyRoles = () => {
9858
+ const rolesMap = {};
9859
+ collections.forEach((collection) => {
9860
+ rolesMap[collection.id] = null;
9861
+ });
9862
+ if (isMounted) {
9863
+ setUserRoles(rolesMap);
9864
+ }
9865
+ };
9866
+ const fetchUserRoles = async () => {
9867
+ if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
9868
+ setLoading(false);
9869
+ return;
9870
+ }
9871
+ if (!requestKey || failedRequestKeyRef.current === requestKey) {
9872
+ setLoading(false);
9873
+ return;
9874
+ }
9875
+ const getUserRolesFn = getUserRolesRef.current;
9876
+ if (typeof getUserRolesFn !== "function") {
9877
+ setEmptyRoles();
9878
+ setLoading(false);
9879
+ return;
9880
+ }
9881
+ try {
9882
+ setLoading(true);
9883
+ const collectionIds = collections.map((c) => c.id);
9884
+ const roles = await getUserRolesFn({
9885
+ userAddress,
9886
+ adminAddress,
9887
+ deedDid: deedId,
9888
+ collectionIds
9889
+ });
9890
+ const rolesMap = {};
9891
+ collections.forEach((collection) => {
9892
+ const roleData = roles?.find((r) => r.collectionId === collection.id);
9893
+ rolesMap[collection.id] = roleData?.role || null;
9894
+ });
9895
+ setUserRoles(rolesMap);
9896
+ } catch (error) {
9897
+ if (isClientFulfillmentError(error)) {
9898
+ failedRequestKeyRef.current = requestKey;
9899
+ } else {
9900
+ failedRequestKeyRef.current = null;
9901
+ }
9902
+ setEmptyRoles();
9903
+ } finally {
9904
+ if (isMounted) {
9905
+ setLoading(false);
9906
+ }
9907
+ }
9908
+ };
9909
+ fetchUserRoles();
9910
+ return () => {
9911
+ isMounted = false;
9912
+ };
9913
+ }, [collections, userAddress, adminAddress, deedId, requestKey]);
9914
+ return { userRoles, loading };
9915
+ }
9916
+
9755
9917
  // src/mantine/blocks/claim/flow/ClaimsListSheet.tsx
9756
- import React122, { useState as useState33, useEffect as useEffect22, useCallback as useCallback22, useMemo as useMemo21 } from "react";
9918
+ import React122, { useState as useState36, useEffect as useEffect25, useCallback as useCallback23, useMemo as useMemo23 } from "react";
9757
9919
  import { CloseButton as CloseButton9, Title as Title10, Loader as Loader9, Stack as Stack86, Text as Text60, Button as Button28, ActionIcon as ActionIcon14, Alert as Alert14 } from "@mantine/core";
9758
9920
  import { IconArrowLeft as IconArrowLeft2, IconAlertCircle as IconAlertCircle2 } from "@tabler/icons-react";
9759
9921
  import { Survey, SurveyModel } from "@ixo/surveys";
@@ -9921,15 +10083,15 @@ var surveyTheme = {
9921
10083
  var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, userAddress, onSubmitComplete }) => {
9922
10084
  const { closePanel } = usePanelStore();
9923
10085
  const handlers = useBlocknoteHandlers();
9924
- const [viewMode, setViewMode] = useState33("list");
9925
- const [claims, setClaims] = useState33([]);
9926
- const [loading, setLoading] = useState33(true);
9927
- const [error, setError] = useState33(null);
9928
- const [surveyJson, setSurveyJson] = useState33(null);
9929
- const [surveyLoading, setSurveyLoading] = useState33(false);
9930
- const [surveyError, setSurveyError] = useState33(null);
10086
+ const [viewMode, setViewMode] = useState36("list");
10087
+ const [claims, setClaims] = useState36([]);
10088
+ const [loading, setLoading] = useState36(true);
10089
+ const [error, setError] = useState36(null);
10090
+ const [surveyJson, setSurveyJson] = useState36(null);
10091
+ const [surveyLoading, setSurveyLoading] = useState36(false);
10092
+ const [surveyError, setSurveyError] = useState36(null);
9931
10093
  console.log("[ClaimsListSheet] render", { collectionId, collectionName, deedId, adminAddress, userAddress, viewMode });
9932
- const fetchClaims = useCallback22(async () => {
10094
+ const fetchClaims = useCallback23(async () => {
9933
10095
  console.log("[ClaimsListSheet] fetchClaims start", { collectionId, userAddress });
9934
10096
  try {
9935
10097
  setLoading(true);
@@ -9952,7 +10114,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
9952
10114
  setLoading(false);
9953
10115
  }
9954
10116
  }, [collectionId, userAddress]);
9955
- const fetchSurveyTemplate = useCallback22(async () => {
10117
+ const fetchSurveyTemplate = useCallback23(async () => {
9956
10118
  console.log("[ClaimsListSheet] fetchSurveyTemplate start", { deedId });
9957
10119
  try {
9958
10120
  setSurveyLoading(true);
@@ -9977,11 +10139,11 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
9977
10139
  setSurveyLoading(false);
9978
10140
  }
9979
10141
  }, [deedId]);
9980
- useEffect22(() => {
10142
+ useEffect25(() => {
9981
10143
  console.log("[ClaimsListSheet] useEffect fetchClaims");
9982
10144
  fetchClaims();
9983
10145
  }, [fetchClaims]);
9984
- const surveyModel = useMemo21(() => {
10146
+ const surveyModel = useMemo23(() => {
9985
10147
  console.log("[ClaimsListSheet] surveyModel useMemo", { hasSurveyJson: !!surveyJson });
9986
10148
  if (!surveyJson) return null;
9987
10149
  const model = new SurveyModel(surveyJson);
@@ -9990,7 +10152,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
9990
10152
  model.questionsOnPageMode = "singlePage";
9991
10153
  return model;
9992
10154
  }, [surveyJson]);
9993
- const handleSurveyComplete = useCallback22(
10155
+ const handleSurveyComplete = useCallback23(
9994
10156
  async (sender) => {
9995
10157
  console.log("[ClaimsListSheet] handleSurveyComplete fired", { data: sender?.data });
9996
10158
  const surveyData = sender.data;
@@ -10045,7 +10207,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
10045
10207
  },
10046
10208
  [handlers, deedId, collectionId, adminAddress, closePanel, onSubmitComplete]
10047
10209
  );
10048
- useEffect22(() => {
10210
+ useEffect25(() => {
10049
10211
  if (surveyModel) {
10050
10212
  console.log("[ClaimsListSheet] register surveyModel.onComplete listener");
10051
10213
  surveyModel.onComplete.add(handleSurveyComplete);
@@ -10081,7 +10243,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
10081
10243
  }
10082
10244
  return "pending";
10083
10245
  };
10084
- const getStatusColor = (status) => {
10246
+ const getStatusColor2 = (status) => {
10085
10247
  switch (status) {
10086
10248
  case "approved":
10087
10249
  return "green";
@@ -10092,7 +10254,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
10092
10254
  return "yellow";
10093
10255
  }
10094
10256
  };
10095
- const formatDate = (dateString) => {
10257
+ const formatDate2 = (dateString) => {
10096
10258
  try {
10097
10259
  return new Date(dateString).toLocaleDateString();
10098
10260
  } catch {
@@ -10151,7 +10313,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
10151
10313
  },
10152
10314
  /* @__PURE__ */ React122.createElement(Stack86, { gap: "md", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Button28, { onClick: handleNewClaim, fullWidth: true }, "New Claim"), loading ? /* @__PURE__ */ React122.createElement(Stack86, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Loader9, { size: "lg" }), /* @__PURE__ */ React122.createElement(Text60, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React122.createElement(Alert14, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React122.createElement(IconAlertCircle2, { size: 18 }) }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React122.createElement(Stack86, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", c: "dimmed", ta: "center" }, 'No claims found. Click "New Claim" to submit your first claim.')) : /* @__PURE__ */ React122.createElement(Stack86, { gap: "xs" }, claims.map((claim) => {
10153
10315
  const status = getClaimStatus(claim.paymentsStatus);
10154
- return /* @__PURE__ */ React122.createElement(ListItemContainer, { key: claim.claimId }, /* @__PURE__ */ React122.createElement(Stack86, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(claim.submissionDate))), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", fw: 500, c: getStatusColor(status) }, status.toUpperCase()));
10316
+ return /* @__PURE__ */ React122.createElement(ListItemContainer, { key: claim.claimId }, /* @__PURE__ */ React122.createElement(Stack86, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate2(claim.submissionDate))), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", fw: 500, c: getStatusColor2(status) }, status.toUpperCase()));
10155
10317
  })))
10156
10318
  ),
10157
10319
  /* @__PURE__ */ React122.createElement(
@@ -10180,10 +10342,6 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
10180
10342
 
10181
10343
  // src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
10182
10344
  import { IconArrowRight as IconArrowRight2 } from "@tabler/icons-react";
10183
- var isClientFulfillmentError = (error) => {
10184
- const message = error instanceof Error ? error.message : String(error ?? "");
10185
- return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
10186
- };
10187
10345
  var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
10188
10346
  console.log("[CollectionItem] RENDER START", { collectionId: collection.id, userRole });
10189
10347
  const { getCurrentUser } = useBlocknoteHandlers();
@@ -10201,14 +10359,14 @@ var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh })
10201
10359
  alert(`Error in ClaimCollectionsList.tsx:31 - getCurrentUser() failed: ${err instanceof Error ? err.message : String(err)}`);
10202
10360
  currentUser = { address: "" };
10203
10361
  }
10204
- const getCollectionName = (collection2) => collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
10362
+ const getCollectionName2 = (collection2) => collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
10205
10363
  const isServiceAgent = userRole === "SA" /* ServiceProvider */;
10206
10364
  const canAccessClaims = isServiceAgent;
10207
10365
  const claimsPanelId = `claims-list-${collection.id}`;
10208
- const collectionName = getCollectionName(collection);
10366
+ const collectionName = getCollectionName2(collection);
10209
10367
  console.log("[CollectionItem] Panel setup", { claimsPanelId, collectionName, canAccessClaims });
10210
10368
  console.log("[CollectionItem] Creating claimsPanelContent useMemo...");
10211
- const claimsPanelContent = useMemo22(() => {
10369
+ const claimsPanelContent = useMemo24(() => {
10212
10370
  console.log("[CollectionItem] claimsPanelContent useMemo EXECUTING", { collectionId: collection.id });
10213
10371
  return /* @__PURE__ */ React123.createElement(
10214
10372
  ClaimsListSheet,
@@ -10235,266 +10393,42 @@ var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh })
10235
10393
  return /* @__PURE__ */ React123.createElement("div", { style: { opacity: canAccessClaims ? 1 : 0.5 } }, /* @__PURE__ */ React123.createElement(ListItemContainer, null, /* @__PURE__ */ React123.createElement(Stack87, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React123.createElement(Text61, { size: "sm", fw: 500, c: canAccessClaims ? void 0 : "dimmed" }, collectionName), collection.description && /* @__PURE__ */ React123.createElement(Text61, { size: "xs", c: "dimmed" }, collection.description)), /* @__PURE__ */ React123.createElement(Tooltip8, { label: "You need to apply to be a service agent first", disabled: canAccessClaims, position: "left", withArrow: true }, /* @__PURE__ */ React123.createElement(ActionIcon15, { variant: "subtle", size: "lg", onClick: handleClick, disabled: !canAccessClaims, style: { cursor: canAccessClaims ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React123.createElement(IconArrowRight2, { size: 20 })))));
10236
10394
  };
10237
10395
  var ClaimCollectionsList = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
10238
- console.log("[ClaimCollectionsList] RENDER START", {
10239
- collectionsCount: collections.length,
10240
- deedId,
10241
- adminAddress,
10242
- userAddress
10243
- });
10244
- const { getUserRoles } = useBlocknoteHandlers();
10245
- const getUserRolesRef = useRef4(getUserRoles);
10246
- useEffect23(() => {
10247
- getUserRolesRef.current = getUserRoles;
10248
- }, [getUserRoles]);
10249
- console.log("[ClaimCollectionsList] getUserRoles handler obtained");
10250
- const [userRoles, setUserRoles] = useState34({});
10251
- const [loadingRoles, setLoadingRoles] = useState34(true);
10252
- console.log("[ClaimCollectionsList] State:", { userRoles, loadingRoles });
10253
- const failedRequestKeyRef = useRef4(null);
10254
- console.log("[ClaimCollectionsList] Creating collectionIdsKey useMemo...");
10255
- const collectionIdsKey = useMemo22(() => {
10256
- const key = collections.map((c) => c.id).sort().join("|");
10257
- console.log("[ClaimCollectionsList] collectionIdsKey computed:", key);
10258
- return key;
10259
- }, [collections]);
10260
- console.log("[ClaimCollectionsList] Creating requestKey useMemo...");
10261
- const requestKey = useMemo22(() => {
10262
- const key = [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|");
10263
- console.log("[ClaimCollectionsList] requestKey computed:", key);
10264
- return key;
10265
- }, [userAddress, adminAddress, deedId, collectionIdsKey]);
10266
- useEffect23(() => {
10267
- console.log("[ClaimCollectionsList] useEffect TRIGGERED");
10268
- let isMounted = true;
10269
- const setEmptyRoles = () => {
10270
- console.log("[ClaimCollectionsList] setEmptyRoles called");
10271
- const rolesMap = {};
10272
- collections.forEach((collection) => {
10273
- rolesMap[collection.id] = null;
10274
- });
10275
- if (isMounted) {
10276
- console.log("[ClaimCollectionsList] Setting empty roles map");
10277
- setUserRoles(rolesMap);
10278
- }
10279
- };
10280
- const fetchUserRoles = async () => {
10281
- console.log("[ClaimCollectionsList] fetchUserRoles CALLED");
10282
- if (!collections.length || !userAddress || !adminAddress) {
10283
- console.log("[ClaimCollectionsList] EARLY RETURN - missing data", { collectionsLength: collections.length, userAddress, adminAddress });
10284
- setLoadingRoles(false);
10285
- return;
10286
- }
10287
- if (!requestKey || failedRequestKeyRef.current === requestKey) {
10288
- console.log("[ClaimCollectionsList] EARLY RETURN - no requestKey or failed request", { requestKey, failedKey: failedRequestKeyRef.current });
10289
- setLoadingRoles(false);
10290
- return;
10291
- }
10292
- const getUserRolesFn = getUserRolesRef.current;
10293
- if (typeof getUserRolesFn !== "function") {
10294
- console.log("[ClaimCollectionsList] getUserRoles is not a function");
10295
- setEmptyRoles();
10296
- setLoadingRoles(false);
10297
- return;
10298
- }
10299
- try {
10300
- console.log("[ClaimCollectionsList] Setting loadingRoles=true");
10301
- setLoadingRoles(true);
10302
- console.log("[ClaimCollectionsList] Calling getUserRoles handler...");
10303
- const roles = await getUserRolesFn({
10304
- userAddress,
10305
- adminAddress,
10306
- deedDid: deedId,
10307
- collectionIds: collections.map((c) => c.id)
10308
- });
10309
- console.log("[ClaimCollectionsList] getUserRoles response:", roles);
10310
- if (!roles) {
10311
- alert("Error in ClaimCollectionsList.tsx:147 - getUserRoles() returned no data");
10312
- }
10313
- console.log("[ClaimCollectionsList] Building roles map...");
10314
- const rolesMap = {};
10315
- collections.forEach((collection) => {
10316
- const roleData = roles?.find((r) => r.collectionId === collection.id);
10317
- rolesMap[collection.id] = roleData?.role || null;
10318
- });
10319
- console.log("[ClaimCollectionsList] Roles map built:", rolesMap);
10320
- if (isMounted) {
10321
- console.log("[ClaimCollectionsList] Setting user roles state");
10322
- setUserRoles(rolesMap);
10323
- }
10324
- } catch (error) {
10325
- console.log("[ClaimCollectionsList] getUserRoles ERROR:", error);
10326
- const errorMsg = error instanceof Error ? error.message : String(error);
10327
- alert(`Error in ClaimCollectionsList.tsx:147 - getUserRoles() failed: ${errorMsg}`);
10328
- if (isClientFulfillmentError(error)) {
10329
- console.log("[ClaimCollectionsList] Client fulfillment error - caching failed request");
10330
- failedRequestKeyRef.current = requestKey;
10331
- } else {
10332
- console.log("[ClaimCollectionsList] Not a client fulfillment error");
10333
- failedRequestKeyRef.current = null;
10334
- }
10335
- setEmptyRoles();
10336
- } finally {
10337
- if (isMounted) {
10338
- console.log("[ClaimCollectionsList] Setting loadingRoles=false");
10339
- setLoadingRoles(false);
10340
- }
10341
- }
10342
- };
10343
- fetchUserRoles();
10344
- return () => {
10345
- console.log("[ClaimCollectionsList] useEffect CLEANUP");
10346
- isMounted = false;
10347
- };
10348
- }, [collections, userAddress, adminAddress, deedId, requestKey]);
10396
+ const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
10349
10397
  if (!collections?.length) {
10350
- console.log("[ClaimCollectionsList] RENDER: No collections found");
10351
10398
  return /* @__PURE__ */ React123.createElement(Text61, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
10352
10399
  }
10353
10400
  if (loadingRoles) {
10354
- console.log("[ClaimCollectionsList] RENDER: Loading roles...");
10355
10401
  return /* @__PURE__ */ React123.createElement(Center4, { py: "md" }, /* @__PURE__ */ React123.createElement(Loader10, { size: "sm" }));
10356
10402
  }
10357
- console.log("[ClaimCollectionsList] RENDER: Rendering collection items", { collectionsCount: collections.length });
10358
- return /* @__PURE__ */ React123.createElement(Stack87, { gap: "md", px: 5 }, collections.map((collection) => {
10359
- console.log("[ClaimCollectionsList] Rendering CollectionItem:", collection.id);
10360
- return /* @__PURE__ */ React123.createElement(
10361
- CollectionItem,
10362
- {
10363
- key: collection.id,
10364
- collection,
10365
- deedId,
10366
- adminAddress,
10367
- userRole: userRoles[collection.id] || null,
10368
- onRefresh
10369
- }
10370
- );
10371
- }));
10403
+ return /* @__PURE__ */ React123.createElement(Stack87, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React123.createElement(CollectionItem, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
10372
10404
  };
10373
10405
 
10374
10406
  // src/mantine/blocks/claim/flow/FlowView.tsx
10375
10407
  var CLAIM_FLOW_PANEL_ID = "claim-flow-panel";
10376
10408
  var ClaimFlowView = ({ editor, block }) => {
10377
- console.log("[FlowView] RENDER START", { blockId: block.id });
10378
10409
  const { editable } = useBlocknoteContext();
10379
- console.log("[FlowView] editable:", editable);
10380
- const { getCurrentUser, getClaimCollections } = useBlocknoteHandlers();
10381
- console.log("[FlowView] handlers obtained");
10382
- const getClaimCollectionsRef = useRef5(getClaimCollections);
10383
- useEffect24(() => {
10384
- getClaimCollectionsRef.current = getClaimCollections;
10385
- }, [getClaimCollections]);
10386
- let currentUser;
10387
- try {
10388
- console.log("[FlowView] Calling getCurrentUser...");
10389
- currentUser = getCurrentUser();
10390
- console.log("[FlowView] getCurrentUser result:", currentUser);
10391
- if (!currentUser) {
10392
- alert("Error in FlowView.tsx:16 - getCurrentUser() returned no data");
10393
- currentUser = { address: "" };
10394
- }
10395
- } catch (err) {
10396
- console.log("[FlowView] getCurrentUser ERROR:", err);
10397
- alert(`Error in FlowView.tsx:16 - getCurrentUser() failed: ${err instanceof Error ? err.message : String(err)}`);
10398
- currentUser = { address: "" };
10399
- }
10400
- const [collections, setCollections] = useState35([]);
10401
- const [loading, setLoading] = useState35(false);
10402
- const [error, setError] = useState35(null);
10403
- console.log("[FlowView] State initialized", { collectionsCount: collections.length, loading, error });
10410
+ const userAddress = useCurrentUser();
10404
10411
  const panelId = `${CLAIM_FLOW_PANEL_ID}-${block.id}`;
10405
- console.log("[FlowView] Creating panelContent useMemo...");
10406
- const panelContent = useMemo23(() => {
10407
- console.log("[FlowView] panelContent useMemo EXECUTING");
10408
- return /* @__PURE__ */ React124.createElement(TemplateConfig6, { editor, block });
10409
- }, [editor, block]);
10410
- console.log("[FlowView] Calling usePanel with panelId:", panelId);
10412
+ const panelContent = useMemo25(() => /* @__PURE__ */ React124.createElement(TemplateConfig6, { editor, block }), [editor, block]);
10411
10413
  const { open } = usePanel(panelId, panelContent);
10412
- console.log("[FlowView] usePanel returned");
10413
- const selectedCollectionIds = useMemo23(() => {
10414
- console.log("[FlowView] selectedCollectionIds useMemo EXECUTING");
10414
+ const selectedCollectionIds = useMemo25(() => {
10415
10415
  try {
10416
10416
  const parsed = JSON.parse(block.props.selectedCollections || "[]");
10417
- console.log("[FlowView] selectedCollectionIds parsed:", parsed);
10418
- return parsed;
10417
+ return Array.isArray(parsed) ? parsed : [];
10419
10418
  } catch {
10420
- console.log("[FlowView] selectedCollectionIds parse error, returning []");
10421
10419
  return [];
10422
10420
  }
10423
10421
  }, [block.props.selectedCollections]);
10424
- const selectedCollectionIdsKey = useMemo23(() => [...selectedCollectionIds].sort().join("|"), [selectedCollectionIds]);
10425
10422
  const did = block.props.deedDid;
10426
10423
  const adminAddress = block.props.adminAddress || "";
10427
- console.log("[FlowView] Block props:", { did, adminAddress, selectedCollectionIds });
10428
- const [fetchedAdminAddress, setFetchedAdminAddress] = useState35(null);
10429
- const fetchCollections = useCallback23(async () => {
10430
- console.log("[FlowView] fetchCollections CALLED", { did, selectedCollectionIdsLength: selectedCollectionIds.length });
10431
- if (!did || selectedCollectionIds.length === 0) {
10432
- console.log("[FlowView] fetchCollections EARLY RETURN (no did or collections)");
10433
- setCollections([]);
10434
- return;
10435
- }
10436
- console.log("[FlowView] fetchCollections setting loading=true");
10437
- setLoading(true);
10438
- setError(null);
10439
- try {
10440
- console.log("[FlowView] fetchCollections calling getClaimCollections...");
10441
- const response = await getClaimCollectionsRef.current({ deedDid: did });
10442
- console.log("[FlowView] getClaimCollections response:", response);
10443
- if (!response) {
10444
- console.log("[FlowView] getClaimCollections returned NO DATA");
10445
- alert("Error in FlowView.tsx:47 - getClaimCollections() returned no data");
10446
- setError("No data returned from getClaimCollections");
10447
- return;
10448
- }
10449
- const { adminAddress: responseAdminAddress, collections: allCollections } = response || { adminAddress: "", collections: [] };
10450
- console.log("[FlowView] Destructured response:", { adminAddress: responseAdminAddress, allCollectionsCount: allCollections?.length });
10451
- if (responseAdminAddress) {
10452
- console.log("[FlowView] Storing fetched adminAddress for block update");
10453
- setFetchedAdminAddress(responseAdminAddress);
10454
- }
10455
- const selectedCollections = (allCollections || []).filter((c) => selectedCollectionIds.includes(c?.id));
10456
- console.log("[FlowView] Filtered collections:", { selectedCount: selectedCollections.length });
10457
- console.log("[FlowView] Setting collections state...");
10458
- setCollections(selectedCollections);
10459
- console.log("[FlowView] Collections state SET");
10460
- } catch (err) {
10461
- console.log("[FlowView] getClaimCollections ERROR:", err);
10462
- const errorMsg = err instanceof Error ? err.message : "Failed to fetch collections";
10463
- alert(`Error in FlowView.tsx:47 - getClaimCollections() failed: ${errorMsg}`);
10464
- setError(errorMsg);
10465
- } finally {
10466
- console.log("[FlowView] fetchCollections setting loading=false");
10467
- setLoading(false);
10468
- }
10469
- }, [did, selectedCollectionIds, selectedCollectionIdsKey]);
10470
- useEffect24(() => {
10471
- if (fetchedAdminAddress && (!block.props.adminAddress || block.props.adminAddress === "")) {
10472
- console.log("[FlowView] useEffect updating block adminAddress:", fetchedAdminAddress);
10473
- editor.updateBlock(block, {
10474
- props: {
10475
- ...block.props,
10476
- adminAddress: fetchedAdminAddress
10477
- }
10478
- });
10479
- console.log("[FlowView] Block adminAddress updated in useEffect");
10480
- setFetchedAdminAddress(null);
10481
- }
10482
- }, [fetchedAdminAddress, block.props.adminAddress, editor, block]);
10483
- useEffect24(() => {
10484
- console.log("[FlowView] useEffect TRIGGERED - calling fetchCollections");
10485
- fetchCollections();
10486
- console.log("[FlowView] useEffect fetchCollections call COMPLETED");
10487
- }, [fetchCollections]);
10424
+ const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
10488
10425
  if (!did) {
10489
- console.log("[FlowView] RENDER: No DID - showing config message");
10490
10426
  return /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm", c: "dimmed" }, "Please configure the claim block in template mode first"));
10491
10427
  }
10492
10428
  if (selectedCollectionIds.length === 0) {
10493
- console.log("[FlowView] RENDER: No collections selected");
10494
10429
  return /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm", c: "dimmed" }, "No claim collections selected"));
10495
10430
  }
10496
- console.log("[FlowView] RENDER: Main view", { loading, error, collectionsCount: collections.length });
10497
- return /* @__PURE__ */ React124.createElement(Stack88, { w: "100%" }, /* @__PURE__ */ React124.createElement(Flex22, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React124.createElement(Title11, { order: 4 }, "Submit Claims"), /* @__PURE__ */ React124.createElement(Flex22, { gap: "xs" }, /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: fetchCollections, loading }, /* @__PURE__ */ React124.createElement(IconRefresh2, { size: 18 })), editable && /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React124.createElement(IconSettings3, { size: 18 })))), loading ? /* @__PURE__ */ React124.createElement(React124.Fragment, null, console.log("[FlowView] RENDER: Showing loader"), /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Loader11, { size: "md" }))) : error ? /* @__PURE__ */ React124.createElement(React124.Fragment, null, console.log("[FlowView] RENDER: Showing error"), /* @__PURE__ */ React124.createElement(Alert15, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React124.createElement(IconAlertCircle3, { size: 18 }) }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm" }, error))) : /* @__PURE__ */ React124.createElement(React124.Fragment, null, console.log("[FlowView] RENDER: Rendering ClaimCollectionsList"), /* @__PURE__ */ React124.createElement(ClaimCollectionsList, { collections, deedId: did, adminAddress, userAddress: currentUser.address, onRefresh: fetchCollections })));
10431
+ return /* @__PURE__ */ React124.createElement(Stack88, { w: "100%" }, /* @__PURE__ */ React124.createElement(Flex22, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React124.createElement(Title11, { order: 4 }, "Submit Claims"), /* @__PURE__ */ React124.createElement(Flex22, { gap: "xs" }, /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React124.createElement(IconRefresh2, { size: 18 })), editable && /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React124.createElement(IconSettings3, { size: 18 })))), loading ? /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Loader11, { size: "md" })) : error ? /* @__PURE__ */ React124.createElement(Alert15, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React124.createElement(IconAlertCircle3, { size: 18 }) }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm" }, error)) : /* @__PURE__ */ React124.createElement(ClaimCollectionsList, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
10498
10432
  };
10499
10433
 
10500
10434
  // src/mantine/blocks/claim/ClaimBlock.tsx
@@ -10533,14 +10467,14 @@ var ClaimBlockSpec = createReactBlockSpec8(
10533
10467
  );
10534
10468
 
10535
10469
  // src/mantine/blocks/bid/BidBlockSpec.tsx
10536
- import React137 from "react";
10470
+ import React141 from "react";
10537
10471
  import { createReactBlockSpec as createReactBlockSpec9 } from "@blocknote/react";
10538
10472
 
10539
10473
  // src/mantine/blocks/bid/BidBlock.tsx
10540
- import React136 from "react";
10474
+ import React140 from "react";
10541
10475
 
10542
10476
  // src/mantine/blocks/bid/template/TemplateView.tsx
10543
- import React130, { useMemo as useMemo25 } from "react";
10477
+ import React130, { useMemo as useMemo27 } from "react";
10544
10478
  import { Group as Group39, Stack as Stack89, Text as Text63, Badge as Badge17 } from "@mantine/core";
10545
10479
 
10546
10480
  // src/mantine/blocks/bid/template/TemplateConfig.tsx
@@ -10548,14 +10482,14 @@ import React129, { useCallback as useCallback25 } from "react";
10548
10482
  import { Paper as Paper14, CloseButton as CloseButton10, Title as Title12 } from "@mantine/core";
10549
10483
 
10550
10484
  // src/mantine/blocks/bid/template/GeneralTab.tsx
10551
- import React127, { useEffect as useEffect25, useState as useState36 } from "react";
10485
+ import React127, { useEffect as useEffect26, useState as useState37 } from "react";
10552
10486
  var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) => {
10553
- const [localTitle, setLocalTitle] = useState36(title || "");
10554
- const [localDescription, setLocalDescription] = useState36(description || "");
10555
- useEffect25(() => {
10487
+ const [localTitle, setLocalTitle] = useState37(title || "");
10488
+ const [localDescription, setLocalDescription] = useState37(description || "");
10489
+ useEffect26(() => {
10556
10490
  setLocalTitle(title || "");
10557
10491
  }, [title]);
10558
- useEffect25(() => {
10492
+ useEffect26(() => {
10559
10493
  setLocalDescription(description || "");
10560
10494
  }, [description]);
10561
10495
  return /* @__PURE__ */ React127.createElement(BaseSection, null, /* @__PURE__ */ React127.createElement(
@@ -10587,9 +10521,9 @@ var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) =
10587
10521
  };
10588
10522
 
10589
10523
  // src/mantine/blocks/bid/template/CollectionsTab.tsx
10590
- import React128, { useCallback as useCallback24, useMemo as useMemo24 } from "react";
10524
+ import React128, { useCallback as useCallback24, useMemo as useMemo26 } from "react";
10591
10525
  var CollectionsTab = ({ did, selectedCollections, adminAddress, onDidChange, onSelectedCollectionsChange, onAdminAddressChange }) => {
10592
- const parsedSelectedCollections = useMemo24(() => {
10526
+ const parsedSelectedCollections = useMemo26(() => {
10593
10527
  try {
10594
10528
  return JSON.parse(selectedCollections || "[]");
10595
10529
  } catch {
@@ -10704,9 +10638,9 @@ var TemplateConfig7 = ({ editor, block }) => {
10704
10638
  var BID_TEMPLATE_PANEL_ID = "bid-template-panel";
10705
10639
  var BidTemplateView = ({ editor, block }) => {
10706
10640
  const panelId = `${BID_TEMPLATE_PANEL_ID}-${block.id}`;
10707
- const panelContent = useMemo25(() => /* @__PURE__ */ React130.createElement(TemplateConfig7, { editor, block }), [editor, block]);
10641
+ const panelContent = useMemo27(() => /* @__PURE__ */ React130.createElement(TemplateConfig7, { editor, block }), [editor, block]);
10708
10642
  const { open } = usePanel(panelId, panelContent);
10709
- const selectedCollectionsCount = useMemo25(() => {
10643
+ const selectedCollectionsCount = useMemo27(() => {
10710
10644
  try {
10711
10645
  const parsed = JSON.parse(block.props.selectedCollections || "[]");
10712
10646
  return parsed.length;
@@ -10718,34 +10652,35 @@ var BidTemplateView = ({ editor, block }) => {
10718
10652
  return /* @__PURE__ */ React130.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React130.createElement(Badge17, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React130.createElement(Group39, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React130.createElement(Group39, { wrap: "nowrap", align: "center" }, getIcon("dollar-sign", "dollar-sign"), /* @__PURE__ */ React130.createElement(Stack89, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React130.createElement(Text63, { fw: 500, size: "sm", contentEditable: false }, "Bid Block"), /* @__PURE__ */ React130.createElement(Text63, { size: "xs", c: "dimmed", contentEditable: false }, block.props.did ? didDisplay : "Configure bid settings"), selectedCollectionsCount > 0 && /* @__PURE__ */ React130.createElement(Text63, { size: "xs", c: "blue", contentEditable: false }, selectedCollectionsCount, " collection", selectedCollectionsCount !== 1 ? "s" : "", " selected")))));
10719
10653
  };
10720
10654
 
10721
- // src/mantine/blocks/bid/flow/FlowView.tsx
10722
- import React135, { useState as useState41, useEffect as useEffect30, useMemo as useMemo30, useCallback as useCallback28, useRef as useRef7 } from "react";
10723
- import { Stack as Stack94, Text as Text68, Loader as Loader16, Center as Center8, Alert as Alert18, Title as Title15, Flex as Flex23, ActionIcon as ActionIcon19 } from "@mantine/core";
10655
+ // src/mantine/blocks/bid/flow/components/FlowView.tsx
10656
+ import React139, { useMemo as useMemo34 } from "react";
10657
+ import { Stack as Stack96, Text as Text70, Loader as Loader16, Center as Center8, Alert as Alert18, Title as Title16, Flex as Flex23, ActionIcon as ActionIcon19 } from "@mantine/core";
10724
10658
  import { IconSettings as IconSettings4, IconRefresh as IconRefresh3, IconAlertCircle as IconAlertCircle6 } from "@tabler/icons-react";
10725
10659
 
10726
- // src/mantine/blocks/bid/flow/ClaimCollectionsList.tsx
10727
- import React134, { useMemo as useMemo29, useState as useState40, useEffect as useEffect29, useRef as useRef6 } from "react";
10728
- import { Stack as Stack93, Text as Text67, Button as Button30, Menu as Menu2, Badge as Badge20, Collapse as Collapse5, Loader as Loader15, Center as Center7, ActionIcon as ActionIcon18 } from "@mantine/core";
10729
- import { IconChevronDown as IconChevronDown5, IconArrowDown as IconArrowDown3, IconArrowUp as IconArrowUp3 } from "@tabler/icons-react";
10660
+ // src/mantine/blocks/bid/flow/components/ClaimCollectionsList.tsx
10661
+ import React138 from "react";
10662
+ import { Stack as Stack95, Text as Text69, Loader as Loader15, Center as Center7 } from "@mantine/core";
10663
+
10664
+ // src/mantine/blocks/bid/flow/components/CollectionItem.tsx
10665
+ import React137, { useMemo as useMemo33 } from "react";
10666
+ import { Stack as Stack94, Text as Text68, Button as Button30, Menu as Menu2, Badge as Badge20, ActionIcon as ActionIcon18, Box as Box23 } from "@mantine/core";
10667
+ import { IconChevronDown as IconChevronDown5, IconArrowRight as IconArrowRight4 } from "@tabler/icons-react";
10730
10668
 
10731
- // src/mantine/blocks/bid/flow/BidSurveyPanel.tsx
10732
- import React131, { useMemo as useMemo26, useState as useState37, useEffect as useEffect26, useCallback as useCallback26 } from "react";
10669
+ // src/mantine/blocks/bid/flow/components/BidSurveyPanel.tsx
10670
+ import React131, { useMemo as useMemo29, useEffect as useEffect28 } from "react";
10733
10671
  import { Paper as Paper15, CloseButton as CloseButton11, Title as Title13, Loader as Loader12, Stack as Stack90, Text as Text64 } from "@mantine/core";
10734
- import { Survey as Survey2, SurveyModel as SurveyModel2 } from "@ixo/surveys";
10735
- var SURVEY_THEME_VARIABLES = Object.entries(surveyTheme.cssVariables ?? {}).reduce((acc, [key, value]) => {
10736
- acc[key] = value;
10737
- return acc;
10738
- }, {});
10739
- var SURVEY_THEME_BACKGROUND = SURVEY_THEME_VARIABLES["--sjs-general-backcolor"] ?? "#050505";
10740
- var SURVEY_THEME_FOREGROUND = SURVEY_THEME_VARIABLES["--sjs-general-forecolor"] ?? "#ffffff";
10741
- var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10742
- const { closePanel } = usePanelStore();
10672
+ import { Survey as Survey2 } from "@ixo/surveys";
10673
+
10674
+ // src/mantine/blocks/bid/flow/hooks/useBidSurvey.ts
10675
+ import { useState as useState38, useEffect as useEffect27, useMemo as useMemo28, useCallback as useCallback26 } from "react";
10676
+ import { SurveyModel as SurveyModel2 } from "@ixo/surveys";
10677
+ function useBidSurvey(deedId, collectionId, role, onSubmitComplete) {
10743
10678
  const handlers = useBlocknoteHandlers();
10744
- const [surveyJson, setSurveyJson] = useState37(null);
10745
- const [loading, setLoading] = useState37(true);
10746
- const [error, setError] = useState37(null);
10747
- const roleLabel = role === "service_agent" ? "Service Agent" : "Evaluation Agent";
10748
- useEffect26(() => {
10679
+ const { closePanel } = usePanelStore();
10680
+ const [surveyJson, setSurveyJson] = useState38(null);
10681
+ const [loading, setLoading] = useState38(true);
10682
+ const [error, setError] = useState38(null);
10683
+ useEffect27(() => {
10749
10684
  const fetchSurveyTemplate = async () => {
10750
10685
  try {
10751
10686
  setLoading(true);
@@ -10764,7 +10699,7 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10764
10699
  };
10765
10700
  fetchSurveyTemplate();
10766
10701
  }, [deedId, role, handlers]);
10767
- const surveyModel = useMemo26(() => {
10702
+ const surveyModel = useMemo28(() => {
10768
10703
  if (!surveyJson) return null;
10769
10704
  const model = new SurveyModel2(surveyJson);
10770
10705
  model.applyTheme(surveyTheme);
@@ -10772,16 +10707,6 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10772
10707
  model.questionsOnPageMode = "singlePage";
10773
10708
  return model;
10774
10709
  }, [surveyJson]);
10775
- const surveyContainerStyle = useMemo26(
10776
- () => ({
10777
- flex: 1,
10778
- overflow: "auto",
10779
- backgroundColor: SURVEY_THEME_BACKGROUND,
10780
- color: SURVEY_THEME_FOREGROUND,
10781
- ...SURVEY_THEME_VARIABLES
10782
- }),
10783
- []
10784
- );
10785
10710
  const handleSurveyComplete = useCallback26(
10786
10711
  async (sender) => {
10787
10712
  const surveyData = sender.data;
@@ -10800,7 +10725,49 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10800
10725
  },
10801
10726
  [handlers, collectionId, role, closePanel, onSubmitComplete]
10802
10727
  );
10803
- useEffect26(() => {
10728
+ return {
10729
+ surveyModel,
10730
+ loading,
10731
+ error,
10732
+ handleSurveyComplete
10733
+ };
10734
+ }
10735
+
10736
+ // src/mantine/blocks/bid/flow/constants.ts
10737
+ var ROLE_CONFIG = {
10738
+ service_agent: { color: "blue", label: "Service Agent" },
10739
+ SA: { color: "blue", label: "Service Agent" },
10740
+ evaluation_agent: { color: "green", label: "Evaluation Agent" },
10741
+ EA: { color: "green", label: "Evaluation Agent" }
10742
+ };
10743
+ var STATUS_CONFIG = {
10744
+ pending: { color: "yellow", label: "Pending" },
10745
+ approved: { color: "green", label: "Approved" },
10746
+ rejected: { color: "red", label: "Rejected" }
10747
+ };
10748
+ var SURVEY_THEME_VARIABLES = Object.entries(surveyTheme.cssVariables ?? {}).reduce((acc, [key, value]) => {
10749
+ acc[key] = value;
10750
+ return acc;
10751
+ }, {});
10752
+ var SURVEY_THEME_BACKGROUND = SURVEY_THEME_VARIABLES["--sjs-general-backcolor"] ?? "#050505";
10753
+ var SURVEY_THEME_FOREGROUND = SURVEY_THEME_VARIABLES["--sjs-general-forecolor"] ?? "#ffffff";
10754
+
10755
+ // src/mantine/blocks/bid/flow/components/BidSurveyPanel.tsx
10756
+ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10757
+ const { closePanel } = usePanelStore();
10758
+ const { surveyModel, loading, error, handleSurveyComplete } = useBidSurvey(deedId, collectionId, role, onSubmitComplete);
10759
+ const roleLabel = role === "service_agent" ? "Service Agent" : "Evaluation Agent";
10760
+ const surveyContainerStyle = useMemo29(
10761
+ () => ({
10762
+ flex: 1,
10763
+ overflow: "auto",
10764
+ backgroundColor: SURVEY_THEME_BACKGROUND,
10765
+ color: SURVEY_THEME_FOREGROUND,
10766
+ ...SURVEY_THEME_VARIABLES
10767
+ }),
10768
+ []
10769
+ );
10770
+ useEffect28(() => {
10804
10771
  if (surveyModel) {
10805
10772
  surveyModel.onComplete.add(handleSurveyComplete);
10806
10773
  return () => {
@@ -10837,33 +10804,69 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
10837
10804
  );
10838
10805
  };
10839
10806
 
10840
- // src/mantine/blocks/bid/flow/BidsList.tsx
10841
- import React133, { useState as useState39, useEffect as useEffect28, useMemo as useMemo28, useCallback as useCallback27 } from "react";
10842
- import { Stack as Stack92, Text as Text66, Loader as Loader14, Center as Center6, Alert as Alert17, Badge as Badge19, Group as Group41, ActionIcon as ActionIcon17 } from "@mantine/core";
10843
- import { IconAlertCircle as IconAlertCircle5, IconArrowRight as IconArrowRight3 } from "@tabler/icons-react";
10807
+ // src/mantine/blocks/bid/flow/components/BidsList.tsx
10808
+ import React134, { useCallback as useCallback29 } from "react";
10809
+ import { Stack as Stack93, Text as Text67, Loader as Loader14, Center as Center6, Alert as Alert17, Paper as Paper17, CloseButton as CloseButton13, Title as Title15 } from "@mantine/core";
10810
+ import { IconAlertCircle as IconAlertCircle5 } from "@tabler/icons-react";
10844
10811
 
10845
- // src/mantine/blocks/bid/flow/BidViewPanel.tsx
10846
- import React132, { useMemo as useMemo27, useState as useState38, useEffect as useEffect27 } from "react";
10812
+ // src/mantine/blocks/bid/flow/components/BidItem.tsx
10813
+ import React133, { useMemo as useMemo32 } from "react";
10814
+ import { Stack as Stack92, Text as Text66, Badge as Badge19, Group as Group41, ActionIcon as ActionIcon17 } from "@mantine/core";
10815
+ import { IconArrowRight as IconArrowRight3 } from "@tabler/icons-react";
10816
+
10817
+ // src/mantine/blocks/bid/flow/components/BidViewPanel.tsx
10818
+ import React132, { useMemo as useMemo31, useState as useState41 } from "react";
10847
10819
  import { Paper as Paper16, CloseButton as CloseButton12, Title as Title14, Loader as Loader13, Stack as Stack91, Text as Text65, Badge as Badge18, Button as Button29, Group as Group40, Modal as Modal2, Alert as Alert16 } from "@mantine/core";
10848
- import { Survey as Survey3, SurveyModel as SurveyModel3 } from "@ixo/surveys";
10820
+ import { Survey as Survey3 } from "@ixo/surveys";
10849
10821
  import { IconCheck as IconCheck2, IconX as IconX4, IconAlertCircle as IconAlertCircle4 } from "@tabler/icons-react";
10850
- var SURVEY_THEME_VARIABLES2 = Object.entries(surveyTheme.cssVariables ?? {}).reduce((acc, [key, value]) => {
10851
- acc[key] = value;
10852
- return acc;
10853
- }, {});
10854
- var SURVEY_THEME_BACKGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-backcolor"] ?? "#050505";
10855
- var SURVEY_THEME_FOREGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-forecolor"] ?? "#ffffff";
10856
- var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
10857
- const { closePanel } = usePanelStore();
10822
+
10823
+ // src/mantine/blocks/bid/flow/hooks/useBidView.ts
10824
+ import { useState as useState39, useEffect as useEffect29, useMemo as useMemo30 } from "react";
10825
+ import { SurveyModel as SurveyModel3 } from "@ixo/surveys";
10826
+
10827
+ // src/mantine/blocks/bid/flow/utils.ts
10828
+ function formatDate(dateString) {
10829
+ try {
10830
+ const date = new Date(dateString);
10831
+ return date.toLocaleDateString(void 0, {
10832
+ year: "numeric",
10833
+ month: "short",
10834
+ day: "numeric"
10835
+ });
10836
+ } catch {
10837
+ return dateString;
10838
+ }
10839
+ }
10840
+ function getRoleLabel(role) {
10841
+ return ROLE_CONFIG[role]?.label || role;
10842
+ }
10843
+ function getRoleColor(role) {
10844
+ return ROLE_CONFIG[role]?.color || "gray";
10845
+ }
10846
+ function getStatusLabel(status) {
10847
+ return STATUS_CONFIG[status]?.label || status;
10848
+ }
10849
+ function getStatusColor(status) {
10850
+ return STATUS_CONFIG[status]?.color || "gray";
10851
+ }
10852
+ function getCollectionName(collection) {
10853
+ return collection.protocol?.profile?.name || collection.name || "Unnamed Collection";
10854
+ }
10855
+ function parseBidData(data) {
10856
+ try {
10857
+ return typeof data === "string" ? JSON.parse(data) : data;
10858
+ } catch {
10859
+ return data;
10860
+ }
10861
+ }
10862
+
10863
+ // src/mantine/blocks/bid/flow/hooks/useBidView.ts
10864
+ function useBidView(bid, deedId) {
10858
10865
  const handlers = useBlocknoteHandlers();
10859
- const [surveyJson, setSurveyJson] = useState38(null);
10860
- const [loading, setLoading] = useState38(true);
10861
- const [error, setError] = useState38(null);
10862
- const [actionLoading, setActionLoading] = useState38(false);
10863
- const [actionError, setActionError] = useState38(null);
10864
- const [rejectModalOpen, setRejectModalOpen] = useState38(false);
10865
- const [rejectReason, setRejectReason] = useState38("");
10866
- useEffect27(() => {
10866
+ const [surveyJson, setSurveyJson] = useState39(null);
10867
+ const [loading, setLoading] = useState39(true);
10868
+ const [error, setError] = useState39(null);
10869
+ useEffect29(() => {
10867
10870
  const fetchSurveyTemplate = async () => {
10868
10871
  try {
10869
10872
  setLoading(true);
@@ -10891,51 +10894,30 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
10891
10894
  };
10892
10895
  fetchSurveyTemplate();
10893
10896
  }, [deedId, bid.role, handlers]);
10894
- const surveyModel = useMemo27(() => {
10897
+ const surveyModel = useMemo30(() => {
10895
10898
  if (!surveyJson) return null;
10896
10899
  const model = new SurveyModel3(surveyJson);
10897
10900
  model.applyTheme(surveyTheme);
10898
10901
  model.showQuestionNumbers = "off";
10899
10902
  model.questionsOnPageMode = "singlePage";
10900
10903
  model.mode = "display";
10901
- let bidData;
10902
- try {
10903
- bidData = typeof bid.data === "string" ? JSON.parse(bid.data) : bid.data;
10904
- } catch {
10905
- bidData = bid.data;
10906
- }
10907
- model.data = bidData;
10904
+ model.data = parseBidData(bid.data);
10908
10905
  return model;
10909
10906
  }, [surveyJson, bid.data]);
10910
- const surveyContainerStyle = useMemo27(
10911
- () => ({
10912
- flex: 1,
10913
- overflow: "auto",
10914
- backgroundColor: SURVEY_THEME_BACKGROUND2,
10915
- color: SURVEY_THEME_FOREGROUND2,
10916
- ...SURVEY_THEME_VARIABLES2
10917
- }),
10918
- []
10919
- );
10920
- const getRoleLabel = (role) => {
10921
- if (role === "service_agent" || role === "SA") return "Service Agent";
10922
- if (role === "evaluation_agent" || role === "EA") return "Evaluation Agent";
10923
- return role;
10924
- };
10925
- const getRoleBadge = (role) => {
10926
- const roleConfig = {
10927
- service_agent: { color: "blue", label: "Service Agent" },
10928
- SA: { color: "blue", label: "Service Agent" },
10929
- evaluation_agent: { color: "green", label: "Evaluation Agent" },
10930
- EA: { color: "green", label: "Evaluation Agent" }
10931
- };
10932
- const config = roleConfig[role] || { color: "gray", label: role };
10933
- return /* @__PURE__ */ React132.createElement(Badge18, { size: "sm", color: config.color }, config.label);
10934
- };
10935
- const handleApproveBid = async () => {
10907
+ return { surveyModel, loading, error };
10908
+ }
10909
+
10910
+ // src/mantine/blocks/bid/flow/hooks/useBidActions.ts
10911
+ import { useState as useState40, useCallback as useCallback27 } from "react";
10912
+ function useBidActions(bid, deedId, adminAddress, onRefresh) {
10913
+ const handlers = useBlocknoteHandlers();
10914
+ const { closePanel } = usePanelStore();
10915
+ const [loading, setLoading] = useState40(false);
10916
+ const [error, setError] = useState40(null);
10917
+ const approveBid = useCallback27(async () => {
10936
10918
  try {
10937
- setActionLoading(true);
10938
- setActionError(null);
10919
+ setLoading(true);
10920
+ setError(null);
10939
10921
  if (bid.role === "service_agent" || bid.role === "SA") {
10940
10922
  await handlers.approveServiceAgentApplication({
10941
10923
  adminAddress,
@@ -10963,39 +10945,67 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
10963
10945
  closePanel();
10964
10946
  onRefresh?.();
10965
10947
  } catch (err) {
10966
- setActionError(err instanceof Error ? err.message : "Failed to approve bid");
10948
+ setError(err instanceof Error ? err.message : "Failed to approve bid");
10967
10949
  } finally {
10968
- setActionLoading(false);
10969
- }
10970
- };
10971
- const handleRejectBid = async () => {
10972
- if (!rejectReason.trim()) {
10973
- setActionError("Please provide a reason for rejection");
10974
- return;
10975
- }
10976
- try {
10977
- setActionLoading(true);
10978
- setActionError(null);
10979
- await handlers.rejectBid({
10980
- bidId: bid.id,
10981
- collectionId: bid.collection,
10982
- did: deedId,
10983
- reason: rejectReason
10984
- });
10985
- setRejectModalOpen(false);
10986
- closePanel();
10987
- onRefresh?.();
10988
- } catch (err) {
10989
- setActionError(err instanceof Error ? err.message : "Failed to reject bid");
10990
- } finally {
10991
- setActionLoading(false);
10950
+ setLoading(false);
10992
10951
  }
10993
- };
10994
- const openRejectModal = () => {
10952
+ }, [bid, deedId, adminAddress, handlers, closePanel, onRefresh]);
10953
+ const rejectBid = useCallback27(
10954
+ async (reason) => {
10955
+ if (!reason.trim()) {
10956
+ setError("Please provide a reason for rejection");
10957
+ return;
10958
+ }
10959
+ try {
10960
+ setLoading(true);
10961
+ setError(null);
10962
+ await handlers.rejectBid({
10963
+ bidId: bid.id,
10964
+ collectionId: bid.collection,
10965
+ did: deedId,
10966
+ reason
10967
+ });
10968
+ closePanel();
10969
+ onRefresh?.();
10970
+ } catch (err) {
10971
+ setError(err instanceof Error ? err.message : "Failed to reject bid");
10972
+ } finally {
10973
+ setLoading(false);
10974
+ }
10975
+ },
10976
+ [bid, deedId, handlers, closePanel, onRefresh]
10977
+ );
10978
+ return { approveBid, rejectBid, loading, error, setError };
10979
+ }
10980
+
10981
+ // src/mantine/blocks/bid/flow/components/BidViewPanel.tsx
10982
+ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
10983
+ const { closePanel } = usePanelStore();
10984
+ const { surveyModel, loading, error } = useBidView(bid, deedId);
10985
+ const { approveBid, rejectBid, loading: actionLoading, error: actionError, setError: setActionError } = useBidActions(bid, deedId, adminAddress, onRefresh);
10986
+ const [rejectModalOpen, setRejectModalOpen] = useState41(false);
10987
+ const [rejectReason, setRejectReason] = useState41("");
10988
+ const surveyContainerStyle = useMemo31(
10989
+ () => ({
10990
+ flex: 1,
10991
+ overflow: "auto",
10992
+ backgroundColor: SURVEY_THEME_BACKGROUND,
10993
+ color: SURVEY_THEME_FOREGROUND,
10994
+ ...SURVEY_THEME_VARIABLES
10995
+ }),
10996
+ []
10997
+ );
10998
+ const handleRejectClick = () => {
10995
10999
  setRejectReason("");
10996
11000
  setActionError(null);
10997
11001
  setRejectModalOpen(true);
10998
11002
  };
11003
+ const handleRejectConfirm = async () => {
11004
+ await rejectBid(rejectReason);
11005
+ if (!actionError) {
11006
+ setRejectModalOpen(false);
11007
+ }
11008
+ };
10999
11009
  return /* @__PURE__ */ React132.createElement(
11000
11010
  Paper16,
11001
11011
  {
@@ -11017,81 +11027,61 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
11017
11027
  marginBottom: "1rem"
11018
11028
  }
11019
11029
  },
11020
- /* @__PURE__ */ React132.createElement(Stack91, { gap: "xs" }, /* @__PURE__ */ React132.createElement(Title14, { order: 3 }, getRoleLabel(bid.role), " Bid"), getRoleBadge(bid.role)),
11030
+ /* @__PURE__ */ React132.createElement(Stack91, { gap: "xs" }, /* @__PURE__ */ React132.createElement(Title14, { order: 3 }, getRoleLabel(bid.role), " Bid"), /* @__PURE__ */ React132.createElement(Badge18, { size: "sm", color: getRoleColor(bid.role) }, getRoleLabel(bid.role))),
11021
11031
  /* @__PURE__ */ React132.createElement(CloseButton12, { onClick: closePanel })
11022
11032
  ),
11023
- !loading && !error && /* @__PURE__ */ React132.createElement(Stack91, { gap: "md", mb: "md" }, actionError && /* @__PURE__ */ React132.createElement(Alert16, { color: "red", icon: /* @__PURE__ */ React132.createElement(IconAlertCircle4, { size: 16 }), onClose: () => setActionError(null), withCloseButton: true }, actionError), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", color: "red", leftSection: /* @__PURE__ */ React132.createElement(IconX4, { size: 16 }), onClick: openRejectModal, loading: actionLoading, disabled: actionLoading }, "Reject"), /* @__PURE__ */ React132.createElement(Button29, { variant: "filled", color: "green", leftSection: /* @__PURE__ */ React132.createElement(IconCheck2, { size: 16 }), onClick: handleApproveBid, loading: actionLoading, disabled: actionLoading }, "Approve"))),
11033
+ !loading && !error && /* @__PURE__ */ React132.createElement(Stack91, { gap: "md", mb: "md" }, actionError && /* @__PURE__ */ React132.createElement(Alert16, { color: "red", icon: /* @__PURE__ */ React132.createElement(IconAlertCircle4, { size: 16 }), onClose: () => setActionError(null), withCloseButton: true }, actionError), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", color: "red", leftSection: /* @__PURE__ */ React132.createElement(IconX4, { size: 16 }), onClick: handleRejectClick, loading: actionLoading, disabled: actionLoading }, "Reject"), /* @__PURE__ */ React132.createElement(Button29, { variant: "filled", color: "green", leftSection: /* @__PURE__ */ React132.createElement(IconCheck2, { size: 16 }), onClick: approveBid, loading: actionLoading, disabled: actionLoading }, "Approve"))),
11024
11034
  /* @__PURE__ */ React132.createElement("div", { style: surveyContainerStyle }, loading && /* @__PURE__ */ React132.createElement(Stack91, { align: "center", justify: "center", style: { height: "100%" } }, /* @__PURE__ */ React132.createElement(Loader13, { size: "lg" }), /* @__PURE__ */ React132.createElement(Text65, { size: "sm", c: "dimmed" }, "Loading bid details...")), error && /* @__PURE__ */ React132.createElement(Stack91, { align: "center", justify: "center", style: { height: "100%", padding: "1rem" } }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm", c: "red" }, error)), !loading && !error && surveyModel && /* @__PURE__ */ React132.createElement(Survey3, { model: surveyModel })),
11025
- /* @__PURE__ */ React132.createElement(Modal2, { opened: rejectModalOpen, onClose: () => setRejectModalOpen(false), title: "Reject Bid", centered: true }, /* @__PURE__ */ React132.createElement(Stack91, { gap: "md" }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm" }, "Please provide a reason for rejecting this bid:"), /* @__PURE__ */ React132.createElement(BaseTextArea, { placeholder: "Enter rejection reason...", value: rejectReason, onChange: (e) => setRejectReason(e.currentTarget.value), minRows: 3 }), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", onClick: () => setRejectModalOpen(false), disabled: actionLoading }, "Cancel"), /* @__PURE__ */ React132.createElement(Button29, { color: "red", onClick: handleRejectBid, loading: actionLoading, disabled: !rejectReason.trim() }, "Reject Bid"))))
11035
+ /* @__PURE__ */ React132.createElement(Modal2, { opened: rejectModalOpen, onClose: () => setRejectModalOpen(false), title: "Reject Bid", centered: true }, /* @__PURE__ */ React132.createElement(Stack91, { gap: "md" }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm" }, "Please provide a reason for rejecting this bid:"), /* @__PURE__ */ React132.createElement(BaseTextArea, { placeholder: "Enter rejection reason...", value: rejectReason, onChange: (e) => setRejectReason(e.currentTarget.value), minRows: 3 }), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", onClick: () => setRejectModalOpen(false), disabled: actionLoading }, "Cancel"), /* @__PURE__ */ React132.createElement(Button29, { color: "red", onClick: handleRejectConfirm, loading: actionLoading, disabled: !rejectReason.trim() }, "Reject Bid"))))
11026
11036
  );
11027
11037
  };
11028
11038
 
11029
- // src/mantine/blocks/bid/flow/BidsList.tsx
11030
- var BidItem = ({ bid, deedId, adminAddress, onRefresh }) => {
11039
+ // src/mantine/hooks/useUserProfile.ts
11040
+ import { useState as useState42, useEffect as useEffect30 } from "react";
11041
+ function useUserProfile(did) {
11031
11042
  const handlers = useBlocknoteHandlers();
11032
- const [userProfile, setUserProfile] = useState39(null);
11033
- const [loadingProfile, setLoadingProfile] = useState39(false);
11034
- useEffect28(() => {
11043
+ const [userProfile, setUserProfile] = useState42(null);
11044
+ const [loading, setLoading] = useState42(false);
11045
+ useEffect30(() => {
11035
11046
  const fetchUserProfile = async () => {
11036
- if (!bid.did) return;
11047
+ if (!did) return;
11037
11048
  try {
11038
- setLoadingProfile(true);
11039
- const profile = await handlers.getMatrixInfoPerDid(bid.did);
11049
+ setLoading(true);
11050
+ const profile = await handlers.getMatrixInfoPerDid(did);
11040
11051
  setUserProfile(profile || null);
11041
11052
  } catch (error) {
11042
11053
  setUserProfile(null);
11043
11054
  } finally {
11044
- setLoadingProfile(false);
11055
+ setLoading(false);
11045
11056
  }
11046
11057
  };
11047
11058
  fetchUserProfile();
11048
- }, [bid.did]);
11059
+ }, [did]);
11060
+ return { userProfile, loading };
11061
+ }
11062
+
11063
+ // src/mantine/blocks/bid/flow/components/BidItem.tsx
11064
+ var BidItem = ({ bid, deedId, adminAddress, onRefresh }) => {
11065
+ const { userProfile, loading: loadingProfile } = useUserProfile(bid.did);
11049
11066
  const bidPanelId = `bid-view-${bid.id}`;
11050
- const bidPanelContent = useMemo28(() => /* @__PURE__ */ React133.createElement(BidViewPanel, { bid, deedId, adminAddress, onRefresh }), [bid, deedId, adminAddress, onRefresh]);
11067
+ const bidPanelContent = useMemo32(() => /* @__PURE__ */ React133.createElement(BidViewPanel, { bid, deedId, adminAddress, onRefresh }), [bid, deedId, adminAddress, onRefresh]);
11051
11068
  const { open: openBidPanel } = usePanel(bidPanelId, bidPanelContent);
11052
11069
  const displayName = userProfile?.displayname || bid.did;
11053
- const getRoleBadge = (role) => {
11054
- const roleConfig = {
11055
- service_agent: { color: "blue", label: "Service Agent" },
11056
- SA: { color: "blue", label: "Service Agent" },
11057
- evaluation_agent: { color: "green", label: "Evaluation Agent" },
11058
- EA: { color: "green", label: "Evaluation Agent" }
11059
- };
11060
- const config = roleConfig[role] || { color: "gray", label: role };
11061
- return /* @__PURE__ */ React133.createElement(Badge19, { size: "xs", variant: "light", color: config.color }, config.label);
11062
- };
11063
- const getStatusBadge = (status) => {
11064
- const statusConfig = {
11065
- pending: { color: "yellow", label: "Pending" },
11066
- approved: { color: "green", label: "Approved" },
11067
- rejected: { color: "red", label: "Rejected" }
11068
- };
11069
- const config = statusConfig[status] || { color: "gray", label: status };
11070
- return /* @__PURE__ */ React133.createElement(Badge19, { size: "sm", color: config.color }, config.label);
11071
- };
11072
- const formatDate = (dateString) => {
11073
- try {
11074
- const date = new Date(dateString);
11075
- return date.toLocaleDateString(void 0, {
11076
- year: "numeric",
11077
- month: "short",
11078
- day: "numeric"
11079
- });
11080
- } catch {
11081
- return dateString;
11082
- }
11083
- };
11084
11070
  const displayDate = bid.created || "";
11085
11071
  const displayStatus = bid.status;
11086
11072
  const displayReason = bid.reason;
11087
- return /* @__PURE__ */ React133.createElement(ListItemContainer, null, /* @__PURE__ */ React133.createElement(Stack92, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, /* @__PURE__ */ React133.createElement(Text66, { size: "xs", fw: 500 }, loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"), getRoleBadge(bid.role)), /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(displayDate)), displayStatus === "rejected" && displayReason && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "red" }, "Reason: ", displayReason)), /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, displayStatus && getStatusBadge(displayStatus), /* @__PURE__ */ React133.createElement(ActionIcon17, { variant: "subtle", size: "lg", onClick: openBidPanel }, /* @__PURE__ */ React133.createElement(IconArrowRight3, { size: 20 }))));
11073
+ return /* @__PURE__ */ React133.createElement(ListItemContainer, { isChecked: false, onClick: () => {
11074
+ } }, /* @__PURE__ */ React133.createElement(Stack92, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, /* @__PURE__ */ React133.createElement(Text66, { size: "xs", fw: 500 }, loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"), /* @__PURE__ */ React133.createElement(Badge19, { size: "xs", variant: "light", color: getRoleColor(bid.role) }, getRoleLabel(bid.role))), /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(displayDate)), displayStatus === "rejected" && displayReason && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "red" }, "Reason: ", displayReason)), /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, displayStatus && /* @__PURE__ */ React133.createElement(Badge19, { size: "sm", color: getStatusColor(displayStatus) }, getStatusLabel(displayStatus)), /* @__PURE__ */ React133.createElement(ActionIcon17, { variant: "subtle", size: "lg", onClick: openBidPanel }, /* @__PURE__ */ React133.createElement(IconArrowRight3, { size: 20 }))));
11088
11075
  };
11089
- var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
11076
+
11077
+ // src/mantine/blocks/bid/flow/hooks/useBids.ts
11078
+ import { useState as useState43, useEffect as useEffect31, useCallback as useCallback28 } from "react";
11079
+ function useBids(collectionId) {
11090
11080
  const handlers = useBlocknoteHandlers();
11091
- const [bids, setBids] = useState39([]);
11092
- const [loading, setLoading] = useState39(true);
11093
- const [error, setError] = useState39(null);
11094
- const fetchBids = useCallback27(async () => {
11081
+ const [bids, setBids] = useState43([]);
11082
+ const [loading, setLoading] = useState43(true);
11083
+ const [error, setError] = useState43(null);
11084
+ const fetchBids = useCallback28(async () => {
11095
11085
  if (!collectionId) {
11096
11086
  setLoading(false);
11097
11087
  return;
@@ -11108,186 +11098,187 @@ var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
11108
11098
  setLoading(false);
11109
11099
  }
11110
11100
  }, [collectionId]);
11111
- useEffect28(() => {
11101
+ useEffect31(() => {
11112
11102
  fetchBids();
11113
11103
  }, [fetchBids]);
11114
- const handleRefresh = useCallback27(() => {
11115
- fetchBids();
11104
+ return { bids, loading, error, refetch: fetchBids };
11105
+ }
11106
+
11107
+ // src/mantine/blocks/bid/flow/components/BidsList.tsx
11108
+ var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
11109
+ const { closePanel } = usePanelStore();
11110
+ const { bids, loading, error, refetch } = useBids(collectionId);
11111
+ const handleRefresh = useCallback29(() => {
11112
+ refetch();
11116
11113
  onRefresh();
11117
- }, [fetchBids, onRefresh]);
11118
- if (loading) {
11119
- return /* @__PURE__ */ React133.createElement(Center6, { py: "md" }, /* @__PURE__ */ React133.createElement(Loader14, { size: "sm" }));
11120
- }
11121
- if (error) {
11122
- return /* @__PURE__ */ React133.createElement(Alert17, { color: "red", icon: /* @__PURE__ */ React133.createElement(IconAlertCircle5, { size: 16 }), py: "xs" }, /* @__PURE__ */ React133.createElement(Text66, { size: "xs" }, error));
11123
- }
11124
- if (!bids || bids.length === 0) {
11125
- return /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "dimmed", ta: "center", py: "sm" }, "No bids submitted yet");
11126
- }
11127
- return /* @__PURE__ */ React133.createElement(Stack92, { gap: "xs", pl: "md" }, bids.map((bid) => /* @__PURE__ */ React133.createElement(BidItem, { key: bid.id, bid, deedId, adminAddress, onRefresh: handleRefresh })));
11114
+ }, [refetch, onRefresh]);
11115
+ const renderContent = () => {
11116
+ if (loading) {
11117
+ return /* @__PURE__ */ React134.createElement(Center6, { py: "md" }, /* @__PURE__ */ React134.createElement(Loader14, { size: "sm" }));
11118
+ }
11119
+ if (error) {
11120
+ return /* @__PURE__ */ React134.createElement(Alert17, { color: "red", icon: /* @__PURE__ */ React134.createElement(IconAlertCircle5, { size: 16 }), py: "xs" }, /* @__PURE__ */ React134.createElement(Text67, { size: "xs" }, error));
11121
+ }
11122
+ if (!bids || bids.length === 0) {
11123
+ return /* @__PURE__ */ React134.createElement(Text67, { size: "xs", c: "dimmed", ta: "center", py: "sm" }, "No bids submitted yet");
11124
+ }
11125
+ return /* @__PURE__ */ React134.createElement(Stack93, { gap: "xs", pl: "md" }, bids.map((bid) => /* @__PURE__ */ React134.createElement(BidItem, { key: bid.id, bid, deedId, adminAddress, onRefresh: handleRefresh })));
11126
+ };
11127
+ return /* @__PURE__ */ React134.createElement(
11128
+ Paper17,
11129
+ {
11130
+ p: "md",
11131
+ shadow: "sm",
11132
+ style: {
11133
+ height: "100%",
11134
+ display: "flex",
11135
+ flexDirection: "column"
11136
+ }
11137
+ },
11138
+ /* @__PURE__ */ React134.createElement(
11139
+ "div",
11140
+ {
11141
+ style: {
11142
+ display: "flex",
11143
+ justifyContent: "space-between",
11144
+ alignItems: "center",
11145
+ marginBottom: "1rem"
11146
+ }
11147
+ },
11148
+ /* @__PURE__ */ React134.createElement(Title15, { order: 3 }, "Submitted Bids"),
11149
+ /* @__PURE__ */ React134.createElement(CloseButton13, { onClick: closePanel })
11150
+ ),
11151
+ renderContent()
11152
+ );
11128
11153
  };
11129
11154
 
11130
- // src/mantine/blocks/bid/flow/ClaimCollectionsList.tsx
11131
- var isClientFulfillmentError2 = (error) => {
11132
- const message = error instanceof Error ? error.message : String(error ?? "");
11133
- return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
11155
+ // src/icons/UserCheck.tsx
11156
+ import React135 from "react";
11157
+ var UserCheck = ({ size = 24, color = "currentColor", style }) => {
11158
+ return /* @__PURE__ */ React135.createElement(
11159
+ "svg",
11160
+ {
11161
+ xmlns: "http://www.w3.org/2000/svg",
11162
+ width: size,
11163
+ height: size,
11164
+ viewBox: "0 0 24 24",
11165
+ fill: "none",
11166
+ stroke: color,
11167
+ strokeWidth: "2",
11168
+ strokeLinecap: "round",
11169
+ strokeLinejoin: "round",
11170
+ className: "lucide lucide-user-check-icon lucide-user-check",
11171
+ style
11172
+ },
11173
+ /* @__PURE__ */ React135.createElement("path", { d: "m16 11 2 2 4-4" }),
11174
+ /* @__PURE__ */ React135.createElement("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
11175
+ /* @__PURE__ */ React135.createElement("circle", { cx: "9", cy: "7", r: "4" })
11176
+ );
11177
+ };
11178
+ var UserCheck_default = UserCheck;
11179
+
11180
+ // src/icons/UserPlus.tsx
11181
+ import React136 from "react";
11182
+ var UserPlus = ({ size = 24, color = "currentColor", style }) => {
11183
+ return /* @__PURE__ */ React136.createElement(
11184
+ "svg",
11185
+ {
11186
+ xmlns: "http://www.w3.org/2000/svg",
11187
+ width: size,
11188
+ height: size,
11189
+ viewBox: "0 0 24 24",
11190
+ fill: "none",
11191
+ stroke: color,
11192
+ strokeWidth: "2",
11193
+ strokeLinecap: "round",
11194
+ strokeLinejoin: "round",
11195
+ className: "lucide lucide-user-plus-icon lucide-user-plus",
11196
+ style
11197
+ },
11198
+ /* @__PURE__ */ React136.createElement("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
11199
+ /* @__PURE__ */ React136.createElement("circle", { cx: "9", cy: "7", r: "4" }),
11200
+ /* @__PURE__ */ React136.createElement("line", { x1: "19", x2: "19", y1: "8", y2: "14" }),
11201
+ /* @__PURE__ */ React136.createElement("line", { x1: "22", x2: "16", y1: "11", y2: "11" })
11202
+ );
11134
11203
  };
11204
+ var UserPlus_default = UserPlus;
11205
+
11206
+ // src/mantine/blocks/bid/flow/components/CollectionItem.tsx
11135
11207
  var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
11136
- const [isExpanded, setIsExpanded] = useState40(false);
11137
- const getCollectionName = (collection2) => {
11138
- return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
11139
- };
11140
- const getRoleBadge = (role) => {
11141
- const roleConfig = {
11142
- ["SA" /* ServiceProvider */]: { label: "Service Agent", color: "blue" },
11143
- ["EA" /* Evaluator */]: { label: "Evaluation Agent", color: "green" },
11144
- ["PO" /* Owner */]: { label: "Owner", color: "violet" },
11145
- ["IA" /* Investor */]: { label: "Investor", color: "orange" }
11146
- };
11147
- const config = roleConfig[role] || { label: role, color: "gray" };
11148
- return /* @__PURE__ */ React134.createElement(Badge20, { size: "sm", color: config.color }, config.label);
11149
- };
11150
11208
  const serviceAgentPanelId = `bid-survey-${collection.id}-service_agent`;
11151
- const serviceAgentPanelContent = useMemo29(
11152
- () => /* @__PURE__ */ React134.createElement(
11209
+ const serviceAgentPanelContent = useMemo33(
11210
+ () => /* @__PURE__ */ React137.createElement(
11153
11211
  BidSurveyPanel,
11154
11212
  {
11155
11213
  deedId,
11156
11214
  collectionId: collection.id,
11157
11215
  role: "service_agent",
11158
- onSubmitComplete: onRefresh
11159
- }
11160
- ),
11161
- [deedId, collection.id, onRefresh]
11162
- );
11163
- const { open: openServiceAgent } = usePanel(serviceAgentPanelId, serviceAgentPanelContent);
11164
- const evaluationAgentPanelId = `bid-survey-${collection.id}-evaluation_agent`;
11165
- const evaluationAgentPanelContent = useMemo29(
11166
- () => /* @__PURE__ */ React134.createElement(
11167
- BidSurveyPanel,
11168
- {
11169
- deedId,
11170
- collectionId: collection.id,
11171
- role: "evaluation_agent",
11172
- onSubmitComplete: onRefresh
11173
- }
11174
- ),
11175
- [deedId, collection.id, onRefresh]
11176
- );
11177
- const { open: openEvaluationAgent } = usePanel(evaluationAgentPanelId, evaluationAgentPanelContent);
11178
- const renderActionButton = () => {
11179
- if (userRole === "PO" /* Owner */) {
11180
- return /* @__PURE__ */ React134.createElement(ActionIcon18, { variant: "subtle", size: "lg", onClick: () => setIsExpanded(!isExpanded) }, isExpanded ? /* @__PURE__ */ React134.createElement(IconArrowUp3, { size: 20 }) : /* @__PURE__ */ React134.createElement(IconArrowDown3, { size: 20 }));
11181
- } else if (userRole === "SA" /* ServiceProvider */ || userRole === "EA" /* Evaluator */) {
11182
- return getRoleBadge(userRole);
11183
- } else {
11184
- return /* @__PURE__ */ React134.createElement(Menu2, { shadow: "md", width: 200 }, /* @__PURE__ */ React134.createElement(Menu2.Target, null, /* @__PURE__ */ React134.createElement(Button30, { size: "xs", variant: "light", rightSection: /* @__PURE__ */ React134.createElement(IconChevronDown5, { size: 14 }) }, "Apply")), /* @__PURE__ */ React134.createElement(Menu2.Dropdown, null, /* @__PURE__ */ React134.createElement(Menu2.Label, null, "Select Role"), /* @__PURE__ */ React134.createElement(Menu2.Item, { onClick: openServiceAgent }, "Service Agent"), /* @__PURE__ */ React134.createElement(Menu2.Item, { onClick: openEvaluationAgent }, "Evaluation Agent")));
11185
- }
11186
- };
11187
- return /* @__PURE__ */ React134.createElement(Stack93, { gap: "xs" }, /* @__PURE__ */ React134.createElement(ListItemContainer, null, /* @__PURE__ */ React134.createElement(Stack93, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React134.createElement(Text67, { size: "sm", fw: 500 }, getCollectionName(collection)), collection.description && /* @__PURE__ */ React134.createElement(Text67, { size: "xs", c: "dimmed" }, collection.description)), renderActionButton()), userRole === "PO" /* Owner */ && /* @__PURE__ */ React134.createElement(Collapse5, { in: isExpanded }, /* @__PURE__ */ React134.createElement(BidsList, { collectionId: collection.id, deedId, adminAddress, onRefresh })));
11188
- };
11189
- var ClaimCollectionsList2 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
11190
- const { getUserRoles } = useBlocknoteHandlers();
11191
- const getUserRolesRef = useRef6(getUserRoles);
11192
- useEffect29(() => {
11193
- getUserRolesRef.current = getUserRoles;
11194
- }, [getUserRoles]);
11195
- const [userRoles, setUserRoles] = useState40({});
11196
- const [loadingRoles, setLoadingRoles] = useState40(true);
11197
- const failedRequestKeyRef = useRef6(null);
11198
- const collectionIdsKey = useMemo29(
11199
- () => collections.map((c) => c.id).sort().join("|"),
11200
- [collections]
11201
- );
11202
- const requestKey = useMemo29(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
11203
- useEffect29(() => {
11204
- let isMounted = true;
11205
- const setEmptyRoles = () => {
11206
- const rolesMap = {};
11207
- collections.forEach((collection) => {
11208
- rolesMap[collection.id] = null;
11209
- });
11210
- if (isMounted) {
11211
- setUserRoles(rolesMap);
11212
- }
11213
- };
11214
- const fetchUserRoles = async () => {
11215
- if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
11216
- setLoadingRoles(false);
11217
- return;
11218
- }
11219
- if (!requestKey || failedRequestKeyRef.current === requestKey) {
11220
- setLoadingRoles(false);
11221
- return;
11222
- }
11223
- const getUserRolesFn = getUserRolesRef.current;
11224
- if (typeof getUserRolesFn !== "function") {
11225
- setEmptyRoles();
11226
- setLoadingRoles(false);
11227
- return;
11216
+ onSubmitComplete: onRefresh
11228
11217
  }
11229
- try {
11230
- setLoadingRoles(true);
11231
- const collectionIds = collections.map((c) => c.id);
11232
- const roles = await getUserRolesFn({
11233
- userAddress,
11234
- adminAddress,
11235
- deedDid: deedId,
11236
- collectionIds
11237
- });
11238
- const rolesMap = {};
11239
- collections.forEach((collection) => {
11240
- const roleData = roles?.find((r) => r.collectionId === collection.id);
11241
- rolesMap[collection.id] = roleData?.role || null;
11242
- });
11243
- setUserRoles(rolesMap);
11244
- } catch (error) {
11245
- if (isClientFulfillmentError2(error)) {
11246
- failedRequestKeyRef.current = requestKey;
11247
- } else {
11248
- failedRequestKeyRef.current = null;
11249
- }
11250
- setEmptyRoles();
11251
- } finally {
11252
- if (isMounted) {
11253
- setLoadingRoles(false);
11254
- }
11218
+ ),
11219
+ [deedId, collection.id, onRefresh]
11220
+ );
11221
+ const { open: openServiceAgent } = usePanel(serviceAgentPanelId, serviceAgentPanelContent);
11222
+ const evaluationAgentPanelId = `bid-survey-${collection.id}-evaluation_agent`;
11223
+ const evaluationAgentPanelContent = useMemo33(
11224
+ () => /* @__PURE__ */ React137.createElement(
11225
+ BidSurveyPanel,
11226
+ {
11227
+ deedId,
11228
+ collectionId: collection.id,
11229
+ role: "evaluation_agent",
11230
+ onSubmitComplete: onRefresh
11255
11231
  }
11256
- };
11257
- fetchUserRoles();
11258
- return () => {
11259
- isMounted = false;
11260
- };
11261
- }, [collections, userAddress, adminAddress, deedId, requestKey]);
11232
+ ),
11233
+ [deedId, collection.id, onRefresh]
11234
+ );
11235
+ const { open: openEvaluationAgent } = usePanel(evaluationAgentPanelId, evaluationAgentPanelContent);
11236
+ const bidsListPanelId = `bids-list-${collection.id}`;
11237
+ const bidsListPanelContent = useMemo33(
11238
+ () => /* @__PURE__ */ React137.createElement(BidsList, { collectionId: collection.id, deedId, adminAddress, onRefresh }),
11239
+ [collection.id, deedId, adminAddress, onRefresh]
11240
+ );
11241
+ const { open: openBidsList } = usePanel(bidsListPanelId, bidsListPanelContent);
11242
+ const renderActionButton = () => {
11243
+ if (userRole === "PO" /* Owner */) {
11244
+ return /* @__PURE__ */ React137.createElement(ActionIcon18, { variant: "subtle", size: "lg", onClick: openBidsList }, /* @__PURE__ */ React137.createElement(IconArrowRight4, { size: 20 }));
11245
+ } else if (userRole === "SA" /* ServiceProvider */ || userRole === "EA" /* Evaluator */) {
11246
+ return /* @__PURE__ */ React137.createElement(Badge20, { size: "sm", color: getRoleColor(userRole) }, getRoleLabel(userRole));
11247
+ } else {
11248
+ return /* @__PURE__ */ React137.createElement(Menu2, { shadow: "md", width: 200 }, /* @__PURE__ */ React137.createElement(Menu2.Target, null, /* @__PURE__ */ React137.createElement(Button30, { size: "xs", variant: "light", rightSection: /* @__PURE__ */ React137.createElement(IconChevronDown5, { size: 14 }) }, "Apply")), /* @__PURE__ */ React137.createElement(Menu2.Dropdown, null, /* @__PURE__ */ React137.createElement(Menu2.Label, null, "Select Role"), /* @__PURE__ */ React137.createElement(Menu2.Item, { onClick: openServiceAgent }, "Service Agent"), /* @__PURE__ */ React137.createElement(Menu2.Item, { onClick: openEvaluationAgent }, "Evaluation Agent")));
11249
+ }
11250
+ };
11251
+ const getCollectionIcon = () => {
11252
+ if (userRole === "PO" /* Owner */) {
11253
+ return /* @__PURE__ */ React137.createElement(UserCheck_default, null);
11254
+ }
11255
+ return /* @__PURE__ */ React137.createElement(UserPlus_default, null);
11256
+ };
11257
+ return /* @__PURE__ */ React137.createElement(ListItemContainer, { isChecked: false, onClick: () => {
11258
+ } }, /* @__PURE__ */ React137.createElement(Box23, { mr: "md", style: { display: "flex", alignItems: "center" } }, getCollectionIcon()), /* @__PURE__ */ React137.createElement(Stack94, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React137.createElement(Text68, { size: "sm", fw: 500 }, getCollectionName(collection)), collection.description && /* @__PURE__ */ React137.createElement(Text68, { size: "xs", c: "dimmed" }, collection.description)), renderActionButton());
11259
+ };
11260
+
11261
+ // src/mantine/blocks/bid/flow/components/ClaimCollectionsList.tsx
11262
+ var ClaimCollectionsList2 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
11263
+ const { userRoles, loading } = useUserRoles(collections, userAddress, adminAddress, deedId);
11262
11264
  if (!collections || collections.length === 0) {
11263
- return /* @__PURE__ */ React134.createElement(Text67, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
11265
+ return /* @__PURE__ */ React138.createElement(Text69, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
11264
11266
  }
11265
- if (loadingRoles) {
11266
- return /* @__PURE__ */ React134.createElement(Center7, { py: "md" }, /* @__PURE__ */ React134.createElement(Loader15, { size: "sm" }));
11267
+ if (loading) {
11268
+ return /* @__PURE__ */ React138.createElement(Center7, { py: "md" }, /* @__PURE__ */ React138.createElement(Loader15, { size: "sm" }));
11267
11269
  }
11268
- return /* @__PURE__ */ React134.createElement(Stack93, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React134.createElement(CollectionItem2, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
11270
+ return /* @__PURE__ */ React138.createElement(Stack95, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React138.createElement(CollectionItem2, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
11269
11271
  };
11270
11272
 
11271
- // src/mantine/blocks/bid/flow/FlowView.tsx
11273
+ // src/mantine/blocks/bid/flow/components/FlowView.tsx
11272
11274
  var BID_FLOW_PANEL_ID = "bid-flow-panel";
11273
11275
  var BidFlowView = ({ editor, block }) => {
11274
11276
  const { editable } = useBlocknoteContext();
11275
- const { getCurrentUser, getClaimCollections } = useBlocknoteHandlers();
11276
- const getClaimCollectionsRef = useRef7(getClaimCollections);
11277
- const getCurrentUserRef = useRef7(getCurrentUser);
11278
- useEffect30(() => {
11279
- getClaimCollectionsRef.current = getClaimCollections;
11280
- getCurrentUserRef.current = getCurrentUser;
11281
- }, [getCurrentUser, getClaimCollections]);
11282
- const [collections, setCollections] = useState41([]);
11283
- const [loading, setLoading] = useState41(false);
11284
- const [error, setError] = useState41(null);
11285
- const [userAddress, setUserAddress] = useState41("");
11286
- const adminAddressUpdatedRef = useRef7(false);
11277
+ const userAddress = useCurrentUser();
11287
11278
  const panelId = `${BID_FLOW_PANEL_ID}-${block.id}`;
11288
- const panelContent = useMemo30(() => /* @__PURE__ */ React135.createElement(TemplateConfig7, { editor, block }), [editor, block]);
11279
+ const panelContent = useMemo34(() => /* @__PURE__ */ React139.createElement(TemplateConfig7, { editor, block }), [editor, block]);
11289
11280
  const { open } = usePanel(panelId, panelContent);
11290
- const selectedCollectionIds = useMemo30(() => {
11281
+ const selectedCollectionIds = useMemo34(() => {
11291
11282
  try {
11292
11283
  const parsed = JSON.parse(block.props.selectedCollections || "[]");
11293
11284
  return Array.isArray(parsed) ? parsed : [];
@@ -11295,71 +11286,25 @@ var BidFlowView = ({ editor, block }) => {
11295
11286
  return [];
11296
11287
  }
11297
11288
  }, [block.props.selectedCollections]);
11298
- const selectedCollectionIdsStr = useMemo30(() => JSON.stringify(selectedCollectionIds.sort()), [selectedCollectionIds]);
11299
11289
  const did = block.props.did;
11300
11290
  const adminAddress = block.props.adminAddress || "";
11301
- useEffect30(() => {
11302
- const fetchUserAddress = () => {
11303
- try {
11304
- const user = getCurrentUserRef.current();
11305
- setUserAddress(user?.address || "");
11306
- } catch (err) {
11307
- setUserAddress("");
11308
- }
11309
- };
11310
- fetchUserAddress();
11311
- }, []);
11312
- const fetchCollections = useCallback28(async () => {
11313
- if (!did || selectedCollectionIds.length === 0) {
11314
- setCollections([]);
11315
- return;
11316
- }
11317
- if (loading) {
11318
- return;
11319
- }
11320
- setLoading(true);
11321
- setError(null);
11322
- try {
11323
- const response = await getClaimCollectionsRef.current({ deedDid: did });
11324
- const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
11325
- const currentAdminAddress = block.props.adminAddress || "";
11326
- if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
11327
- adminAddressUpdatedRef.current = true;
11328
- editor.updateBlock(block, {
11329
- props: {
11330
- ...block.props,
11331
- adminAddress: fetchedAdminAddress
11332
- }
11333
- });
11334
- }
11335
- const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
11336
- setCollections(selectedCollections);
11337
- } catch (err) {
11338
- setError(err instanceof Error ? err.message : "Failed to fetch collections");
11339
- setCollections([]);
11340
- } finally {
11341
- setLoading(false);
11342
- }
11343
- }, [did, selectedCollectionIdsStr]);
11344
- useEffect30(() => {
11345
- fetchCollections();
11346
- }, [fetchCollections]);
11291
+ const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
11347
11292
  if (!did) {
11348
- return /* @__PURE__ */ React135.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React135.createElement(Text68, { size: "sm", c: "dimmed" }, "Please configure the bid block in template mode first"));
11293
+ return /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm", c: "dimmed" }, "Please configure the bid block in template mode first"));
11349
11294
  }
11350
11295
  if (selectedCollectionIds.length === 0) {
11351
- return /* @__PURE__ */ React135.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React135.createElement(Text68, { size: "sm", c: "dimmed" }, "No claim collections selected"));
11296
+ return /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm", c: "dimmed" }, "No claim collections selected"));
11352
11297
  }
11353
- return /* @__PURE__ */ React135.createElement(Stack94, { w: "100%" }, /* @__PURE__ */ React135.createElement(Flex23, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React135.createElement(Title15, { order: 4 }, "Bid Application"), /* @__PURE__ */ React135.createElement(Flex23, { gap: "xs" }, /* @__PURE__ */ React135.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: fetchCollections, loading }, /* @__PURE__ */ React135.createElement(IconRefresh3, { size: 18 })), editable && /* @__PURE__ */ React135.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React135.createElement(IconSettings4, { size: 18 })))), loading ? /* @__PURE__ */ React135.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React135.createElement(Loader16, { size: "md" })) : error ? /* @__PURE__ */ React135.createElement(Alert18, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React135.createElement(IconAlertCircle6, { size: 18 }) }, /* @__PURE__ */ React135.createElement(Text68, { size: "sm" }, error)) : /* @__PURE__ */ React135.createElement(ClaimCollectionsList2, { collections, deedId: did, adminAddress, userAddress, onRefresh: fetchCollections }));
11298
+ return /* @__PURE__ */ React139.createElement(Stack96, { w: "100%" }, /* @__PURE__ */ React139.createElement(Flex23, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React139.createElement(Title16, { order: 4 }, "Bid Application"), /* @__PURE__ */ React139.createElement(Flex23, { gap: "xs" }, /* @__PURE__ */ React139.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React139.createElement(IconRefresh3, { size: 18 })), editable && /* @__PURE__ */ React139.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React139.createElement(IconSettings4, { size: 18 })))), loading ? /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Loader16, { size: "md" })) : error ? /* @__PURE__ */ React139.createElement(Alert18, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React139.createElement(IconAlertCircle6, { size: 18 }) }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm" }, error)) : /* @__PURE__ */ React139.createElement(ClaimCollectionsList2, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
11354
11299
  };
11355
11300
 
11356
11301
  // src/mantine/blocks/bid/BidBlock.tsx
11357
11302
  function BidBlock({ editor, block }) {
11358
11303
  const { docType } = useBlocknoteContext();
11359
11304
  if (docType === "template") {
11360
- return /* @__PURE__ */ React136.createElement(BidTemplateView, { editor, block });
11305
+ return /* @__PURE__ */ React140.createElement(BidTemplateView, { editor, block });
11361
11306
  }
11362
- return /* @__PURE__ */ React136.createElement(BidFlowView, { editor, block });
11307
+ return /* @__PURE__ */ React140.createElement(BidFlowView, { editor, block });
11363
11308
  }
11364
11309
 
11365
11310
  // src/mantine/blocks/bid/BidBlockSpec.tsx
@@ -11378,24 +11323,24 @@ var BidBlockSpec = createReactBlockSpec9(
11378
11323
  {
11379
11324
  render: (props) => {
11380
11325
  const ixoProps = props;
11381
- return /* @__PURE__ */ React137.createElement(BidBlock, { ...ixoProps });
11326
+ return /* @__PURE__ */ React141.createElement(BidBlock, { ...ixoProps });
11382
11327
  }
11383
11328
  }
11384
11329
  );
11385
11330
 
11386
11331
  // src/mantine/blocks/evaluator/EvaluatorBlock.tsx
11387
- import React144 from "react";
11332
+ import React148 from "react";
11388
11333
 
11389
11334
  // src/mantine/blocks/evaluator/template/TemplateView.tsx
11390
- import React140, { useMemo as useMemo32 } from "react";
11391
- import { Group as Group42, Stack as Stack95, Text as Text69, Badge as Badge21 } from "@mantine/core";
11335
+ import React144, { useMemo as useMemo36 } from "react";
11336
+ import { Group as Group42, Stack as Stack97, Text as Text71, Badge as Badge21 } from "@mantine/core";
11392
11337
 
11393
11338
  // src/mantine/blocks/evaluator/template/TemplateConfig.tsx
11394
- import React139, { useCallback as useCallback30 } from "react";
11395
- import { Paper as Paper17, CloseButton as CloseButton13, Title as Title16 } from "@mantine/core";
11339
+ import React143, { useCallback as useCallback31 } from "react";
11340
+ import { Paper as Paper18, CloseButton as CloseButton14, Title as Title17 } from "@mantine/core";
11396
11341
 
11397
11342
  // src/mantine/blocks/evaluator/template/GeneralTab.tsx
11398
- import React138, { useEffect as useEffect31, useState as useState42, useCallback as useCallback29, useMemo as useMemo31 } from "react";
11343
+ import React142, { useEffect as useEffect32, useState as useState44, useCallback as useCallback30, useMemo as useMemo35 } from "react";
11399
11344
  var GeneralTab8 = ({
11400
11345
  title,
11401
11346
  description,
@@ -11408,29 +11353,29 @@ var GeneralTab8 = ({
11408
11353
  onSelectedCollectionsChange,
11409
11354
  onAdminAddressChange
11410
11355
  }) => {
11411
- const [localTitle, setLocalTitle] = useState42(title || "");
11412
- const [localDescription, setLocalDescription] = useState42(description || "");
11413
- useEffect31(() => {
11356
+ const [localTitle, setLocalTitle] = useState44(title || "");
11357
+ const [localDescription, setLocalDescription] = useState44(description || "");
11358
+ useEffect32(() => {
11414
11359
  setLocalTitle(title || "");
11415
11360
  }, [title]);
11416
- useEffect31(() => {
11361
+ useEffect32(() => {
11417
11362
  setLocalDescription(description || "");
11418
11363
  }, [description]);
11419
- const parsedSelectedCollections = useMemo31(() => {
11364
+ const parsedSelectedCollections = useMemo35(() => {
11420
11365
  try {
11421
11366
  return JSON.parse(selectedCollections || "[]");
11422
11367
  } catch {
11423
11368
  return [];
11424
11369
  }
11425
11370
  }, [selectedCollections]);
11426
- const handleCollectionsChange = useCallback29(
11371
+ const handleCollectionsChange = useCallback30(
11427
11372
  (collections) => {
11428
11373
  const stringified = JSON.stringify(collections || []);
11429
11374
  onSelectedCollectionsChange(stringified);
11430
11375
  },
11431
11376
  [onSelectedCollectionsChange]
11432
11377
  );
11433
- const handleAdminAddressChange = useCallback29(
11378
+ const handleAdminAddressChange = useCallback30(
11434
11379
  (adminAddress2) => {
11435
11380
  if (onAdminAddressChange) {
11436
11381
  onAdminAddressChange(adminAddress2);
@@ -11438,7 +11383,7 @@ var GeneralTab8 = ({
11438
11383
  },
11439
11384
  [onAdminAddressChange]
11440
11385
  );
11441
- return /* @__PURE__ */ React138.createElement(BaseSection, null, /* @__PURE__ */ React138.createElement(
11386
+ return /* @__PURE__ */ React142.createElement(BaseSection, null, /* @__PURE__ */ React142.createElement(
11442
11387
  BaseTextInput,
11443
11388
  {
11444
11389
  label: "Title",
@@ -11450,7 +11395,7 @@ var GeneralTab8 = ({
11450
11395
  onTitleChange(newTitle);
11451
11396
  }
11452
11397
  }
11453
- ), /* @__PURE__ */ React138.createElement(
11398
+ ), /* @__PURE__ */ React142.createElement(
11454
11399
  BaseTextArea,
11455
11400
  {
11456
11401
  label: "Description",
@@ -11463,7 +11408,7 @@ var GeneralTab8 = ({
11463
11408
  onDescriptionChange(newDescription);
11464
11409
  }
11465
11410
  }
11466
- ), /* @__PURE__ */ React138.createElement(
11411
+ ), /* @__PURE__ */ React142.createElement(
11467
11412
  CollectionSelector,
11468
11413
  {
11469
11414
  did: deedDid,
@@ -11479,7 +11424,7 @@ var GeneralTab8 = ({
11479
11424
  // src/mantine/blocks/evaluator/template/TemplateConfig.tsx
11480
11425
  var TemplateConfig8 = ({ editor, block }) => {
11481
11426
  const { closePanel } = usePanelStore();
11482
- const updateProp = useCallback30(
11427
+ const updateProp = useCallback31(
11483
11428
  (key, value) => {
11484
11429
  editor.updateBlock(block, {
11485
11430
  props: {
@@ -11490,8 +11435,8 @@ var TemplateConfig8 = ({ editor, block }) => {
11490
11435
  },
11491
11436
  [editor, block]
11492
11437
  );
11493
- return /* @__PURE__ */ React139.createElement(
11494
- Paper17,
11438
+ return /* @__PURE__ */ React143.createElement(
11439
+ Paper18,
11495
11440
  {
11496
11441
  p: "md",
11497
11442
  shadow: "sm",
@@ -11501,7 +11446,7 @@ var TemplateConfig8 = ({ editor, block }) => {
11501
11446
  flexDirection: "column"
11502
11447
  }
11503
11448
  },
11504
- /* @__PURE__ */ React139.createElement(
11449
+ /* @__PURE__ */ React143.createElement(
11505
11450
  "div",
11506
11451
  {
11507
11452
  style: {
@@ -11511,17 +11456,17 @@ var TemplateConfig8 = ({ editor, block }) => {
11511
11456
  marginBottom: "1rem"
11512
11457
  }
11513
11458
  },
11514
- /* @__PURE__ */ React139.createElement(Title16, { order: 3 }, "Evaluator Settings"),
11515
- /* @__PURE__ */ React139.createElement(CloseButton13, { onClick: closePanel })
11459
+ /* @__PURE__ */ React143.createElement(Title17, { order: 3 }, "Evaluator Settings"),
11460
+ /* @__PURE__ */ React143.createElement(CloseButton14, { onClick: closePanel })
11516
11461
  ),
11517
- /* @__PURE__ */ React139.createElement(
11462
+ /* @__PURE__ */ React143.createElement(
11518
11463
  ReusablePanel,
11519
11464
  {
11520
11465
  extraTabs: [
11521
11466
  {
11522
11467
  label: "General",
11523
11468
  value: "general",
11524
- content: /* @__PURE__ */ React139.createElement(
11469
+ content: /* @__PURE__ */ React143.createElement(
11525
11470
  GeneralTab8,
11526
11471
  {
11527
11472
  title: block.props.title || "",
@@ -11548,24 +11493,24 @@ var TemplateConfig8 = ({ editor, block }) => {
11548
11493
  var EVALUATOR_TEMPLATE_PANEL_ID = "evaluator-template-panel";
11549
11494
  var EvaluatorTemplateView = ({ editor, block }) => {
11550
11495
  const panelId = `${EVALUATOR_TEMPLATE_PANEL_ID}-${block.id}`;
11551
- const panelContent = useMemo32(() => /* @__PURE__ */ React140.createElement(TemplateConfig8, { editor, block }), [editor, block]);
11496
+ const panelContent = useMemo36(() => /* @__PURE__ */ React144.createElement(TemplateConfig8, { editor, block }), [editor, block]);
11552
11497
  const { open } = usePanel(panelId, panelContent);
11553
- return /* @__PURE__ */ React140.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React140.createElement(Badge21, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React140.createElement(Group42, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React140.createElement(Group42, { wrap: "nowrap", align: "center" }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React140.createElement(Stack95, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React140.createElement(Text69, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Evaluator Title"), /* @__PURE__ */ React140.createElement(Text69, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description || "Evaluator description")))));
11498
+ return /* @__PURE__ */ React144.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React144.createElement(Badge21, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React144.createElement(Group42, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React144.createElement(Group42, { wrap: "nowrap", align: "center" }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React144.createElement(Stack97, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React144.createElement(Text71, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Evaluator Title"), /* @__PURE__ */ React144.createElement(Text71, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description || "Evaluator description")))));
11554
11499
  };
11555
11500
 
11556
11501
  // src/mantine/blocks/evaluator/flow/FlowView.tsx
11557
- import React143, { useState as useState45, useEffect as useEffect34, useMemo as useMemo35, useCallback as useCallback32, useRef as useRef9 } from "react";
11558
- import { Stack as Stack98, Text as Text72, Loader as Loader19, Center as Center10, Alert as Alert20, Title as Title18, Flex as Flex24, ActionIcon as ActionIcon22 } from "@mantine/core";
11502
+ import React147, { useMemo as useMemo39 } from "react";
11503
+ import { Stack as Stack100, Text as Text74, Loader as Loader19, Center as Center10, Alert as Alert20, Title as Title19, Flex as Flex24, ActionIcon as ActionIcon22 } from "@mantine/core";
11559
11504
  import { IconSettings as IconSettings5, IconRefresh as IconRefresh5, IconAlertCircle as IconAlertCircle8 } from "@tabler/icons-react";
11560
11505
 
11561
11506
  // src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
11562
- import React142, { useMemo as useMemo34, useState as useState44, useEffect as useEffect33, useRef as useRef8 } from "react";
11563
- import { Stack as Stack97, Text as Text71, ActionIcon as ActionIcon21, Tooltip as Tooltip9, Loader as Loader18, Center as Center9 } from "@mantine/core";
11507
+ import React146, { useMemo as useMemo38, useEffect as useEffect34, useRef as useRef7 } from "react";
11508
+ import { Stack as Stack99, Text as Text73, ActionIcon as ActionIcon21, Tooltip as Tooltip9, Loader as Loader18, Center as Center9 } from "@mantine/core";
11564
11509
 
11565
11510
  // src/mantine/blocks/evaluator/flow/ClaimsList.tsx
11566
- import React141, { useState as useState43, useEffect as useEffect32, useCallback as useCallback31, useMemo as useMemo33 } from "react";
11567
- import { Paper as Paper18, CloseButton as CloseButton14, Title as Title17, Loader as Loader17, Stack as Stack96, Text as Text70, ActionIcon as ActionIcon20, Alert as Alert19, Badge as Badge22, Group as Group43, Button as Button31, Divider as Divider7 } from "@mantine/core";
11568
- import { IconAlertCircle as IconAlertCircle7, IconArrowRight as IconArrowRight4, IconRefresh as IconRefresh4, IconArrowLeft as IconArrowLeft3 } from "@tabler/icons-react";
11511
+ import React145, { useState as useState45, useEffect as useEffect33, useCallback as useCallback32, useMemo as useMemo37 } from "react";
11512
+ import { Paper as Paper19, CloseButton as CloseButton15, Title as Title18, Loader as Loader17, Stack as Stack98, Text as Text72, ActionIcon as ActionIcon20, Alert as Alert19, Badge as Badge22, Group as Group43, Button as Button31, Divider as Divider7 } from "@mantine/core";
11513
+ import { IconAlertCircle as IconAlertCircle7, IconArrowRight as IconArrowRight5, IconRefresh as IconRefresh4, IconArrowLeft as IconArrowLeft3 } from "@tabler/icons-react";
11569
11514
  import { Survey as Survey4, SurveyModel as SurveyModel4 } from "@ixo/surveys";
11570
11515
 
11571
11516
  // src/mantine/blocks/evaluator/flow/theme.ts
@@ -11727,26 +11672,26 @@ var surveyTheme2 = {
11727
11672
  };
11728
11673
 
11729
11674
  // src/mantine/blocks/evaluator/flow/ClaimsList.tsx
11730
- var SURVEY_THEME_VARIABLES3 = Object.entries(surveyTheme2.cssVariables ?? {}).reduce((acc, [key, value]) => {
11675
+ var SURVEY_THEME_VARIABLES2 = Object.entries(surveyTheme2.cssVariables ?? {}).reduce((acc, [key, value]) => {
11731
11676
  acc[key] = value;
11732
11677
  return acc;
11733
11678
  }, {});
11734
- var SURVEY_THEME_BACKGROUND3 = SURVEY_THEME_VARIABLES3["--sjs-general-backcolor"] ?? "#050505";
11735
- var SURVEY_THEME_FOREGROUND3 = SURVEY_THEME_VARIABLES3["--sjs-general-forecolor"] ?? "#ffffff";
11679
+ var SURVEY_THEME_BACKGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-backcolor"] ?? "#050505";
11680
+ var SURVEY_THEME_FOREGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-forecolor"] ?? "#ffffff";
11736
11681
  var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvaluationComplete }) => {
11737
11682
  const { closePanel } = usePanelStore();
11738
11683
  const handlers = useBlocknoteHandlers();
11739
- const [viewMode, setViewMode] = useState43("list");
11740
- const [claims, setClaims] = useState43([]);
11741
- const [loading, setLoading] = useState43(true);
11742
- const [error, setError] = useState43(null);
11743
- const [selectedClaim, setSelectedClaim] = useState43(null);
11744
- const [claimData, setClaimData] = useState43(null);
11745
- const [surveyJson, setSurveyJson] = useState43(null);
11746
- const [surveyLoading, setSurveyLoading] = useState43(false);
11747
- const [surveyError, setSurveyError] = useState43(null);
11748
- const [evaluating, setEvaluating] = useState43(false);
11749
- const fetchClaims = useCallback31(async () => {
11684
+ const [viewMode, setViewMode] = useState45("list");
11685
+ const [claims, setClaims] = useState45([]);
11686
+ const [loading, setLoading] = useState45(true);
11687
+ const [error, setError] = useState45(null);
11688
+ const [selectedClaim, setSelectedClaim] = useState45(null);
11689
+ const [claimData, setClaimData] = useState45(null);
11690
+ const [surveyJson, setSurveyJson] = useState45(null);
11691
+ const [surveyLoading, setSurveyLoading] = useState45(false);
11692
+ const [surveyError, setSurveyError] = useState45(null);
11693
+ const [evaluating, setEvaluating] = useState45(false);
11694
+ const fetchClaims = useCallback32(async () => {
11750
11695
  try {
11751
11696
  setLoading(true);
11752
11697
  setError(null);
@@ -11761,10 +11706,10 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11761
11706
  setLoading(false);
11762
11707
  }
11763
11708
  }, [collectionId]);
11764
- useEffect32(() => {
11709
+ useEffect33(() => {
11765
11710
  fetchClaims();
11766
11711
  }, [fetchClaims]);
11767
- const fetchClaimAndSurvey = useCallback31(
11712
+ const fetchClaimAndSurvey = useCallback32(
11768
11713
  async (claim) => {
11769
11714
  try {
11770
11715
  setSurveyLoading(true);
@@ -11788,7 +11733,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11788
11733
  // eslint-disable-next-line react-hooks/exhaustive-deps
11789
11734
  [collectionId, deedId]
11790
11735
  );
11791
- const handleViewClaim = useCallback31(
11736
+ const handleViewClaim = useCallback32(
11792
11737
  (claim) => {
11793
11738
  setSelectedClaim(claim);
11794
11739
  fetchClaimAndSurvey(claim);
@@ -11796,7 +11741,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11796
11741
  },
11797
11742
  [fetchClaimAndSurvey]
11798
11743
  );
11799
- const handleBackToList = useCallback31(() => {
11744
+ const handleBackToList = useCallback32(() => {
11800
11745
  setViewMode("list");
11801
11746
  setSelectedClaim(null);
11802
11747
  setClaimData(null);
@@ -11805,7 +11750,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11805
11750
  setEvaluating(false);
11806
11751
  fetchClaims();
11807
11752
  }, [fetchClaims]);
11808
- const surveyModel = useMemo33(() => {
11753
+ const surveyModel = useMemo37(() => {
11809
11754
  if (!surveyJson || !claimData) return null;
11810
11755
  const model = new SurveyModel4(surveyJson);
11811
11756
  model.applyTheme(surveyTheme2);
@@ -11817,18 +11762,18 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11817
11762
  }
11818
11763
  return model;
11819
11764
  }, [surveyJson, claimData]);
11820
- const surveyContainerStyle = useMemo33(
11765
+ const surveyContainerStyle = useMemo37(
11821
11766
  () => ({
11822
11767
  flex: 1,
11823
11768
  overflow: "auto",
11824
- backgroundColor: SURVEY_THEME_BACKGROUND3,
11825
- color: SURVEY_THEME_FOREGROUND3,
11826
- ...SURVEY_THEME_VARIABLES3,
11769
+ backgroundColor: SURVEY_THEME_BACKGROUND2,
11770
+ color: SURVEY_THEME_FOREGROUND2,
11771
+ ...SURVEY_THEME_VARIABLES2,
11827
11772
  padding: "1rem"
11828
11773
  }),
11829
11774
  []
11830
11775
  );
11831
- const handleApprove = useCallback31(async () => {
11776
+ const handleApprove = useCallback32(async () => {
11832
11777
  if (!selectedClaim) return;
11833
11778
  try {
11834
11779
  setEvaluating(true);
@@ -11857,7 +11802,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11857
11802
  setEvaluating(false);
11858
11803
  }
11859
11804
  }, [selectedClaim, handlers, deedId, collectionId, adminAddress, handleBackToList]);
11860
- const handleReject = useCallback31(async () => {
11805
+ const handleReject = useCallback32(async () => {
11861
11806
  if (!selectedClaim) return;
11862
11807
  try {
11863
11808
  setEvaluating(true);
@@ -11869,8 +11814,8 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11869
11814
  setEvaluating(false);
11870
11815
  }
11871
11816
  }, [selectedClaim, handleBackToList]);
11872
- return /* @__PURE__ */ React141.createElement(
11873
- Paper18,
11817
+ return /* @__PURE__ */ React145.createElement(
11818
+ Paper19,
11874
11819
  {
11875
11820
  p: "md",
11876
11821
  shadow: "sm",
@@ -11881,7 +11826,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11881
11826
  overflow: "hidden"
11882
11827
  }
11883
11828
  },
11884
- /* @__PURE__ */ React141.createElement(
11829
+ /* @__PURE__ */ React145.createElement(
11885
11830
  "div",
11886
11831
  {
11887
11832
  style: {
@@ -11891,10 +11836,10 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11891
11836
  marginBottom: "1rem"
11892
11837
  }
11893
11838
  },
11894
- /* @__PURE__ */ React141.createElement("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" } }, viewMode === "survey" && /* @__PURE__ */ React141.createElement(ActionIcon20, { variant: "subtle", onClick: handleBackToList }, /* @__PURE__ */ React141.createElement(IconArrowLeft3, { size: 20 })), /* @__PURE__ */ React141.createElement(Title17, { order: 3 }, viewMode === "list" ? `${collectionName} - Claims` : `Evaluate Claim #${selectedClaim?.claimId.slice(-8)}`), viewMode === "list" && !loading && claims.length > 0 && /* @__PURE__ */ React141.createElement(Badge22, { size: "lg", variant: "light" }, claims.length)),
11895
- /* @__PURE__ */ React141.createElement(Group43, { gap: "xs" }, viewMode === "list" && /* @__PURE__ */ React141.createElement(ActionIcon20, { variant: "subtle", onClick: fetchClaims, loading, title: "Refresh claims" }, /* @__PURE__ */ React141.createElement(IconRefresh4, { size: 18 })), /* @__PURE__ */ React141.createElement(CloseButton14, { onClick: closePanel }))
11839
+ /* @__PURE__ */ React145.createElement("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" } }, viewMode === "survey" && /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", onClick: handleBackToList }, /* @__PURE__ */ React145.createElement(IconArrowLeft3, { size: 20 })), /* @__PURE__ */ React145.createElement(Title18, { order: 3 }, viewMode === "list" ? `${collectionName} - Claims` : `Evaluate Claim #${selectedClaim?.claimId.slice(-8)}`), viewMode === "list" && !loading && claims.length > 0 && /* @__PURE__ */ React145.createElement(Badge22, { size: "lg", variant: "light" }, claims.length)),
11840
+ /* @__PURE__ */ React145.createElement(Group43, { gap: "xs" }, viewMode === "list" && /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", onClick: fetchClaims, loading, title: "Refresh claims" }, /* @__PURE__ */ React145.createElement(IconRefresh4, { size: 18 })), /* @__PURE__ */ React145.createElement(CloseButton15, { onClick: closePanel }))
11896
11841
  ),
11897
- /* @__PURE__ */ React141.createElement(
11842
+ /* @__PURE__ */ React145.createElement(
11898
11843
  "div",
11899
11844
  {
11900
11845
  style: {
@@ -11903,7 +11848,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11903
11848
  position: "relative"
11904
11849
  }
11905
11850
  },
11906
- /* @__PURE__ */ React141.createElement(
11851
+ /* @__PURE__ */ React145.createElement(
11907
11852
  "div",
11908
11853
  {
11909
11854
  style: {
@@ -11921,9 +11866,9 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11921
11866
  pointerEvents: viewMode === "list" ? "auto" : "none"
11922
11867
  }
11923
11868
  },
11924
- /* @__PURE__ */ React141.createElement(Stack96, { gap: "md", style: { flex: 1 } }, loading ? /* @__PURE__ */ React141.createElement(Stack96, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React141.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React141.createElement(Text70, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React141.createElement(Alert19, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React141.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React141.createElement(Text70, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React141.createElement(Stack96, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React141.createElement(Text70, { size: "sm", c: "dimmed", ta: "center" }, "No claims found for this collection.")) : /* @__PURE__ */ React141.createElement(Stack96, { gap: "xs" }, claims.map((claim) => /* @__PURE__ */ React141.createElement(ClaimListItem, { key: claim.claimId, claim, onViewClaim: () => handleViewClaim(claim) }))))
11869
+ /* @__PURE__ */ React145.createElement(Stack98, { gap: "md", style: { flex: 1 } }, loading ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React145.createElement(Alert19, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React145.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed", ta: "center" }, "No claims found for this collection.")) : /* @__PURE__ */ React145.createElement(Stack98, { gap: "xs" }, claims.map((claim) => /* @__PURE__ */ React145.createElement(ClaimListItem, { key: claim.claimId, claim, onViewClaim: () => handleViewClaim(claim) }))))
11925
11870
  ),
11926
- /* @__PURE__ */ React141.createElement(
11871
+ /* @__PURE__ */ React145.createElement(
11927
11872
  "div",
11928
11873
  {
11929
11874
  style: {
@@ -11941,16 +11886,16 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
11941
11886
  pointerEvents: viewMode === "survey" ? "auto" : "none"
11942
11887
  }
11943
11888
  },
11944
- surveyLoading ? /* @__PURE__ */ React141.createElement(Stack96, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React141.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React141.createElement(Text70, { size: "sm", c: "dimmed" }, "Loading claim data...")) : surveyError ? /* @__PURE__ */ React141.createElement(Stack96, { style: { flex: 1 } }, /* @__PURE__ */ React141.createElement(Alert19, { color: "red", title: "Failed to load claim data", icon: /* @__PURE__ */ React141.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React141.createElement(Text70, { size: "sm" }, surveyError))) : /* @__PURE__ */ React141.createElement(React141.Fragment, null, /* @__PURE__ */ React141.createElement("div", { style: surveyContainerStyle }, surveyModel && /* @__PURE__ */ React141.createElement(Survey4, { model: surveyModel })), /* @__PURE__ */ React141.createElement(Divider7, { my: "md" }), /* @__PURE__ */ React141.createElement(Stack96, { gap: "sm" }, /* @__PURE__ */ React141.createElement(Button31, { color: "green", onClick: handleApprove, loading: evaluating, disabled: evaluating }, "Approve Claim"), /* @__PURE__ */ React141.createElement(Button31, { color: "red", variant: "outline", onClick: handleReject, loading: evaluating, disabled: evaluating }, "Reject Claim")))
11889
+ surveyLoading ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed" }, "Loading claim data...")) : surveyError ? /* @__PURE__ */ React145.createElement(Stack98, { style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Alert19, { color: "red", title: "Failed to load claim data", icon: /* @__PURE__ */ React145.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm" }, surveyError))) : /* @__PURE__ */ React145.createElement(React145.Fragment, null, /* @__PURE__ */ React145.createElement("div", { style: surveyContainerStyle }, surveyModel && /* @__PURE__ */ React145.createElement(Survey4, { model: surveyModel })), /* @__PURE__ */ React145.createElement(Divider7, { my: "md" }), /* @__PURE__ */ React145.createElement(Stack98, { gap: "sm" }, /* @__PURE__ */ React145.createElement(Button31, { color: "green", onClick: handleApprove, loading: evaluating, disabled: evaluating }, "Approve Claim"), /* @__PURE__ */ React145.createElement(Button31, { color: "red", variant: "outline", onClick: handleReject, loading: evaluating, disabled: evaluating }, "Reject Claim")))
11945
11890
  )
11946
11891
  )
11947
11892
  );
11948
11893
  };
11949
11894
  var ClaimListItem = ({ claim, onViewClaim }) => {
11950
11895
  const handlers = useBlocknoteHandlers();
11951
- const [userProfile, setUserProfile] = useState43(null);
11952
- const [loadingProfile, setLoadingProfile] = useState43(false);
11953
- useEffect32(() => {
11896
+ const [userProfile, setUserProfile] = useState45(null);
11897
+ const [loadingProfile, setLoadingProfile] = useState45(false);
11898
+ useEffect33(() => {
11954
11899
  const fetchUserProfile = async () => {
11955
11900
  if (!claim.agentDid) return;
11956
11901
  try {
@@ -11993,7 +11938,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
11993
11938
  }
11994
11939
  return { status: "Pending", color: "yellow" };
11995
11940
  };
11996
- const formatDate = (dateString) => {
11941
+ const formatDate2 = (dateString) => {
11997
11942
  if (!dateString) return "N/A";
11998
11943
  try {
11999
11944
  return new Date(dateString).toLocaleDateString();
@@ -12003,7 +11948,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
12003
11948
  };
12004
11949
  const claimStatus = getClaimStatus(claim);
12005
11950
  const displayName = userProfile?.displayname || (claim.agentAddress ? `${claim.agentAddress.slice(0, 12)}...` : "Unknown");
12006
- return /* @__PURE__ */ React141.createElement(
11951
+ return /* @__PURE__ */ React145.createElement(
12007
11952
  "div",
12008
11953
  {
12009
11954
  onClick: onViewClaim,
@@ -12017,32 +11962,28 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
12017
11962
  tabIndex: 0,
12018
11963
  style: { cursor: "pointer" }
12019
11964
  },
12020
- /* @__PURE__ */ React141.createElement(ListItemContainer, null, /* @__PURE__ */ React141.createElement(Stack96, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React141.createElement(Text70, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React141.createElement(Text70, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(claim.submissionDate || claim.submittedAt)), claim.agentDid && /* @__PURE__ */ React141.createElement(Group43, { gap: 4 }, /* @__PURE__ */ React141.createElement(Text70, { size: "xs", c: "dimmed" }, "Agent: ", loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React141.createElement(Text70, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"))), /* @__PURE__ */ React141.createElement(Stack96, { gap: 4, align: "flex-end" }, /* @__PURE__ */ React141.createElement(Badge22, { color: claimStatus.color, size: "sm" }, claimStatus.status), /* @__PURE__ */ React141.createElement(ActionIcon20, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React141.createElement(IconArrowRight4, { size: 16 }))))
11965
+ /* @__PURE__ */ React145.createElement(ListItemContainer, null, /* @__PURE__ */ React145.createElement(Stack98, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate2(claim.submissionDate || claim.submittedAt)), claim.agentDid && /* @__PURE__ */ React145.createElement(Group43, { gap: 4 }, /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "dimmed" }, "Agent: ", loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"))), /* @__PURE__ */ React145.createElement(Stack98, { gap: 4, align: "flex-end" }, /* @__PURE__ */ React145.createElement(Badge22, { color: claimStatus.color, size: "sm" }, claimStatus.status), /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React145.createElement(IconArrowRight5, { size: 16 }))))
12021
11966
  );
12022
11967
  };
12023
11968
 
12024
11969
  // src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
12025
- import { IconArrowRight as IconArrowRight5 } from "@tabler/icons-react";
12026
- var isClientFulfillmentError3 = (error) => {
12027
- const message = error instanceof Error ? error.message : String(error ?? "");
12028
- return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
12029
- };
11970
+ import { IconArrowRight as IconArrowRight6 } from "@tabler/icons-react";
12030
11971
  var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
12031
11972
  const { getCurrentUser } = useBlocknoteHandlers();
12032
- const getCurrentUserRef = useRef8(getCurrentUser);
12033
- useEffect33(() => {
11973
+ const getCurrentUserRef = useRef7(getCurrentUser);
11974
+ useEffect34(() => {
12034
11975
  getCurrentUserRef.current = getCurrentUser;
12035
11976
  }, [getCurrentUser]);
12036
11977
  const currentUser = getCurrentUserRef.current();
12037
- const getCollectionName = (collection2) => {
11978
+ const getCollectionName2 = (collection2) => {
12038
11979
  return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
12039
11980
  };
12040
11981
  const isEvaluator = userRole === "EA" /* Evaluator */;
12041
11982
  const canEvaluateClaims = isEvaluator;
12042
11983
  const claimsPanelId = `evaluator-claims-list-${collection.id}`;
12043
- const collectionName = getCollectionName(collection);
12044
- const claimsPanelContent = useMemo34(
12045
- () => /* @__PURE__ */ React142.createElement(
11984
+ const collectionName = getCollectionName2(collection);
11985
+ const claimsPanelContent = useMemo38(
11986
+ () => /* @__PURE__ */ React146.createElement(
12046
11987
  ClaimsList,
12047
11988
  {
12048
11989
  collectionId: collection.id,
@@ -12061,106 +12002,24 @@ var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }
12061
12002
  openClaimsPanel();
12062
12003
  }
12063
12004
  };
12064
- return /* @__PURE__ */ React142.createElement("div", { style: { opacity: canEvaluateClaims ? 1 : 0.5 } }, /* @__PURE__ */ React142.createElement(ListItemContainer, null, /* @__PURE__ */ React142.createElement(Stack97, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React142.createElement(Text71, { size: "sm", fw: 500, c: canEvaluateClaims ? void 0 : "dimmed" }, getCollectionName(collection)), collection.description && /* @__PURE__ */ React142.createElement(Text71, { size: "xs", c: "dimmed" }, collection.description)), /* @__PURE__ */ React142.createElement(Tooltip9, { label: "You need to be an evaluator agent to review claims", disabled: canEvaluateClaims, position: "left", withArrow: true }, /* @__PURE__ */ React142.createElement(ActionIcon21, { variant: "subtle", size: "lg", onClick: handleClick, disabled: !canEvaluateClaims, style: { cursor: canEvaluateClaims ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React142.createElement(IconArrowRight5, { size: 20 })))));
12005
+ return /* @__PURE__ */ React146.createElement("div", { style: { opacity: canEvaluateClaims ? 1 : 0.5 } }, /* @__PURE__ */ React146.createElement(ListItemContainer, null, /* @__PURE__ */ React146.createElement(Stack99, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React146.createElement(Text73, { size: "sm", fw: 500, c: canEvaluateClaims ? void 0 : "dimmed" }, getCollectionName2(collection)), collection.description && /* @__PURE__ */ React146.createElement(Text73, { size: "xs", c: "dimmed" }, collection.description)), /* @__PURE__ */ React146.createElement(Tooltip9, { label: "You need to be an evaluator agent to review claims", disabled: canEvaluateClaims, position: "left", withArrow: true }, /* @__PURE__ */ React146.createElement(ActionIcon21, { variant: "subtle", size: "lg", onClick: handleClick, disabled: !canEvaluateClaims, style: { cursor: canEvaluateClaims ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React146.createElement(IconArrowRight6, { size: 20 })))));
12065
12006
  };
12066
12007
  var ClaimCollectionsList3 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
12067
- const { getUserRoles } = useBlocknoteHandlers();
12068
- const getUserRolesRef = useRef8(getUserRoles);
12069
- useEffect33(() => {
12070
- getUserRolesRef.current = getUserRoles;
12071
- }, [getUserRoles]);
12072
- const [userRoles, setUserRoles] = useState44({});
12073
- const [loadingRoles, setLoadingRoles] = useState44(true);
12074
- const failedRequestKeyRef = useRef8(null);
12075
- const collectionIdsKey = useMemo34(
12076
- () => collections.map((c) => c.id).sort().join("|"),
12077
- [collections]
12078
- );
12079
- const requestKey = useMemo34(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
12080
- useEffect33(() => {
12081
- let isMounted = true;
12082
- const setEmptyRoles = () => {
12083
- const rolesMap = {};
12084
- collections.forEach((collection) => {
12085
- rolesMap[collection.id] = null;
12086
- });
12087
- if (isMounted) {
12088
- setUserRoles(rolesMap);
12089
- }
12090
- };
12091
- const fetchUserRoles = async () => {
12092
- if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
12093
- setLoadingRoles(false);
12094
- return;
12095
- }
12096
- if (!requestKey || failedRequestKeyRef.current === requestKey) {
12097
- setLoadingRoles(false);
12098
- return;
12099
- }
12100
- const getUserRolesFn = getUserRolesRef.current;
12101
- if (typeof getUserRolesFn !== "function") {
12102
- setEmptyRoles();
12103
- setLoadingRoles(false);
12104
- return;
12105
- }
12106
- try {
12107
- setLoadingRoles(true);
12108
- const collectionIds = collections.map((c) => c.id);
12109
- const roles = await getUserRolesFn({
12110
- userAddress,
12111
- adminAddress,
12112
- deedDid: deedId,
12113
- collectionIds
12114
- });
12115
- const rolesMap = {};
12116
- collections.forEach((collection) => {
12117
- const roleData = roles?.find((r) => r.collectionId === collection.id);
12118
- rolesMap[collection.id] = roleData?.role || null;
12119
- });
12120
- setUserRoles(rolesMap);
12121
- } catch (error) {
12122
- if (isClientFulfillmentError3(error)) {
12123
- failedRequestKeyRef.current = requestKey;
12124
- } else {
12125
- failedRequestKeyRef.current = null;
12126
- }
12127
- setEmptyRoles();
12128
- } finally {
12129
- if (isMounted) {
12130
- setLoadingRoles(false);
12131
- }
12132
- }
12133
- };
12134
- fetchUserRoles();
12135
- return () => {
12136
- isMounted = false;
12137
- };
12138
- }, [collections, userAddress, adminAddress, deedId, requestKey]);
12008
+ const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
12139
12009
  if (!collections || collections.length === 0) {
12140
- return /* @__PURE__ */ React142.createElement(Text71, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
12010
+ return /* @__PURE__ */ React146.createElement(Text73, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
12141
12011
  }
12142
12012
  if (loadingRoles) {
12143
- return /* @__PURE__ */ React142.createElement(Center9, { py: "md" }, /* @__PURE__ */ React142.createElement(Loader18, { size: "sm" }));
12013
+ return /* @__PURE__ */ React146.createElement(Center9, { py: "md" }, /* @__PURE__ */ React146.createElement(Loader18, { size: "sm" }));
12144
12014
  }
12145
- return /* @__PURE__ */ React142.createElement(Stack97, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React142.createElement(CollectionItem3, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
12015
+ return /* @__PURE__ */ React146.createElement(Stack99, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React146.createElement(CollectionItem3, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
12146
12016
  };
12147
12017
 
12148
12018
  // src/mantine/blocks/evaluator/flow/FlowView.tsx
12149
12019
  var EvaluatorFlowView = ({ editor, block }) => {
12150
12020
  const { editable } = useBlocknoteContext();
12151
- const { getCurrentUser, getClaimCollections } = useBlocknoteHandlers();
12152
- const getCurrentUserRef = useRef9(getCurrentUser);
12153
- const getClaimCollectionsRef = useRef9(getClaimCollections);
12154
- useEffect34(() => {
12155
- getCurrentUserRef.current = getCurrentUser;
12156
- getClaimCollectionsRef.current = getClaimCollections;
12157
- }, [getCurrentUser, getClaimCollections]);
12158
- const [collections, setCollections] = useState45([]);
12159
- const [loading, setLoading] = useState45(false);
12160
- const [error, setError] = useState45(null);
12161
- const [userAddress, setUserAddress] = useState45("");
12162
- const adminAddressUpdatedRef = useRef9(false);
12163
- const selectedCollectionIds = useMemo35(() => {
12021
+ const userAddress = useCurrentUser();
12022
+ const selectedCollectionIds = useMemo39(() => {
12164
12023
  try {
12165
12024
  const parsed = JSON.parse(block.props.selectedCollections || "[]");
12166
12025
  return Array.isArray(parsed) ? parsed : [];
@@ -12168,72 +12027,29 @@ var EvaluatorFlowView = ({ editor, block }) => {
12168
12027
  return [];
12169
12028
  }
12170
12029
  }, [block.props.selectedCollections]);
12171
- const selectedCollectionIdsStr = useMemo35(() => JSON.stringify([...selectedCollectionIds].sort()), [selectedCollectionIds]);
12172
12030
  const did = block.props.deedDid;
12173
12031
  const adminAddress = block.props.adminAddress || "";
12174
- useEffect34(() => {
12175
- try {
12176
- const currentUser = getCurrentUserRef.current();
12177
- setUserAddress(currentUser?.address || "");
12178
- } catch (err) {
12179
- setUserAddress("");
12180
- }
12181
- }, []);
12182
- const fetchCollections = useCallback32(async () => {
12183
- if (!did || selectedCollectionIds.length === 0) {
12184
- setCollections([]);
12185
- return;
12186
- }
12187
- if (loading) {
12188
- return;
12189
- }
12190
- setLoading(true);
12191
- setError(null);
12192
- try {
12193
- const response = await getClaimCollectionsRef.current({ deedDid: did });
12194
- const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
12195
- const currentAdminAddress = block.props.adminAddress || "";
12196
- if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
12197
- adminAddressUpdatedRef.current = true;
12198
- editor.updateBlock(block, {
12199
- props: {
12200
- ...block.props,
12201
- adminAddress: fetchedAdminAddress
12202
- }
12203
- });
12204
- }
12205
- const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
12206
- setCollections(selectedCollections);
12207
- } catch (err) {
12208
- setError(err instanceof Error ? err.message : "Failed to fetch collections");
12209
- setCollections([]);
12210
- } finally {
12211
- setLoading(false);
12212
- }
12213
- }, [did, selectedCollectionIdsStr]);
12214
- useEffect34(() => {
12215
- fetchCollections();
12216
- }, [fetchCollections]);
12032
+ const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
12217
12033
  if (!did) {
12218
- return /* @__PURE__ */ React143.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React143.createElement(Text72, { size: "sm", c: "dimmed" }, "Please configure the evaluator block in template mode first"));
12034
+ return /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm", c: "dimmed" }, "Please configure the evaluator block in template mode first"));
12219
12035
  }
12220
12036
  if (selectedCollectionIds.length === 0) {
12221
- return /* @__PURE__ */ React143.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React143.createElement(Text72, { size: "sm", c: "dimmed" }, "No claim collections selected"));
12037
+ return /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm", c: "dimmed" }, "No claim collections selected"));
12222
12038
  }
12223
- return /* @__PURE__ */ React143.createElement(Stack98, { w: "100%" }, /* @__PURE__ */ React143.createElement(Flex24, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React143.createElement(Title18, { order: 4 }, "Evaluate Claims"), /* @__PURE__ */ React143.createElement(Flex24, { gap: "xs" }, /* @__PURE__ */ React143.createElement(ActionIcon22, { variant: "subtle", size: "sm", onClick: fetchCollections, loading }, /* @__PURE__ */ React143.createElement(IconRefresh5, { size: 18 })), editable && /* @__PURE__ */ React143.createElement(ActionIcon22, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React143.createElement(IconSettings5, { size: 18 })))), loading ? /* @__PURE__ */ React143.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React143.createElement(Loader19, { size: "md" })) : error ? /* @__PURE__ */ React143.createElement(Alert20, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React143.createElement(IconAlertCircle8, { size: 18 }) }, /* @__PURE__ */ React143.createElement(Text72, { size: "sm" }, error)) : /* @__PURE__ */ React143.createElement(ClaimCollectionsList3, { collections, deedId: did, adminAddress, userAddress, onRefresh: fetchCollections }));
12039
+ return /* @__PURE__ */ React147.createElement(Stack100, { w: "100%" }, /* @__PURE__ */ React147.createElement(Flex24, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React147.createElement(Title19, { order: 4 }, "Evaluate Claims"), /* @__PURE__ */ React147.createElement(Flex24, { gap: "xs" }, /* @__PURE__ */ React147.createElement(ActionIcon22, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React147.createElement(IconRefresh5, { size: 18 })), editable && /* @__PURE__ */ React147.createElement(ActionIcon22, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React147.createElement(IconSettings5, { size: 18 })))), loading ? /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Loader19, { size: "md" })) : error ? /* @__PURE__ */ React147.createElement(Alert20, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React147.createElement(IconAlertCircle8, { size: 18 }) }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm" }, error)) : /* @__PURE__ */ React147.createElement(ClaimCollectionsList3, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
12224
12040
  };
12225
12041
 
12226
12042
  // src/mantine/blocks/evaluator/EvaluatorBlock.tsx
12227
12043
  function EvaluatorBlock({ editor, block }) {
12228
12044
  const { docType } = useBlocknoteContext();
12229
12045
  if (docType === "template") {
12230
- return /* @__PURE__ */ React144.createElement(EvaluatorTemplateView, { editor, block });
12046
+ return /* @__PURE__ */ React148.createElement(EvaluatorTemplateView, { editor, block });
12231
12047
  }
12232
- return /* @__PURE__ */ React144.createElement(EvaluatorFlowView, { editor, block });
12048
+ return /* @__PURE__ */ React148.createElement(EvaluatorFlowView, { editor, block });
12233
12049
  }
12234
12050
 
12235
12051
  // src/mantine/blocks/evaluator/EvaluatorBlockSpec.tsx
12236
- import React145 from "react";
12052
+ import React149 from "react";
12237
12053
  import { createReactBlockSpec as createReactBlockSpec10 } from "@blocknote/react";
12238
12054
  var EvaluatorBlockSpec = createReactBlockSpec10(
12239
12055
  {
@@ -12251,18 +12067,18 @@ var EvaluatorBlockSpec = createReactBlockSpec10(
12251
12067
  {
12252
12068
  render: (props) => {
12253
12069
  const ixoProps = props;
12254
- return /* @__PURE__ */ React145.createElement(EvaluatorBlock, { ...ixoProps });
12070
+ return /* @__PURE__ */ React149.createElement(EvaluatorBlock, { ...ixoProps });
12255
12071
  }
12256
12072
  }
12257
12073
  );
12258
12074
 
12259
12075
  // src/mantine/blocks/list/ui/ListBlocksToolbar.tsx
12260
- import React146 from "react";
12076
+ import React150 from "react";
12261
12077
  import { ActionIcon as ActionIcon23, Group as Group44, Tooltip as Tooltip10 } from "@mantine/core";
12262
12078
  import { IconChevronUp as IconChevronUp4, IconChevronDown as IconChevronDown6 } from "@tabler/icons-react";
12263
12079
  var ListBlocksToolbar = () => {
12264
12080
  const { broadcastCollapse } = useListBlocksUI();
12265
- return /* @__PURE__ */ React146.createElement(Group44, { gap: "xs" }, /* @__PURE__ */ React146.createElement(Tooltip10, { label: "Collapse all lists", withArrow: true }, /* @__PURE__ */ React146.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Collapse all lists", onClick: () => broadcastCollapse("collapse") }, /* @__PURE__ */ React146.createElement(IconChevronUp4, { size: 18 }))), /* @__PURE__ */ React146.createElement(Tooltip10, { label: "Expand all lists", withArrow: true }, /* @__PURE__ */ React146.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Expand all lists", onClick: () => broadcastCollapse("expand") }, /* @__PURE__ */ React146.createElement(IconChevronDown6, { size: 18 }))));
12081
+ return /* @__PURE__ */ React150.createElement(Group44, { gap: "xs" }, /* @__PURE__ */ React150.createElement(Tooltip10, { label: "Collapse all lists", withArrow: true }, /* @__PURE__ */ React150.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Collapse all lists", onClick: () => broadcastCollapse("collapse") }, /* @__PURE__ */ React150.createElement(IconChevronUp4, { size: 18 }))), /* @__PURE__ */ React150.createElement(Tooltip10, { label: "Expand all lists", withArrow: true }, /* @__PURE__ */ React150.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Expand all lists", onClick: () => broadcastCollapse("expand") }, /* @__PURE__ */ React150.createElement(IconChevronDown6, { size: 18 }))));
12266
12082
  };
12267
12083
 
12268
12084
  // src/mantine/blocks/registry/blockRegistry.ts
@@ -12418,10 +12234,10 @@ blockRegistry.register({
12418
12234
  });
12419
12235
 
12420
12236
  // src/mantine/blocks/hooks/useBlockDependencies.ts
12421
- import { useMemo as useMemo36, useEffect as useEffect35, useState as useState46, useCallback as useCallback33 } from "react";
12237
+ import { useMemo as useMemo40, useEffect as useEffect35, useState as useState46, useCallback as useCallback33 } from "react";
12422
12238
 
12423
12239
  // src/mantine/blocks/hooks/useDependsOn.ts
12424
- import { useMemo as useMemo37 } from "react";
12240
+ import { useMemo as useMemo41 } from "react";
12425
12241
 
12426
12242
  // src/mantine/blocks/index.ts
12427
12243
  var blockSpecs = {
@@ -12750,15 +12566,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
12750
12566
  import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
12751
12567
 
12752
12568
  // src/core/hooks/useMatrixProvider.ts
12753
- import { useEffect as useEffect36, useState as useState47, useRef as useRef10, useCallback as useCallback34, useMemo as useMemo38 } from "react";
12569
+ import { useEffect as useEffect36, useState as useState47, useRef as useRef8, useCallback as useCallback34, useMemo as useMemo42 } from "react";
12754
12570
  import { MatrixProvider } from "@ixo/matrix-crdt";
12755
12571
  function useMatrixProvider({ matrixClient, roomId, yDoc }) {
12756
12572
  const [matrixProvider, setProvider] = useState47(null);
12757
12573
  const [status, setStatus] = useState47("disconnected");
12758
- const isMountedRef = useRef10(true);
12759
- const providerRef = useRef10(null);
12760
- const retryTimeoutRef = useRef10(null);
12761
- const providerOptions = useMemo38(
12574
+ const isMountedRef = useRef8(true);
12575
+ const providerRef = useRef8(null);
12576
+ const retryTimeoutRef = useRef8(null);
12577
+ const providerOptions = useMemo42(
12762
12578
  () => ({
12763
12579
  translator: {
12764
12580
  updateEventType: "matrix-crdt.doc_update",
@@ -12845,17 +12661,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
12845
12661
  }
12846
12662
 
12847
12663
  // src/mantine/hooks/useCollaborativeYDoc.ts
12848
- import { useMemo as useMemo39 } from "react";
12664
+ import { useMemo as useMemo43 } from "react";
12849
12665
  import * as Y from "yjs";
12850
12666
  function useCollaborativeYDoc(_options) {
12851
- return useMemo39(() => {
12667
+ return useMemo43(() => {
12852
12668
  const doc = new Y.Doc();
12853
12669
  return doc;
12854
12670
  }, []);
12855
12671
  }
12856
12672
 
12857
12673
  // src/mantine/hooks/useCollaborativeIxoEditor.ts
12858
- import { useMemo as useMemo40, useEffect as useEffect37 } from "react";
12674
+ import { useMemo as useMemo44, useEffect as useEffect37 } from "react";
12859
12675
  function useCreateCollaborativeIxoEditor(options) {
12860
12676
  const yDoc = useCollaborativeYDoc(options);
12861
12677
  const {
@@ -12874,7 +12690,7 @@ function useCreateCollaborativeIxoEditor(options) {
12874
12690
  matrixClient,
12875
12691
  permissions = { write: false }
12876
12692
  } = options || {};
12877
- const memoizedUser = useMemo40(
12693
+ const memoizedUser = useMemo44(
12878
12694
  () => ({
12879
12695
  id: user?.id || "",
12880
12696
  name: user?.name || "",
@@ -12889,7 +12705,7 @@ function useCreateCollaborativeIxoEditor(options) {
12889
12705
  matrixClient,
12890
12706
  roomId: options.roomId
12891
12707
  });
12892
- const defaultUploadFile = useMemo40(
12708
+ const defaultUploadFile = useMemo44(
12893
12709
  () => uploadFile || (async (file) => {
12894
12710
  return new Promise((resolve, reject) => {
12895
12711
  const reader = new FileReader();
@@ -12903,7 +12719,7 @@ function useCreateCollaborativeIxoEditor(options) {
12903
12719
  }),
12904
12720
  [uploadFile]
12905
12721
  );
12906
- const schema = useMemo40(
12722
+ const schema = useMemo44(
12907
12723
  () => BlockNoteSchema2.create({
12908
12724
  blockSpecs: {
12909
12725
  ...defaultBlockSpecs2,
@@ -12918,11 +12734,11 @@ function useCreateCollaborativeIxoEditor(options) {
12918
12734
  }),
12919
12735
  []
12920
12736
  );
12921
- const root = useMemo40(() => yDoc.getMap("root"), [yDoc]);
12922
- const documentFragment = useMemo40(() => yDoc.getXmlFragment("document"), [yDoc]);
12923
- const flowArray = useMemo40(() => yDoc.getArray("flow"), [yDoc]);
12924
- const userFragment = useMemo40(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
12925
- const collaborationConfig = useMemo40(
12737
+ const root = useMemo44(() => yDoc.getMap("root"), [yDoc]);
12738
+ const documentFragment = useMemo44(() => yDoc.getXmlFragment("document"), [yDoc]);
12739
+ const flowArray = useMemo44(() => yDoc.getArray("flow"), [yDoc]);
12740
+ const userFragment = useMemo44(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
12741
+ const collaborationConfig = useMemo44(
12926
12742
  () => ({
12927
12743
  provider: matrixProvider,
12928
12744
  fragment: documentFragment,
@@ -12934,7 +12750,7 @@ function useCreateCollaborativeIxoEditor(options) {
12934
12750
  }),
12935
12751
  [matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
12936
12752
  );
12937
- const ixoConfig = useMemo40(
12753
+ const ixoConfig = useMemo44(
12938
12754
  () => ({
12939
12755
  theme,
12940
12756
  editable,
@@ -12953,7 +12769,7 @@ function useCreateCollaborativeIxoEditor(options) {
12953
12769
  uploadFile: defaultUploadFile,
12954
12770
  collaboration: collaborationConfig
12955
12771
  });
12956
- const titleText = useMemo40(() => yDoc.getText("title"), [yDoc]);
12772
+ const titleText = useMemo44(() => yDoc.getText("title"), [yDoc]);
12957
12773
  let ixoEditor;
12958
12774
  if (editor) {
12959
12775
  ixoEditor = editor;
@@ -13064,15 +12880,15 @@ function useCreateCollaborativeIxoEditor(options) {
13064
12880
  }
13065
12881
 
13066
12882
  // src/mantine/components/CoverImage.tsx
13067
- import React147, { useState as useState48, useRef as useRef11, useEffect as useEffect38 } from "react";
13068
- import { Box as Box23, Button as Button32, Group as Group45 } from "@mantine/core";
12883
+ import React151, { useState as useState48, useRef as useRef9, useEffect as useEffect38 } from "react";
12884
+ import { Box as Box24, Button as Button32, Group as Group45 } from "@mantine/core";
13069
12885
  function CoverImage({ coverImageUrl, logoUrl }) {
13070
12886
  const { editor, handlers, editable } = useBlocknoteContext();
13071
12887
  const [isHovering, setIsHovering] = useState48(false);
13072
12888
  const [isRepositioning, setIsRepositioning] = useState48(false);
13073
12889
  const [coverPosition, setCoverPosition] = useState48(50);
13074
- const coverFileInputRef = useRef11(null);
13075
- const logoFileInputRef = useRef11(null);
12890
+ const coverFileInputRef = useRef9(null);
12891
+ const logoFileInputRef = useRef9(null);
13076
12892
  const [coverImageData, setCoverImageData] = useState48(() => editor?.getCoverImage?.());
13077
12893
  const [logoData, setLogoData] = useState48(() => editor?.getLogo?.());
13078
12894
  useEffect38(() => {
@@ -13145,8 +12961,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13145
12961
  return null;
13146
12962
  }
13147
12963
  if (!hasCover) {
13148
- return /* @__PURE__ */ React147.createElement(
13149
- Box23,
12964
+ return /* @__PURE__ */ React151.createElement(
12965
+ Box24,
13150
12966
  {
13151
12967
  style: {
13152
12968
  position: "relative",
@@ -13158,9 +12974,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13158
12974
  onMouseEnter: () => editable && setIsHovering(true),
13159
12975
  onMouseLeave: () => editable && setIsHovering(false)
13160
12976
  },
13161
- /* @__PURE__ */ React147.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13162
- /* @__PURE__ */ React147.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }),
13163
- editable && isHovering && !logoSrc && /* @__PURE__ */ React147.createElement(
12977
+ /* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
12978
+ /* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }),
12979
+ editable && isHovering && !logoSrc && /* @__PURE__ */ React151.createElement(
13164
12980
  Group45,
13165
12981
  {
13166
12982
  gap: "xs",
@@ -13171,7 +12987,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13171
12987
  zIndex: 10
13172
12988
  }
13173
12989
  },
13174
- /* @__PURE__ */ React147.createElement(
12990
+ /* @__PURE__ */ React151.createElement(
13175
12991
  Button32,
13176
12992
  {
13177
12993
  variant: "filled",
@@ -13188,7 +13004,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13188
13004
  },
13189
13005
  "Add icon"
13190
13006
  ),
13191
- /* @__PURE__ */ React147.createElement(
13007
+ /* @__PURE__ */ React151.createElement(
13192
13008
  Button32,
13193
13009
  {
13194
13010
  variant: "filled",
@@ -13206,8 +13022,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13206
13022
  "Add cover"
13207
13023
  )
13208
13024
  ),
13209
- logoSrc && /* @__PURE__ */ React147.createElement(
13210
- Box23,
13025
+ logoSrc && /* @__PURE__ */ React151.createElement(
13026
+ Box24,
13211
13027
  {
13212
13028
  style: {
13213
13029
  position: "relative",
@@ -13218,7 +13034,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13218
13034
  zIndex: 11
13219
13035
  }
13220
13036
  },
13221
- /* @__PURE__ */ React147.createElement(
13037
+ /* @__PURE__ */ React151.createElement(
13222
13038
  "img",
13223
13039
  {
13224
13040
  src: logoSrc,
@@ -13233,7 +13049,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13233
13049
  }
13234
13050
  }
13235
13051
  ),
13236
- editable && isHovering && /* @__PURE__ */ React147.createElement(
13052
+ editable && isHovering && /* @__PURE__ */ React151.createElement(
13237
13053
  Group45,
13238
13054
  {
13239
13055
  gap: "xs",
@@ -13244,7 +13060,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13244
13060
  zIndex: 12
13245
13061
  }
13246
13062
  },
13247
- /* @__PURE__ */ React147.createElement(
13063
+ /* @__PURE__ */ React151.createElement(
13248
13064
  Button32,
13249
13065
  {
13250
13066
  variant: "filled",
@@ -13261,7 +13077,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13261
13077
  },
13262
13078
  "Change"
13263
13079
  ),
13264
- /* @__PURE__ */ React147.createElement(
13080
+ /* @__PURE__ */ React151.createElement(
13265
13081
  Button32,
13266
13082
  {
13267
13083
  variant: "filled",
@@ -13282,8 +13098,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13282
13098
  )
13283
13099
  );
13284
13100
  }
13285
- return /* @__PURE__ */ React147.createElement(
13286
- Box23,
13101
+ return /* @__PURE__ */ React151.createElement(
13102
+ Box24,
13287
13103
  {
13288
13104
  style: {
13289
13105
  position: "relative",
@@ -13303,7 +13119,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13303
13119
  onMouseMove: handleMouseMove,
13304
13120
  onClick: () => isRepositioning && setIsRepositioning(false)
13305
13121
  },
13306
- /* @__PURE__ */ React147.createElement(
13122
+ /* @__PURE__ */ React151.createElement(
13307
13123
  "img",
13308
13124
  {
13309
13125
  src: coverUrl,
@@ -13321,7 +13137,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13321
13137
  }
13322
13138
  }
13323
13139
  ),
13324
- editable && isHovering && /* @__PURE__ */ React147.createElement(
13140
+ editable && isHovering && /* @__PURE__ */ React151.createElement(
13325
13141
  Group45,
13326
13142
  {
13327
13143
  gap: "xs",
@@ -13332,7 +13148,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13332
13148
  zIndex: 10
13333
13149
  }
13334
13150
  },
13335
- /* @__PURE__ */ React147.createElement(
13151
+ /* @__PURE__ */ React151.createElement(
13336
13152
  Button32,
13337
13153
  {
13338
13154
  variant: "filled",
@@ -13349,7 +13165,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13349
13165
  },
13350
13166
  "Change cover"
13351
13167
  ),
13352
- /* @__PURE__ */ React147.createElement(
13168
+ /* @__PURE__ */ React151.createElement(
13353
13169
  Button32,
13354
13170
  {
13355
13171
  variant: "filled",
@@ -13366,7 +13182,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13366
13182
  },
13367
13183
  isRepositioning ? "Done" : "Reposition"
13368
13184
  ),
13369
- /* @__PURE__ */ React147.createElement(
13185
+ /* @__PURE__ */ React151.createElement(
13370
13186
  Button32,
13371
13187
  {
13372
13188
  variant: "filled",
@@ -13384,8 +13200,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13384
13200
  "Remove"
13385
13201
  )
13386
13202
  ),
13387
- /* @__PURE__ */ React147.createElement(
13388
- Box23,
13203
+ /* @__PURE__ */ React151.createElement(
13204
+ Box24,
13389
13205
  {
13390
13206
  style: {
13391
13207
  position: "absolute",
@@ -13396,7 +13212,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13396
13212
  zIndex: 11
13397
13213
  }
13398
13214
  },
13399
- logoSrc && /* @__PURE__ */ React147.createElement(
13215
+ logoSrc && /* @__PURE__ */ React151.createElement(
13400
13216
  "img",
13401
13217
  {
13402
13218
  src: logoSrc,
@@ -13411,9 +13227,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13411
13227
  }
13412
13228
  }
13413
13229
  ),
13414
- editable && isHovering && /* @__PURE__ */ React147.createElement(React147.Fragment, null, logoSrc ? (
13230
+ editable && isHovering && /* @__PURE__ */ React151.createElement(React151.Fragment, null, logoSrc ? (
13415
13231
  // Logo exists: Show Change/Remove buttons when hovering on cover
13416
- /* @__PURE__ */ React147.createElement(
13232
+ /* @__PURE__ */ React151.createElement(
13417
13233
  Group45,
13418
13234
  {
13419
13235
  gap: "xs",
@@ -13424,7 +13240,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13424
13240
  zIndex: 12
13425
13241
  }
13426
13242
  },
13427
- /* @__PURE__ */ React147.createElement(
13243
+ /* @__PURE__ */ React151.createElement(
13428
13244
  Button32,
13429
13245
  {
13430
13246
  variant: "filled",
@@ -13441,7 +13257,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13441
13257
  },
13442
13258
  "Change"
13443
13259
  ),
13444
- /* @__PURE__ */ React147.createElement(
13260
+ /* @__PURE__ */ React151.createElement(
13445
13261
  Button32,
13446
13262
  {
13447
13263
  variant: "filled",
@@ -13461,7 +13277,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13461
13277
  )
13462
13278
  ) : (
13463
13279
  // No logo: Show "Add icon" button when hovering anywhere on cover
13464
- /* @__PURE__ */ React147.createElement(
13280
+ /* @__PURE__ */ React151.createElement(
13465
13281
  Button32,
13466
13282
  {
13467
13283
  variant: "filled",
@@ -13485,49 +13301,51 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13485
13301
  )
13486
13302
  ))
13487
13303
  ),
13488
- /* @__PURE__ */ React147.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13489
- /* @__PURE__ */ React147.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
13304
+ /* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13305
+ /* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
13490
13306
  );
13491
13307
  }
13492
13308
 
13493
13309
  // src/mantine/IxoEditor.tsx
13494
- import React149 from "react";
13310
+ import React153 from "react";
13495
13311
  import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
13496
13312
  import { BlockNoteView } from "@blocknote/mantine";
13497
13313
  import { filterSuggestionItems } from "@blocknote/core";
13498
- import { Flex as Flex25, MantineProvider, Text as Text73 } from "@mantine/core";
13314
+ import { Flex as Flex25, MantineProvider, Text as Text75 } from "@mantine/core";
13499
13315
 
13500
13316
  // src/mantine/components/PanelContent.tsx
13501
- import React148 from "react";
13502
- import { Box as Box24 } from "@mantine/core";
13317
+ import React152 from "react";
13318
+ import { Box as Box25 } from "@mantine/core";
13503
13319
  var panelStyles = {
13504
13320
  light: {
13505
13321
  backgroundColor: "#ffffff",
13506
13322
  // editor background
13507
13323
  color: "#1a1a1a",
13508
13324
  // main text color
13509
- border: "1px solid #e0e0e0",
13510
- // border color
13511
- // mimic menu/sidebar visual balance
13512
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
13325
+ borderLeft: "1px solid #e0e0e0",
13326
+ // left border only - seamless with editor
13327
+ borderTop: "none",
13328
+ borderRight: "none",
13329
+ borderBottom: "none"
13513
13330
  },
13514
13331
  dark: {
13515
13332
  backgroundColor: "#1f1f1f",
13516
13333
  // editor background
13517
13334
  color: "#f0f0f0",
13518
13335
  // main text color
13519
- border: "1px solid #1a1a1a",
13520
- // border color
13521
- // mimic menu/sidebar visual balance
13522
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
13336
+ borderLeft: "1px solid #3a3a3a",
13337
+ // left border only - seamless with editor
13338
+ borderTop: "none",
13339
+ borderRight: "none",
13340
+ borderBottom: "none"
13523
13341
  }
13524
13342
  };
13525
13343
  function PanelContent({ theme }) {
13526
13344
  const { activePanel, registeredPanels } = usePanelStore();
13527
13345
  const isOpen = activePanel !== null;
13528
13346
  const content = activePanel ? registeredPanels.get(activePanel) : null;
13529
- return /* @__PURE__ */ React148.createElement(
13530
- Box24,
13347
+ return /* @__PURE__ */ React152.createElement(
13348
+ Box25,
13531
13349
  {
13532
13350
  pos: "sticky",
13533
13351
  right: 0,
@@ -13558,34 +13376,47 @@ function IxoEditorContent({
13558
13376
  coverImageUrl,
13559
13377
  logoUrl
13560
13378
  }) {
13561
- return /* @__PURE__ */ React149.createElement("div", { style: { display: "flex", height: "100%" } }, /* @__PURE__ */ React149.createElement("div", { className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`, style: { flex: 1 } }, /* @__PURE__ */ React149.createElement(CoverImage, { coverImageUrl, logoUrl }), /* @__PURE__ */ React149.createElement(
13562
- BlockNoteView,
13379
+ const { activePanel } = usePanelStore();
13380
+ const isPanelOpen = activePanel !== null;
13381
+ return /* @__PURE__ */ React153.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React153.createElement(
13382
+ "div",
13563
13383
  {
13564
- editor,
13565
- editable: isEditable,
13566
- sideMenu: config.sideMenu,
13567
- slashMenu: false,
13568
- formattingToolbar: config.formattingToolbar,
13569
- linkToolbar: config.linkToolbar,
13570
- filePanel: config.filePanel,
13571
- tableHandles: config.tableHandles,
13572
- theme: config.theme,
13573
- onChange,
13574
- onSelectionChange
13384
+ className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
13385
+ style: {
13386
+ width: isPanelVisible && isPanelOpen ? "50%" : "100%",
13387
+ transition: "width 0.2s ease"
13388
+ }
13575
13389
  },
13576
- config.slashMenu && /* @__PURE__ */ React149.createElement(
13577
- SuggestionMenuController,
13390
+ /* @__PURE__ */ React153.createElement(CoverImage, { coverImageUrl, logoUrl }),
13391
+ /* @__PURE__ */ React153.createElement(
13392
+ BlockNoteView,
13578
13393
  {
13579
- triggerCharacter: "/",
13580
- getItems: async (query) => {
13581
- const defaultItems = getDefaultReactSlashMenuItems(editor);
13582
- const customItems = getExtraSlashMenuItems(editor);
13583
- return filterSuggestionItems([...defaultItems, ...customItems], query);
13394
+ editor,
13395
+ editable: isEditable,
13396
+ sideMenu: config.sideMenu,
13397
+ slashMenu: false,
13398
+ formattingToolbar: config.formattingToolbar,
13399
+ linkToolbar: config.linkToolbar,
13400
+ filePanel: config.filePanel,
13401
+ tableHandles: config.tableHandles,
13402
+ theme: config.theme,
13403
+ onChange,
13404
+ onSelectionChange
13405
+ },
13406
+ config.slashMenu && /* @__PURE__ */ React153.createElement(
13407
+ SuggestionMenuController,
13408
+ {
13409
+ triggerCharacter: "/",
13410
+ getItems: async (query) => {
13411
+ const defaultItems = getDefaultReactSlashMenuItems(editor);
13412
+ const customItems = getExtraSlashMenuItems(editor);
13413
+ return filterSuggestionItems([...defaultItems, ...customItems], query);
13414
+ }
13584
13415
  }
13585
- }
13586
- ),
13587
- children
13588
- )), isPanelVisible && /* @__PURE__ */ React149.createElement(PanelContent, { theme: config.theme }));
13416
+ ),
13417
+ children
13418
+ )
13419
+ ), isPanelVisible && /* @__PURE__ */ React153.createElement(PanelContent, { theme: config.theme }));
13589
13420
  }
13590
13421
  function IxoEditor({
13591
13422
  editor,
@@ -13614,7 +13445,7 @@ function IxoEditor({
13614
13445
  tableHandles: true
13615
13446
  };
13616
13447
  const isEditable = editable;
13617
- const editorContent = /* @__PURE__ */ React149.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React149.createElement(ListBlocksUIProvider, null, /* @__PURE__ */ React149.createElement(Flex25, { pr: 25, justify: "flex-end", align: "center", gap: "xs" }, /* @__PURE__ */ React149.createElement(Text73, { size: "xs", c: "dimmed", tt: "uppercase" }, "Global actions"), /* @__PURE__ */ React149.createElement(ListBlocksToolbar, null)), /* @__PURE__ */ React149.createElement(
13448
+ const editorContent = /* @__PURE__ */ React153.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React153.createElement(ListBlocksUIProvider, null, /* @__PURE__ */ React153.createElement(Flex25, { pr: 25, justify: "flex-end", align: "center", gap: "xs" }, /* @__PURE__ */ React153.createElement(Text75, { size: "xs", c: "dimmed", tt: "uppercase" }, "Global actions"), /* @__PURE__ */ React153.createElement(ListBlocksToolbar, null)), /* @__PURE__ */ React153.createElement(
13618
13449
  IxoEditorContent,
13619
13450
  {
13620
13451
  isPanelVisible,
@@ -13630,7 +13461,7 @@ function IxoEditor({
13630
13461
  children
13631
13462
  )));
13632
13463
  if (mantineTheme) {
13633
- return /* @__PURE__ */ React149.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
13464
+ return /* @__PURE__ */ React153.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
13634
13465
  }
13635
13466
  return editorContent;
13636
13467
  }
@@ -13717,4 +13548,4 @@ export {
13717
13548
  ixoGraphQLClient,
13718
13549
  getEntity
13719
13550
  };
13720
- //# sourceMappingURL=chunk-YDHPP6BI.mjs.map
13551
+ //# sourceMappingURL=chunk-3BZ6OPAK.mjs.map