{"version":3,"sources":["jsdelivr-header.js","/npm/@michael-gamel/local-storage-manager@2.1.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,SAAW,QAAQ,mBAKzB,SAAS,0BACL,MAAM,EAAQ,QACd,IAGI,OAFA,aAAa,QAAQ,EAAO,GAC5B,aAAa,WAAW,IACjB,CACX,CAAE,MAAO,GACL,OAAO,CACX,CACJ,CAOA,SAAS,QAAQ,EAAK,GAClB,IAAI,0BAaA,MAAM,IAAI,MAAM,SAAS,iBAZzB,QAAY,IAAR,EACA,MAAM,IAAI,MAAM,SAAS,cACtB,QAAc,IAAV,EACP,MAAM,IAAI,MAAM,SAAS,gBAEJ,iBAAV,EACP,aAAa,QAAQ,EAAK,KAAK,UAAU,IAEzC,aAAa,QAAQ,EAAK,OAAO,GAMjD,CAQA,SAAS,QAAQ,GACb,OAAO,KAAK,MAAM,aAAa,QAAQ,GAC3C,CAMA,SAAS,WAAW,GAChB,aAAa,WAAW,EAC5B,CAKA,SAAS,QACL,aAAa,OACjB,CAMA,SAAS,eACL,MAAM,EAAQ,GACd,IAAK,MAAM,KAAO,aACV,aAAa,eAAe,IAC5B,EAAM,KAAK,GAGnB,OAAO,CACX,CAEA,OAAO,QAAU,CACb,QAAS,QACT,QAAS,QACT,WAAY,WACZ,MAAO,MACP,aAAc","file":"/npm/@michael-gamel/local-storage-manager@2.1.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@michael-gamel/local-storage-manager@2.1.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const messages = require('./messages.json');\r\n\r\n\"use strict\";\r\n\r\n\r\nfunction isLocalStorageSupported() {\r\n    const dummy = 'dummy';\r\n    try {\r\n        localStorage.setItem(dummy, dummy);\r\n        localStorage.removeItem(dummy);\r\n        return true;\r\n    } catch (e) {\r\n        return false;\r\n    }\r\n}\r\n\r\n/**\r\n * add/set item to browser localstorage\r\n * @param key the identifier for the localstorage item\r\n  * @param value the value of localstorage item\r\n */\r\nfunction setItem(key, value) {\r\n    if (isLocalStorageSupported()) {\r\n        if (key === undefined) {\r\n            throw new Error(messages.undefinedKey)\r\n        } else if (value === undefined) {\r\n            throw new Error(messages.undefinedValue)\r\n        } else {\r\n            if (typeof value === 'object') {\r\n                localStorage.setItem(key, JSON.stringify(value));\r\n            } else {\r\n                localStorage.setItem(key, String(value));\r\n            }\r\n        }\r\n    } else {\r\n        throw new Error(messages.supportingIssue)\r\n    }\r\n}\r\n\r\n/**\r\n  * read certain item from the local storage\r\n  * parse the item to json if the item is a stringified object.\r\n  * @param  {key} The key of the property to be detected\r\n  * @returns {Object} the returned object holds the value for the detected property\r\n */\r\nfunction getItem(key) {\r\n    return JSON.parse(localStorage.getItem(key));\r\n}\r\n\r\n/**\r\n  * remove certain item from the localStorage and from the cachedSession\r\n  * @param  {key} The key of the property to be removed\r\n */\r\nfunction removeItem(key) {\r\n    localStorage.removeItem(key);\r\n}\r\n\r\n/**\r\n * clear all the localStorage items and the cachedSession items\r\n */\r\nfunction empty() {\r\n    localStorage.clear();\r\n}\r\n\r\n/**\r\n* list all items in the localStorage\r\n* @returns {Object} the returned object holds the cached Session object\r\n*/\r\nfunction listAllItems() {\r\n    const items = [];\r\n    for (const key in localStorage) {\r\n        if (localStorage.hasOwnProperty(key)) {\r\n            items.push(items);\r\n        }\r\n    }\r\n    return items;\r\n}\r\n\r\nmodule.exports = {\r\n    setItem: setItem,\r\n    getItem: getItem,\r\n    removeItem: removeItem,\r\n    empty: empty,\r\n    listAllItems: listAllItems\r\n}\r\n\r\n"]}