"use client"
const require_state = require('./state-CTITyT0R.js');
let react = require("react");
let _tanstack_react_query = require("@tanstack/react-query");
let axios = require("axios");
axios = require_state.__toESM(axios);

//#region recce-source/js/src/lib/api/cll.ts
async function getCll(input, client = require_state.axiosClient) {
	return (await client.post("/api/cll", input)).data;
}

//#endregion
//#region recce-source/js/src/lib/api/lineagecheck.ts
async function createLineageDiffCheck(viewOptions, client = require_state.axiosClient) {
	return (await client.post("/api/checks", {
		type: "lineage_diff",
		params: {},
		view_options: viewOptions
	})).data;
}

//#endregion
//#region recce-source/js/src/lib/api/schemacheck.ts
async function createSchemaDiffCheck(params, client = require_state.axiosClient) {
	return (await client.post("/api/checks", {
		type: "schema_diff",
		params
	})).data;
}

//#endregion
//#region recce-source/js/src/lib/api/select.ts
async function select(input, client = require_state.axiosClient) {
	return (await client.post(`/api/select`, input)).data;
}

//#endregion
//#region recce-source/js/src/lib/api/sessionStorageKeys.ts
const prefix$1 = "recce";
const sessionStorageKeys = {
	recommendationIgnored: `${prefix$1}-recommendation-ignored`,
	recommendationShowed: `${prefix$1}-recommendation-showed`,
	prevRefreshTimeStamp: `${prefix$1}-prev-refresh-timestamp`,
	lineageNotificationDismissed: `${prefix$1}-lineage-notification-dismissed`
};

//#endregion
//#region recce-source/js/src/lib/api/adhocQuery.ts
async function submitQuery(params, options, client = require_state.axiosClient) {
	return await require_state.submitRun("query", params, options, client);
}
async function submitQueryBase(params, options, client = require_state.axiosClient) {
	return await require_state.submitRun("query_base", params, options, client);
}
async function submitQueryDiff(params, options, client = require_state.axiosClient) {
	return await require_state.submitRun("query_diff", params, options, client);
}

//#endregion
//#region recce-source/js/src/lib/api/localStorageKeys.ts
const prefix = "recce-";
const localStorageKeys = {
	bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,
	previewChangeFeedbackID: `${prefix}-preview-change-feedback`,
	prepareEnvGuideID: `${prefix}-prepare-env`
};

//#endregion
//#region recce-source/js/src/lib/api/connectToCloud.ts
async function connectToCloud(client = require_state.axiosClient) {
	return (await client.post("/api/connect")).data;
}

//#endregion
//#region recce-source/js/src/lib/api/checks.ts
async function createSimpleCheck(client = require_state.axiosClient) {
	return (await client.post("/api/checks", { type: "simple" })).data;
}
async function createCheckByRun(runId, viewOptions, client = require_state.axiosClient) {
	const track_props = require_state.getExperimentTrackingBreakingChangeEnabled() ? { breaking_change_analysis: true } : {};
	return (await client.post("/api/checks", {
		run_id: runId,
		view_options: viewOptions,
		track_props
	})).data;
}
async function listChecks(client = require_state.axiosClient) {
	return (await client.get("/api/checks")).data;
}
function useChecks(enabled) {
	const { apiClient } = require_state.useApiConfig();
	return (0, _tanstack_react_query.useQuery)({
		queryKey: require_state.cacheKeys.checks(),
		queryFn: () => listChecks(apiClient),
		enabled
	});
}
async function getCheck(checkId, client = require_state.axiosClient) {
	return (await client.get(`/api/checks/${checkId}`)).data;
}
async function updateCheck(checkId, payload, client = require_state.axiosClient) {
	return (await client.patch(`/api/checks/${checkId}`, payload)).data;
}
async function deleteCheck(checkId, client = require_state.axiosClient) {
	return (await client.delete(`/api/checks/${checkId}`)).data;
}
async function reorderChecks(order, client = require_state.axiosClient) {
	return await client.post("/api/checks/reorder", order);
}
async function markAsPresetCheck(checkId, client = require_state.axiosClient) {
	await client.post(`/api/checks/${checkId}/mark-as-preset`);
}

//#endregion
//#region recce-source/js/src/lib/api/user.ts
async function fetchUser(client = require_state.axiosClient) {
	try {
		return (await client.get("/api/users")).data;
	} catch (error) {
		console.error("Error fetching user data:", error);
		throw error;
	}
}
async function fetchGitHubAvatar(userId) {
	try {
		return (await axios.default.get(`https://api.github.com/user/${userId}`)).data.avatar_url;
	} catch (error) {
		console.warn("Failed to fetch GitHub avatar:", error);
		return null;
	}
}

//#endregion
//#region recce-source/js/src/lib/api/version.ts
async function getVersion(client = require_state.axiosClient) {
	return (await client.get("/api/version")).data;
}
function useVersionNumber() {
	const [version, setVersion] = (0, react.useState)("");
	const [latestVersion, setLatestVersion] = (0, react.useState)("");
	const { apiClient } = require_state.useApiConfig();
	(0, react.useEffect)(() => {
		async function fetchVersion() {
			try {
				const { version: version$1, latestVersion: latestVersion$1 } = await getVersion(apiClient);
				setVersion(version$1);
				setLatestVersion(latestVersion$1);
			} catch (error) {
				console.error("Error fetching version number:", error);
			}
		}
		fetchVersion();
	}, [apiClient]);
	return {
		version,
		latestVersion
	};
}

//#endregion
Object.defineProperty(exports, 'connectToCloud', {
  enumerable: true,
  get: function () {
    return connectToCloud;
  }
});
Object.defineProperty(exports, 'createCheckByRun', {
  enumerable: true,
  get: function () {
    return createCheckByRun;
  }
});
Object.defineProperty(exports, 'createLineageDiffCheck', {
  enumerable: true,
  get: function () {
    return createLineageDiffCheck;
  }
});
Object.defineProperty(exports, 'createSchemaDiffCheck', {
  enumerable: true,
  get: function () {
    return createSchemaDiffCheck;
  }
});
Object.defineProperty(exports, 'createSimpleCheck', {
  enumerable: true,
  get: function () {
    return createSimpleCheck;
  }
});
Object.defineProperty(exports, 'deleteCheck', {
  enumerable: true,
  get: function () {
    return deleteCheck;
  }
});
Object.defineProperty(exports, 'fetchGitHubAvatar', {
  enumerable: true,
  get: function () {
    return fetchGitHubAvatar;
  }
});
Object.defineProperty(exports, 'fetchUser', {
  enumerable: true,
  get: function () {
    return fetchUser;
  }
});
Object.defineProperty(exports, 'getCheck', {
  enumerable: true,
  get: function () {
    return getCheck;
  }
});
Object.defineProperty(exports, 'getCll', {
  enumerable: true,
  get: function () {
    return getCll;
  }
});
Object.defineProperty(exports, 'getVersion', {
  enumerable: true,
  get: function () {
    return getVersion;
  }
});
Object.defineProperty(exports, 'listChecks', {
  enumerable: true,
  get: function () {
    return listChecks;
  }
});
Object.defineProperty(exports, 'localStorageKeys', {
  enumerable: true,
  get: function () {
    return localStorageKeys;
  }
});
Object.defineProperty(exports, 'markAsPresetCheck', {
  enumerable: true,
  get: function () {
    return markAsPresetCheck;
  }
});
Object.defineProperty(exports, 'reorderChecks', {
  enumerable: true,
  get: function () {
    return reorderChecks;
  }
});
Object.defineProperty(exports, 'select', {
  enumerable: true,
  get: function () {
    return select;
  }
});
Object.defineProperty(exports, 'sessionStorageKeys', {
  enumerable: true,
  get: function () {
    return sessionStorageKeys;
  }
});
Object.defineProperty(exports, 'submitQuery', {
  enumerable: true,
  get: function () {
    return submitQuery;
  }
});
Object.defineProperty(exports, 'submitQueryBase', {
  enumerable: true,
  get: function () {
    return submitQueryBase;
  }
});
Object.defineProperty(exports, 'submitQueryDiff', {
  enumerable: true,
  get: function () {
    return submitQueryDiff;
  }
});
Object.defineProperty(exports, 'updateCheck', {
  enumerable: true,
  get: function () {
    return updateCheck;
  }
});
Object.defineProperty(exports, 'useChecks', {
  enumerable: true,
  get: function () {
    return useChecks;
  }
});
Object.defineProperty(exports, 'useVersionNumber', {
  enumerable: true,
  get: function () {
    return useVersionNumber;
  }
});
//# sourceMappingURL=version-B9s8yne-.js.map