YUI.add("cookie",function(n,e){var t=n.Lang,o=n.Object,g=null,S=t.isString,r=t.isObject,k=t.isUndefined,s=t.isFunction,u=encodeURIComponent,b=decodeURIComponent,i=n.config.doc;function a(e){throw new TypeError(e)}function c(e){S(e)&&""!==e||a("Cookie name must be a non-empty string.")}function f(e){S(e)&&""!==e||a("Subcookie name must be a non-empty string.")}n.Cookie={_createCookieString:function(e,t,n,o){o=o||{};var e=u(e)+"="+(n?u(t):t),n=o.expires,t=o.path,i=o.domain;return r(o)&&(n instanceof Date&&(e+="; expires="+n.toUTCString()),S(t)&&""!==t&&(e+="; path="+t),S(i)&&""!==i&&(e+="; domain="+i),!0===o.secure)&&(e+="; secure"),e},_createCookieHashString:function(e){r(e)||a("Cookie._createCookieHashString(): Argument must be an object.");var n=[];return o.each(e,function(e,t){s(e)||k(e)||n.push(u(t)+"="+u(String(e)))}),n.join("&")},_parseCookieHash:function(e){var t,n,o,i=e.split("&"),r={};if(e.length)for(t=0,n=i.length;t<n;t++)o=i[t].split("="),r[b(o[0])]=b(o[1]);return r},_parseCookieString:function(e,t,n){var o,i,r,s,u,a,c,f={};if(S(e)&&0<e.length)for(o=!1===t?function(e){return e}:b,i=e.split(/;\s/g),s=r=g,a=0,c=i.length;a<c;a++){if((u=i[a].match(/([^=]+)=/i))instanceof Array)try{r=b(u[1]),s=o(i[a].substring(u[1].length+1))}catch(h){}else r=b(i[a]),s="";(k(n)||!n.reverseCookieLoading||k(f[r]))&&(f[r]=s)}return f},_setDoc:function(e){i=e},exists:function(e){return c(e),this._parseCookieString(i.cookie,!0).hasOwnProperty(e)},get:function(e,t){var n;return c(e),s(t)?(n=t,t={}):r(t)?n=t.converter:t={},t=this._parseCookieString(i.cookie,!t.raw,t)[e],k(t)?g:s(n)?n(t):t},getSub:function(e,t,n,o){e=this.getSubs(e,o);return e===g||(f(t),k(e[t]))?g:s(n)?n(e[t]):e[t]},getSubs:function(e,t){c(e);t=this._parseCookieString(i.cookie,!1,t);return S(t[e])?this._parseCookieHash(t[e]):g},remove:function(e,t){return c(e),t=n.merge(t||{},{expires:new Date(0)}),this.set(e,"",t)},removeSub:function(e,t,n){var o,i;if(c(e),f(t),n=n||{},o=this.getSubs(e),r(o)&&o.hasOwnProperty(t)){if(delete o[t],n.removeIfEmpty){for(i in o)if(o.hasOwnProperty(i)&&!s(o[i])&&!k(o[i]))return this.setSubs(e,o,n);return this.remove(e,n)}return this.setSubs(e,o,n)}return""},set:function(e,t,n){c(e),k(t)&&a("Cookie.set(): Value cannot be undefined.");e=this._createCookieString(e,t,!(n=n||{}).raw,n);return i.cookie=e},setSub:function(e,t,n,o){c(e),f(t),k(n)&&a("Cookie.setSub(): Subcookie value cannot be undefined.");var i=this.getSubs(e);return(i=r(i)?i:{})[t]=n,this.setSubs(e,i,o)},setSubs:function(e,t,n){c(e),r(t)||a("Cookie.setSubs(): Cookie value must be an object.");e=this._createCookieString(e,this._createCookieHashString(t),!1,n);return i.cookie=e}}},"patched-v3.18.7",{requires:["yui-base"]});