{"version":3,"file":"getStaffbaseCsrfToken-DmZ_r2KU.mjs","names":[],"sources":["../src/host/getStaffbaseCsrfToken.ts"],"sourcesContent":["import type { WindowWithStaffbaseAuth } from '../types/host/WindowWithStaffbaseAuth'\n\n/**\n * Reads the Staffbase CSRF token from the host's global auth manager\n * (`window.we.authMgr.getCsrfToken`).\n *\n * Returns null (instead of an empty string) when the token is unavailable, so\n * callers can fail fast with a clear message rather than firing a request the\n * server is guaranteed to reject with a 403.\n * @returns {string | null} The CSRF token, or null when it cannot be resolved.\n */\nexport const getStaffbaseCsrfToken = (): string | null => {\n  if (typeof window === 'undefined') return null\n\n  const w = window as unknown as WindowWithStaffbaseAuth\n  const token = w?.we?.authMgr?.getCsrfToken?.()\n\n  return token && token.length > 0 ? token : null\n}\n"],"mappings":";AAWA,IAAa,UAA6C;CACxD,IAAI,OAAO,SAAW,KAAa,OAAO;CAG1C,IAAM,IAAQ,QAAG,IAAI,SAAS,eAAe;CAE7C,OAAO,KAAS,EAAM,SAAS,IAAI,IAAQ;AAC7C"}