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GAAG,UAAC,KAAiB;IAClD,IAAM,KAAK,GAAG,eAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,gBAAO,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,cAAK,EAAE,EAAE,CAAC,CAAC;IAEhF,4EAA4E;IAC5E,IAAM,yBAAyB,GAAG,UAAC,CAAa;QAC9C,OAAO,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,UAAC,IAAc;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC",
10 "sourcesContent": [
11 "import { Transition } from '../transition/transition';\nimport { UIRouter } from '../router';\nimport { TransitionService } from '../transition/transitionService';\nimport { Resolvable } from '../resolve';\nimport { inArray, uniqR, unnestR, values } from '../common';\nimport { PathNode } from '../path';\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable(Resolvable.fromData(UIRouter, trans.router), '');\n trans.addResolvable(Resolvable.fromData(Transition, trans), '');\n trans.addResolvable(Resolvable.fromData('$transition$', trans), '');\n trans.addResolvable(Resolvable.fromData('$stateParams', trans.params()), '');\n\n trans.entering().forEach((state) => {\n trans.addResolvable(Resolvable.fromData('$state$', state), state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n\nconst TRANSITION_TOKENS = ['$transition$', Transition];\nconst isTransition = inArray(TRANSITION_TOKENS);\n\n// References to Transition in the treeChanges pathnodes makes all\n// previous Transitions reachable in memory, causing a memory leak\n// This function removes resolves for '$transition$' and `Transition` from the treeChanges.\n// Do not use this on current transitions, only on old ones.\nexport const treeChangesCleanup = (trans: Transition) => {\n const nodes = values(trans.treeChanges()).reduce(unnestR, []).reduce(uniqR, []);\n\n // If the resolvable is a Transition, return a new resolvable with null data\n const replaceTransitionWithNull = (r: Resolvable): Resolvable => {\n return isTransition(r.token) ? Resolvable.fromData(r.token, null) : r;\n };\n\n nodes.forEach((node: PathNode) => {\n node.resolvables = node.resolvables.map(replaceTransitionWithNull);\n });\n};\n"
12 ]
13}
\No newline at end of file