@@ -0,0 +1,165 @@
2+ * JavaScript Cookie v2.2.0
3+ * https://github.com/js-cookie/js-cookie
5+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6+ * Released under the MIT license
9+ var registeredInModuleLoader = false;
10+ if (typeof define === 'function' && define.amd) {
12+ registeredInModuleLoader = true;
14+ if (typeof exports === 'object') {
15+ module.exports = factory();
16+ registeredInModuleLoader = true;
18+ if (!registeredInModuleLoader) {
19+ var OldCookies = window.Cookies;
20+ var api = window.Cookies = factory();
21+ api.noConflict = function () {
22+ window.Cookies = OldCookies;
30+ for (; i < arguments.length; i++) {
31+ var attributes = arguments[ i ];
32+ for (var key in attributes) {
33+ result[key] = attributes[key];
39+ function init (converter) {
40+ function api (key, value, attributes) {
42+ if (typeof document === 'undefined') {
48+ if (arguments.length > 1) {
49+ attributes = extend({
51+ }, api.defaults, attributes);
53+ if (typeof attributes.expires === 'number') {
54+ var expires = new Date();
55+ expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
56+ attributes.expires = expires;
59+ // We're using "expires" because "max-age" is not supported by IE
60+ attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
63+ result = JSON.stringify(value);
64+ if (/^[\{\[]/.test(result)) {
69+ if (!converter.write) {
70+ value = encodeURIComponent(String(value))
71+ .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
73+ value = converter.write(value, key);
76+ key = encodeURIComponent(String(key));
77+ key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
78+ key = key.replace(/[\(\)]/g, escape);
80+ var stringifiedAttributes = '';
82+ for (var attributeName in attributes) {
83+ if (!attributes[attributeName]) {
86+ stringifiedAttributes += '; ' + attributeName;
87+ if (attributes[attributeName] === true) {
90+ stringifiedAttributes += '=' + attributes[attributeName];
92+ return (document.cookie = key + '=' + value + stringifiedAttributes);
101+ // To prevent the for loop in the first place assign an empty array
102+ // in case there are no cookies at all. Also prevents odd result when
104+ var cookies = document.cookie ? document.cookie.split('; ') : [];
105+ var rdecode = /(%[0-9A-Z]{2})+/g;
108+ for (; i < cookies.length; i++) {
109+ var parts = cookies[i].split('=');
110+ var cookie = parts.slice(1).join('=');
112+ if (!this.json && cookie.charAt(0) === '"') {
113+ cookie = cookie.slice(1, -1);
117+ var name = parts[0].replace(rdecode, decodeURIComponent);
118+ cookie = converter.read ?
119+ converter.read(cookie, name) : converter(cookie, name) ||
120+ cookie.replace(rdecode, decodeURIComponent);
124+ cookie = JSON.parse(cookie);
134+ result[name] = cookie;
143+ api.get = function (key) {
144+ return api.call(api, key);
146+ api.getJSON = function () {
149+ }, [].slice.call(arguments));
153+ api.remove = function (key, attributes) {
154+ api(key, '', extend(attributes, {
159+ api.withConverter = init;
164+ return init(function () {});