{"version":3,"file":"GithubIcon-B7XRgSML.js","sources":["../../src/components/ui/sidebar/utils.ts","../../src/components/icons/GithubIcon.vue"],"sourcesContent":["import type { ComputedRef, Ref } from 'vue'\nimport { ref } from 'vue'\nimport { createContext } from 'reka-ui'\n\n// export const SIDEBAR_COOKIE_NAME = 'sidebar:state'\n// export const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\nexport const SIDEBAR_STORAGE_KEY = 'proj-sidebar:state'\nexport const SIDEBAR_RESIZE_STORAGE_KEY = 'proj-sidebar:resize'\nexport const SIDEBAR_WIDTH = '16rem'\nexport const SIDEBAR_WIDTH_MOBILE = '18rem'\nexport const SIDEBAR_WIDTH_ICON = '70px'\nexport const SIDEBAR_KEYBOARD_SHORTCUT = 'b'\n\nfunction clampSidebarWidth(width: number): number {\n const maxWidth = window.innerWidth / 3\n const minWidth = parseFloat(SIDEBAR_WIDTH) * parseFloat(getComputedStyle(document.documentElement).fontSize)\n return Math.max(minWidth, Math.min(width, maxWidth))\n}\n\nfunction loadSidebarWidth(): number {\n const storedWidth = localStorage.getItem(SIDEBAR_RESIZE_STORAGE_KEY)\n const defaultWidth = parseFloat(SIDEBAR_WIDTH) * parseFloat(getComputedStyle(document.documentElement).fontSize)\n\n let width = storedWidth ? parseFloat(storedWidth) : defaultWidth\n\n return clampSidebarWidth(width)\n}\n\nexport const sidebarWidth = ref(loadSidebarWidth())\n\nexport const setSidebarWidth = (width: number) => {\n const clampedWidth = clampSidebarWidth(width)\n sidebarWidth.value = clampedWidth\n localStorage.setItem(SIDEBAR_RESIZE_STORAGE_KEY, `${clampedWidth}px`)\n}\n\nexport const [useSidebar, provideSidebarContext] = createContext<{\n state: ComputedRef<'expanded' | 'collapsed'>\n open: Ref\n setOpen: (value: boolean) => void\n isMobile: Ref\n openMobile: Ref\n setOpenMobile: (value: boolean) => void\n toggleSidebar: () => void\n\n /**\n * Current sidebar width in pixels.\n */\n currentSidebarWidth: ComputedRef\n /**\n * Updates the sidebar width.\n * @param {number} width Width in pixels.\n */\n updateSidebarWidth: (width: number) => void\n}>('Sidebar')\n","\n\n\n"],"names":["SIDEBAR_STORAGE_KEY","SIDEBAR_RESIZE_STORAGE_KEY","SIDEBAR_WIDTH","SIDEBAR_WIDTH_MOBILE","SIDEBAR_WIDTH_ICON","SIDEBAR_KEYBOARD_SHORTCUT","clampSidebarWidth","width","maxWidth","window","innerWidth","minWidth","parseFloat","getComputedStyle","document","documentElement","fontSize","Math","max","min","sidebarWidth","ref","storedWidth","localStorage","getItem","defaultWidth","loadSidebarWidth","setSidebarWidth","clampedWidth","value","setItem","useSidebar","provideSidebarContext","createContext","_hoisted_1","xmlns","viewBox","fill","stroke","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","d"],"mappings":"scAMO,MAAMA,EAAsB,qBACtBC,EAA6B,sBAC7BC,EAAgB,QAChBC,EAAuB,QACvBC,EAAqB,OACrBC,EAA4B,IAEzC,SAASC,EAAkBC,GACnB,MAAAC,EAAWC,OAAOC,WAAa,EAC/BC,EAAWC,WAAWV,GAAiBU,WAAWC,iBAAiBC,SAASC,iBAAiBC,UACnG,OAAOC,KAAKC,IAAIP,EAAUM,KAAKE,IAAIZ,EAAOC,GAC5C,CAWa,MAAAY,EAAeC,EAT5B,WACQ,MAAAC,EAAcC,aAAaC,QAAQvB,GACnCwB,EAAeb,WAAWV,GAAiBU,WAAWC,iBAAiBC,SAASC,iBAAiBC,UAIvG,OAAOV,EAFKgB,EAAcV,WAAWU,GAAeG,EAGtD,CAEwCC,IAE3BC,EAAmBpB,IACxB,MAAAqB,EAAetB,EAAkBC,GACvCa,EAAaS,MAAQD,EACrBL,aAAaO,QAAQ7B,EAA4B,GAAG2B,MAAgB,GAGxDG,EAAYC,GAAyBC,EAkBhD,WCrDIC,EAAkC,CAACC,MAAO,6BAAaC,QAAW,YAACC,KAAM,OAAgBC,OAAA,2DAA9F,SAAAC,EAAAC,GAGIC,OAAAA,IAAAC,EAD4P,MAAAR,EAAAM,EAAA,KAAAA,EAAA,GAAA,CAE9PG,EAAkC,OAAA,CAA5BC,EAAE,4PAAuB,MAAA"}