// src/product-framework/product-authoring-gate.ts
var runtimeProductAuthoring = null;
function getRuntimeProductAuthoring() {
  return runtimeProductAuthoring;
}
function isPlatformCreatorWorkspace() {
  const vite = readVitePlatformCreatorFlag();
  if (vite !== void 0) return vite;
  const next = readNextPlatformCreatorFlag();
  if (next !== void 0) return next;
  return false;
}
function readVitePlatformCreatorFlag() {
  try {
    const raw = import.meta.env?.VITE_EXXAT_PLATFORM_CREATOR;
    if (raw === "true") return true;
    if (raw === "false") return false;
    return void 0;
  } catch {
    return void 0;
  }
}
function readNextPlatformCreatorFlag() {
  if (typeof process === "undefined") return void 0;
  const raw = process.env.NEXT_PUBLIC_EXXAT_PLATFORM_CREATOR;
  if (raw === "true") return true;
  if (raw === "false") return false;
  return void 0;
}

// src/product-framework/product-authoring.ts
function isProductAuthoringEnabled() {
  if (!isProductAuthoringRuntimeAllowed()) return false;
  const runtime = getRuntimeProductAuthoring();
  if (runtime !== null) return runtime;
  if (isPlatformCreatorWorkspace()) return true;
  const viteFlag = readViteProductAuthoringFlag();
  if (viteFlag !== void 0) return viteFlag;
  const nextFlag = readNextProductAuthoringFlag();
  if (nextFlag !== void 0) return nextFlag;
  return true;
}
function isProductAuthoringRuntimeAllowed() {
  return isViteDev() || isNodeDevelopment();
}
function parseAuthoringFlag(raw) {
  if (raw === "true") return true;
  if (raw === "false") return false;
  return void 0;
}
function readViteProductAuthoringFlag() {
  try {
    const env = import.meta.env;
    if (!env) return void 0;
    return parseAuthoringFlag(env.VITE_EXXAT_PRODUCT_AUTHORING);
  } catch {
    return void 0;
  }
}
function readNextProductAuthoringFlag() {
  if (typeof process === "undefined") return void 0;
  const env = process.env;
  return parseAuthoringFlag(env.NEXT_PUBLIC_EXXAT_PRODUCT_AUTHORING);
}
function isViteDev() {
  try {
    return import.meta.env?.DEV === true;
  } catch {
    return false;
  }
}
function isNodeDevelopment() {
  return typeof process !== "undefined" && process.env.NODE_ENV === "development";
}
export {
  isProductAuthoringEnabled,
  isProductAuthoringRuntimeAllowed
};
//# sourceMappingURL=product-authoring.js.map