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A,SAAmBwM,GAClB,IAAIE,EAAIhN,KAAKiN,WAAWH,GACpBE,GAAK,GACRhN,KAAK6M,cAAcK,OAAOF,EAAG,GAG9B,IAAIxM,EAAIR,KAAK6M,cAAcO,OAC3BpN,KAAK4M,MAAM7I,aAAavD,EACrBR,KAAK6M,cAAcrM,EAAI,GAAGU,UAC1BlB,KAAKkB,UAET,GAAC,CAAAd,IAAA,aAAAE,MAED,SAAWwM,GACV,OAAO9M,KAAK6M,cAAgB7M,KAAK6M,cAAcQ,WAAU,SAAAN,GAAC,OAAIA,EAAED,KAAOA,CAAE,IAAI,IAC9E,GAAC,CAAA1M,IAAA,UAAAE,MAED,WACCN,KAAKqF,IAAIiI,eAAetN,KAAK4M,OAC7B5M,KAAKkB,UAAY,KACjBlB,KAAK6M,cAAgB,KACrB7M,KAAK4M,MAAQ,IACd,M,oEAACD,CAAA,CAjFU,GAoFZ,K,8PCrFe,WAASI,GACvB,MAAmB,UAAZQ,EAAOR,IAAuB,OAANA,GAAiC,mBAAZA,EAAElL,QAA6C,mBAAdkL,EAAEjL,QACxF,C","sources":["webpack://mucklet-client/./cfg/client/module.config.js","webpack://mucklet-client/./src/common/classes/Err.js","webpack://mucklet-client/./src/common/components/ConfirmScreenDialog.js","webpack://mucklet-client/./src/common/components/FAIcon.js","webpack://mucklet-client/./src/common/components/Fader.js","webpack://mucklet-client/./src/common/components/ScreenDialog.js","webpack://mucklet-client/./src/common/modules/api/Api.js","webpack://mucklet-client/./src/common/modules/auth/Auth.js","webpack://mucklet-client/./src/common/modules/screen/Screen.js","webpack://mucklet-client/./src/common/utils/isComponent.js"],"sourcesContent":["const config = {};\n\nexport default config;\n","import l10n from 'modapp-l10n';\n\n/**\n * Err represents a local error.\n */\nclass Err {\n\n\tconstructor(code, message, data) {\n\t\tthis._code = code || 'unknown';\n\t\tthis._message = message || `Unknown error`;\n\t\tthis._data = data;\n\t}\n\n\t/**\n\t * Error code\n\t * @type {string}\n\t */\n\tget code() {\n\t\treturn this._code;\n\t}\n\n\t/**\n\t * Error message\n\t * @type {string}\n\t */\n\tget message() {\n\t\treturn this._message;\n\t}\n\n\t/**\n\t * Error data object\n\t * @type {*}\n\t */\n\tget data() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Returns the error as a LocaleString.\n\t * @returns {LocaleString}\n\t */\n\tlocaleString() {\n\t\treturn l10n.l(this._code, this._message, this._data);\n\t}\n}\n\nexport default Err;\n","import { Elem, Txt } from 'modapp-base-component';\nimport l10n from 'modapp-l10n';\nimport ScreenDialog from './ScreenDialog';\nimport isComponent from 'utils/isComponent';\nimport './confirmScreenDialog.scss';\n\n/**\n * Draws an error screen dialog with a button that redirects to a given URL.\n */\nclass ConfirmScreenDialog {\n\n\t/**\n\t * Creates a new ConfirmScreenDialog instance.\n\t * @param {function} [opt] Optional parameters\n\t * @param {string} [opt.className] Class name to use instead of 'confirm'.\n\t * @param {string|LocaleString} [opt.title] Title text or component.\n\t * @param {string|LocaleString|Component} [opt.body] Body text or component.\n\t * @param {string|LocaleString} [opt.confirm] Confirm button text or component.\n\t * @param {boolean} [opt.onClose] Callback function called when the confirmed is closed.\n\t * @param {boolean} [opt.onConfirm] Callback function called when the confirmed is closed.\n\t */\n\tconstructor(opt) {\n\t\tthis.opt = opt || {};\n\t}\n\n\trender(el) {\n\t\tlet opt = this.opt;\n\t\tthis.elem = new ScreenDialog(new Elem(n => n.elem('div', { className: 'confirmscreendialog' }, [\n\t\t\tn.elem('div', { className: 'confirmscreendialog--body' }, [\n\t\t\t\tn.component(isComponent(opt.body)\n\t\t\t\t\t? opt.body\n\t\t\t\t\t: new Txt(opt.body || l10n.l('confirm.body', \"Are you sure?\"), { className: 'confirmscreendialog--content' }),\n\t\t\t\t),\n\t\t\t]),\n\t\t\tn.elem('button', {\n\t\t\t\tevents: { click: () => this._confirm() },\n\t\t\t\tclassName: 'btn large primary confirmscreendialog--btn pad-top-xl',\n\t\t\t}, [\n\t\t\t\tn.component(new Txt(opt.confirm || l10n.l('confirmScreenDialog.okay', \"Okay\"))),\n\t\t\t]),\n\t\t])), {\n\t\t\ttitle: opt.title || l10n.l('confirmScreenDialog.confirm', \"Confirm\"),\n\t\t\tclose: opt.onClose || null,\n\t\t});\n\t\tthis.elem.render(el);\n\t}\n\n\tunrender() {\n\t\tif (this.elem) {\n\t\t\tthis.elem.unrender();\n\t\t\tthis.elem = null;\n\t\t}\n\t}\n\n\t_confirm() {\n\t\tif (this.opt.onConfirm) {\n\t\t\tthis.opt.onConfirm();\n\t\t}\n\t}\n}\n\nexport default ConfirmScreenDialog;\n","import { RootElem } from 'modapp-base-component';\n\nconst customIcons = {\n\tupstairs: true,\n\tdownstairs: true,\n\ticosahedron: true,\n};\n\n/**\n * FAIcon is a font-awesome icon.\n */\nclass FAIcon extends RootElem {\n\n\t/**\n\t * Creates an instance of FAIcon\n\t * @param {string} icon Font-awesome icon name (eg. 'envelope').\n\t * @param {object} [opt] Optional parameters.\n\t * @param {string} [opt.className] Additional class names to append to font-awesome class names.\n\t * @param {object} [opt.attributes] Key/value attributes object\n\t * @param {object} [opt.events] Key/value events object, where the key is the event name, and value is the callback.\n\t */\n\tconstructor(icon, opt) {\n\t\topt = Object.assign({ attributes: null }, opt);\n\t\topt.attributes = Object.assign({ 'aria-hidden': 'true' }, opt.attributes);\n\t\tsuper('i', opt);\n\t\tthis.icon = \"\";\n\t\tthis.custom = false;\n\t\tthis.setIcon(icon);\n\t}\n\n\t/**\n\t * Sets icon\n\t * @param {string} icon Font-awesome icon name (eg. 'envelope').\n\t * @returns {this}\n\t */\n\tsetIcon(icon) {\n\t\ticon = String(icon || \"\");\n\t\tif (icon == this.icon) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet custom = !!customIcons[icon];\n\n\t\tif (this.icon) {\n\t\t\tif (this.custom) {\n\t\t\t\tthis.removeClass('muicon-' + this.icon);\n\t\t\t\tif (!custom) {\n\t\t\t\t\tthis.removeClass('faicon-custom');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.removeClass('fa-' + this.icon);\n\t\t\t\tif (custom) {\n\t\t\t\t\tthis.removeClass('fa');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (icon) {\n\t\t\tif (custom) {\n\t\t\t\tthis.addClass('faicon-custom');\n\t\t\t\tthis.addClass('muicon-' + icon);\n\t\t\t} else {\n\t\t\t\tthis.addClass('fa');\n\t\t\t\tthis.addClass('fa-' + icon);\n\t\t\t}\n\t\t}\n\t\tthis.icon = icon;\n\t\tthis.custom = custom;\n\t\treturn this;\n\t}\n}\n\nexport default FAIcon;\n","import { RootElem } from 'modapp-base-component';\nimport { anim } from 'modapp-utils';\n\n/**\n * Fader is component wrapper that can fade in and out components.\n */\nclass Fader extends RootElem {\n\n\t/**\n\t * Creates an instance of Fader\n\t * @param {?Component} component Component to wrap.\n\t * @param {object} [opt] Optional parameters.\n\t * @param {boolean} [opt.duration] Optional transition duration in milliseconds.\n\t * @param {boolean} [opt.hidden] Flag to tell if the fader should start as hidden.\n\t */\n\tconstructor(component, opt) {\n\t\tsuper('div', opt);\n\n\t\topt = opt || {};\n\t\tthis._fadeOpt = {\n\t\t\tcallback: this._onTransitionEnd.bind(this),\n\t\t\tduration: typeof opt?.duration == 'number' ? opt.duration : 150,\n\t\t};\n\t\tthis._current = null;\n\t\tthis._component = null;\n\t\tthis._token = null;\n\n\t\tthis.setComponent(component);\n\t}\n\n\t/**\n\t * Gets the current set component.\n\t * @returns {?Component}\n\t */\n\tgetComponent() {\n\t\treturn this._component;\n\t}\n\n\t/**\n\t * Sets the component to fade in, or null to fade out.\n\t * @param {?Component} component Component to set.\n\t * @param {object} [opt] Optional parameters\n\t * @param {function} [opt.onRender] Callback function to call after rendering the component.\n\t * @param {function} [opt.onUnrender] Callback function to call before unrendering the component.\n\t * @returns {this}\n\t */\n\tsetComponent(component, opt) {\n\t\tcomponent = component || null;\n\t\tif (this._component === component) return this;\n\n\t\tthis._component = component;\n\t\tthis._componentOpt = opt;\n\t\tlet el = this.getElement();\n\t\tif (!el) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Is the component the same at currently rendered one?\n\t\tif (this._component === this._current) {\n\t\t\tif (this._current) {\n\t\t\t\tthis._fade(1);\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif (this._current) {\n\t\t\tthis._fade(0);\n\t\t} else {\n\t\t\tthis._renderComponent();\n\t\t\tthis._fade(1);\n\t\t}\n\t\treturn this;\n\t}\n\n\trender(el) {\n\t\tsuper.render(el);\n\t\tthis._renderComponent();\n\t\tsuper.setStyle('opacity', this._component ? null : 0);\n\t\treturn this.getElement();\n\t}\n\n\tunrender() {\n\t\tanim.stop(this._token);\n\t\tif (this.getElement()) {\n\t\t\tthis._unrenderComponent();\n\t\t\tsuper.unrender();\n\t\t}\n\t}\n\n\t_fade(opacity) {\n\t\tlet el = this.getElement();\n\t\tif (el) {\n\t\t\tanim.stop(this._token);\n\t\t\tthis._token = anim.fade(el, opacity, this._fadeOpt);\n\t\t}\n\t}\n\n\t_renderComponent() {\n\t\tlet el = this.getElement();\n\t\tif (this._component) {\n\t\t\tthis._component.render(el);\n\t\t\tthis._current = this._component;\n\t\t\tthis._currentOpt = this._componentOpt;\n\t\t\t// Call onRender callback if available\n\t\t\tlet onRender = this._currentOpt?.onRender;\n\t\t\tif (onRender) {\n\t\t\t\tonRender(this, this._component);\n\t\t\t}\n\t\t}\n\t}\n\n\t_unrenderComponent() {\n\t\tif (this._current) {\n\t\t\t// Call onUnrender callback if available\n\t\t\tlet onUnrender = this._currentOpt?.onUnrender;\n\t\t\tif (onUnrender) {\n\t\t\t\tonUnrender(this, this._current);\n\t\t\t}\n\t\t\tthis._current.unrender();\n\t\t\tthis._current = null;\n\t\t\tthis._currentOpt = null;\n\t\t}\n\t}\n\n\t_onTransitionEnd() {\n\t\tlet el = this.getElement();\n\t\tif (!el) return;\n\n\t\tif (this._component && this._current === this._component) return;\n\n\t\tthis._unrenderComponent();\n\t\tthis._renderComponent();\n\n\t\tif (this._component) {\n\t\t\tthis._fade(1);\n\t\t}\n\t}\n}\n\nexport default Fader;\n","import { Elem, Txt } from 'modapp-base-component';\nimport FAIcon from 'components/FAIcon';\nimport Fader from 'components/Fader';\nimport './screendialog.scss';\n\n/**\n * ScreenDialog draws a screen dialog\n */\nclass ScreenDialog {\n\tconstructor(component, opt) {\n\t\topt = opt || {};\n\t\tthis.title = opt.title;\n\t\tthis.close = opt.close;\n\t\tthis.size = opt.size;\n\t\tthis.body = new Fader(null, { className: 'screendialog--body' });\n\t\tthis.setComponent(component);\n\t}\n\n\trender(el) {\n\t\tthis.elem = new Elem(n => n.elem('div', { className: 'screendialog' }, [\n\t\t\tn.elem('div', { className: 'screendialog--container' + (this.size ? ' ' + this.size : '') }, [\n\t\t\t\tthis.title || this.close ? n.elem('div', { className: 'screendialog--head' }, [\n\t\t\t\t\tthis.close ? n.elem('button', { className: 'screendialog--close iconbtn medium', events: { click: () => this.close() }}, [\n\t\t\t\t\t\tn.component(new FAIcon('close')),\n\t\t\t\t\t]) : n.component(null),\n\t\t\t\t\tn.component(new Txt(this.title || \"\", { tagName: 'h2' })),\n\t\t\t\t]) : n.component(null),\n\t\t\t\tn.component(this.body),\n\t\t\t]),\n\t\t]));\n\t\tthis.elem.render(el);\n\t}\n\n\tgetComponent() {\n\t\treturn this.body.getComponent();\n\t}\n\n\tunrender() {\n\t\tif (this.elem) {\n\t\t\tthis.elem.unrender();\n\t\t\tthis.elem = null;\n\t\t}\n\t}\n\n\tsetComponent(component) {\n\t\tthis.body.setComponent(component);\n\t\treturn this;\n\t}\n}\n\nexport default ScreenDialog;\n","import ResClient, { isResError } from 'resclient';\n\nconst namespace = 'module.api';\n\n/**\n * Api module connects to the backend api and provides low level\n * methods for service modules to send and receive data.\n */\nclass Api extends ResClient {\n\n\tconstructor(app, params) {\n\t\tlet opt = Object.assign({\n\t\t\tdebug: false,\n\t\t}, params);\n\t\topt.debug = !!(opt.debug && opt.debug != 'false' && opt.debug != '0' && opt.debug != 'no');\n\t\tsuper(app.props.apiHostPath, {\n\t\t\tnamespace,\n\t\t\teventBus: app.eventBus,\n\t\t\treconnectDelay: 3000,\n\t\t\tsubscribeStaleDelay: 2000,\n\t\t\tsubscribeRetryDelay: 0,\n\t\t\tunsubscribeDelay: 5000,\n\t\t\tdebug: opt.debug,\n\t\t });\n\n\t\tthis.app = app;\n\t\tthis.webResourcePath = this._resolveWebResourcePath(app.props.apiWebresourcePath);\n\t}\n\n\tgetWebResourceUri(rid) {\n\t\tlet idx = rid.indexOf('?');\n\t\tlet rname = idx >= 0 ? rid.substr(0, idx) : rid;\n\t\tlet query = idx >= 0 ? rid.substr(idx) : '';\n\n\t\treturn this.webResourcePath + rname.replace(/\\./g, '/') + query;\n\t}\n\n\tisError(resource) {\n\t\treturn isResError(resource);\n\t}\n\n\tonEvent(rid, cb) {\n\t\tthis.app.eventBus.on(null, cb, namespace + '.resource' + (rid ? '.' + rid : ''));\n\t}\n\n\toffEvent(rid, cb) {\n\t\tthis.app.eventBus.off(null, cb, namespace + '.resource' + (rid ? '.' + rid : ''));\n\t}\n\n\t_resolveWebResourcePath(url) {\n\t\tif (!url.match(/^http?:\\/\\//)) {\n\t\t\tlet a = document.createElement('a');\n\t\t\ta.href = url;\n\t\t\turl = a.href;\n\t\t}\n\n\t\treturn url.replace(/\\/$/, '') + '/';\n\t}\n\n\tdispose() {\n\t\tthis.disconnect();\n\t}\n}\n\nexport default Api;\n","import { Model } from 'modapp-resource';\nimport l10n from 'modapp-l10n';\nimport { hmacsha256, publicPepper } from 'utils/sha256';\nimport reload, { redirect } from 'utils/reload';\nimport Err from 'classes/Err';\n\nconst oauth2Url = AUTH_LOGIN_URL;\nconst oauth2LogoutUrl = AUTH_LOGOUT_URL;\nconst authenticateUrl = AUTH_AUTHENTICATE_URL;\nconst crossOrigin = API_CROSS_ORIGIN;\nconst wsLoginRid = AUTH_LOGIN_RID;\nconst wsAuthRid = AUTH_AUTHENTICATE_RID;\n\nfunction redirectWithUri(url, pushHistory) {\n\tredirect(url + '?redirect_uri=' + encodeURIComponent(window.location.href), false, pushHistory);\n}\n\n/**\n * Auth authenticates and fetches the user, or redirects to login on fail.\n */\nclass Auth {\n\n\t/**\n\t * Creates a new Auth instance.\n\t * @param {App} app App instance.\n\t * @param {object} params Module params\n\t * @param {string} [params.player] Login username. Ignored if mode is not 'pass'.\n\t * @param {string} [params.pass] Hashed password. Ignored if mode is not 'pass'.\n\t * @param {\"http\"|\"ws\"|\"pass\"} [params.mode] Auth mode. http=header authentication on http handshake, ws=authenticate call over WebSocket, pass=password authentication\n\t */\n\tconstructor(app, params) {\n\t\tthis.app = app;\n\t\tthis.params = Object.assign({\n\t\t\tplayer: '',\n\t\t\tpass: '',\n\t\t\tmode: 'http',\n\t\t}, params);\n\n\t\t// Bind callbacks\n\t\tthis._onConnect = this._onConnect.bind(this);\n\t\tthis._onUnsubscribe = this._onUnsubscribe.bind(this);\n\t\tthis._onModelChange = this._onModelChange.bind(this);\n\n\t\tthis.app.require([\n\t\t\t'api',\n\t\t\t'screen',\n\t\t], this._init.bind(this));\n\t}\n\n\t_init(module) {\n\t\tthis.module = Object.assign({ self: this }, module);\n\t\tthis.loginPromise = null;\n\t\tthis.loginResolve = null;\n\t\tthis.userPromise = null;\n\t\tthis.model = new Model({ data: { loggedIn: false, user: null, authError: null }});\n\t\tthis.model.on('change', this._onModelChange);\n\t\tthis.state = {};\n\n\t\tthis.module.api.setOnConnect(this._onConnect);\n\t}\n\n\t/**\n\t * Authenticates the user or redirects to login if not logged in.\n\t *\n\t * The returned promise will be rejected if the API returns any other error\n\t * than 'user.authenticationFailed'. If user.authenticationFailed is\n\t * returned, the auth module will redirect the client to the authentication\n\t * endpoint, or resolve to null if noRedirect is true.\n\t * @param {boolean} noRedirect Flag to prevent redirect on not being logged in. Instead, the promise will resolve to null.\n\t * @returns {Promise} Promise to the authenticate.\n\t */\n\tauthenticate(noRedirect) {\n\t\tif (this.params.mode == 'pass') {\n\t\t\treturn this._getCurrentUser(true);\n\t\t}\n\n\t\treturn fetch(authenticateUrl, {\n\t\t\tmethod: 'POST',\n\t\t\tmode: 'cors',\n\t\t\tcredentials: crossOrigin ? 'include' : 'same-origin',\n\t\t}).catch(err => {\n\t\t\tthrow new Err('auth.failedToFetch', \"Failed to send authentication check.\");\n\t\t}).then(resp => {\n\t\t\t// Legacy behavior and other >= 400 errors\n\t\t\tif (resp.status >= 400) {\n\t\t\t\treturn resp.json().then(err => {\n\t\t\t\t\tif (resp.status < 500) {\n\t\t\t\t\t\tif (!noRedirect) {\n\t\t\t\t\t\t\tredirectWithUri(oauth2Url);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tthrow err;\n\t\t\t\t}).catch(err => resp.text().then(\n\t\t\t\t\ttext => {\n\t\t\t\t\t\tthrow new Err('auth.failedToAuthenticateMsg', \"Failed to authenticate: {text}\", resp.text());\n\t\t\t\t\t},\n\t\t\t\t\terr => {\n\t\t\t\t\t\tthrow new Err('auth.failedToAuthenticate', \"Failed to authenticate.\");\n\t\t\t\t\t},\n\t\t\t\t));\n\t\t\t}\n\t\t\t// New behavior allows a 200 response but with an {\"error\": {...}}\n\t\t\t// json object, to indicate failed authentication.\n\t\t\treturn resp.text().then(text => {\n\t\t\t\ttry {\n\t\t\t\t\tlet result = JSON.parse(text);\n\t\t\t\t\tif (result?.error) {\n\t\t\t\t\t\tif (!noRedirect) {\n\t\t\t\t\t\t\tredirectWithUri(oauth2Url);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// A 200 response with invalid JSON is legacy success.\n\t\t\t\t}\n\t\t\t\treturn this._getCurrentUser(true);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Tries to refresh access tokens by calling the authenticate endpoint.\n\t *\n\t * The returned promise will be rejected if refresh failed.\n\t * @param {boolean} redirectOnerror Flag to redirect to login on error. Defaults to false.\n\t * @returns {Promise} Promise to tokens being refreshed.\n\t */\n\trefreshTokens(redirectOnerror) {\n\t\treturn fetch(authenticateUrl, {\n\t\t\tmethod: 'POST',\n\t\t\tmode: 'cors',\n\t\t\tcredentials: crossOrigin ? 'include' : 'same-origin',\n\t\t}).then(authResp => {\n\t\t\treturn authResp.text().then(text => {\n\t\t\t\tif (text) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet result = JSON.parse(text);\n\t\t\t\t\t\tif (result?.error) {\n\t\t\t\t\t\t\t// A proper error messages means we are not logged in.\n\t\t\t\t\t\t\tif (redirectOnError) {\n\t\t\t\t\t\t\t\tthis.redirectToLogin(true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Promise.reject(result.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (ex) {}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\n\t/**\n\t * Returns a promise to when the user is logged in.\n\t * The promise will never reject.\n\t * @returns {Promise.<Model>} Promise to user being logged in.\n\t */\n\tgetUserPromise() {\n\t\treturn this.loginPromise = this.loginPromise || (\n\t\t\tthis.model.loggedIn\n\t\t\t\t? Promise.resolve(this.model.user)\n\t\t\t\t: new Promise(resolve => this.loginResolve = resolve)\n\t\t);\n\t}\n\n\t/**\n\t * Returns the user or null if the user isn't logged in.\n\t * @returns {?Model} User model or null.\n\t */\n\tgetUser() {\n\t\treturn this.model.user;\n\t}\n\n\t/**\n\t * Calls the logout endpoint and then reloads.\n\t */\n\tlogout() {\n\t\tthis._afterFade(() => {\n\t\t\tredirect(oauth2LogoutUrl, true);\n\t\t});\n\t}\n\n\t/**\n\t * Redirects to the oauth2 login page.\n\t * @param {boolean} noFade Flag to prevent fading out.\n\t */\n\tredirectToLogin(noFade) {\n\t\tif (noFade) {\n\t\t\tredirectWithUri(oauth2Url, true);\n\t\t} else {\n\t\t\tthis._afterFade(() => {\n\t\t\t\tredirectWithUri(oauth2Url, true);\n\t\t\t});\n\t\t}\n\t}\n\n\t_getCurrentUser(reconnect) {\n\t\tif (reconnect) {\n\t\t\t// Disconnect to force a reconnect with new header cookies\n\t\t\tthis.module.api.disconnect();\n\t\t\tthis.model.set({ authError: null });\n\t\t\tthis._onUnsubscribe();\n\t\t}\n\t\tif (!this.userPromise) {\n\t\t\tthis.userPromise = this.module.api.connect()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (this.model.authError) {\n\t\t\t\t\t\tthrow this.model.authError;\n\t\t\t\t\t}\n\t\t\t\t\treturn this.module.api.call(wsAuthRid, 'getUser');\n\t\t\t\t})\n\t\t\t\t.then(user => {\n\t\t\t\t\tif (this.module.api.isError(user)) {\n\t\t\t\t\t\tthrow new Error(\"Error getting user: \" + l10n.t(user.code, user.message, user.data));\n\t\t\t\t\t}\n\t\t\t\t\tthis.model.set({\n\t\t\t\t\t\tloggedIn: true,\n\t\t\t\t\t\tuser,\n\t\t\t\t\t});\n\t\t\t\t\tif (this.loginResolve) {\n\t\t\t\t\t\tthis.loginResolve(user);\n\t\t\t\t\t\tthis.loginResolve = null;\n\t\t\t\t\t}\n\t\t\t\t\tuser.on('unsubscribe', this._onUnsubscribe);\n\t\t\t\t\treturn user;\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tif (err.code?.endsWith?.('.termsNotAgreed')) {\n\t\t\t\t\t\tredirectWithUri(oauth2Url);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Or else we throw the error to be handled by the caller to\n\t\t\t\t\t// show an error message.\n\t\t\t\t\tthis.userPromise = null;\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\t\t}\n\t\treturn this.userPromise;\n\t}\n\n\t_onConnect() {\n\t\treturn (this.params.mode == 'pass'\n\t\t\t? this.module.api.authenticate(wsLoginRid, 'login', {\n\t\t\t\tname: this.params.player,\n\t\t\t\thash: hmacsha256(this.params.pass.trim(), publicPepper),\n\t\t\t})\n\t\t\t: this.params.mode == 'ws'\n\t\t\t\t? this.module.api.authenticate(wsAuthRid, 'authenticate')\n\t\t\t\t: Promise.resolve() // 'http'\n\t\t).catch(err => {\n\t\t\treturn this.model.set({ authError: err });\n\t\t});\n\t}\n\n\t_onUnsubscribe() {\n\t\t// Remove user model\n\t\tif (this.model.user) {\n\t\t\tthis.model.user.off('unsubscribe', this._onUnsubscribe);\n\t\t\tthis.loginPromise = null;\n\t\t}\n\t\tthis.model.set({\n\t\t\tloggedIn: false,\n\t\t\tuser: null,\n\t\t});\n\t\tthis.userPromise = null;\n\t}\n\n\t_onModelChange(changed) {\n\t\t// Show login screen when logged out\n\t\tif (changed.hasOwnProperty('loggedIn') && !this.model.loggedIn) {\n\t\t\tthis._afterFade(reload);\n\t\t}\n\t}\n\n\t_afterFade(cb) {\n\t\tthis.module.screen.setComponent({\n\t\t\trender: () => cb(),\n\t\t\tunrender: () => {},\n\t\t});\n\t}\n\n\tdispose() {\n\t\tthis.model.off('change', this._onModelChange);\n\t\tthis._onUnsubscribe();\n\t}\n}\n\nexport default Auth;\n","import Fader from 'components/Fader';\nimport './screen.scss';\n\n/**\n * Screen handles the screen viewport.\n */\nclass Screen {\n\tconstructor(app, params) {\n\t\tthis.app = app;\n\n\t\tthis.fader = new Fader(null, { className: 'screen' });\n\t\tthis.app.setComponent(this.fader);\n\t}\n\n\tgetFader() {\n\t\treturn this.fader;\n\t}\n\n\t/**\n\t * Get current component.\n\t * @returns {Component} Current component.\n\t */\n\tgetComponent() {\n\t\treturn this.component;\n\t}\n\n\t/**\n\t * Set component.\n\t * @param {Component?} component Component to set.\n\t * @returns {this}\n\t */\n\tsetComponent(component) {\n\t\tthis.component = component || null;\n\t\tthis.subcomponents = [];\n\t\tthis.fader.setComponent(component);\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Add subcomponent adds a component that will be shown instead of set\n\t * component until removed. Multiple added subcomponents stack.\n\t * @param {string} id ID of subcomponent\n\t * @param {Component} component Subcomponent\n\t */\n\taddSubcomponent(id, component) {\n\t\tlet o;\n\t\tlet i = this._getSubIdx(id);\n\t\tif (i >= 0) {\n\t\t\t// Move existing subcomponent to back. Keep previous component.\n\t\t\to = this.subcomponents[i];\n\t\t\tthis.subcomponents.splice(i, 1);\n\t\t} else {\n\t\t\t// Add a new subcomponent\n\t\t\to = { id, component };\n\t\t}\n\n\t\tthis.subcomponents.push(o);\n\t\tthis.fader.setComponent(o.component);\n\t}\n\n\t/**\n\t * Removes previously set subcomponent by ID.\n\t * @param {string} id ID of subcomponent.\n\t */\n\tremoveSubcomponent(id) {\n\t\tlet i = this._getSubIdx(id);\n\t\tif (i >= 0) {\n\t\t\tthis.subcomponents.splice(i, 1);\n\t\t}\n\n\t\tlet l = this.subcomponents.length;\n\t\tthis.fader.setComponent(l\n\t\t\t? this.subcomponents[l - 1].component\n\t\t\t: this.component,\n\t\t);\n\t}\n\n\t_getSubIdx(id) {\n\t\treturn this.subcomponents ? this.subcomponents.findIndex(o => o.id === id) : null;\n\t}\n\n\tdispose() {\n\t\tthis.app.unsetComponent(this.fader);\n\t\tthis.component = null;\n\t\tthis.subcomponents = null;\n\t\tthis.fader = null;\n\t}\n}\n\nexport default Screen;\n","/**\n * Tests if an object is has a render and unrender method, making it a component.\n * @param {*} o Object to test.\n * @returns {boolean} True if it is a component, otherwise false.\n */\nexport default function(o) {\n\treturn typeof o == 'object' && o !== null && typeof o.render == 'function' && typeof o.unrender == 'function';\n}\n"],"names":["Err","code","message","data","_classCallCheck","this","_code","_message","_data","key","get","value","l10n","l","ConfirmScreenDialog","opt","el","_this","elem","ScreenDialog","Elem","n","className","component","isComponent","body","Txt","events","click","_confirm","confirm","title","close","onClose","render","unrender","onConfirm","customIcons","upstairs","downstairs","icosahedron","FAIcon","_RootElem","_inherits","_super","_createSuper","icon","Object","assign","attributes","call","custom","setIcon","String","removeClass","addClass","RootElem","Fader","_opt","_fadeOpt","callback","_onTransitionEnd","bind","_assertThisInitialized","duration","_current","_component","_token","setComponent","_componentOpt","getElement","_fade","_renderComponent","_get","_getPrototypeOf","prototype","anim","_unrenderComponent","opacity","_this$_currentOpt","_currentOpt","onRender","_this$_currentOpt2","onUnrender","size","tagName","getComponent","namespace","Api","_ResClient","app","params","debug","props","apiHostPath","eventBus","reconnectDelay","subscribeStaleDelay","subscribeRetryDelay","unsubscribeDelay","webResourcePath","_resolveWebResourcePath","apiWebresourcePath","rid","idx","indexOf","rname","substr","query","replace","resource","isResError","cb","on","off","url","match","a","document","createElement","href","disconnect","ResClient","oauth2Url","AUTH_LOGIN_URL","authenticateUrl","AUTH_AUTHENTICATE_URL","wsAuthRid","AUTH_AUTHENTICATE_RID","redirectWithUri","pushHistory","redirect","encodeURIComponent","window","location","Auth","player","pass","mode","_onConnect","_onUnsubscribe","_onModelChange","require","_init","module","self","loginPromise","loginResolve","userPromise","model","Model","loggedIn","user","authError","state","api","setOnConnect","noRedirect","_getCurrentUser","fetch","method","credentials","catch","err","then","resp","status","json","text","result","JSON","parse","error","ex","redirectOnerror","_this2","authResp","redirectOnError","redirectToLogin","Promise","reject","_this3","resolve","_afterFade","AUTH_LOGOUT_URL","noFade","reconnect","_this4","set","connect","isError","Error","t","_err$code","_err$code$endsWith","endsWith","_this5","authenticate","AUTH_LOGIN_RID","name","hash","hmacsha256","trim","publicPepper","changed","hasOwnProperty","reload","screen","Screen","fader","subcomponents","id","o","i","_getSubIdx","splice","push","length","findIndex","unsetComponent","_typeof"],"sourceRoot":""}