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,WAAd,KAA8B,IAAI,KAAJ,CAAU,CAAV,CAArC;AACD;AAED;;;;;;AAMM,SAAU,WAAV,CAAkD,EAAlD,EAA2D,IAA3D,EAAyE,KAAzE,EAAkF;AACtF,QAAI,GAAG,MAAH,CAAU,IAAV,KAAmB,GAAG,YAAH,CAAgB,IAAhB,CAAnB,IAA6C,GAAG,YAAH,CAAgB,IAAhB,EAA8B,IAA/E,EAAqF;AACnF,eAAO,QAAQ,QAAR,GAA0B,QAAjC;AACD;AACD,QAAI,GAAG,MAAH,CAAU,IAAV,CAAJ,EAAqB,OAAO,QAAP;AACrB,QAAI,GAAG,YAAH,CAAgB,IAAhB,CAAJ,EAA2B,OAAO,QAAP;AAC5B","sourcesContent":["import Vue from 'vue'\nimport { VNode, VNodeDirective, FunctionalComponentOptions } from 'vue/types'\nimport { VuetifyIcon } from 'vuetify'\n\nexport function createSimpleFunctional (\n c: string,\n el = 'div',\n name?: string\n) {\n return Vue.extend({\n name: name || c.replace(/__/g, '-'),\n\n functional: true,\n\n render (h, { data, children }): VNode {\n data.staticClass = (`${c} ${data.staticClass || ''}`).trim()\n\n return h(el, data, children)\n }\n })\n}\n\nfunction mergeTransitions (\n transitions: undefined | Function | Function[],\n array: Function[]\n) {\n if (Array.isArray(transitions)) return transitions.concat(array)\n if (transitions) array.push(transitions)\n return array\n}\n\nexport function createSimpleTransition (\n name: string,\n origin = 'top center 0',\n mode?: string\n): FunctionalComponentOptions {\n return {\n name,\n\n functional: true,\n\n props: {\n group: {\n type: Boolean,\n default: false\n },\n hideOnLeave: {\n type: Boolean,\n default: false\n },\n leaveAbsolute: {\n type: Boolean,\n default: false\n },\n mode: {\n type: String,\n default: mode\n },\n origin: {\n type: String,\n default: origin\n }\n },\n\n render (h, context): VNode {\n const tag = `transition${context.props.group ? '-group' : ''}`\n context.data = context.data || {}\n context.data.props = {\n name,\n mode: context.props.mode\n }\n context.data.on = context.data.on || {}\n if (!Object.isExtensible(context.data.on)) {\n context.data.on = { ...context.data.on }\n }\n\n const ourBeforeEnter: Function[] = []\n const ourLeave: Function[] = []\n const absolute = (el: HTMLElement) => (el.style.position = 'absolute')\n\n ourBeforeEnter.push((el: HTMLElement) => {\n el.style.transformOrigin = context.props.origin\n el.style.webkitTransformOrigin = context.props.origin\n })\n\n if (context.props.leaveAbsolute) ourLeave.push(absolute)\n if (context.props.hideOnLeave) {\n ourLeave.push((el: HTMLElement) => (el.style.display = 'none'))\n }\n\n const { beforeEnter, leave } = context.data.on\n\n // Type says Function | Function[] but\n // will only work if provided a function\n context.data.on.beforeEnter = () => mergeTransitions(beforeEnter, ourBeforeEnter)\n context.data.on.leave = mergeTransitions(leave, ourLeave)\n\n return h(tag, context.data, context.children)\n }\n }\n}\n\nexport function createJavaScriptTransition (\n name: string,\n functions: Record<string, () => any>,\n mode = 'in-out'\n): FunctionalComponentOptions {\n return {\n name,\n\n functional: true,\n\n props: {\n mode: {\n type: String,\n default: mode\n }\n },\n\n render (h, context): VNode {\n const data = {\n props: {\n ...context.props,\n name\n },\n on: functions\n }\n\n return h('transition', data, context.children)\n }\n }\n}\n\nexport type BindingConfig = Pick<VNodeDirective, 'arg' | 'modifiers' | 'value'>\nexport function directiveConfig (binding: BindingConfig, defaults = {}): VNodeDirective {\n return {\n ...defaults,\n ...binding.modifiers,\n value: binding.arg,\n ...(binding.value || {})\n }\n}\n\nexport function addOnceEventListener (el: EventTarget, event: string, cb: () => void): void {\n var once = () => {\n cb()\n el.removeEventListener(event, once, false)\n }\n\n el.addEventListener(event, once, false)\n}\n\nlet passiveSupported = false\ntry {\n if (typeof window !== 'undefined') {\n const testListenerOpts = Object.defineProperty({}, 'passive', {\n get: () => {\n passiveSupported = true\n }\n })\n\n window.addEventListener('testListener', testListenerOpts, testListenerOpts)\n window.removeEventListener('testListener', testListenerOpts, testListenerOpts)\n }\n} catch (e) { console.warn(e) }\nexport { passiveSupported }\n\nexport function addPassiveEventListener (\n el: EventTarget,\n event: string,\n cb: EventHandlerNonNull | (() => void),\n options: {}\n): void {\n el.addEventListener(event, cb, passiveSupported ? options : false)\n}\n\nexport function getNestedValue (obj: any, path: (string | number)[], fallback?: any): any {\n const last = path.length - 1\n\n if (last < 0) return obj === undefined ? fallback : obj\n\n for (let i = 0; i < last; i++) {\n if (obj == null) {\n return fallback\n }\n obj = obj[path[i]]\n }\n\n if (obj == null) return fallback\n\n return obj[path[last]] === undefined ? fallback : obj[path[last]]\n}\n\nexport function deepEqual (a: any, b: any): boolean {\n if (a === b) return true\n\n if (a instanceof Date && b instanceof Date) {\n // If the values are Date, they were convert to timestamp with getTime and compare it\n if (a.getTime() !== b.getTime()) return false\n }\n\n if (a !== Object(a) || b !== Object(b)) {\n // If the values aren't objects, they were already checked for equality\n return false\n }\n\n const props = Object.keys(a)\n\n if (props.length !== Object.keys(b).length) {\n // Different number of props, don't bother to check\n return false\n }\n\n return props.every(p => deepEqual(a[p], b[p]))\n}\n\nexport function getObjectValueByPath (obj: object, path: string, fallback?: any): any {\n // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621\n if (!path || path.constructor !== String) return fallback\n path = path.replace(/\\[(\\w+)\\]/g, '.$1') // convert indexes to properties\n path = path.replace(/^\\./, '') // strip a leading dot\n return getNestedValue(obj, path.split('.'), fallback)\n}\n\nexport function getPropertyFromItem (\n item: object,\n property: string | (string | number)[] | ((item: object, fallback?: any) => any),\n fallback?: any\n): any {\n if (property == null) return item === undefined ? fallback : item\n\n if (item !== Object(item)) return fallback === undefined ? item : fallback\n\n if (typeof property === 'string') return getObjectValueByPath(item, property, fallback)\n\n if (Array.isArray(property)) return getNestedValue(item, property, fallback)\n\n if (typeof property !== 'function') return fallback\n\n const value = property(item, fallback)\n\n return typeof value === 'undefined' ? fallback : value\n}\n\nexport function createRange (length: number): number[] {\n return Array.from({ length }, (v, k) => k)\n}\n\nexport function getZIndex (el?: Element | null): number {\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return 0\n\n const index = +window.getComputedStyle(el).getPropertyValue('z-index')\n\n if (isNaN(index)) return getZIndex(el.parentNode as Element)\n return index\n}\n\nconst tagsToReplace = {\n '&': '&',\n '<': '<',\n '>': '>'\n} as any\n\nexport function escapeHTML (str: string): string {\n return str.replace(/[&<>]/g, tag => tagsToReplace[tag] || tag)\n}\n\nexport function filterObjectOnKeys<T, K extends keyof T> (obj: T, keys: K[]): { [N in K]: T[N] } {\n const filtered = {} as { [N in K]: T[N] }\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]\n if (typeof obj[key] !== 'undefined') {\n filtered[key] = obj[key]\n }\n }\n\n return filtered\n}\n\nexport function filterChildren (array: VNode[] = [], tag: string): VNode[] {\n return array.filter(child => {\n return child.componentOptions &&\n child.componentOptions.Ctor.options.name === tag\n })\n}\n\nexport function convertToUnit (str: string | number | null | undefined, unit = 'px'): string | undefined {\n if (str == null || str === '') {\n return undefined\n } else if (isNaN(+str!)) {\n return String(str)\n } else {\n return `${Number(str)}${unit}`\n }\n}\n\nexport function kebabCase (str: string): string {\n return (str || '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nexport function isObject (obj: any): obj is object {\n return obj !== null && typeof obj === 'object'\n}\n\n// KeyboardEvent.keyCode aliases\nexport const keyCodes = Object.freeze({\n enter: 13,\n tab: 9,\n delete: 46,\n esc: 27,\n space: 32,\n up: 38,\n down: 40,\n left: 37,\n right: 39,\n end: 35,\n home: 36,\n del: 46,\n backspace: 8,\n insert: 45,\n pageup: 33,\n pagedown: 34\n})\n\nconst ICONS_PREFIX = '$vuetify.icons.'\n\n// This remaps internal names like '$vuetify.icons.cancel'\n// to the current name or component for that icon.\nexport function remapInternalIcon (vm: Vue, iconName: string): VuetifyIcon {\n if (!iconName.startsWith(ICONS_PREFIX)) {\n return iconName\n }\n\n // Now look up icon indirection name, e.g. '$vuetify.icons.cancel'\n return getObjectValueByPath(vm, iconName, iconName)\n}\n\nexport function keys<O> (o: O) {\n return Object.keys(o) as (keyof O)[]\n}\n\n/**\n * Camelize a hyphen-delimited string.\n */\nconst camelizeRE = /-(\\w)/g\nexport const camelize = (str: string): string => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')\n}\n\n/**\n * Returns the set difference of B and A, i.e. the set of elements in B but not in A\n */\nexport function arrayDiff (a: any[], b: any[]): any[] {\n const diff = []\n for (let i = 0; i < b.length; i++) {\n if (a.indexOf(b[i]) < 0) diff.push(b[i])\n }\n return diff\n}\n\n/**\n * Makes the first character of a string uppercase\n */\nexport function upperFirst (str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n\n/**\n * Returns:\n * - 'normal' for old style slots - `<template slot=\"default\">`\n * - 'scoped' for old style scoped slots (`<template slot=\"default\" slot-scope=\"data\">`) or bound v-slot (`#default=\"data\"`)\n * - 'v-slot' for unbound v-slot (`#default`) - only if the third param is true, otherwise counts as scoped\n */\nexport function getSlotType<T extends boolean = false> (vm: Vue, name: string, split?: T): (T extends true ? 'v-slot' : never) | 'normal' | 'scoped' | void {\n if (vm.$slots[name] && vm.$scopedSlots[name] && (vm.$scopedSlots[name] as any).name) {\n return split ? 'v-slot' as any : 'scoped'\n }\n if (vm.$slots[name]) return 'normal'\n if (vm.$scopedSlots[name]) return 'scoped'\n}\n"],"sourceRoot":""}
|