import { r as __exportAll } from "./chunk-BSw8zbkd.mjs";
import { A as any, F as literal, L as object, P as lazy, R as string, V as datetime, a as BaseDocumentHeaderSchema, b as generateId, c as baseCreateDocument, f as createAction, g as createState, h as createReducer, j as array, k as _enum, l as baseLoadFromInput, o as BaseDocumentStateSchema, s as baseActions, u as baseSaveToFileHandle, v as defaultBaseState, x as isDocumentAction } from "./dist-CYoGQ6PD.mjs";
//#region document-models/governance/v1/gen/document-model.ts
const documentModel = {
	id: "rfp-hub/governance",
	name: "Governance",
	author: {
		name: "Powerhouse",
		website: "https://www.powerhouse.inc/"
	},
	extension: "rfpg",
	description: "RFP Hub governance — disputes, publisher allowlist decisions, schema/policy RFCs, and published policies. First-class audit trail for all meta-decisions.",
	specifications: [{
		state: {
			local: {
				schema: "",
				examples: [],
				initialValue: ""
			},
			global: {
				schema: "type GovernanceState {\n  # Disputes queue\n  disputes: [Dispute!]!\n\n  # Publisher verification decisions audit trail\n  publisherDecisions: [PublisherDecision!]!\n\n  # Schema / policy change RFCs\n  rfcs: [Rfc!]!\n\n  # Published policies (inclusion, ranking, etc.)\n  policies: [Policy!]!\n}\n\ntype Dispute {\n  id: OID!\n  disputeKind: DisputeKind!\n  subjectRef: PHID!\n  filedBy: String!\n  filedAt: DateTime!\n  summary: String!\n  status: DisputeStatus!\n  assignedTo: String\n  resolvedAt: DateTime\n  resolution: String\n  appealAt: DateTime\n  appealReason: String\n}\n\nenum DisputeKind {\n  DUPLICATE_CLAIM\n  INACCURATE_ENTRY\n  PUBLISHER_CONDUCT\n  REVIEW_DECISION\n  POLICY_VIOLATION\n  OTHER\n}\n\nenum DisputeStatus {\n  OPEN\n  INVESTIGATING\n  RESOLVED\n  DISMISSED\n  APPEALED\n}\n\ntype PublisherDecision {\n  id: OID!\n  grantSystemRef: PHID!\n  decision: PublisherDecisionKind!\n  decidedBy: String!\n  decidedAt: DateTime!\n  reason: String\n}\n\nenum PublisherDecisionKind {\n  APPROVED\n  REVOKED\n  SUSPENDED\n  REINSTATED\n}\n\ntype Rfc {\n  id: OID!\n  title: String!\n  summary: String!\n  author: String!\n  proposedAt: DateTime!\n  status: RfcStatus!\n  ratifiedAt: DateTime\n  implementedAt: DateTime\n}\n\nenum RfcStatus {\n  PROPOSED\n  UNDER_REVIEW\n  RATIFIED\n  IMPLEMENTED\n  REJECTED\n  WITHDRAWN\n}\n\ntype Policy {\n  id: OID!\n  name: String!\n  summary: String!\n  content: String!\n  effectiveFrom: DateTime!\n  supersededAt: DateTime\n  supersededBy: OID\n}\n",
				examples: [],
				initialValue: "{\"disputes\": [], \"publisherDecisions\": [], \"rfcs\": [], \"policies\": []}"
			}
		},
		modules: [
			{
				id: "disputes-module",
				name: "disputes",
				description: "Dispute filing + investigation + resolution + appeal lifecycle",
				operations: [
					{
						id: "gv-file-dispute",
						name: "FILE_DISPUTE",
						description: "",
						schema: "input FileDisputeInput {\n    id: OID!\n    disputeKind: DisputeKind!\n    subjectRef: PHID!\n    filedBy: String!\n    filedAt: DateTime!\n    summary: String!\n}",
						template: "",
						reducer: "state.disputes.push({\n  id: action.input.id,\n  disputeKind: action.input.disputeKind,\n  subjectRef: action.input.subjectRef,\n  filedBy: action.input.filedBy,\n  filedAt: action.input.filedAt,\n  summary: action.input.summary,\n  status: \"OPEN\",\n  assignedTo: null,\n  resolvedAt: null,\n  resolution: null,\n  appealAt: null,\n  appealReason: null,\n});",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-assign-investigator",
						name: "ASSIGN_INVESTIGATOR",
						description: "",
						schema: "input AssignInvestigatorInput {\n    id: OID!\n    assignedTo: String!\n}",
						template: "",
						reducer: "const d = state.disputes.find((x) => x.id === action.input.id);\nif (!d) throw new Error(`Dispute ${action.input.id} not found`);\nd.assignedTo = action.input.assignedTo;\nd.status = \"INVESTIGATING\";",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-resolve-dispute",
						name: "RESOLVE_DISPUTE",
						description: "",
						schema: "input ResolveDisputeInput {\n    id: OID!\n    resolvedAt: DateTime!\n    resolution: String!\n}",
						template: "",
						reducer: "const d = state.disputes.find((x) => x.id === action.input.id);\nif (!d) throw new Error(`Dispute ${action.input.id} not found`);\nd.resolvedAt = action.input.resolvedAt;\nd.resolution = action.input.resolution;\nd.status = \"RESOLVED\";",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-dismiss-dispute",
						name: "DISMISS_DISPUTE",
						description: "",
						schema: "input DismissDisputeInput {\n    id: OID!\n    dismissedAt: DateTime!\n    reason: String!\n}",
						template: "",
						reducer: "const d = state.disputes.find((x) => x.id === action.input.id);\nif (!d) throw new Error(`Dispute ${action.input.id} not found`);\nd.resolvedAt = action.input.dismissedAt;\nd.resolution = action.input.reason;\nd.status = \"DISMISSED\";",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-appeal-dispute",
						name: "APPEAL_DISPUTE",
						description: "",
						schema: "input AppealDisputeInput {\n    id: OID!\n    appealAt: DateTime!\n    appealReason: String!\n}",
						template: "",
						reducer: "const d = state.disputes.find((x) => x.id === action.input.id);\nif (!d) throw new Error(`Dispute ${action.input.id} not found`);\nd.appealAt = action.input.appealAt;\nd.appealReason = action.input.appealReason;\nd.status = \"APPEALED\";",
						errors: [],
						examples: [],
						scope: "global"
					}
				]
			},
			{
				id: "publisher-decisions-module",
				name: "publisher_decisions",
				description: "Audit trail of verified-publisher approval/revoke/suspend decisions",
				operations: [{
					id: "gv-record-publisher-decision",
					name: "RECORD_PUBLISHER_DECISION",
					description: "",
					schema: "input RecordPublisherDecisionInput {\n    id: OID!\n    grantSystemRef: PHID!\n    decision: PublisherDecisionKind!\n    decidedBy: String!\n    decidedAt: DateTime!\n    reason: String\n}",
					template: "",
					reducer: "state.publisherDecisions.push({\n  id: action.input.id,\n  grantSystemRef: action.input.grantSystemRef,\n  decision: action.input.decision,\n  decidedBy: action.input.decidedBy,\n  decidedAt: action.input.decidedAt,\n  reason: action.input.reason || null,\n});",
					errors: [],
					examples: [],
					scope: "global"
				}]
			},
			{
				id: "rfcs-module",
				name: "rfcs",
				description: "Schema and policy change RFCs with propose → review → ratify → implement flow",
				operations: [
					{
						id: "gv-propose-rfc",
						name: "PROPOSE_RFC",
						description: "",
						schema: "input ProposeRfcInput {\n    id: OID!\n    title: String!\n    summary: String!\n    author: String!\n    proposedAt: DateTime!\n}",
						template: "",
						reducer: "state.rfcs.push({\n  id: action.input.id,\n  title: action.input.title,\n  summary: action.input.summary,\n  author: action.input.author,\n  proposedAt: action.input.proposedAt,\n  status: \"PROPOSED\",\n  ratifiedAt: null,\n  implementedAt: null,\n});",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-start-rfc-review",
						name: "START_RFC_REVIEW",
						description: "",
						schema: "input StartRfcReviewInput {\n    id: OID!\n}",
						template: "",
						reducer: "const r = state.rfcs.find((x) => x.id === action.input.id);\nif (!r) throw new Error(`RFC ${action.input.id} not found`);\nr.status = \"UNDER_REVIEW\";",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-ratify-rfc",
						name: "RATIFY_RFC",
						description: "",
						schema: "input RatifyRfcInput {\n    id: OID!\n    ratifiedAt: DateTime!\n}",
						template: "",
						reducer: "const r = state.rfcs.find((x) => x.id === action.input.id);\nif (!r) throw new Error(`RFC ${action.input.id} not found`);\nr.status = \"RATIFIED\";\nr.ratifiedAt = action.input.ratifiedAt;",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-implement-rfc",
						name: "IMPLEMENT_RFC",
						description: "",
						schema: "input ImplementRfcInput {\n    id: OID!\n    implementedAt: DateTime!\n}",
						template: "",
						reducer: "const r = state.rfcs.find((x) => x.id === action.input.id);\nif (!r) throw new Error(`RFC ${action.input.id} not found`);\nr.status = \"IMPLEMENTED\";\nr.implementedAt = action.input.implementedAt;",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-reject-rfc",
						name: "REJECT_RFC",
						description: "",
						schema: "input RejectRfcInput {\n    id: OID!\n}",
						template: "",
						reducer: "const r = state.rfcs.find((x) => x.id === action.input.id);\nif (!r) throw new Error(`RFC ${action.input.id} not found`);\nr.status = \"REJECTED\";",
						errors: [],
						examples: [],
						scope: "global"
					},
					{
						id: "gv-withdraw-rfc",
						name: "WITHDRAW_RFC",
						description: "",
						schema: "input WithdrawRfcInput {\n    id: OID!\n}",
						template: "",
						reducer: "const r = state.rfcs.find((x) => x.id === action.input.id);\nif (!r) throw new Error(`RFC ${action.input.id} not found`);\nr.status = \"WITHDRAWN\";",
						errors: [],
						examples: [],
						scope: "global"
					}
				]
			},
			{
				id: "policies-module",
				name: "policies",
				description: "Published policies (inclusion, ranking, featured placement, etc.)",
				operations: [{
					id: "gv-publish-policy",
					name: "PUBLISH_POLICY",
					description: "",
					schema: "input PublishPolicyInput {\n    id: OID!\n    name: String!\n    summary: String!\n    content: String!\n    effectiveFrom: DateTime!\n}",
					template: "",
					reducer: "state.policies.push({\n  id: action.input.id,\n  name: action.input.name,\n  summary: action.input.summary,\n  content: action.input.content,\n  effectiveFrom: action.input.effectiveFrom,\n  supersededAt: null,\n  supersededBy: null,\n});",
					errors: [],
					examples: [],
					scope: "global"
				}, {
					id: "gv-supersede-policy",
					name: "SUPERSEDE_POLICY",
					description: "",
					schema: "input SupersedePolicyInput {\n    id: OID!\n    supersededAt: DateTime!\n    supersededBy: OID!\n}",
					template: "",
					reducer: "const p = state.policies.find((x) => x.id === action.input.id);\nif (!p) throw new Error(`Policy ${action.input.id} not found`);\np.supersededAt = action.input.supersededAt;\np.supersededBy = action.input.supersededBy;",
					errors: [],
					examples: [],
					scope: "global"
				}]
			}
		],
		version: 1,
		changeLog: []
	}]
};
//#endregion
//#region document-models/governance/v1/src/reducers/disputes.ts
const governanceDisputesOperations = {
	fileDisputeOperation(state, action) {
		state.disputes.push({
			id: action.input.id,
			disputeKind: action.input.disputeKind,
			subjectRef: action.input.subjectRef,
			filedBy: action.input.filedBy,
			filedAt: action.input.filedAt,
			summary: action.input.summary,
			status: "OPEN",
			assignedTo: null,
			resolvedAt: null,
			resolution: null,
			appealAt: null,
			appealReason: null
		});
	},
	assignInvestigatorOperation(state, action) {
		const d = state.disputes.find((x) => x.id === action.input.id);
		if (!d) throw new Error(`Dispute ${action.input.id} not found`);
		d.assignedTo = action.input.assignedTo;
		d.status = "INVESTIGATING";
	},
	resolveDisputeOperation(state, action) {
		const d = state.disputes.find((x) => x.id === action.input.id);
		if (!d) throw new Error(`Dispute ${action.input.id} not found`);
		d.resolvedAt = action.input.resolvedAt;
		d.resolution = action.input.resolution;
		d.status = "RESOLVED";
	},
	dismissDisputeOperation(state, action) {
		const d = state.disputes.find((x) => x.id === action.input.id);
		if (!d) throw new Error(`Dispute ${action.input.id} not found`);
		d.resolvedAt = action.input.dismissedAt;
		d.resolution = action.input.reason;
		d.status = "DISMISSED";
	},
	appealDisputeOperation(state, action) {
		const d = state.disputes.find((x) => x.id === action.input.id);
		if (!d) throw new Error(`Dispute ${action.input.id} not found`);
		d.appealAt = action.input.appealAt;
		d.appealReason = action.input.appealReason;
		d.status = "APPEALED";
	}
};
//#endregion
//#region document-models/governance/v1/src/reducers/publisher-decisions.ts
const governancePublisherDecisionsOperations = { recordPublisherDecisionOperation(state, action) {
	state.publisherDecisions.push({
		id: action.input.id,
		grantSystemRef: action.input.grantSystemRef,
		decision: action.input.decision,
		decidedBy: action.input.decidedBy,
		decidedAt: action.input.decidedAt,
		reason: action.input.reason || null
	});
} };
//#endregion
//#region document-models/governance/v1/src/reducers/rfcs.ts
const governanceRfcsOperations = {
	proposeRfcOperation(state, action) {
		state.rfcs.push({
			id: action.input.id,
			title: action.input.title,
			summary: action.input.summary,
			author: action.input.author,
			proposedAt: action.input.proposedAt,
			status: "PROPOSED",
			ratifiedAt: null,
			implementedAt: null
		});
	},
	startRfcReviewOperation(state, action) {
		const r = state.rfcs.find((x) => x.id === action.input.id);
		if (!r) throw new Error(`RFC ${action.input.id} not found`);
		r.status = "UNDER_REVIEW";
	},
	ratifyRfcOperation(state, action) {
		const r = state.rfcs.find((x) => x.id === action.input.id);
		if (!r) throw new Error(`RFC ${action.input.id} not found`);
		r.status = "RATIFIED";
		r.ratifiedAt = action.input.ratifiedAt;
	},
	implementRfcOperation(state, action) {
		const r = state.rfcs.find((x) => x.id === action.input.id);
		if (!r) throw new Error(`RFC ${action.input.id} not found`);
		r.status = "IMPLEMENTED";
		r.implementedAt = action.input.implementedAt;
	},
	rejectRfcOperation(state, action) {
		const r = state.rfcs.find((x) => x.id === action.input.id);
		if (!r) throw new Error(`RFC ${action.input.id} not found`);
		r.status = "REJECTED";
	},
	withdrawRfcOperation(state, action) {
		const r = state.rfcs.find((x) => x.id === action.input.id);
		if (!r) throw new Error(`RFC ${action.input.id} not found`);
		r.status = "WITHDRAWN";
	}
};
//#endregion
//#region document-models/governance/v1/src/reducers/policies.ts
const governancePoliciesOperations = {
	publishPolicyOperation(state, action) {
		state.policies.push({
			id: action.input.id,
			name: action.input.name,
			summary: action.input.summary,
			content: action.input.content,
			effectiveFrom: action.input.effectiveFrom,
			supersededAt: null,
			supersededBy: null
		});
	},
	supersedePolicyOperation(state, action) {
		const p = state.policies.find((x) => x.id === action.input.id);
		if (!p) throw new Error(`Policy ${action.input.id} not found`);
		p.supersededAt = action.input.supersededAt;
		p.supersededBy = action.input.supersededBy;
	}
};
//#endregion
//#region document-models/governance/v1/gen/schema/zod.ts
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
const definedNonNullAnySchema = any().refine((v) => isDefinedNonNullAny(v));
const DisputeKindSchema = _enum([
	"DUPLICATE_CLAIM",
	"INACCURATE_ENTRY",
	"OTHER",
	"POLICY_VIOLATION",
	"PUBLISHER_CONDUCT",
	"REVIEW_DECISION"
]);
const DisputeStatusSchema = _enum([
	"APPEALED",
	"DISMISSED",
	"INVESTIGATING",
	"OPEN",
	"RESOLVED"
]);
const PublisherDecisionKindSchema = _enum([
	"APPROVED",
	"REINSTATED",
	"REVOKED",
	"SUSPENDED"
]);
const RfcStatusSchema = _enum([
	"IMPLEMENTED",
	"PROPOSED",
	"RATIFIED",
	"REJECTED",
	"UNDER_REVIEW",
	"WITHDRAWN"
]);
function AppealDisputeInputSchema() {
	return object({
		appealAt: datetime(),
		appealReason: string(),
		id: string()
	});
}
function AssignInvestigatorInputSchema() {
	return object({
		assignedTo: string(),
		id: string()
	});
}
function DismissDisputeInputSchema() {
	return object({
		dismissedAt: datetime(),
		id: string(),
		reason: string()
	});
}
function DisputeSchema() {
	return object({
		__typename: literal("Dispute").optional(),
		appealAt: datetime().nullish(),
		appealReason: string().nullish(),
		assignedTo: string().nullish(),
		disputeKind: DisputeKindSchema,
		filedAt: datetime(),
		filedBy: string(),
		id: string(),
		resolution: string().nullish(),
		resolvedAt: datetime().nullish(),
		status: DisputeStatusSchema,
		subjectRef: string(),
		summary: string()
	});
}
function FileDisputeInputSchema() {
	return object({
		disputeKind: DisputeKindSchema,
		filedAt: datetime(),
		filedBy: string(),
		id: string(),
		subjectRef: string(),
		summary: string()
	});
}
function GovernanceStateSchema() {
	return object({
		__typename: literal("GovernanceState").optional(),
		disputes: array(lazy(() => DisputeSchema())),
		policies: array(lazy(() => PolicySchema())),
		publisherDecisions: array(lazy(() => PublisherDecisionSchema())),
		rfcs: array(lazy(() => RfcSchema()))
	});
}
function ImplementRfcInputSchema() {
	return object({
		id: string(),
		implementedAt: datetime()
	});
}
function PolicySchema() {
	return object({
		__typename: literal("Policy").optional(),
		content: string(),
		effectiveFrom: datetime(),
		id: string(),
		name: string(),
		summary: string(),
		supersededAt: datetime().nullish(),
		supersededBy: string().nullish()
	});
}
function ProposeRfcInputSchema() {
	return object({
		author: string(),
		id: string(),
		proposedAt: datetime(),
		summary: string(),
		title: string()
	});
}
function PublishPolicyInputSchema() {
	return object({
		content: string(),
		effectiveFrom: datetime(),
		id: string(),
		name: string(),
		summary: string()
	});
}
function PublisherDecisionSchema() {
	return object({
		__typename: literal("PublisherDecision").optional(),
		decidedAt: datetime(),
		decidedBy: string(),
		decision: PublisherDecisionKindSchema,
		grantSystemRef: string(),
		id: string(),
		reason: string().nullish()
	});
}
function RatifyRfcInputSchema() {
	return object({
		id: string(),
		ratifiedAt: datetime()
	});
}
function RecordPublisherDecisionInputSchema() {
	return object({
		decidedAt: datetime(),
		decidedBy: string(),
		decision: PublisherDecisionKindSchema,
		grantSystemRef: string(),
		id: string(),
		reason: string().nullish()
	});
}
function RejectRfcInputSchema() {
	return object({ id: string() });
}
function ResolveDisputeInputSchema() {
	return object({
		id: string(),
		resolution: string(),
		resolvedAt: datetime()
	});
}
function RfcSchema() {
	return object({
		__typename: literal("Rfc").optional(),
		author: string(),
		id: string(),
		implementedAt: datetime().nullish(),
		proposedAt: datetime(),
		ratifiedAt: datetime().nullish(),
		status: RfcStatusSchema,
		summary: string(),
		title: string()
	});
}
function StartRfcReviewInputSchema() {
	return object({ id: string() });
}
function SupersedePolicyInputSchema() {
	return object({
		id: string(),
		supersededAt: datetime(),
		supersededBy: string()
	});
}
function WithdrawRfcInputSchema() {
	return object({ id: string() });
}
//#endregion
//#region document-models/governance/v1/gen/reducer.ts
const stateReducer = (state, action, dispatch) => {
	if (isDocumentAction(action)) return state;
	switch (action.type) {
		case "FILE_DISPUTE":
			FileDisputeInputSchema().parse(action.input);
			governanceDisputesOperations.fileDisputeOperation(state[action.scope], action, dispatch);
			break;
		case "ASSIGN_INVESTIGATOR":
			AssignInvestigatorInputSchema().parse(action.input);
			governanceDisputesOperations.assignInvestigatorOperation(state[action.scope], action, dispatch);
			break;
		case "RESOLVE_DISPUTE":
			ResolveDisputeInputSchema().parse(action.input);
			governanceDisputesOperations.resolveDisputeOperation(state[action.scope], action, dispatch);
			break;
		case "DISMISS_DISPUTE":
			DismissDisputeInputSchema().parse(action.input);
			governanceDisputesOperations.dismissDisputeOperation(state[action.scope], action, dispatch);
			break;
		case "APPEAL_DISPUTE":
			AppealDisputeInputSchema().parse(action.input);
			governanceDisputesOperations.appealDisputeOperation(state[action.scope], action, dispatch);
			break;
		case "RECORD_PUBLISHER_DECISION":
			RecordPublisherDecisionInputSchema().parse(action.input);
			governancePublisherDecisionsOperations.recordPublisherDecisionOperation(state[action.scope], action, dispatch);
			break;
		case "PROPOSE_RFC":
			ProposeRfcInputSchema().parse(action.input);
			governanceRfcsOperations.proposeRfcOperation(state[action.scope], action, dispatch);
			break;
		case "START_RFC_REVIEW":
			StartRfcReviewInputSchema().parse(action.input);
			governanceRfcsOperations.startRfcReviewOperation(state[action.scope], action, dispatch);
			break;
		case "RATIFY_RFC":
			RatifyRfcInputSchema().parse(action.input);
			governanceRfcsOperations.ratifyRfcOperation(state[action.scope], action, dispatch);
			break;
		case "IMPLEMENT_RFC":
			ImplementRfcInputSchema().parse(action.input);
			governanceRfcsOperations.implementRfcOperation(state[action.scope], action, dispatch);
			break;
		case "REJECT_RFC":
			RejectRfcInputSchema().parse(action.input);
			governanceRfcsOperations.rejectRfcOperation(state[action.scope], action, dispatch);
			break;
		case "WITHDRAW_RFC":
			WithdrawRfcInputSchema().parse(action.input);
			governanceRfcsOperations.withdrawRfcOperation(state[action.scope], action, dispatch);
			break;
		case "PUBLISH_POLICY":
			PublishPolicyInputSchema().parse(action.input);
			governancePoliciesOperations.publishPolicyOperation(state[action.scope], action, dispatch);
			break;
		case "SUPERSEDE_POLICY":
			SupersedePolicyInputSchema().parse(action.input);
			governancePoliciesOperations.supersedePolicyOperation(state[action.scope], action, dispatch);
			break;
		default: return state;
	}
};
const reducer = createReducer(stateReducer);
//#endregion
//#region document-models/governance/v1/gen/disputes/creators.ts
var creators_exports$3 = /* @__PURE__ */ __exportAll({
	appealDispute: () => appealDispute,
	assignInvestigator: () => assignInvestigator,
	dismissDispute: () => dismissDispute,
	fileDispute: () => fileDispute,
	resolveDispute: () => resolveDispute
});
const fileDispute = (input) => createAction("FILE_DISPUTE", { ...input }, void 0, FileDisputeInputSchema, "global");
const assignInvestigator = (input) => createAction("ASSIGN_INVESTIGATOR", { ...input }, void 0, AssignInvestigatorInputSchema, "global");
const resolveDispute = (input) => createAction("RESOLVE_DISPUTE", { ...input }, void 0, ResolveDisputeInputSchema, "global");
const dismissDispute = (input) => createAction("DISMISS_DISPUTE", { ...input }, void 0, DismissDisputeInputSchema, "global");
const appealDispute = (input) => createAction("APPEAL_DISPUTE", { ...input }, void 0, AppealDisputeInputSchema, "global");
//#endregion
//#region document-models/governance/v1/gen/publisher-decisions/creators.ts
var creators_exports$2 = /* @__PURE__ */ __exportAll({ recordPublisherDecision: () => recordPublisherDecision });
const recordPublisherDecision = (input) => createAction("RECORD_PUBLISHER_DECISION", { ...input }, void 0, RecordPublisherDecisionInputSchema, "global");
//#endregion
//#region document-models/governance/v1/gen/rfcs/creators.ts
var creators_exports$1 = /* @__PURE__ */ __exportAll({
	implementRfc: () => implementRfc,
	proposeRfc: () => proposeRfc,
	ratifyRfc: () => ratifyRfc,
	rejectRfc: () => rejectRfc,
	startRfcReview: () => startRfcReview,
	withdrawRfc: () => withdrawRfc
});
const proposeRfc = (input) => createAction("PROPOSE_RFC", { ...input }, void 0, ProposeRfcInputSchema, "global");
const startRfcReview = (input) => createAction("START_RFC_REVIEW", { ...input }, void 0, StartRfcReviewInputSchema, "global");
const ratifyRfc = (input) => createAction("RATIFY_RFC", { ...input }, void 0, RatifyRfcInputSchema, "global");
const implementRfc = (input) => createAction("IMPLEMENT_RFC", { ...input }, void 0, ImplementRfcInputSchema, "global");
const rejectRfc = (input) => createAction("REJECT_RFC", { ...input }, void 0, RejectRfcInputSchema, "global");
const withdrawRfc = (input) => createAction("WITHDRAW_RFC", { ...input }, void 0, WithdrawRfcInputSchema, "global");
//#endregion
//#region document-models/governance/v1/gen/policies/creators.ts
var creators_exports = /* @__PURE__ */ __exportAll({
	publishPolicy: () => publishPolicy,
	supersedePolicy: () => supersedePolicy
});
const publishPolicy = (input) => createAction("PUBLISH_POLICY", { ...input }, void 0, PublishPolicyInputSchema, "global");
const supersedePolicy = (input) => createAction("SUPERSEDE_POLICY", { ...input }, void 0, SupersedePolicyInputSchema, "global");
//#endregion
//#region document-models/governance/v1/actions.ts
/** Actions for the Governance document model */
const actions = {
	...baseActions,
	...creators_exports$3,
	...creators_exports$2,
	...creators_exports$1,
	...creators_exports
};
//#endregion
//#region document-models/governance/v1/gen/document-type.ts
const governanceDocumentType = "rfp-hub/governance";
//#endregion
//#region document-models/governance/v1/gen/document-schema.ts
/** Schema for validating the header object of a Governance document */
const GovernanceDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: literal(governanceDocumentType) });
/** Schema for validating the state object of a Governance document */
const GovernancePHStateSchema = BaseDocumentStateSchema.extend({ global: GovernanceStateSchema() });
const GovernanceDocumentSchema = object({
	header: GovernanceDocumentHeaderSchema,
	state: GovernancePHStateSchema,
	initialState: GovernancePHStateSchema
});
/** Simple helper function to check if a state object is a Governance document state object */
function isGovernanceState(state) {
	return GovernancePHStateSchema.safeParse(state).success;
}
/** Simple helper function to assert that a document state object is a Governance document state object */
function assertIsGovernanceState(state) {
	GovernancePHStateSchema.parse(state);
}
/** Simple helper function to check if a document is a Governance document */
function isGovernanceDocument(document) {
	return GovernanceDocumentSchema.safeParse(document).success;
}
/** Simple helper function to assert that a document is a Governance document */
function assertIsGovernanceDocument(document) {
	GovernanceDocumentSchema.parse(document);
}
//#endregion
//#region document-models/governance/v1/gen/utils.ts
const initialGlobalState = {
	disputes: [],
	publisherDecisions: [],
	rfcs: [],
	policies: []
};
const initialLocalState = {};
const utils$1 = {
	fileExtension: "rfpg",
	createState(state) {
		return {
			...defaultBaseState(),
			global: {
				...initialGlobalState,
				...state?.global
			},
			local: {
				...initialLocalState,
				...state?.local
			}
		};
	},
	createDocument(state) {
		const document = baseCreateDocument(utils$1.createState, state);
		document.header.documentType = governanceDocumentType;
		document.header.id = generateId();
		return document;
	},
	saveToFileHandle(document, input) {
		return baseSaveToFileHandle(document, input);
	},
	loadFromInput(input) {
		return baseLoadFromInput(input, reducer);
	},
	isStateOfType(state) {
		return isGovernanceState(state);
	},
	assertIsStateOfType(state) {
		return assertIsGovernanceState(state);
	},
	isDocumentOfType(document) {
		return isGovernanceDocument(document);
	},
	assertIsDocumentOfType(document) {
		return assertIsGovernanceDocument(document);
	}
};
//#endregion
//#region document-models/governance/v1/src/utils.ts
var utils_exports = /* @__PURE__ */ __exportAll({});
//#endregion
//#region document-models/governance/v1/utils.ts
/** Utils for the Governance document model */
const utils = {
	...utils$1,
	...utils_exports
};
//#endregion
//#region document-models/governance/v1/module.ts
/** Document model module for the Governance document type */
const Governance = {
	version: 1,
	reducer,
	actions,
	utils,
	documentModel: createState(defaultBaseState(), documentModel)
};
//#endregion
export { RfcStatusSchema as $, dismissDispute as A, FileDisputeInputSchema as B, startRfcReview as C, appealDispute as D, recordPublisherDecision as E, AssignInvestigatorInputSchema as F, PublishPolicyInputSchema as G, ImplementRfcInputSchema as H, DismissDisputeInputSchema as I, RatifyRfcInputSchema as J, PublisherDecisionKindSchema as K, DisputeKindSchema as L, resolveDispute as M, reducer as N, assignInvestigator as O, AppealDisputeInputSchema as P, RfcSchema as Q, DisputeSchema as R, rejectRfc as S, creators_exports$2 as T, PolicySchema as U, GovernanceStateSchema as V, ProposeRfcInputSchema as W, RejectRfcInputSchema as X, RecordPublisherDecisionInputSchema as Y, ResolveDisputeInputSchema as Z, supersedePolicy as _, utils$1 as a, documentModel as at, proposeRfc as b, GovernancePHStateSchema as c, isGovernanceDocument as d, StartRfcReviewInputSchema as et, isGovernanceState as f, publishPolicy as g, creators_exports as h, initialLocalState as i, isDefinedNonNullAny as it, fileDispute as j, creators_exports$3 as k, assertIsGovernanceDocument as l, actions as m, utils as n, WithdrawRfcInputSchema as nt, GovernanceDocumentHeaderSchema as o, governanceDocumentType as p, PublisherDecisionSchema as q, initialGlobalState as r, definedNonNullAnySchema as rt, GovernanceDocumentSchema as s, Governance as t, SupersedePolicyInputSchema as tt, assertIsGovernanceState as u, creators_exports$1 as v, withdrawRfc as w, ratifyRfc as x, implementRfc as y, DisputeStatusSchema as z };

//# sourceMappingURL=module-DRNJYxYD.mjs.map