{"mappings":"SAoBSA,sBACPC,KAAKC,aAAmB,YACxBD,KAAKE,aAAmB,YAExB,IAAIC,EAAYH,KAAKI,wBACrBJ,KAAKK,QAAUF,EAAYG,OAAOC,aAAeD,OAAOE,YAzB1DF,OAAOE,YAAc,CACnBC,MAAO,GAEPC,QAAS,SAAUC,EAAIC,GACrB,OAAOZ,KAAKS,MAAME,GAAME,OAAOD,IAGjCE,QAAS,SAAUH,GACjB,OAAOX,KAAKS,MAAMM,eAAeJ,GAAMX,KAAKS,MAAME,QAAMK,GAG1DC,WAAY,SAAUN,GACpB,cAAcX,KAAKS,MAAME,IAG3BO,MAAO,WACL,OAAOlB,KAAKS,MAAQ,KAYxBV,oBAAoBoB,UAAUf,sBAAwB,WACpD,IAAIgB,EAAU,OAEd,IACE,IAAIf,EAAUC,OAAOC,aAGrB,OAFAF,EAAQK,QAAQU,EAAS,KACzBf,EAAQY,WAAWG,IACZ,EACP,MAAOC,GACP,OAAO,IAKXtB,oBAAoBoB,UAAUG,aAAe,WAC3C,OAAOtB,KAAKK,QAAQS,QAAQd,KAAKC,eAAiB,GAGpDF,oBAAoBoB,UAAUI,aAAe,SAAUC,GACrDxB,KAAKK,QAAQK,QAAQV,KAAKC,aAAcuB,IAI1CzB,oBAAoBoB,UAAUM,aAAe,WAC3C,IAAIC,EAAY1B,KAAKK,QAAQS,QAAQd,KAAKE,cAC1C,OAAOwB,EAAYC,KAAKC,MAAMF,GAAa,MAG7C3B,oBAAoBoB,UAAUU,aAAe,SAAUC,GACrD9B,KAAKK,QAAQK,QAAQV,KAAKE,aAAcyB,KAAKI,UAAUD,KAGzD/B,oBAAoBoB,UAAUa,eAAiB,WAC7ChC,KAAKK,QAAQY,WAAWjB,KAAKE","sources":["src/js/local_storage_manager.js"],"sourcesContent":["window.fakeStorage = {\n _data: {},\n\n setItem: function (id, val) {\n return this._data[id] = String(val);\n },\n\n getItem: function (id) {\n return this._data.hasOwnProperty(id) ? this._data[id] : undefined;\n },\n\n removeItem: function (id) {\n return delete this._data[id];\n },\n\n clear: function () {\n return this._data = {};\n }\n};\n\nfunction LocalStorageManager() {\n this.bestScoreKey = \"bestScore\";\n this.gameStateKey = \"gameState\";\n\n var supported = this.localStorageSupported();\n this.storage = supported ? window.localStorage : window.fakeStorage;\n}\n\nLocalStorageManager.prototype.localStorageSupported = function () {\n var testKey = \"test\";\n\n try {\n var storage = window.localStorage;\n storage.setItem(testKey, \"1\");\n storage.removeItem(testKey);\n return true;\n } catch (error) {\n return false;\n }\n};\n\n// Best score getters/setters\nLocalStorageManager.prototype.getBestScore = function () {\n return this.storage.getItem(this.bestScoreKey) || 0;\n};\n\nLocalStorageManager.prototype.setBestScore = function (score) {\n this.storage.setItem(this.bestScoreKey, score);\n};\n\n// Game state getters/setters and clearing\nLocalStorageManager.prototype.getGameState = function () {\n var stateJSON = this.storage.getItem(this.gameStateKey);\n return stateJSON ? JSON.parse(stateJSON) : null;\n};\n\nLocalStorageManager.prototype.setGameState = function (gameState) {\n this.storage.setItem(this.gameStateKey, JSON.stringify(gameState));\n};\n\nLocalStorageManager.prototype.clearGameState = function () {\n this.storage.removeItem(this.gameStateKey);\n};\n"],"names":["LocalStorageManager","this","bestScoreKey","gameStateKey","supported","localStorageSupported","storage","window","localStorage","fakeStorage","_data","setItem","id","val","String","getItem","hasOwnProperty","undefined","removeItem","clear","prototype","testKey","error","getBestScore","setBestScore","score","getGameState","stateJSON","JSON","parse","setGameState","gameState","stringify","clearGameState"],"version":3,"file":"index.5fc2f41a.js.map"}