;!function(e,c){"use strict";var t=function(e){if("object"!=typeof e.document)throw new Error("Cookies.js requires a `window` with a `document` object");var i=function(e,t,o){return 1===arguments.length?i.get(e):i.set(e,t,o)};return i._document=e.document,i._cacheKeyPrefix="cookey.",i._maxExpireDate=new Date("Fri, 31 Dec 9999 23:59:59 UTC"),i.defaults={path:"/",secure:!1},i.get=function(e){i._cachedDocumentCookie!==i._document.cookie&&i._renewCache();var t=i._cache[i._cacheKeyPrefix+e];return t===c?c:decodeURIComponent(t)},i.set=function(e,t,o){return(o=i._getExtendedOptions(o)).expires=i._getExpiresDate(t===c?-1:o.expires),i._document.cookie=i._generateCookieString(e,t,o),i},i.expire=function(e,t){return i.set(e,c,t)},i._getExtendedOptions=function(e){return{path:e&&e.path||i.defaults.path,domain:e&&e.domain||i.defaults.domain,expires:e&&e.expires||i.defaults.expires,secure:e&&e.secure!==c?e.secure:i.defaults.secure}},i._isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},i._getExpiresDate=function(e,t){if(t=t||new Date,"number"==typeof e?e=e===1/0?i._maxExpireDate:new Date(t.getTime()+1e3*e):"string"==typeof e&&(e=new Date(e)),e&&!i._isValidDate(e))throw new Error("`expires` parameter cannot be converted to a valid Date instance");return e},i._generateCookieString=function(e,t,o){var n=(e=(e=e.replace(/[^#$&+\^`|]/g,encodeURIComponent)).replace(/\(/g,"%28").replace(/\)/g,"%29"))+"="+(t=(t+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent));return n+=(o=o||{}).path?";path="+o.path:"",n+=o.domain?";domain="+o.domain:"",n+=o.expires?";expires="+o.expires.toUTCString():"",n+=o.secure?";secure":""},i._getCacheFromString=function(e){for(var t={},o=e?e.split("; "):[],n=0;n<o.length;n++){var r=i._getKeyValuePairFromCookieString(o[n]);t[i._cacheKeyPrefix+r.key]===c&&(t[i._cacheKeyPrefix+r.key]=r.value)}return t},i._getKeyValuePairFromCookieString=function(e){var t=e.indexOf("=");t=t<0?e.length:t;var o,n=e.substr(0,t);try{o=decodeURIComponent(n)}catch(e){console&&"function"==typeof console.error&&console.error('Could not decode cookie with key "'+n+'"',e)}return{key:o,value:e.substr(t+1)}},i._renewCache=function(){i._cache=i._getCacheFromString(i._document.cookie),i._cachedDocumentCookie=i._document.cookie},i._areEnabled=function(){var e="cookies.js",t="1"===i.set(e,1).get(e);return i.expire(e),t},i.enabled=i._areEnabled(),i},o=e&&"object"==typeof e.document?t(e):t;"function"==typeof define&&define.amd?define(function(){return o}):"object"==typeof exports?("object"==typeof module&&"object"==typeof module.exports&&(exports=module.exports=o),exports.Cookies=o):e.Cookies=o}("undefined"==typeof window?this:window);