{"version":3,"sources":["../node_modules/tsup/assets/esm_shims.js","../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../src/umbrella/rspack.ts","../packages/presentation/rspack/src/index.ts","../packages/presentation/rspack/src/schemas.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","/**\n * ESM-safe runtime helpers untuk monorepo.\n *\n * Menggantikan pola fragile seperti:\n *   - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\n *   - `__dirname` → gunakan `getDirname(import.meta.url)`\n *   - `__filename` → gunakan `getFilename(import.meta.url)`\n *\n * Semua helper ini bekerja di ESM dan CJS.\n *\n * @module @tailwind-styled/shared/esmHelpers\n */\n\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\n\n// Safe check for require availability - works in both CJS and ESM\nlet nodeModuleRef: typeof import(\"node:module\") | null = null\nfunction getNodeModuleRef(): typeof import(\"node:module\") | null {\n  if (isBrowser) return null\n  if (nodeModuleRef !== null) return nodeModuleRef\n  try {\n    const test = typeof require === 'function' ? (require('node:module') as typeof import(\"node:module\")) : null\n    nodeModuleRef = test\n    return test\n  } catch {\n    nodeModuleRef = null\n    return null\n  }\n}\n\nlet _nodePath: typeof import(\"node:path\") | null = null\nlet _nodeUrl: typeof import(\"node:url\") | null = null\nlet _nodeFs: typeof import(\"node:fs\") | null = null\nlet _nodeCrypto: typeof import(\"node:crypto\") | null = null\nlet _nodeOs: typeof import(\"node:os\") | null = null\n\n/**\n * Get current file URL in a way that works in both ESM and CJS.\n * In ESM: uses import.meta.url\n * In CJS: uses __filename converted to file URL\n */\nfunction getCurrentFileUrl(): string {\n  // In CJS builds, import.meta.url is replaced by esbuild with __importMetaUrl\n  // which is set via the banner polyfill. In ESM it's the real URL.\n  if (import.meta.url) {\n    return import.meta.url\n  }\n  // Fallback: __filename is available in bare CJS (not bundled)\n  if (typeof __filename !== \"undefined\") {\n    return `file://${__filename.replace(/\\\\/g, \"/\")}`\n  }\n  return \"file://unknown\"\n}\n\nfunction getNodePath(): typeof import(\"node:path\") {\n  if (isBrowser) throw new Error(\"node:path not available in browser\")\n  if (!_nodePath) {\n    if (typeof require === \"function\") {\n      _nodePath = require(\"node:path\") as typeof import(\"node:path\")\n    } else {\n      const nodeRequire = getNodeModuleRef()\n      if (!nodeRequire) throw new Error(\"require not available\")\n      _nodePath = nodeRequire.createRequire(getCurrentFileUrl())(\"node:path\") as typeof import(\"node:path\")\n    }\n  }\n  return _nodePath!\n}\nfunction getNodeUrl(): typeof import(\"node:url\") {\n  if (isBrowser) throw new Error(\"node:url not available in browser\")\n  if (!_nodeUrl) {\n    if (typeof require === \"function\") {\n      _nodeUrl = require(\"node:url\") as typeof import(\"node:url\")\n    } else {\n      const nodeRequire = getNodeModuleRef()\n      if (!nodeRequire) throw new Error(\"require not available\")\n      _nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())(\"node:url\") as typeof import(\"node:url\")\n    }\n  }\n  return _nodeUrl!\n}\nfunction getNodeFs(): typeof import(\"node:fs\") {\n  if (isBrowser) throw new Error(\"node:fs not available in browser\")\n  if (!_nodeFs) {\n    if (typeof require === \"function\") {\n      _nodeFs = require(\"node:fs\") as typeof import(\"node:fs\")\n    } else {\n      const nodeRequire = getNodeModuleRef()\n      if (!nodeRequire) throw new Error(\"require not available\")\n      _nodeFs = nodeRequire.createRequire(getCurrentFileUrl())(\"node:fs\") as typeof import(\"node:fs\")\n    }\n  }\n  return _nodeFs!\n}\nfunction getNodeCrypto(): typeof import(\"node:crypto\") {\n  if (isBrowser) throw new Error(\"node:crypto not available in browser\")\n  if (!_nodeCrypto) {\n    if (typeof require === \"function\") {\n      _nodeCrypto = require(\"node:crypto\") as typeof import(\"node:crypto\")\n    } else {\n      const nodeRequire = getNodeModuleRef()\n      if (!nodeRequire) throw new Error(\"require not available\")\n      _nodeCrypto = nodeRequire.createRequire(getCurrentFileUrl())(\"node:crypto\") as typeof import(\"node:crypto\")\n    }\n  }\n  return _nodeCrypto!\n}\nfunction getNodeOs(): typeof import(\"node:os\") {\n  if (isBrowser) throw new Error(\"node:os not available in browser\")\n  if (!_nodeOs) {\n    if (typeof require === \"function\") {\n      _nodeOs = require(\"node:os\") as typeof import(\"node:os\")\n    } else {\n      const nodeRequire = getNodeModuleRef()\n      if (!nodeRequire) throw new Error(\"require not available\")\n      _nodeOs = nodeRequire.createRequire(getCurrentFileUrl())(\"node:os\") as typeof import(\"node:os\")\n    }\n  }\n  return _nodeOs!\n}\n\n/**\n * Buat `require()` function yang relative terhadap sebuah ESM module.\n *\n * @example\n * const req = createEsmRequire(import.meta.url)\n * const mod = req(\"some-pkg\")\n */\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\n  if (isBrowser) throw new Error(\"require not available in browser\")\n  // CJS: require is already available globally\n  if (typeof require === \"function\") return require\n  const nodeRequire = getNodeModuleRef()\n  if (!nodeRequire) throw new Error(\"require not available\")\n  return nodeRequire.createRequire(importMetaUrl)\n}\n\n/**\n * Dapat `__dirname` dari `import.meta.url`.\n *\n * @example\n * const dir = getDirname(import.meta.url)\n */\nexport function getDirname(importMetaUrl: string): string {\n  if (isBrowser) return \"\"\n  // CJS: __dirname is directly available\n  if (typeof __dirname !== \"undefined\") return __dirname\n  const nodePath = getNodePath()\n  const nodeUrl = getNodeUrl()\n  return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\n}\n\n/**\n * Dapat `__filename` dari `import.meta.url`.\n */\nexport function getFilename(importMetaUrl: string): string {\n  if (isBrowser) return \"\"\n  // CJS: __filename is directly available\n  if (typeof __filename !== \"undefined\") return __filename\n  return getNodeUrl().fileURLToPath(importMetaUrl)\n}\n\n/**\n * Resolve path dari root monorepo (bukan CWD).\n */\nexport function resolveFromRoot(...segments: string[]): string {\n  if (isBrowser) return segments.join(\"/\")\n\n  const nodePath = getNodePath()\n  const nodeFs = getNodeFs()\n\n  // Use __dirname in CJS, or getDirname with current file URL in ESM\n  let dir = typeof __dirname !== \"undefined\"\n    ? __dirname\n    : getDirname(getCurrentFileUrl())\n\n  for (let i = 0; i < 10; i++) {\n    const pkgPath = nodePath.join(dir, \"package.json\")\n    try {\n      const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\n      if (pkg.workspaces) {\n        return nodePath.resolve(dir, ...segments)\n      }\n    } catch { /* intentionally silent */ }\n    dir = nodePath.dirname(dir)\n  }\n  return nodePath.resolve(process.cwd(), ...segments)\n}\n\n/**\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\n */\nexport function tryRequire<T = unknown>(\n  moduleName: string,\n  importMetaUrl: string\n): T | null {\n  if (isBrowser) return null\n  try {\n    return createEsmRequire(importMetaUrl)(moduleName) as T\n  } catch { /* intentionally silent — optional dep */ }\n  return null\n}\n\n/**\n * Resolve .node binary path yang cross-platform dan ESM-safe.\n */\nexport function resolveNativeNodePath(\n  importMetaUrl: string,\n  ...relativeSegments: string[]\n): string {\n  if (isBrowser) return relativeSegments.join(\"/\")\n  return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\n}\n","import { createHash } from \"node:crypto\"\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { createRequire } from \"node:module\"\n\n// Native-only: Node.js is always available. No browser fallback.\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type TokenMap = Record<string, string>\n\nexport type VariantValue = string | number | boolean | undefined\n\nexport type VariantProps = Record<string, VariantValue>\n\nexport type HtmlTagName = keyof HTMLElementTagNameMap\n\nexport type CompoundCondition = Record<string, string | number | boolean>\n\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Logging\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Logger {\n  warn(...args: unknown[]): void\n  debug(...args: unknown[]): void\n  error(...args: unknown[]): void\n  log(...args: unknown[]): void\n}\n\nexport function createLogger(namespace: string): Logger {\n  const prefix = `[${namespace}]`\n  return {\n    warn(...args: unknown[]) {\n      process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n    },\n    debug(...args: unknown[]) {\n      process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n    },\n    error(...args: unknown[]) {\n      process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n    },\n    log(...args: unknown[]) {\n      process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n    },\n  }\n}\n\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\n  const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\n  return (msg: string) => {\n    if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\n      console.debug(prefix, msg)\n    }\n  }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error handling\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\n\ntype ZodLikeIssue = {\n  path?: readonly PropertyKey[]\n  message?: string\n}\n\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\n  if (!path || path.length === 0) return \"(root)\"\n  return path\n    .map((segment) =>\n      typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n    )\n    .join(\".\")\n}\n\nexport class TwError extends Error {\n  /** @deprecated Gunakan source */\n  public readonly domain: string\n  public readonly source: ErrorSource\n  public readonly code: string\n  public readonly originalCause?: unknown\n\n  constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\n    super(message)\n    this.name = \"TwError\"\n    this.domain = domainOrSource\n    this.source = domainOrSource as ErrorSource\n    this.code = code\n    this.originalCause = cause\n    if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\n  }\n\n  static fromIo(code: string, message: string): TwError {\n    return new TwError(\"io\", code, message)\n  }\n\n  static fromCompile(code: string, message: string): TwError {\n    return new TwError(\"compile\", code, message)\n  }\n\n  static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\n    if (err instanceof TwError) return err\n    if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\n    if (err && typeof err === \"object\") {\n      const e = err as { code?: string; message?: string }\n      return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\n    }\n    return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\n  }\n\n  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\n  static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\n    const first = err.issues?.[0] ?? err.errors?.[0]\n    const path = formatIssuePath(first?.path)\n    const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\n    return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\n  }\n\n  static wrap(source: string, code: string, err: unknown): TwError {\n    if (err instanceof TwError) return err\n    if (err instanceof Error) return new TwError(source, code, err.message, err)\n    return new TwError(source, code, String(err), err)\n  }\n\n  override toString(): string {\n    return `TwError [${this.source}:${this.code}] ${this.message}`\n  }\n\n  toJSON(): { name: string; source: string; code: string; message: string } {\n    return { name: this.name, source: this.source, code: this.code, message: this.message }\n  }\n\n  toCliMessage(): string {\n    return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\n  }\n}\n\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\n  return TwError.wrap(domain, code, error)\n}\n\nexport function isTwError(err: unknown): err is TwError {\n  return err instanceof TwError\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Native binding resolution\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface LoadNativeBindingOptions<T> {\n  runtimeDir: string\n  candidates: string[]\n  isValid: (module: unknown) => module is T\n  invalidExportMessage: string\n}\n\nexport interface LoadNativeBindingResult<T> {\n  binding: T | null\n  loadErrors: Array<{ path: string; message: string }>\n  loadedPath?: string\n}\n\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\n  const { runtimeDir, candidates, isValid } = options\n  const loadErrors: Array<{ path: string; message: string }> = []\n\n  for (const candidate of candidates) {\n    const candidatePath = path.resolve(runtimeDir, candidate)\n    try {\n      if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\n        continue\n      }\n      const mod = requireNativeModule(candidatePath)\n      if (mod && isValid(mod)) {\n        return { binding: mod, loadErrors, loadedPath: candidatePath }\n      }\n      loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\n    } catch (e) {\n      loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\n    }\n  }\n\n  return { binding: null, loadErrors }\n}\n\nconst _require = createRequire(\n  typeof __filename !== \"undefined\"\n    ? `file://${__filename}`\n    : (import.meta.url ?? \"file://unknown\")\n)\n\nfunction requireNativeModule(p: string): unknown {\n  return _require(p)\n}\n\nexport interface ResolveCandidatesOptions {\n  runtimeDir?: string\n  envVarNames?: string[]\n  includeDefaultCandidates?: boolean\n  enforceNodeExtensionForEnvPath?: boolean\n  /** @deprecated — ignored, kept for backward compat */\n  packageName?: string\n}\n\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\n  const {\n    envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\n    includeDefaultCandidates = true,\n    enforceNodeExtensionForEnvPath = false,\n  } = options\n  // Default ke cwd kalau runtimeDir tidak disediakan\n  const runtimeDir = options.runtimeDir || process.cwd()\n  const candidates: string[] = []\n\n  for (const envVar of envVarNames) {\n    const envPath = process.env[envVar]\n    if (envPath) {\n      candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\n    }\n  }\n\n  if (!includeDefaultCandidates) return candidates\n\n  if (fs.existsSync(runtimeDir)) {\n    try {\n      for (const entry of fs.readdirSync(runtimeDir)) {\n        if (entry.endsWith(\".node\")) candidates.push(entry)\n      }\n    } catch { /* ignore read errors */ }\n  }\n\n  const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\n  const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\n    : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\n      : `${process.platform}-${process.arch}`\n\n  for (const bin of BINARY_NAMES) {\n    candidates.push(path.resolve(runtimeDir, `${bin}.node`))\n    candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\n    // 1 level: dist/ → package-root/native/ (published npm package)\n    candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.node`))\n    candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n    // cwd fallback (user project root)\n    candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\n    candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\n    // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/ (monorepo dev)\n    candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n    candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n    // 3 level fallback\n    candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n  }\n\n  return Array.from(new Set(candidates))\n}\n\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\n  if (dir) return path.resolve(dir)\n  try {\n    return path.dirname(fileURLToPath(importMetaUrl))\n  } catch {\n    return process.cwd()\n  }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Hashing\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\n  const hash = createHash(algorithm).update(content).digest(\"hex\")\n  return length ? hash.slice(0, length) : hash\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error formatting\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function formatErrorMessage(error: unknown): string {\n  if (error instanceof TwError) return error.toString()\n  if (error instanceof Error) return error.message\n  return String(error)\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// LRU Cache\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport class LRUCache<K, V> {\n  private capacity: number\n  private cache: Map<K, V>\n\n  constructor(capacity: number) {\n    this.capacity = capacity\n    this.cache = new Map()\n  }\n\n  get(key: K): V | undefined {\n    if (!this.cache.has(key)) return undefined\n    const value = this.cache.get(key)!\n    this.cache.delete(key)\n    this.cache.set(key, value)\n    return value\n  }\n\n  set(key: K, value: V): void {\n    if (this.cache.has(key)) {\n      this.cache.delete(key)\n    } else if (this.cache.size >= this.capacity) {\n      const firstKey = this.cache.keys().next().value\n      if (firstKey !== undefined) {\n        this.cache.delete(firstKey)\n      }\n    }\n    this.cache.set(key, value)\n  }\n\n  delete(key: K): boolean {\n    return this.cache.delete(key)\n  }\n\n  has(key: K): boolean {\n    return this.cache.has(key)\n  }\n\n  clear(): void {\n    this.cache.clear()\n  }\n\n  entries(): IterableIterator<[K, V]> {\n    return this.cache.entries()\n  }\n\n  get size(): number {\n    return this.cache.size\n  }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Trace Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\nexport {\n  getHealthColor,\n  getModeColor,\n  formatMemory,\n  formatDuration,\n  calculateHealth,\n  getBuildTimeColor,\n  getMemoryColor,\n  createTraceSnapshot,\n  getPipelinePercentages,\n} from \"./trace\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Performance Telemetry\n// ─────────────────────────────────────────────────────────────────────────────\n\n\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error Codes\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { ErrorCode } from \"./error-codes\"\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tailwind Compatibility\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TailwindInfo } from \"./compatibility\"\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\n\n// ── Native binding schemas (Zod boundary validation)\nexport {\n  NativeScanFileSchema, NativeScanResultSchema,\n  NativeAnalyzerReportSchema, NativeTransformResultSchema,\n  NativeCssCompileResultSchema, NativeWatchResultSchema,\n  NativeCacheEntrySchema, NativeCacheReadResultSchema,\n  safeParseNative, parseNative,\n} from './native-schemas'\n\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\nexport {\n  createEsmRequire,\n  getDirname,\n  getFilename,\n  resolveFromRoot,\n  tryRequire,\n  resolveNativeNodePath,\n} from \"./esmHelpers\"\n\n// ── Performance telemetry ────────────────────────────────────────────────────\nexport {\n  TelemetryCollector,\n  getGlobalTelemetry,\n  resetGlobalTelemetry,\n  createBuildTimer,\n  type BuildTelemetry,\n  type TelemetrySummary,\n  type BuildPhases,\n} from \"./telemetry\"\n\n// ── Config/JSON schema validation ─────────────────────────────────────────────\nexport {\n  ScanCacheSchema,\n  ScanCacheClassEntrySchema,\n  TailwindConfigSchema,\n  RegistryPluginEntrySchema,\n  RegistryFileSchema,\n  PackageJsonSchema,\n  parseJsonWithSchema,\n  parseJsonFileWithSchema,\n  type ScanCache,\n  type ScanCacheClassEntry,\n  type TailwindConfig,\n  type RegistryPluginEntry,\n  type RegistryFile,\n  type PackageJson,\n} from \"./configSchemas\"\n\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\nexport {\n  resolveWorkerPath,\n  resolveLoaderPath,\n  type WorkerPathOptions,\n  type WorkerPathResult,\n} from \"./workerResolver\"\n\n// ── Codegen helpers ───────────────────────────────────────────────────────────\nexport {\n  generateComponentCode,\n  generateStorybookStory,\n  generateClassRenameCodemod,\n  generateBarrelFile,\n  type ComponentCodegenOptions,\n} from \"./codegen\"\n\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\nexport {\n  resolveNativeBinary,\n  formatNativeNotFoundError,\n  type NativeResolutionResult,\n} from \"./native-resolution\"\n\n// ── Shared observability contract ────────────────────────────────────────────\nexport {\n  createObservabilityClient,\n  type ClassInspection,\n  type ClassProperty,\n  type ClassUsageLocation,\n  type BuildTrace,\n  type BuildPhaseTrace,\n  type DashboardMetrics,\n  type DashboardSummary,\n  type ObservabilityClient,\n} from \"./observability\"\n\nexport {\n  TW_STATE_STATIC_FILENAME,\n  extractStaticStateCss,\n  appendStaticStateCssToSafelist,\n  type TwStateConfigEntry,\n  type StaticStateCssInput,\n  type GeneratedStateRule,\n  type StaticStateExtractionResult,\n} from \"./staticStateExtractor\"\nexport { setGlobalLogFile } from \"./logger\"","export * from \"@tailwind-styled/rspack\"\n","/**\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\n *\n * Usage:\n *   import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\n *\n *   export default defineConfig({\n *     plugins: [tailwindStyledRspackPlugin()],\n *   })\n *\n * v5:\n * - Simplified API\n * - Mode always zero-runtime\n */\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\n\nimport { parseRspackPluginOptions } from \"./schemas\"\n\nfunction getDirname(): string {\n  if (typeof __dirname !== \"undefined\") {\n    return __dirname\n  }\n  if (typeof import.meta !== \"undefined\" && import.meta.url) {\n    return getEsmDirname(import.meta.url)\n  }\n  return process.cwd()\n}\n\nfunction resolveLoaderPath(basename: string): string {\n  const runtimeDir = getDirname()\n  const preferredExtensions =\n    typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\n\n  for (const ext of preferredExtensions) {\n    const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\n    if (fs.existsSync(candidate)) return candidate\n  }\n\n  return path.resolve(runtimeDir, `${basename}.js`)\n}\n\ninterface RspackRule {\n  _tailwindStyledRspackMarker?: boolean\n  test?: RegExp\n  exclude?: RegExp\n  use?: Array<{\n    loader: string\n    options: {\n      mode: \"zero-runtime\"\n      addDataAttr: boolean\n      preserveImports: boolean\n      safelistPath?: string\n    }\n  }>\n}\n\ninterface RspackCompiler {\n  options: {\n    mode?: string\n    module?: {\n      rules?: RspackRule[]\n    }\n  }\n}\n\nexport interface RspackPluginOptions {\n  /** File patterns to include. Default: /\\.[jt]sx?$/ */\n  include?: RegExp\n  /** File patterns to exclude. Default: /node_modules/ */\n  exclude?: RegExp\n  /** Add data-tw debug attributes in dev. Default: true in dev */\n  addDataAttr?: boolean\n  /** Enable analyzer. Default: false */\n  analyze?: boolean\n  /**\n   * Path ke safelist CSS file.\n   * `_tw-state-static.css` ditulis di direktori yang sama.\n   * Default: `<cwd>/__tw_safelist.css`\n   */\n  safelistPath?: string\n}\n\nexport class TailwindStyledRspackPlugin {\n  private opts: RspackPluginOptions\n\n  constructor(opts: RspackPluginOptions = {}) {\n    this.opts = parseRspackPluginOptions(opts)\n  }\n\n  apply(compiler: RspackCompiler): void {\n    const isDev = compiler.options.mode !== \"production\"\n    const loaderPath = resolveLoaderPath(\"loader\")\n    const existing = compiler.options.module?.rules ?? []\n    const alreadyRegistered = existing.some(\n      (rule) =>\n        typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\n    )\n\n    if (alreadyRegistered) return\n\n    const safelistPath =\n      this.opts.safelistPath ?? path.join(process.cwd(), \"__tw_safelist.css\")\n\n    // Tulis placeholder agar @import di CSS entry tidak error saat cold start\n    const stateStaticPath = path.join(path.dirname(safelistPath), \"_tw-state-static.css\")\n    if (!fs.existsSync(stateStaticPath)) {\n      try {\n        fs.mkdirSync(path.dirname(stateStaticPath), { recursive: true })\n        fs.writeFileSync(\n          stateStaticPath,\n          `/* _tw-state-static.css — Auto-generated by tailwind-styled-v4. DO NOT EDIT.\\n` +\n          ` * Import di CSS entry: @import \"./_tw-state-static.css\";\\n` +\n          ` */\\n`,\n          \"utf-8\"\n        )\n      } catch { /* non-fatal */ }\n    }\n\n    const rule: RspackRule = {\n      _tailwindStyledRspackMarker: true,\n      test: this.opts.include ?? /\\.[jt]sx?$/,\n      exclude: this.opts.exclude ?? /node_modules/,\n      use: [\n        {\n          loader: loaderPath,\n          options: {\n            mode: \"zero-runtime\",\n            addDataAttr: this.opts.addDataAttr ?? isDev,\n            preserveImports: true,\n            safelistPath,\n          },\n        },\n      ],\n    }\n\n    compiler.options.module = {\n      ...(compiler.options.module ?? {}),\n      rules: [rule, ...existing],\n    }\n  }\n}\n\nexport function tailwindStyledRspackPlugin(\n  opts: RspackPluginOptions = {}\n): TailwindStyledRspackPlugin {\n  return new TailwindStyledRspackPlugin(opts)\n}\n\nexport default tailwindStyledRspackPlugin\n\nexport {\n  parseRspackPluginOptions,\n  type RspackPluginOptionsInput,\n  RspackPluginOptionsSchema,\n} from \"./schemas\"\n","import { z } from \"zod\"\nimport { TwError } from \"@tailwind-styled/shared\"\n\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\n  path.length > 0\n    ? path\n        .map((segment) =>\n          typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n        )\n        .join(\".\")\n    : \"<root>\"\n\nconst formatIssues = (error: z.ZodError): string =>\n  error.issues\n    .map((issue) => {\n      const p = formatIssuePath(issue.path)\n      return `${p}: ${issue.message}`\n    })\n    .join(\"; \")\n\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\n  const parsed = schema.safeParse(data)\n  if (parsed.success) return parsed.data\n  const details = formatIssues(parsed.error)\n  throw new TwError(\n    \"validation\",\n    \"SCHEMA_VALIDATION_FAILED\",\n    details ? `${label}: ${details}` : label,\n    parsed.error\n  )\n}\n\nexport const RspackPluginOptionsSchema = z.object({\n  include: z.instanceof(RegExp).optional(),\n  exclude: z.instanceof(RegExp).optional(),\n  addDataAttr: z.boolean().optional(),\n  analyze: z.boolean().optional(),\n  cssEntry: z.string().optional(),\n  /** Path ke safelist CSS file. Default: <cwd>/__tw_safelist.css */\n  safelistPath: z.string().optional(),\n})\n\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\n\nexport const parseRspackPluginOptions = (options: unknown) =>\n  parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\n"],"mappings":";;;;;;;;;;;;AACA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAF9B,IAIM,aACA,YAEO,WACA;AARb;AAAA;AAAA;AAIA,IAAM,cAAc,MAAM,cAAc,YAAY,GAAG;AACvD,IAAM,aAAa,MAAM,KAAK,QAAQ,YAAY,CAAC;AAE5C,IAAM,YAA4B,2BAAW;AAC7C,IAAM,aAA6B,4BAAY;AAAA;AAAA;;;ACStD,SAAS,mBAAwD;AAC/D,MAAI,UAAW,QAAO;AACtB,MAAI,kBAAkB,KAAM,QAAO;AACnC,MAAI;AACF,UAAM,OAAO,OAAO,cAAY,aAAc,UAAQ,QAAa,IAAqC;AACxG,oBAAgB;AAChB,WAAO;AAAA,EACT,QAAQ;AACN,oBAAgB;AAChB,WAAO;AAAA,EACT;AACF;AAaA,SAAS,oBAA4B;AAGnC,MAAI,YAAY,KAAK;AACnB,WAAO,YAAY;AAAA,EACrB;AAEA,MAAI,OAAO,eAAe,aAAa;AACrC,WAAO,UAAU,WAAW,QAAQ,OAAO,GAAG,CAAC;AAAA,EACjD;AACA,SAAO;AACT;AAEA,SAAS,cAA0C;AACjD,MAAI,UAAW,OAAM,IAAI,MAAM,oCAAoC;AACnE,MAAI,CAAC,WAAW;AACd,QAAI,OAAO,cAAY,YAAY;AACjC,kBAAY,UAAQ,MAAW;AAAA,IACjC,OAAO;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