import { b as generateId } from "./dist-CdWSQzOH.js";
import { m as actions } from "./module-Ctaksc0n.js";
import "./upgrade-manifest-DlrLhQpQ.js";
import "./document-drive-DwMcPeeu.js";
import "./chunk-VBDAOXYI-DxYKDIjC.js";
import "./dist-B2aX2Fsh.js";
import { i as useSelectedGovernanceDocument } from "./governance-6La_bH0z.js";
import "./load-design-tokens-DI8M2VZx.js";
import { t as DocumentToolbar } from "./connect-9ej7S5NE-Db2m-K1a.js";
import { useCallback, useState } from "react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region editors/governance-editor/components/GovernanceHeader.tsx
function GovernanceHeader({ state }) {
	const openDisputes = (state.disputes ?? []).filter((d) => d.status === "OPEN" || d.status === "INVESTIGATING").length;
	const activeRfcs = (state.rfcs ?? []).filter((r) => ["PROPOSED", "UNDER_REVIEW"].includes(r.status)).length;
	const hasPendingWork = openDisputes > 0 || activeRfcs > 0;
	return /* @__PURE__ */ jsx("header", {
		className: "rfp-header",
		children: /* @__PURE__ */ jsxs("div", {
			className: "rfp-header-row",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				style: { gap: 4 },
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "rfp-meta",
						children: "Hub Governance"
					}),
					/* @__PURE__ */ jsx("h1", {
						className: "rfp-h1",
						children: "RFP Hub governance"
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "rfp-hint",
						children: [
							state.disputes.length,
							" dispute",
							state.disputes.length === 1 ? "" : "s",
							" · ",
							state.rfcs.length,
							" RFC",
							state.rfcs.length === 1 ? "" : "s",
							" · ",
							state.policies.length,
							" ",
							"polic",
							state.policies.length === 1 ? "y" : "ies"
						]
					})
				]
			}), /* @__PURE__ */ jsx("span", {
				className: `rfp-status-badge ${openDisputes > 0 ? "rfp-status-rejected" : hasPendingWork ? "rfp-status-pending" : "rfp-status-approved"}`,
				children: openDisputes > 0 ? `${openDisputes} open dispute${openDisputes === 1 ? "" : "s"}` : hasPendingWork ? "Pending work" : "All clear"
			})]
		})
	});
}
//#endregion
//#region editors/governance-editor/components/constants.ts
const DISPUTE_STATUS_CLASS = {
	OPEN: "rfp-status-pending",
	INVESTIGATING: "rfp-status-review",
	RESOLVED: "rfp-status-approved",
	DISMISSED: "rfp-status-closed",
	APPEALED: "rfp-status-rejected"
};
const RFC_STATUS_CLASS = {
	PROPOSED: "rfp-status-pending",
	UNDER_REVIEW: "rfp-status-review",
	RATIFIED: "rfp-status-approved",
	IMPLEMENTED: "rfp-status-completed",
	REJECTED: "rfp-status-rejected",
	WITHDRAWN: "rfp-status-closed"
};
//#endregion
//#region editors/governance-editor/components/DisputesSection.tsx
const DISPUTE_KINDS = [
	"DUPLICATE_CLAIM",
	"INACCURATE_ENTRY",
	"PUBLISHER_CONDUCT",
	"REVIEW_DECISION",
	"POLICY_VIOLATION",
	"OTHER"
];
function DisputesSection({ state, on }) {
	const [filedBy, setFiledBy] = useState("");
	const [subjectRef, setSubjectRef] = useState("");
	const [summary, setSummary] = useState("");
	const [kind, setKind] = useState("POLICY_VIOLATION");
	const [actionDraft, setActionDraft] = useState({});
	const canFile = !!filedBy.trim() && !!subjectRef.trim() && !!summary.trim();
	const updateDraft = (id, v) => setActionDraft((prev) => ({
		...prev,
		[id]: v
	}));
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Disputes"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [
					/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { flex: 1 },
						value: filedBy,
						onChange: (e) => setFiledBy(e.target.value),
						placeholder: "Filed by (DID)"
					}),
					/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { flex: 1 },
						value: subjectRef,
						onChange: (e) => setSubjectRef(e.target.value),
						placeholder: "Subject ref (PHID)"
					}),
					/* @__PURE__ */ jsx("select", {
						className: "rfp-select",
						style: { maxWidth: 200 },
						value: kind,
						onChange: (e) => setKind(e.target.value),
						children: DISPUTE_KINDS.map((k) => /* @__PURE__ */ jsx("option", {
							value: k,
							children: k.toLowerCase().replace(/_/g, " ")
						}, k))
					})
				]
			}),
			/* @__PURE__ */ jsx("textarea", {
				className: "rfp-textarea",
				value: summary,
				onChange: (e) => setSummary(e.target.value),
				placeholder: "What's the dispute about?"
			}),
			/* @__PURE__ */ jsx("button", {
				type: "button",
				className: "rfp-btn-primary",
				disabled: !canFile,
				onClick: () => {
					if (canFile) {
						on.fileDispute(filedBy.trim(), subjectRef.trim(), summary.trim(), kind);
						setFiledBy("");
						setSubjectRef("");
						setSummary("");
					}
				},
				style: { alignSelf: "flex-start" },
				children: "File dispute"
			}),
			state.disputes.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No disputes filed."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.disputes.map((d) => {
					const canAssign = d.status === "OPEN";
					const canResolve = d.status === "OPEN" || d.status === "INVESTIGATING";
					const canAppeal = d.status === "RESOLVED" || d.status === "DISMISSED";
					const draft = actionDraft[d.id] ?? "";
					return /* @__PURE__ */ jsxs("li", {
						className: "rfp-list-item",
						style: {
							flexDirection: "column",
							alignItems: "stretch"
						},
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-col",
							style: { gap: 4 },
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-row",
									style: { gap: 8 },
									children: [
										/* @__PURE__ */ jsx("span", {
											className: `rfp-status-badge ${DISPUTE_STATUS_CLASS[d.status] ?? "rfp-status-draft"}`,
											children: d.status.toLowerCase()
										}),
										/* @__PURE__ */ jsx("span", {
											className: "rfp-chip",
											children: d.disputeKind.toLowerCase().replace(/_/g, " ")
										}),
										d.assignedTo ? /* @__PURE__ */ jsxs("span", {
											className: "rfp-chip",
											children: ["→ ", d.assignedTo]
										}) : null
									]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "rfp-body",
									children: d.summary
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: [
										"Subject: ",
										d.subjectRef,
										" · Filed",
										" ",
										new Date(d.filedAt).toLocaleString(),
										" by ",
										d.filedBy
									]
								}),
								d.resolution ? /* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: [
										/* @__PURE__ */ jsx("strong", { children: "Resolution:" }),
										" ",
										d.resolution,
										d.resolvedAt ? ` (${new Date(d.resolvedAt).toLocaleString()})` : ""
									]
								}) : null,
								d.appealReason ? /* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: [
										/* @__PURE__ */ jsx("strong", { children: "Appeal:" }),
										" ",
										d.appealReason,
										d.appealAt ? ` (${new Date(d.appealAt).toLocaleString()})` : ""
									]
								}) : null
							]
						}), (canAssign || canResolve || canAppeal) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
							className: "rfp-input",
							value: draft,
							onChange: (e) => updateDraft(d.id, e.target.value),
							placeholder: canAssign ? "Investigator DID / reason / appeal text" : "Reason / resolution / appeal text"
						}), /* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							style: {
								gap: 8,
								flexWrap: "wrap"
							},
							children: [
								canAssign ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-secondary",
									disabled: !draft.trim(),
									onClick: () => {
										on.assignInvestigator(d.id, draft.trim());
										updateDraft(d.id, "");
									},
									children: "Assign investigator"
								}) : null,
								canResolve ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
									className: "rfp-btn-primary",
									disabled: !draft.trim(),
									onClick: () => {
										on.resolveDispute(d.id, draft.trim());
										updateDraft(d.id, "");
									},
									children: "Resolve"
								}), /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-secondary",
									disabled: !draft.trim(),
									onClick: () => {
										on.dismissDispute(d.id, draft.trim());
										updateDraft(d.id, "");
									},
									style: { color: "var(--rfp-on-surface-variant)" },
									children: "Dismiss"
								})] }) : null,
								canAppeal ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-secondary",
									disabled: !draft.trim(),
									onClick: () => {
										on.appealDispute(d.id, draft.trim());
										updateDraft(d.id, "");
									},
									style: { color: "var(--rfp-error)" },
									children: "Appeal"
								}) : null
							]
						})] })]
					}, d.id);
				})
			})
		]
	});
}
//#endregion
//#region editors/governance-editor/components/RfcsSection.tsx
function RfcsSection({ state, on }) {
	const [title, setTitle] = useState("");
	const [summary, setSummary] = useState("");
	const [author, setAuthor] = useState("");
	const canPropose = !!title.trim() && !!summary.trim() && !!author.trim();
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "RFCs"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: title,
					onChange: (e) => setTitle(e.target.value),
					placeholder: "RFC title"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: author,
					onChange: (e) => setAuthor(e.target.value),
					placeholder: "Author DID"
				})]
			}),
			/* @__PURE__ */ jsx("textarea", {
				className: "rfp-textarea",
				value: summary,
				onChange: (e) => setSummary(e.target.value),
				placeholder: "Short summary"
			}),
			/* @__PURE__ */ jsx("button", {
				type: "button",
				className: "rfp-btn-primary",
				disabled: !canPropose,
				onClick: () => {
					if (canPropose) {
						on.proposeRfc(title.trim(), summary.trim(), author.trim());
						setTitle("");
						setSummary("");
						setAuthor("");
					}
				},
				style: { alignSelf: "flex-start" },
				children: "Propose RFC"
			}),
			state.rfcs.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No RFCs yet."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.rfcs.map((r) => {
					const canStart = r.status === "PROPOSED";
					const canRatify = r.status === "UNDER_REVIEW" || r.status === "PROPOSED";
					const canImplement = r.status === "RATIFIED";
					const canReject = r.status === "PROPOSED" || r.status === "UNDER_REVIEW";
					const canWithdraw = r.status === "PROPOSED" || r.status === "UNDER_REVIEW";
					return /* @__PURE__ */ jsxs("li", {
						className: "rfp-list-item",
						style: {
							flexDirection: "column",
							alignItems: "stretch"
						},
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-col",
							style: { gap: 4 },
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-row",
									style: { gap: 8 },
									children: [/* @__PURE__ */ jsx("strong", { children: r.title }), /* @__PURE__ */ jsx("span", {
										className: `rfp-status-badge ${RFC_STATUS_CLASS[r.status] ?? "rfp-status-draft"}`,
										children: r.status.toLowerCase().replace(/_/g, " ")
									})]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "rfp-body",
									children: r.summary
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: [
										"by ",
										r.author,
										" · proposed",
										" ",
										new Date(r.proposedAt).toLocaleDateString(),
										r.ratifiedAt ? ` · ratified ${new Date(r.ratifiedAt).toLocaleDateString()}` : "",
										r.implementedAt ? ` · implemented ${new Date(r.implementedAt).toLocaleDateString()}` : ""
									]
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							style: {
								gap: 8,
								flexWrap: "wrap"
							},
							children: [
								canStart ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-secondary",
									onClick: () => on.startRfcReview(r.id),
									children: "Start review"
								}) : null,
								canRatify ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-primary",
									onClick: () => on.ratifyRfc(r.id),
									children: "Ratify"
								}) : null,
								canImplement ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-primary",
									onClick: () => on.implementRfc(r.id),
									children: "Mark implemented"
								}) : null,
								canReject ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-secondary",
									onClick: () => on.rejectRfc(r.id),
									style: { color: "var(--rfp-error)" },
									children: "Reject"
								}) : null,
								canWithdraw ? /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-ghost",
									onClick: () => on.withdrawRfc(r.id),
									children: "Withdraw"
								}) : null
							]
						})]
					}, r.id);
				})
			})
		]
	});
}
//#endregion
//#region editors/governance-editor/components/PoliciesSection.tsx
function PoliciesSection({ state, on }) {
	const [name, setName] = useState("");
	const [summary, setSummary] = useState("");
	const [content, setContent] = useState("");
	const [supersedeDraft, setSupersedeDraft] = useState({});
	const canPublish = !!name.trim() && !!summary.trim() && !!content.trim();
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Policies"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx("input", {
				className: "rfp-input",
				value: name,
				onChange: (e) => setName(e.target.value),
				placeholder: "Policy name (e.g. Inclusion Policy v1)"
			}),
			/* @__PURE__ */ jsx("input", {
				className: "rfp-input",
				value: summary,
				onChange: (e) => setSummary(e.target.value),
				placeholder: "Policy summary"
			}),
			/* @__PURE__ */ jsx("textarea", {
				className: "rfp-textarea",
				value: content,
				onChange: (e) => setContent(e.target.value),
				placeholder: "Full policy text (markdown supported)"
			}),
			/* @__PURE__ */ jsx("button", {
				type: "button",
				className: "rfp-btn-primary",
				disabled: !canPublish,
				onClick: () => {
					if (canPublish) {
						on.publishPolicy(name.trim(), summary.trim(), content.trim());
						setName("");
						setSummary("");
						setContent("");
					}
				},
				style: { alignSelf: "flex-start" },
				children: "Publish policy"
			}),
			state.policies.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No policies published."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.policies.map((p) => {
					const draft = supersedeDraft[p.id] ?? "";
					const canSupersede = !p.supersededAt;
					return /* @__PURE__ */ jsxs("li", {
						className: "rfp-list-item",
						style: {
							flexDirection: "column",
							alignItems: "stretch"
						},
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-col",
							style: { gap: 4 },
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-row",
									style: { gap: 8 },
									children: [/* @__PURE__ */ jsx("strong", { children: p.name }), p.supersededAt ? /* @__PURE__ */ jsx("span", {
										className: "rfp-chip",
										children: "superseded"
									}) : /* @__PURE__ */ jsx("span", {
										className: "rfp-chip rfp-chip-primary",
										children: "active"
									})]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "rfp-body",
									children: p.summary
								}),
								/* @__PURE__ */ jsx("pre", {
									className: "rfp-hint",
									style: {
										whiteSpace: "pre-wrap",
										fontFamily: "var(--rfp-font)",
										margin: 0
									},
									children: p.content
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: [
										"Effective",
										" ",
										new Date(p.effectiveFrom).toLocaleDateString(),
										p.supersededAt ? ` · superseded ${new Date(p.supersededAt).toLocaleDateString()}` : "",
										p.supersededBy ? ` · by ${p.supersededBy}` : ""
									]
								})
							]
						}), canSupersede ? /* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							children: [/* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								style: { flex: 1 },
								value: draft,
								onChange: (e) => setSupersedeDraft((prev) => ({
									...prev,
									[p.id]: e.target.value
								})),
								placeholder: "ID of superseding policy"
							}), /* @__PURE__ */ jsx("button", {
								className: "rfp-btn-secondary",
								disabled: !draft.trim(),
								onClick: () => {
									on.supersedePolicy(p.id, draft.trim());
									setSupersedeDraft((prev) => ({
										...prev,
										[p.id]: ""
									}));
								},
								children: "Supersede"
							})]
						}) : null]
					}, p.id);
				})
			})
		]
	});
}
//#endregion
//#region editors/governance-editor/components/PublisherDecisionsSection.tsx
const DECISION_CLASS = {
	APPROVED: "rfp-status-approved",
	REVOKED: "rfp-status-rejected",
	SUSPENDED: "rfp-status-closed",
	REINSTATED: "rfp-status-approved"
};
function PublisherDecisionsSection({ state, on }) {
	const [grantSystemRef, setGrantSystemRef] = useState("");
	const [decision, setDecision] = useState("APPROVED");
	const [decidedBy, setDecidedBy] = useState("");
	const [reason, setReason] = useState("");
	const canRecord = !!grantSystemRef.trim() && !!decidedBy.trim();
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsxs("h2", {
				className: "rfp-section-subtitle",
				children: ["Publisher decisions · ", state.publisherDecisions.length]
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx("p", {
				className: "rfp-hint",
				children: "Audit trail of approve / revoke / suspend decisions on verified publishers. Each decision is an immutable record."
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: grantSystemRef,
					onChange: (e) => setGrantSystemRef(e.target.value),
					placeholder: "Grant system PHID"
				}), /* @__PURE__ */ jsxs("select", {
					className: "rfp-select",
					style: { maxWidth: 160 },
					value: decision,
					onChange: (e) => setDecision(e.target.value),
					children: [
						/* @__PURE__ */ jsx("option", {
							value: "APPROVED",
							children: "Approve"
						}),
						/* @__PURE__ */ jsx("option", {
							value: "REVOKED",
							children: "Revoke"
						}),
						/* @__PURE__ */ jsx("option", {
							value: "SUSPENDED",
							children: "Suspend"
						}),
						/* @__PURE__ */ jsx("option", {
							value: "REINSTATED",
							children: "Reinstate"
						})
					]
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: decidedBy,
					onChange: (e) => setDecidedBy(e.target.value),
					placeholder: "Decided by (DID)"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: reason,
					onChange: (e) => setReason(e.target.value),
					placeholder: "Reason (optional)"
				})]
			}),
			/* @__PURE__ */ jsx("button", {
				className: "rfp-btn-primary",
				disabled: !canRecord,
				onClick: () => {
					on.recordPublisherDecision(grantSystemRef.trim(), decision, decidedBy.trim(), reason.trim());
					setGrantSystemRef("");
					setDecidedBy("");
					setReason("");
				},
				style: { alignSelf: "flex-start" },
				children: "Record decision"
			}),
			state.publisherDecisions.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No publisher decisions yet."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.publisherDecisions.map((d) => /* @__PURE__ */ jsx("li", {
					className: "rfp-list-item",
					children: /* @__PURE__ */ jsxs("div", {
						className: "rfp-col",
						style: {
							gap: 4,
							flex: 1
						},
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "rfp-row",
								style: { gap: 8 },
								children: [/* @__PURE__ */ jsx("span", {
									className: `rfp-status-badge ${DECISION_CLASS[d.decision] ?? "rfp-status-draft"}`,
									children: d.decision.toLowerCase()
								}), /* @__PURE__ */ jsx("span", {
									className: "rfp-hint",
									children: d.grantSystemRef
								})]
							}),
							d.reason ? /* @__PURE__ */ jsx("div", {
								className: "rfp-body",
								children: d.reason
							}) : null,
							/* @__PURE__ */ jsxs("div", {
								className: "rfp-hint",
								children: [
									"by ",
									d.decidedBy,
									" ·",
									" ",
									new Date(d.decidedAt).toLocaleString()
								]
							})
						]
					})
				}, d.id))
			})
		]
	});
}
//#endregion
//#region editors/governance-editor/editor.tsx
function Editor() {
	const [document, dispatch] = useSelectedGovernanceDocument();
	const fileDispute = useCallback((filedBy, subjectRef, summary, disputeKind) => dispatch(actions.fileDispute({
		id: generateId(),
		disputeKind,
		subjectRef,
		filedBy,
		filedAt: (/* @__PURE__ */ new Date()).toISOString(),
		summary
	})), [dispatch]);
	const assignInvestigator = useCallback((id, assignedTo) => dispatch(actions.assignInvestigator({
		id,
		assignedTo
	})), [dispatch]);
	const resolveDispute = useCallback((id, resolution) => dispatch(actions.resolveDispute({
		id,
		resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
		resolution
	})), [dispatch]);
	const dismissDispute = useCallback((id, reason) => dispatch(actions.dismissDispute({
		id,
		dismissedAt: (/* @__PURE__ */ new Date()).toISOString(),
		reason
	})), [dispatch]);
	const appealDispute = useCallback((id, appealReason) => dispatch(actions.appealDispute({
		id,
		appealAt: (/* @__PURE__ */ new Date()).toISOString(),
		appealReason
	})), [dispatch]);
	const proposeRfc = useCallback((title, summary, author) => dispatch(actions.proposeRfc({
		id: generateId(),
		title,
		summary,
		author,
		proposedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const startRfcReview = useCallback((id) => dispatch(actions.startRfcReview({ id })), [dispatch]);
	const ratifyRfc = useCallback((id) => dispatch(actions.ratifyRfc({
		id,
		ratifiedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const implementRfc = useCallback((id) => dispatch(actions.implementRfc({
		id,
		implementedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const rejectRfc = useCallback((id) => dispatch(actions.rejectRfc({ id })), [dispatch]);
	const withdrawRfc = useCallback((id) => dispatch(actions.withdrawRfc({ id })), [dispatch]);
	const publishPolicy = useCallback((name, summary, content) => dispatch(actions.publishPolicy({
		id: generateId(),
		name,
		summary,
		content,
		effectiveFrom: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const supersedePolicy = useCallback((id, supersededBy) => dispatch(actions.supersedePolicy({
		id,
		supersededAt: (/* @__PURE__ */ new Date()).toISOString(),
		supersededBy
	})), [dispatch]);
	const recordPublisherDecision = useCallback((grantSystemRef, decision, decidedBy, reason) => dispatch(actions.recordPublisherDecision({
		id: generateId(),
		grantSystemRef,
		decision,
		decidedBy,
		decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
		reason: reason || null
	})), [dispatch]);
	if (!document) return null;
	const state = document.state.global;
	return /* @__PURE__ */ jsxs("div", {
		className: "rfp-scope",
		children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx("div", {
			className: "rfp-page",
			children: /* @__PURE__ */ jsxs("div", {
				className: "rfp-page-inner",
				children: [
					/* @__PURE__ */ jsx(GovernanceHeader, { state }),
					/* @__PURE__ */ jsx(DisputesSection, {
						state,
						on: {
							fileDispute,
							assignInvestigator,
							resolveDispute,
							dismissDispute,
							appealDispute
						}
					}),
					/* @__PURE__ */ jsx(RfcsSection, {
						state,
						on: {
							proposeRfc,
							startRfcReview,
							ratifyRfc,
							implementRfc,
							rejectRfc,
							withdrawRfc
						}
					}),
					/* @__PURE__ */ jsx(PoliciesSection, {
						state,
						on: {
							publishPolicy,
							supersedePolicy
						}
					}),
					/* @__PURE__ */ jsx(PublisherDecisionsSection, {
						state,
						on: { recordPublisherDecision }
					})
				]
			})
		})]
	});
}
//#endregion
export { Editor as default };

//# sourceMappingURL=editor-DG5o3gAS.js.map