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AAI,KAAK,IAAL,KAAc,IAAlB,EAAwB;AACtB;AACA,uBAAO,IAAP;AACD,aAHD,MAGO,IAAI,KAAK,KAAL,KAAe,IAAnB,EAAyB;AAC9B;AACA,uBAAO,KAAP;AACD,aAHM,MAGA;AACL;AACA,uBAAO,KAAK,QAAL,CAAc,IAArB;AACD;AACF,SA/BO;AAgCR,wBAhCQ,8BAgCQ;AACd,mBAAO;AACL,+BAAe,KAAK,UADf;AAEL,gCAAgB,CAAC,KAAK;AAFjB,aAAP;AAID;AArCO,KApCqC;AA4E/C,WAAO;AACL,gBAAQ;AACN,mBADM,mBACG,MADH,EACW,MADX,EACiB;AACrB,oBAAI,WAAW,MAAf,EAAuB;AACrB,yBAAK,gBAAL,CAAsB,MAAtB,GAA+B,KAAK,MAApC;AACD;AACF,aALK;;AAMN,uBAAW;AANL;AADH;AA5EwC,CAA/B,CAAlB;kBAwFe,S","sourcesContent":["import Vue from 'vue'\nimport { PropValidator, RenderContext } from 'vue/types/options'\n\n/* eslint-disable-next-line no-use-before-define */\ninterface Themeable extends Vue {\n theme: {\n isDark: boolean\n }\n}\n\nexport function functionalThemeClasses (context: RenderContext): object {\n const vm = {\n ...context.props,\n ...context.injections\n }\n const isDark = Themeable.options.computed.isDark.call(vm)\n return Themeable.options.computed.themeClasses.call({ isDark })\n}\n\n/* @vue/component */\nconst Themeable = Vue.extend().extend({\n name: 'themeable',\n\n provide (): object {\n return {\n theme: this.themeableProvide\n }\n },\n\n inject: {\n theme: {\n default: {\n isDark: false\n }\n }\n },\n\n props: {\n dark: {\n type: Boolean,\n default: null\n } as PropValidator,\n light: {\n type: Boolean,\n default: null\n } as PropValidator\n },\n\n data () {\n return {\n themeableProvide: {\n isDark: false\n }\n }\n },\n\n computed: {\n isDark (): boolean {\n if (this.dark === true) {\n // explicitly dark\n return true\n } else if (this.light === true) {\n // explicitly light\n return false\n } else {\n // inherit from parent, or default false if there is none\n return this.theme.isDark\n }\n },\n themeClasses (): object {\n return {\n 'theme--dark': this.isDark,\n 'theme--light': !this.isDark\n }\n },\n /** Used by menus and dialogs, inherits from v-app instead of the parent */\n rootIsDark (): boolean {\n if (this.dark === true) {\n // explicitly dark\n return true\n } else if (this.light === true) {\n // explicitly light\n return false\n } else {\n // inherit from v-app\n return this.$vuetify.dark\n }\n },\n rootThemeClasses (): Dictionary {\n return {\n 'theme--dark': this.rootIsDark,\n 'theme--light': !this.rootIsDark\n }\n }\n },\n\n watch: {\n isDark: {\n handler (newVal, oldVal) {\n if (newVal !== oldVal) {\n this.themeableProvide.isDark = this.isDark\n }\n },\n immediate: true\n }\n }\n})\n\nexport default Themeable\n"],"sourceRoot":""}