<commit_before>'use strict'

import Vue from 'vue'
import middleware from './middleware'
import { createApp, NuxtError } from './index'
import { applyAsyncData, sanitizeComponent, getMatchedComponents, getMatchedComponentsInstances, flatMapComponents, getContext, middlewareSeries, promisify, getLocation, compile } from './utils'
const noopData = () => { return {} }
const noopFetch = () => {}
let _lastPaths = []
let _lastComponentsFiles = []

let app
let router
<%= (store ? 'let store' : '') %>

function mapTransitions(Components, to, from) {
  return Components.map((Component) => {
    let transition = Component.options.transition
    if (typeof transition === 'function') {
      return transition(to, from)
    }
    return transition
  })
}

function loadAsyncComponents (to, from, next) {
  const resolveComponents = flatMapComponents(to, (Component, _, match, key) => {
    if (typeof Component === 'function' && !Component.options) {
      return new Promise(function (resolve, reject) {
        const _resolve = (Component) => {
          Component = sanitizeComponent(Component)
          match.components[key] = Component
          resolve(Component)
        }
        Component().then(_resolve).catch(reject)
      })
    }
    Component = sanitizeComponent(Component)
    match.components[key] = Component
    return match.components[key]
  })
  const fromPath = from.fullPath.split('#')[0]
  const toPath = to.fullPath.split('#')[0]
  this._hashChanged = (fromPath === toPath)<commit_msg>fix(client): combine & prefer leave* transitions of from route<commit_after>'use strict'

import Vue from 'vue'
import middleware from './middleware'
import { createApp, NuxtError } from './index'
import { applyAsyncData, sanitizeComponent, getMatchedComponents, getMatchedComponentsInstances, flatMapComponents, getContext, middlewareSeries, promisify, getLocation, compile } from './utils'
const noopData = () => { return {} }
const noopFetch = () => {}
let _lastPaths = []
let _lastComponentsFiles = []

let app
let router
<%= (store ? 'let store' : '') %>

function mapTransitions(Components, to, from) {
  const resolve = t => (typeof t.options.transition === 'function')
    ? t.options.transition(to, from)
    : Object.assign({}, t.options.transition)

  const resolveRoute = r => resolve(r.matched[0].components.default)

  return Components.map((Component) => {
    let transitions = Object.assign({}, to ? resolveRoute(to) : resolve(Component))
    // Combine transitions
    // Prefer leave* transitions of from route
    let from_transitions = from ? resolveRoute(from) : {}
    Object.keys(from_transitions).forEach(key=> {
      if(from_transitions[key] && key.toLowerCase().indexOf('leave') !== -1) {
        transitions[key] = from_transitions[key]
      }
    })
    return transitions
  })
}

function loadAsyncComponents (to, from, next) {
  const resolveComponents = flatMapComponents(to, (Component, _, match, key) => {
    if (typeof Component === 'function' && !Component.options) {
      return new Promise(function (resolve, reject) {
        const _resolve = (Component) => {
          Component = sanitizeComponent(Component)
          match.components[key] = Component
          resolve(Component)
        }
        Component().then(_resolve).catch(reject)
      })
    }
    Component = sanitizeComponent(Component)
    match.components[key] = Component
    return match.components[key]
  })
  const fromPath = from.fullPath.split('#')[0]
  const toPath = to.fullPath.split('#')[0]
  this._hashChanged = (fromPath === toPath)
{'fraction_non_alphanumeric': 0.13499859668818412, 'fraction_numerical': 0.0016839741790625876, 'mean_word_length': 3.882191780821918, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256346', 'n_tokens_mistral': 1004, 'n_tokens_neox': 998, 'n_words': 248}