{
  "version": 3,
  "sources": ["auth.js"],
  "sourcesContent": ["import { config } from \"./config.js\";\nimport { clearStored } from \"./stored.js\";\n\nconst TOKEN_KEY = \"authToken\";\nconst SITE_CONTEXT_KEY = \"siteContextUuid\";\nconst SHARED_GALLERY_PASSWORD_KEY = \"sharedGalleryPassword\";\n\nexport function getAuthToken() {\n    return localStorage.getItem(TOKEN_KEY);\n}\n\nexport function setAuthToken(token) {\n    clearStored();\n    localStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearAuthToken() {\n    clearStored();\n    localStorage.removeItem(TOKEN_KEY);\n}\n\n/**\n * Which site the request is about, sent as `X-Photo-Site-UUID` so the API can\n * scope it (see `SiteContextMiddleware`).\n *\n * On a photographer's own site the answer is baked into the page and is the only\n * site it may ask about, so it wins over anything stored; in the panel it is\n * whichever of their sites the photographer is currently managing.\n */\nexport function getSiteContextUuid() {\n    return config.siteUuid ?? localStorage.getItem(SITE_CONTEXT_KEY);\n}\n\nexport function setSiteContextUuid(uuid) {\n    localStorage.setItem(SITE_CONTEXT_KEY, uuid);\n}\n\n/**\n * The password a visitor entered for a password-protected share link, sent as\n * `X-Photo-Password`.\n *\n * NOTE: Kept in session storage rather than local storage - a share link is\n *       shared, so its password has no business outliving the browsing session\n *       on what may well be a borrowed or shared computer.\n */\nexport function getSharedGalleryPassword() {\n    return sessionStorage.getItem(SHARED_GALLERY_PASSWORD_KEY);\n}\n\nexport function setSharedGalleryPassword(password) {\n    sessionStorage.setItem(SHARED_GALLERY_PASSWORD_KEY, password);\n}\n\nexport function clearSharedGalleryPassword() {\n    sessionStorage.removeItem(SHARED_GALLERY_PASSWORD_KEY);\n}\n"],
  "mappings": "AAAA,OAAS,UAAAA,MAAc,cACvB,OAAS,eAAAC,MAAmB,cAE5B,MAAMC,EAAY,YACZC,EAAmB,kBACnBC,EAA8B,wBAE7B,gBAAS,cAAe,CAC3B,OAAO,aAAa,QAAQF,CAAS,CACzC,CAEO,gBAAS,aAAaG,EAAO,CAChCJ,EAAY,EACZ,aAAa,QAAQC,EAAWG,CAAK,CACzC,CAEO,gBAAS,gBAAiB,CAC7BJ,EAAY,EACZ,aAAa,WAAWC,CAAS,CACrC,CAUO,gBAAS,oBAAqB,CACjC,OAAOF,EAAO,UAAY,aAAa,QAAQG,CAAgB,CACnE,CAEO,gBAAS,mBAAmBG,EAAM,CACrC,aAAa,QAAQH,EAAkBG,CAAI,CAC/C,CAUO,gBAAS,0BAA2B,CACvC,OAAO,eAAe,QAAQF,CAA2B,CAC7D,CAEO,gBAAS,yBAAyBG,EAAU,CAC/C,eAAe,QAAQH,EAA6BG,CAAQ,CAChE,CAEO,gBAAS,4BAA6B,CACzC,eAAe,WAAWH,CAA2B,CACzD",
  "names": ["config", "clearStored", "TOKEN_KEY", "SITE_CONTEXT_KEY", "SHARED_GALLERY_PASSWORD_KEY", "token", "uuid", "password"]
}
