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