{"version":3,"file":"ui/thirdparty/npm.angular-local-storage.3abaac6fe7a87858b804.js","mappings":"2EAOA,IAAmBA,EACfC,EACFC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAgkBCC,OAxkBgBT,EAwkBRS,OAAOT,QAvkBdC,EAAYD,EAAQC,UACtBC,EAAcF,EAAQE,YACtBC,EAAWH,EAAQG,SACnBC,EAAWJ,EAAQI,SACnBC,EAAUL,EAAQK,QAClBC,EAAWN,EAAQM,SACnBC,EAASP,EAAQO,OACjBC,EAASR,EAAQQ,OAEnBR,EACGU,OAAO,qBAAsB,IAC7BC,SAAS,uBAAuB,WAO/BC,KAAKC,OAAS,KAGdD,KAAKE,YAAc,eAMnBF,KAAKG,OAAS,CACZC,OAAQ,GACRC,KAAM,IACNC,QAAQ,GAIVN,KAAKO,iBAAkB,EAGvBP,KAAKQ,OAAS,CACZC,SAAS,EACTC,YAAY,GAIdV,KAAKW,UAAY,SAASV,GAExB,OADAD,KAAKC,OAASA,EACPD,IACT,EAGAA,KAAKY,eAAiB,SAASV,GAE7B,OADAF,KAAKE,YAAcA,EACZF,IACT,EAEAA,KAAKa,mBAAqB,SAAUC,GAElC,OADAd,KAAKO,kBAAoBO,EAClBd,IACT,EAEAA,KAAKe,iBAAmB,SAASC,EAAKX,EAAMC,GAI1C,OAHAN,KAAKG,OAAOC,OAASY,EACrBhB,KAAKG,OAAOE,KAAOA,EACnBL,KAAKG,OAAOG,OAASA,EACdN,IACT,EAGAA,KAAKiB,uBAAyB,SAASC,GAErC,OADAlB,KAAKG,OAAOe,OAASA,EACdlB,IACT,EAIAA,KAAKmB,UAAY,SAASC,EAASC,GAKjC,OAJArB,KAAKQ,OAAS,CACZC,QAASW,EACTV,WAAYW,GAEPrB,IACT,EAEAA,KAAKsB,KAAO,CAAC,aAAc,UAAW,YAAa,SAAS,WAAY,SAASC,EAAYC,EAASC,EAAWC,EAAQC,GACvH,IAKIC,EALAC,EAAO7B,KACPC,EAAS4B,EAAK5B,OACdE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KhD,EACLiD,IAAKjD,EACLkD,IAAKhD,EACLoD,OAAQ1C,EACR2C,SAAUpB,GAGhB,EACJ,G,kBC9kBF,EAAQ,OACRzF,EAAO6H,QAAU,oB","sources":["webpack://apps/./node_modules/angular-local-storage/dist/angular-local-storage.js","webpack://apps/./node_modules/angular-local-storage/index.js"],"sourcesContent":["/**\n * An Angular module that gives you access to the browsers local storage\n * @version v0.7.1 - 2017-06-21\n * @link https://github.com/grevory/angular-local-storage\n * @author grevory \n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n(function (window, angular) {\nvar isDefined = angular.isDefined,\n isUndefined = angular.isUndefined,\n isNumber = angular.isNumber,\n isObject = angular.isObject,\n isArray = angular.isArray,\n isString = angular.isString,\n extend = angular.extend,\n toJson = angular.toJson;\n\nangular\n .module('LocalStorageModule', [])\n .provider('localStorageService', function() {\n // You should set a prefix to avoid overwriting any local storage variables from the rest of your app\n // e.g. localStorageServiceProvider.setPrefix('yourAppName');\n // With provider you can use config as this:\n // myApp.config(function (localStorageServiceProvider) {\n // localStorageServiceProvider.prefix = 'yourAppName';\n // });\n this.prefix = 'ls';\n\n // You could change web storage type localstorage or sessionStorage\n this.storageType = 'localStorage';\n\n // Cookie options (usually in case of fallback)\n // expiry = Number of days before cookies expire // 0 = Does not expire\n // path = The web path the cookie represents\n // secure = Wether the cookies should be secure (i.e only sent on HTTPS requests)\n this.cookie = {\n expiry: 30,\n path: '/',\n secure: false\n };\n\n // Decides wether we should default to cookies if localstorage is not supported.\n this.defaultToCookie = true;\n\n // Send signals for each of the following actions?\n this.notify = {\n setItem: true,\n removeItem: false\n };\n\n // Setter for the prefix\n this.setPrefix = function(prefix) {\n this.prefix = prefix;\n return this;\n };\n\n // Setter for the storageType\n this.setStorageType = function(storageType) {\n this.storageType = storageType;\n return this;\n };\n // Setter for defaultToCookie value, default is true.\n this.setDefaultToCookie = function (shouldDefault) {\n this.defaultToCookie = !!shouldDefault; // Double-not to make sure it's a bool value.\n return this;\n };\n // Setter for cookie config\n this.setStorageCookie = function(exp, path, secure) {\n this.cookie.expiry = exp;\n this.cookie.path = path;\n this.cookie.secure = secure;\n return this;\n };\n\n // Setter for cookie domain\n this.setStorageCookieDomain = function(domain) {\n this.cookie.domain = domain;\n return this;\n };\n\n // Setter for notification config\n // itemSet & itemRemove should be booleans\n this.setNotify = function(itemSet, itemRemove) {\n this.notify = {\n setItem: itemSet,\n removeItem: itemRemove\n };\n return this;\n };\n\n this.$get = ['$rootScope', '$window', '$document', '$parse','$timeout', function($rootScope, $window, $document, $parse, $timeout) {\n var self = this;\n var prefix = self.prefix;\n var cookie = self.cookie;\n var notify = self.notify;\n var storageType = self.storageType;\n var webStorage;\n\n // When Angular's $document is not available\n if (!$document) {\n $document = document;\n } else if ($document[0]) {\n $document = $document[0];\n }\n\n // If there is a prefix set in the config lets use that with an appended period for readability\n if (prefix.substr(-1) !== '.') {\n prefix = !!prefix ? prefix + '.' : '';\n }\n var deriveQualifiedKey = function(key) {\n return prefix + key;\n };\n\n // Removes prefix from the key.\n var underiveQualifiedKey = function (key) {\n return key.replace(new RegExp('^' + prefix, 'g'), '');\n };\n\n // Check if the key is within our prefix namespace.\n var isKeyPrefixOurs = function (key) {\n return key.indexOf(prefix) === 0;\n };\n\n // Checks the browser to see if local storage is supported\n var checkSupport = function () {\n try {\n var supported = (storageType in $window && $window[storageType] !== null);\n\n // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage\n // is available, but trying to call .setItem throws an exception.\n //\n // \"QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage\n // that exceeded the quota.\"\n var key = deriveQualifiedKey('__' + Math.round(Math.random() * 1e7));\n if (supported) {\n webStorage = $window[storageType];\n webStorage.setItem(key, '');\n webStorage.removeItem(key);\n }\n\n return supported;\n } catch (e) {\n // Only change storageType to cookies if defaulting is enabled.\n if (self.defaultToCookie)\n storageType = 'cookie';\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n return false;\n }\n };\n var browserSupportsLocalStorage = checkSupport();\n\n // Directly adds a value to local storage\n // If local storage is not available in the browser use cookies\n // Example use: localStorageService.add('library','angular');\n var addToLocalStorage = function (key, value, type) {\n var previousType = getStorageType();\n\n try {\n setStorageType(type);\n\n // Let's convert undefined values to null to get the value consistent\n if (isUndefined(value)) {\n value = null;\n } else {\n value = toJson(value);\n }\n\n // If this browser does not support local storage use cookies\n if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') {\n if (!browserSupportsLocalStorage) {\n $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');\n }\n\n if (notify.setItem) {\n $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'});\n }\n return addToCookies(key, value);\n }\n\n try {\n if (webStorage) {\n webStorage.setItem(deriveQualifiedKey(key), value);\n }\n if (notify.setItem) {\n $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType});\n }\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n return addToCookies(key, value);\n }\n return true;\n } finally {\n setStorageType(previousType);\n }\n };\n\n // Directly get a value from local storage\n // Example use: localStorageService.get('library'); // returns 'angular'\n var getFromLocalStorage = function (key, type) {\n var previousType = getStorageType();\n\n try {\n setStorageType(type);\n\n if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') {\n if (!browserSupportsLocalStorage) {\n $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');\n }\n\n return getFromCookies(key);\n }\n\n var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null;\n // angular.toJson will convert null to 'null', so a proper conversion is needed\n // FIXME not a perfect solution, since a valid 'null' string can't be stored\n if (!item || item === 'null') {\n return null;\n }\n\n try {\n return JSON.parse(item);\n } catch (e) {\n return item;\n }\n } finally {\n setStorageType(previousType);\n }\n };\n\n // Remove an item from local storage\n // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular'\n //\n // This is var-arg removal, check the last argument to see if it is a storageType\n // and set type accordingly before removing.\n //\n var removeFromLocalStorage = function () {\n var previousType = getStorageType();\n\n try {\n // can't pop on arguments, so we do this\n var consumed = 0;\n if (arguments.length >= 1 &&\n (arguments[arguments.length - 1] === 'localStorage' ||\n arguments[arguments.length - 1] === 'sessionStorage')) {\n consumed = 1;\n setStorageType(arguments[arguments.length - 1]);\n }\n\n var i, key;\n for (i = 0; i < arguments.length - consumed; i++) {\n key = arguments[i];\n if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') {\n if (!browserSupportsLocalStorage) {\n $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');\n }\n\n if (notify.removeItem) {\n $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'});\n }\n removeFromCookies(key);\n }\n else {\n try {\n webStorage.removeItem(deriveQualifiedKey(key));\n if (notify.removeItem) {\n $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {\n key: key,\n storageType: self.storageType\n });\n }\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n removeFromCookies(key);\n }\n }\n }\n } finally {\n setStorageType(previousType);\n }\n };\n\n // Return array of keys for local storage\n // Example use: var keys = localStorageService.keys()\n var getKeysForLocalStorage = function (type) {\n var previousType = getStorageType();\n\n try {\n setStorageType(type);\n\n if (!browserSupportsLocalStorage) {\n $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');\n return [];\n }\n\n var prefixLength = prefix.length;\n var keys = [];\n for (var key in webStorage) {\n // Only return keys that are for this app\n if (key.substr(0, prefixLength) === prefix) {\n try {\n keys.push(key.substr(prefixLength));\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description);\n return [];\n }\n }\n }\n\n return keys;\n } finally {\n setStorageType(previousType);\n }\n };\n\n // Remove all data for this app from local storage\n // Also optionally takes a regular expression string and removes the matching key-value pairs\n // Example use: localStorageService.clearAll();\n // Should be used mostly for development purposes\n var clearAllFromLocalStorage = function (regularExpression, type) {\n var previousType = getStorageType();\n\n try {\n setStorageType(type);\n\n // Setting both regular expressions independently\n // Empty strings result in catchall RegExp\n var prefixRegex = !!prefix ? new RegExp('^' + prefix) : new RegExp();\n var testRegex = !!regularExpression ? new RegExp(regularExpression) : new RegExp();\n\n if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') {\n if (!browserSupportsLocalStorage) {\n $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');\n }\n return clearAllFromCookies();\n }\n if (!browserSupportsLocalStorage && !self.defaultToCookie)\n return false;\n var prefixLength = prefix.length;\n\n for (var key in webStorage) {\n // Only remove items that are for this app and match the regular expression\n if (prefixRegex.test(key) && testRegex.test(key.substr(prefixLength))) {\n try {\n removeFromLocalStorage(key.substr(prefixLength));\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n return clearAllFromCookies();\n }\n }\n }\n\n return true;\n } finally {\n setStorageType(previousType);\n }\n };\n\n // Checks the browser to see if cookies are supported\n var browserSupportsCookies = (function() {\n try {\n return $window.navigator.cookieEnabled ||\n (\"cookie\" in $document && ($document.cookie.length > 0 ||\n ($document.cookie = \"test\").indexOf.call($document.cookie, \"test\") > -1));\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n return false;\n }\n }());\n\n // Directly adds a value to cookies\n // Typically used as a fallback if local storage is not available in the browser\n // Example use: localStorageService.cookie.add('library','angular');\n var addToCookies = function (key, value, daysToExpiry, secure) {\n\n if (isUndefined(value)) {\n return false;\n } else if(isArray(value) || isObject(value)) {\n value = toJson(value);\n }\n\n if (!browserSupportsCookies) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED');\n return false;\n }\n\n try {\n var expiry = '',\n expiryDate = new Date(),\n cookieDomain = '';\n\n if (value === null) {\n // Mark that the cookie has expired one day ago\n expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000));\n expiry = \"; expires=\" + expiryDate.toGMTString();\n value = '';\n } else if (isNumber(daysToExpiry) && daysToExpiry !== 0) {\n expiryDate.setTime(expiryDate.getTime() + (daysToExpiry * 24 * 60 * 60 * 1000));\n expiry = \"; expires=\" + expiryDate.toGMTString();\n } else if (cookie.expiry !== 0) {\n expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000));\n expiry = \"; expires=\" + expiryDate.toGMTString();\n }\n if (!!key) {\n var cookiePath = \"; path=\" + cookie.path;\n if (cookie.domain) {\n cookieDomain = \"; domain=\" + cookie.domain;\n }\n /* Providing the secure parameter always takes precedence over config\n * (allows developer to mix and match secure + non-secure) */\n if (typeof secure === 'boolean') {\n if (secure === true) {\n /* We've explicitly specified secure,\n * add the secure attribute to the cookie (after domain) */\n cookieDomain += \"; secure\";\n }\n // else - secure has been supplied but isn't true - so don't set secure flag, regardless of what config says\n }\n else if (cookie.secure === true) {\n // secure parameter wasn't specified, get default from config\n cookieDomain += \"; secure\";\n }\n $document.cookie = deriveQualifiedKey(key) + \"=\" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain;\n }\n } catch (e) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);\n return false;\n }\n return true;\n };\n\n // Directly get a value from a cookie\n // Example use: localStorageService.cookie.get('library'); // returns 'angular'\n var getFromCookies = function (key) {\n if (!browserSupportsCookies) {\n $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED');\n return false;\n }\n\n var cookies = $document.cookie && $document.cookie.split(';') || [];\n for(var i=0; i < cookies.length; i++) {\n var thisCookie = cookies[i];\n while (thisCookie.charAt(0) === ' ') {\n thisCookie = thisCookie.substring(1,thisCookie.length);\n }\n if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) {\n var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length));\n try {\n var parsedValue = JSON.parse(storedValues);\n return typeof(parsedValue) === 'number' ? storedValues : parsedValue;\n } catch(e) {\n return storedValues;\n }\n }\n }\n return null;\n };\n\n var removeFromCookies = function (key) {\n addToCookies(key,null);\n };\n\n var clearAllFromCookies = function () {\n var thisCookie = null;\n var prefixLength = prefix.length;\n var cookies = $document.cookie.split(';');\n for(var i = 0; i < cookies.length; i++) {\n thisCookie = cookies[i];\n\n while (thisCookie.charAt(0) === ' ') {\n thisCookie = thisCookie.substring(1, thisCookie.length);\n }\n\n var key = thisCookie.substring(prefixLength, thisCookie.indexOf('='));\n removeFromCookies(key);\n }\n };\n\n var getStorageType = function() {\n return storageType;\n };\n\n var setStorageType = function(type) {\n if (type && storageType !== type) {\n storageType = type;\n browserSupportsLocalStorage = checkSupport();\n }\n return browserSupportsLocalStorage;\n };\n\n // Add a listener on scope variable to save its changes to local storage\n // Return a function which when called cancels binding\n var bindToScope = function(scope, key, def, lsKey, type) {\n lsKey = lsKey || key;\n var value = getFromLocalStorage(lsKey, type);\n\n if (value === null && isDefined(def)) {\n value = def;\n } else if (isObject(value) && isObject(def)) {\n value = extend(value, def);\n }\n\n $parse(key).assign(scope, value);\n\n return scope.$watch(key, function(newVal) {\n addToLocalStorage(lsKey, newVal, type);\n }, isObject(scope[key]));\n };\n\n // Add listener to local storage, for update callbacks.\n if (browserSupportsLocalStorage) {\n if ($window.addEventListener) {\n $window.addEventListener(\"storage\", handleStorageChangeCallback, false);\n $rootScope.$on('$destroy', function() {\n $window.removeEventListener(\"storage\", handleStorageChangeCallback);\n });\n } else if($window.attachEvent){\n // attachEvent and detachEvent are proprietary to IE v6-10\n $window.attachEvent(\"onstorage\", handleStorageChangeCallback);\n $rootScope.$on('$destroy', function() {\n $window.detachEvent(\"onstorage\", handleStorageChangeCallback);\n });\n }\n }\n\n // Callback handler for storage changed.\n function handleStorageChangeCallback(e) {\n if (!e) { e = $window.event; }\n if (notify.setItem) {\n if (isString(e.key) && isKeyPrefixOurs(e.key)) {\n var key = underiveQualifiedKey(e.key);\n // Use timeout, to avoid using $rootScope.$apply.\n $timeout(function () {\n $rootScope.$broadcast('LocalStorageModule.notification.changed', { key: key, newvalue: e.newValue, storageType: self.storageType });\n });\n }\n }\n }\n\n // Return localStorageService.length\n // ignore keys that not owned\n var lengthOfLocalStorage = function(type) {\n var previousType = getStorageType();\n\n try {\n setStorageType(type);\n\n var count = 0;\n var storage = $window[storageType];\n for(var i = 0; i < storage.length; i++) {\n if(storage.key(i).indexOf(prefix) === 0 ) {\n count++;\n }\n }\n \n return count;\n } finally {\n setStorageType(previousType);\n }\n };\n\n var changePrefix = function(localStoragePrefix) {\n prefix = localStoragePrefix;\n };\n\n return {\n isSupported: browserSupportsLocalStorage,\n getStorageType: getStorageType,\n setStorageType: setStorageType,\n setPrefix: changePrefix,\n set: addToLocalStorage,\n add: addToLocalStorage, //DEPRECATED\n get: getFromLocalStorage,\n keys: getKeysForLocalStorage,\n remove: removeFromLocalStorage,\n clearAll: clearAllFromLocalStorage,\n bind: bindToScope,\n deriveKey: deriveQualifiedKey,\n underiveKey: underiveQualifiedKey,\n length: lengthOfLocalStorage,\n defaultToCookie: this.defaultToCookie,\n cookie: {\n isSupported: browserSupportsCookies,\n set: addToCookies,\n add: addToCookies, //DEPRECATED\n get: getFromCookies,\n remove: removeFromCookies,\n clearAll: clearAllFromCookies\n }\n };\n }];\n });\n})(window, window.angular);","require('./dist/angular-local-storage.js');\nmodule.exports = 'LocalStorageModule';\n"],"names":["angular","isDefined","isUndefined","isNumber","isObject","isArray","isString","extend","toJson","window","module","provider","this","prefix","storageType","cookie","expiry","path","secure","defaultToCookie","notify","setItem","removeItem","setPrefix","setStorageType","setDefaultToCookie","shouldDefault","setStorageCookie","exp","setStorageCookieDomain","domain","setNotify","itemSet","itemRemove","$get","$rootScope","$window","$document","$parse","$timeout","webStorage","self","document","substr","deriveQualifiedKey","key","underiveQualifiedKey","replace","RegExp","checkSupport","supported","Math","round","random","e","$broadcast","message","browserSupportsLocalStorage","addToLocalStorage","value","type","previousType","getStorageType","newvalue","addToCookies","getFromLocalStorage","getFromCookies","item","getItem","JSON","parse","removeFromLocalStorage","i","consumed","arguments","length","removeFromCookies","browserSupportsCookies","navigator","cookieEnabled","indexOf","call","daysToExpiry","expiryDate","Date","cookieDomain","setTime","getTime","toGMTString","cookiePath","encodeURIComponent","cookies","split","thisCookie","charAt","substring","storedValues","decodeURIComponent","parsedValue","clearAllFromCookies","prefixLength","handleStorageChangeCallback","event","isKeyPrefixOurs","newValue","addEventListener","$on","removeEventListener","attachEvent","detachEvent","isSupported","localStoragePrefix","set","add","get","keys","push","Description","remove","clearAll","regularExpression","prefixRegex","testRegex","test","bind","scope","def","lsKey","assign","$watch","newVal","deriveKey","underiveKey","count","storage","exports"],"sourceRoot":""}