// Static deployment defaults. URL params can override these for local bundles: // modelBase=, runtimeBase=, customKernelBase= (() => { const REMOTE_MODEL_BASE_URL = "https://huggingface.co/ryanhlewis/flux2-klein-4b-webgpu-lowbit/resolve/main"; const params = new URLSearchParams(globalThis.location?.search || ""); const trim = (value) => String(value || "").replace(/\/+$/, ""); const hostname = globalThis.location?.hostname || ""; const localHost = hostname === "127.0.0.1" || hostname === "localhost" || hostname === "::1"; const defaultModelBase = localHost ? "/models" : REMOTE_MODEL_BASE_URL; const modelBase = trim( params.get("modelBase") || params.get("modelBaseUrl") || globalThis.FLUX2_MODEL_BASE_URL || defaultModelBase ); const runtimeFallback = modelBase === "/models" ? "/runtime" : modelBase; const customFallback = modelBase === "/models" ? "/runtime/custom_lowbit" : `${modelBase}/custom_lowbit`; globalThis.FLUX2_MODEL_BASE_URL = modelBase; globalThis.FLUX2_RUNTIME_BASE_URL = trim( params.get("runtimeBase") || params.get("runtimeBaseUrl") || globalThis.FLUX2_RUNTIME_BASE_URL || runtimeFallback ); globalThis.FLUX2_CUSTOM_KERNEL_BASE_URL = trim( params.get("customKernelBase") || params.get("customKernelBaseUrl") || globalThis.FLUX2_CUSTOM_KERNEL_BASE_URL || customFallback ); })();