import{B as k,a as x,h as f,w as p}from"/build/_shared/chunk-FNLAOAQV.js";import{d as u}from"/build/_shared/chunk-4AMCPB2Y.js";function g(){return p("root").requestInfo}function C(e){function c(o,n){let a=e[n];if(!a)throw new Error(`Unknown client hint: ${typeof n=="string"?n:"Unknown"}`);let s=o.split(";").map(i=>i.trim()).find(i=>i.startsWith(a.cookieName+"="))?.split("=")[1];return s?decodeURIComponent(s):null}function t(o){let n=typeof document<"u"?document.cookie:typeof o<"u"?o.headers.get("Cookie")??"":"";return Object.entries(e).reduce((a,[s,i])=>{let m=s;return"transform"in i?a[m]=i.transform(c(n,m)??i.fallback):a[m]=c(n,m)??i.fallback,a},{})}function r(){return`
const cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {
	const [key, value] = cur.split('=');
	acc[key] = value;
	return acc;
}, {});
let cookieChanged = false;
const hints = [
${Object.values(e).map(o=>{let n=JSON.stringify(o.cookieName);return`{ name: ${n}, actual: String(${o.getValueCode}), cookie: cookies[${n}] }`}).join(`,
`)}
];
for (const hint of hints) {
	if (decodeURIComponent(hint.cookie) !== hint.actual) {
		cookieChanged = true;
		document.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';
	}
}
// if the cookie changed, reload the page, unless the browser doesn't support
// cookies (in which case we would enter an infinite loop of reloads)
if (cookieChanged && navigator.cookieEnabled) {
	window.location.reload();
}
			`}return{getHints:t,getClientHintCheckScript:r}}var d={cookieName:"CH-prefers-color-scheme",getValueCode:"window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'",fallback:"light",transform(e){return e==="dark"?"dark":"light"}};function H(e,c=d.cookieName){let t=window.matchMedia("(prefers-color-scheme: dark)");function r(){let o=t.matches?"dark":"light";document.cookie=`${c}=${o}; Max-Age=31536000; Path=/`,e(o)}return t.addEventListener("change",r),function(){t.removeEventListener("change",r)}}var l={cookieName:"CH-reduced-motion",getValueCode:"window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'reduce' : 'no-preference'",fallback:"no-preference",transform(e){return e==="reduce"?"reduce":"no-preference"}};function w(e,c=l.cookieName){let t=window.matchMedia("(prefers-reduced-motion: reduce)");function r(){let o=t.matches?"reduce":"no-preference";document.cookie=`${c}=${o}; Max-Age=31536000; Path=/`,e(o)}return t.addEventListener("change",r),function(){t.removeEventListener("change",r)}}var b={cookieName:"CH-time-zone",getValueCode:"Intl.DateTimeFormat().resolvedOptions().timeZone",fallback:"UTC"};var h=u(x(),1);var M=u(k(),1),v="KCDShop_CH-prefers-color-scheme",S="KCDShop_CH-reduced-motion",N=C({theme:{...d,cookieName:v},timeZone:{...b,cookieName:"KCDShop_CH-time-zone"},reducedMotion:{...l,cookieName:S}}),{getHints:z}=N;function O(){return g().hints}function A(){let{revalidate:e}=f();return h.useEffect(()=>H(()=>e(),v),[e]),h.useEffect(()=>w(()=>e(),S),[e]),(0,M.jsx)("script",{dangerouslySetInnerHTML:{__html:N.getClientHintCheckScript()}})}export{g as a,O as b,A as c};
//# sourceMappingURL=/build/_shared/chunk-EYL65FZP.js.map
