import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-RakiOObV.mjs";
import { T as useDocumentById, c as useDocumentsInSelectedFolder, g as useSelectedDocument, s as useDocumentsInSelectedDrive } from "./dist-DFMBprYi.mjs";
import { a as utils, d as isSourceDocument, l as assertIsSourceDocument, t as Source } from "./module-DZ7wp9Eh.mjs";
//#region document-models/source/v1/gen/controller.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
const SourceController = PHDocumentController.forDocumentModel(Source);
//#endregion
//#region document-models/source/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		title: null,
		description: null,
		content: null,
		sourceType: null,
		status: "INBOX",
		provenance: null,
		extractedClaims: [],
		extractionStats: null,
		createdAt: null,
		createdBy: 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 SourceDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createSourceDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/source/v1/hooks.ts
/** Hook to get a Source document by its id */
function useSourceDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isSourceDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Source document */
function useSelectedSourceDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsSourceDocument(document);
	return [document, dispatch];
}
/** Hook to get all Source documents in the selected drive */
function useSourceDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isSourceDocument);
}
/** Hook to get all Source documents in the selected folder */
function useSourceDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isSourceDocument);
}
//#endregion
export { createSourceDocument as a, defaultLocalState as c, useSourceDocumentsInSelectedFolder as i, defaultPHState as l, useSourceDocumentById as n, createState as o, useSourceDocumentsInSelectedDrive as r, defaultGlobalState as s, useSelectedSourceDocument as t, SourceController as u };

//# sourceMappingURL=source-_wEaBOI7.mjs.map