/** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (($, Drupal, cookies) => { const deprecatedMessageSuffix = `is deprecated in Drupal 9.0.0 and will be removed in Drupal 10.0.0. Use the core/js-cookie library instead. See https://www.drupal.org/node/3104677`; const isFunction = obj => Object.prototype.toString.call(obj) === '[object Function]'; const parseCookieValue = (value, parseJson) => { if (value.indexOf('"') === 0) { value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { value = decodeURIComponent(value.replace(/\+/g, ' ')); return parseJson ? JSON.parse(value) : value; } catch (e) {} }; const reader = (cookieValue, cookieName, converter, readUnsanitized, parseJson) => { const value = readUnsanitized ? cookieValue : parseCookieValue(cookieValue, parseJson); if (converter !== undefined && isFunction(converter)) { return converter(value, cookieName); } return value; }; $.cookie = (key, value = undefined, options = undefined) => { Drupal.deprecationError({ message: `jQuery.cookie() ${deprecatedMessageSuffix}` }); if (value !== undefined && !isFunction(value)) { const attributes = { ...$.cookie.defaults, ...options }; if (typeof attributes.expires === 'string' && attributes.expires !== '') { attributes.expires = new Date(attributes.expires); } const cookieSetter = cookies.withConverter({ write: cookieValue => encodeURIComponent(cookieValue) }); value = $.cookie.json && !$.cookie.raw ? JSON.stringify(value) : String(value); return cookieSetter.set(key, value, attributes); } const userProvidedConverter = value; const cookiesShim = cookies.withConverter({ read: (cookieValue, cookieName) => reader(cookieValue, cookieName, userProvidedConverter, $.cookie.raw, $.cookie.json) }); if (key !== undefined) { return cookiesShim.get(key); } const results = cookiesShim.get(); Object.keys(results).forEach(resultKey => { if (results[resultKey] === undefined) { delete results[resultKey]; } }); return results; }; $.cookie.defaults = { path: '', ...cookies.defaults }; $.cookie.json = false; $.cookie.raw = false; $.removeCookie = (key, options) => { Drupal.deprecationError({ message: `jQuery.removeCookie() ${deprecatedMessageSuffix}` }); cookies.remove(key, { ...$.cookie.defaults, ...options }); return !cookies.get(key); }; })(jQuery, Drupal, window.Cookies);