{"version":3,"file":"auth.js","sources":["../../../resources/javascript/entrypoint/auth.js"],"sourcesContent":["// This file implements frontend functionality for the sign in modal.\n//\n// The sign in flow can be triggered in two ways. The easiest is by setting the\n// hash of the current location. For example:\n// `<a href=\"#sign-in?email=test@d3r.com&successRedirect=/\">Sign In</a>`\n//\n// That can also be done programatically, e.g.:\n// `window.location.hash = '#sign-in?email=test@d3r.com&successRedirect=/`.\n//\n// For a reference to supported hash options, see the beginSignInFlowForHash\n// function.\n//\n// The second way to trigger the sign in flow is to call one of the methods in\n// the `beginSignInFlow` function from\n// `resources/javascript/features/auth/lazy.js`. Use this if you need\n// more control over the options object, or you need to avoid adding an entry to\n// the browser history. The function is also available globally, as\n// `window.MV.auth.beginSignInFlow`.\n\nimport { isAuthenticated, setAuthenticated } from '../features/auth/session';\nimport { beginSignInFlow, beginSignInFlowForURL } from '../features/auth/lazy';\nimport { isSignInHash } from '../features/auth/hash';\nimport { onDOMContentLoaded } from '../util/loaded';\n\nwindow.MV = window.MV || {};\n\nwindow.MV.auth = Object.assign(window.MV.auth || {}, {\n  beginSignInFlow,\n  setAuthenticated,\n  isAuthenticated,\n  isSignInHash,\n  quickAddUrl: false,\n});\n\nsetAuthenticated(window.MV.auth.authenticated_on_load || null);\n\nonDOMContentLoaded(() => {\n  beginSignInFlowForURL(new URL(window.location.href));\n});\n\nwindow.addEventListener('hashchange', (e) => {\n  beginSignInFlowForURL(new URL(e.newURL));\n});\n"],"names":["window","MV","auth","Object","assign","beginSignInFlow","setAuthenticated","isAuthenticated","isSignInHash","quickAddUrl","authenticated_on_load","onDOMContentLoaded","beginSignInFlowForURL","URL","location","href","addEventListener","e","newURL"],"mappings":"mFAwBAA,OAAOC,GAAKD,OAAOC,IAAM,GAEzBD,OAAOC,GAAGC,KAAOC,OAAOC,OAAOJ,OAAOC,GAAGC,MAAQ,GAAI,CACnDG,kBACAC,mBACAC,kBACAC,eACAC,aAAa,IAGfH,EAAiBN,OAAOC,GAAGC,KAAKQ,uBAAyB,MAEzDC,GAAmB,KACjBC,EAAsB,IAAIC,IAAIb,OAAOc,SAASC,MAAM,IAGtDf,OAAOgB,iBAAiB,cAAeC,IACrCL,EAAsB,IAAIC,IAAII,EAAEC,QAAQ"}