import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-CdWSQzOH.js";
import { a as utils, d as isProjectDocument, l as assertIsProjectDocument, t as Project } from "./module-Cpz1JYVM.js";
import { c as useDocumentsInSelectedDrive, l as useDocumentsInSelectedFolder, p as useSelectedDocument, s as useDocumentById } from "./dist-B2aX2Fsh.js";
//#region document-models/project/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		name: null,
		description: null,
		contentURI: null,
		email: null,
		membersURI: null,
		attestationIssuersURI: null,
		relevantTo: [],
		image: null,
		coverImage: null,
		licenseURI: null,
		socials: [],
		extensions: null,
		sameAs: [],
		ownerDid: null,
		code: null
	};
}
function defaultLocalState() {
	return {};
}
function defaultPHState() {
	return {
		...defaultBaseState(),
		global: defaultGlobalState(),
		local: defaultLocalState()
	};
}
function createGlobalState(state) {
	return {
		...defaultGlobalState(),
		...state || {}
	};
}
function createLocalState(state) {
	return {
		...defaultLocalState(),
		...state || {}
	};
}
function createState(baseState, globalState, localState) {
	return {
		...createBaseState(baseState?.auth, baseState?.document),
		global: createGlobalState(globalState),
		local: createLocalState(localState)
	};
}
/**
* Creates a ProjectDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createProjectDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/project/v1/gen/controller.ts
const ProjectController = PHDocumentController.forDocumentModel(Project);
//#endregion
//#region document-models/project/v1/hooks.ts
/** Hook to get a Project document by its id */
function useProjectDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isProjectDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Project document */
function useSelectedProjectDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsProjectDocument(document);
	return [document, dispatch];
}
/** Hook to get all Project documents in the selected drive */
function useProjectDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isProjectDocument);
}
/** Hook to get all Project documents in the selected folder */
function useProjectDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isProjectDocument);
}
//#endregion
export { ProjectController as a, defaultGlobalState as c, useSelectedProjectDocument as i, defaultLocalState as l, useProjectDocumentsInSelectedDrive as n, createProjectDocument as o, useProjectDocumentsInSelectedFolder as r, createState as s, useProjectDocumentById as t, defaultPHState as u };

//# sourceMappingURL=project-gM6yUiQB.js.map