{"version":3,"file":"DmkUysdq.js","sources":["../../../../node_modules/vuetify/lib/composables/display.mjs"],"sourcesContent":["// Utilities\nimport { computed, inject, reactive, shallowRef, toRefs, watchEffect } from 'vue';\nimport { getCurrentInstanceName, mergeDeep, propsFactory } from \"../util/index.mjs\";\nimport { IN_BROWSER, SUPPORTS_TOUCH } from \"../util/globals.mjs\"; // Types\nexport const breakpoints = ['sm', 'md', 'lg', 'xl', 'xxl']; // no xs\n\nexport const DisplaySymbol = Symbol.for('vuetify:display');\nconst defaultDisplayOptions = {\n mobileBreakpoint: 'lg',\n thresholds: {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560\n }\n};\nconst parseDisplayOptions = function () {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultDisplayOptions;\n return mergeDeep(defaultDisplayOptions, options);\n};\nfunction getClientWidth(ssr) {\n return IN_BROWSER && !ssr ? window.innerWidth : typeof ssr === 'object' && ssr.clientWidth || 0;\n}\nfunction getClientHeight(ssr) {\n return IN_BROWSER && !ssr ? window.innerHeight : typeof ssr === 'object' && ssr.clientHeight || 0;\n}\nfunction getPlatform(ssr) {\n const userAgent = IN_BROWSER && !ssr ? window.navigator.userAgent : 'ssr';\n function match(regexp) {\n return Boolean(userAgent.match(regexp));\n }\n const android = match(/android/i);\n const ios = match(/iphone|ipad|ipod/i);\n const cordova = match(/cordova/i);\n const electron = match(/electron/i);\n const chrome = match(/chrome/i);\n const edge = match(/edge/i);\n const firefox = match(/firefox/i);\n const opera = match(/opera/i);\n const win = match(/win/i);\n const mac = match(/mac/i);\n const linux = match(/linux/i);\n return {\n android,\n ios,\n cordova,\n electron,\n chrome,\n edge,\n firefox,\n opera,\n win,\n mac,\n linux,\n touch: SUPPORTS_TOUCH,\n ssr: userAgent === 'ssr'\n };\n}\nexport function createDisplay(options, ssr) {\n const {\n thresholds,\n mobileBreakpoint\n } = parseDisplayOptions(options);\n const height = shallowRef(getClientHeight(ssr));\n const platform = shallowRef(getPlatform(ssr));\n const state = reactive({});\n const width = shallowRef(getClientWidth(ssr));\n function updateSize() {\n height.value = getClientHeight();\n width.value = getClientWidth();\n }\n function update() {\n updateSize();\n platform.value = getPlatform();\n }\n\n // eslint-disable-next-line max-statements\n watchEffect(() => {\n const xs = width.value < thresholds.sm;\n const sm = width.value < thresholds.md && !xs;\n const md = width.value < thresholds.lg && !(sm || xs);\n const lg = width.value < thresholds.xl && !(md || sm || xs);\n const xl = width.value < thresholds.xxl && !(lg || md || sm || xs);\n const xxl = width.value >= thresholds.xxl;\n const name = xs ? 'xs' : sm ? 'sm' : md ? 'md' : lg ? 'lg' : xl ? 'xl' : 'xxl';\n const breakpointValue = typeof mobileBreakpoint === 'number' ? mobileBreakpoint : thresholds[mobileBreakpoint];\n const mobile = width.value < breakpointValue;\n state.xs = xs;\n state.sm = sm;\n state.md = md;\n state.lg = lg;\n state.xl = xl;\n state.xxl = xxl;\n state.smAndUp = !xs;\n state.mdAndUp = !(xs || sm);\n state.lgAndUp = !(xs || sm || md);\n state.xlAndUp = !(xs || sm || md || lg);\n state.smAndDown = !(md || lg || xl || xxl);\n state.mdAndDown = !(lg || xl || xxl);\n state.lgAndDown = !(xl || xxl);\n state.xlAndDown = !xxl;\n state.name = name;\n state.height = height.value;\n state.width = width.value;\n state.mobile = mobile;\n state.mobileBreakpoint = mobileBreakpoint;\n state.platform = platform.value;\n state.thresholds = thresholds;\n });\n if (IN_BROWSER) {\n window.addEventListener('resize', updateSize, {\n passive: true\n });\n }\n return {\n ...toRefs(state),\n update,\n ssr: !!ssr\n };\n}\nexport const makeDisplayProps = propsFactory({\n mobileBreakpoint: [Number, String]\n}, 'display');\nexport function useDisplay() {\n let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();\n const display = inject(DisplaySymbol);\n if (!display) throw new Error('Could not find Vuetify display injection');\n const mobile = computed(() => {\n if (!props.mobileBreakpoint) return display.mobile.value;\n const breakpointValue = typeof props.mobileBreakpoint === 'number' ? props.mobileBreakpoint : display.thresholds.value[props.mobileBreakpoint];\n return display.width.value < breakpointValue;\n });\n const displayClasses = computed(() => {\n if (!name) return {};\n return {\n [`${name}--mobile`]: mobile.value\n };\n });\n return {\n ...display,\n displayClasses,\n mobile\n };\n}\n//# sourceMappingURL=display.mjs.map"],"names":["DisplaySymbol","makeDisplayProps","propsFactory","useDisplay","props","name","getCurrentInstanceName","display","inject","mobile","computed","breakpointValue","displayClasses"],"mappings":";;gXAMO,MAAMA,EAAgB,OAAO,IAAI,iBAAiB,EAoH5CC,EAAmBC,EAAa,CAC3C,iBAAkB,CAAC,OAAQ,MAAM,CACnC,EAAG,SAAS,EACL,SAASC,GAAa,CAC3B,IAAIC,EAAQ,UAAU,OAAS,GAAK,UAAU,CAAC,IAAM,OAAY,UAAU,CAAC,EAAI,CAAA,EAC5EC,EAAO,UAAU,OAAS,GAAK,UAAU,CAAC,IAAM,OAAY,UAAU,CAAC,EAAIC,EAAsB,EACrG,MAAMC,EAAUC,EAAOR,CAAa,EACpC,GAAI,CAACO,EAAS,MAAM,IAAI,MAAM,0CAA0C,EACxE,MAAME,EAASC,EAAS,IAAM,CAC5B,GAAI,CAACN,EAAM,iBAAkB,OAAOG,EAAQ,OAAO,MACnD,MAAMI,EAAkB,OAAOP,EAAM,kBAAqB,SAAWA,EAAM,iBAAmBG,EAAQ,WAAW,MAAMH,EAAM,gBAAgB,EAC7I,OAAOG,EAAQ,MAAM,MAAQI,CACjC,CAAG,EACKC,EAAiBF,EAAS,IACzBL,EACE,CACL,CAAC,GAAGA,CAAI,UAAU,EAAGI,EAAO,KAClC,EAHsB,EAInB,EACD,MAAO,CACL,GAAGF,EACH,eAAAK,EACA,OAAAH,CACJ,CACA","debug_id":"e7faa451-39c0-5eff-87ad-ef6dd9a767c7"}