diff options
author | Russ Cox <rsc@golang.org> | 2015-02-23 10:15:35 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2015-02-23 10:16:29 -0500 |
commit | de50bad12134ad79c897637649cb8b16c4824d1a (patch) | |
tree | c0843706ff7aeb53435061a6b4f87cf1bf354f40 | |
parent | 7cec2157b892bbc53a93cea6fbcf1c62377f1d33 (diff) | |
parent | 48469a2c866ca21f6d72bc4dee52b1a3fbf187c5 (diff) | |
download | go-de50bad12134ad79c897637649cb8b16c4824d1a.tar.gz go-de50bad12134ad79c897637649cb8b16c4824d1a.zip |
[dev.cc] all: merge master (48469a2) into dev.cc
Change-Id: I10f7950d173b302151f2a31daebce297b4306ebe
35 files changed, 4979 insertions, 956 deletions
diff --git a/misc/trace/README.md b/misc/trace/README.md new file mode 100644 index 0000000000..b9364de78c --- /dev/null +++ b/misc/trace/README.md @@ -0,0 +1,6 @@ +This directory contains helper file for trace viewer (go tool trace). + +trace_viewer_lean.html was generated following instructions in: +https://github.com/google/trace-viewer/wiki/Embedding +on revision 895aa74558d19d91906fb720df6458244ef160c6 using: +trace-viewer$ ./vulcanize_trace_viewer --config=lean diff --git a/misc/trace/trace_viewer_lean.html b/misc/trace/trace_viewer_lean.html new file mode 100644 index 0000000000..3237df16d2 --- /dev/null +++ b/misc/trace/trace_viewer_lean.html @@ -0,0 +1,2868 @@ +<!DOCTYPE HTML> +<html> + <head i18n-values="dir:textdirection;"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<style> +.labeled-checkbox { + display: flex; + white-space: nowrap; +} +</style> + + + + + + + + + + + + + + + + + + + +<template id="overlay-template"> +<style> + overlay-mask { + left: 0; + padding: 8px; + position: absolute; + top: 0; + z-index: 1000; + font-family: sans-serif; + -webkit-justify-content: center; + background: rgba(0, 0, 0, 0.8); + display: -webkit-flex; + height: 100%; + left: 0; + position: fixed; + top: 0; + width: 100%; + } + overlay-mask:focus { + outline: none; + } + overlay-vertical-centering-container { + -webkit-justify-content: center; + -webkit-flex-direction: column; + display: -webkit-flex; + } + overlay-frame { + z-index: 1100; + background: rgb(255, 255, 255); + border: 1px solid #ccc; + margin: 75px; + display: -webkit-flex; + -webkit-flex-direction: column; + } + title-bar { + -webkit-align-items: center; + -webkit-flex-direction: row; + border-bottom: 1px solid #ccc; + background-color: #ddd; + display: -webkit-flex; + padding: 5px; + -webkit-flex: 0 0 auto; + } + title { + display: inline; + font-weight: bold; + -webkit-box-flex: 1; + -webkit-flex: 1 1 auto; + } + close-button { + -webkit-align-self: flex-end; + border: 1px solid #eee; + background-color: #999; + font-size: 10pt; + font-weight: bold; + padding: 2px; + text-align: center; + width: 16px; + } + close-button:hover { + background-color: #ddd; + border-color: black; + cursor: pointer; + } + overlay-content { + display: -webkit-flex; + -webkit-flex: 1 1 auto; + -webkit-flex-direction: column; + overflow-y: auto; + padding: 10px; + min-width: 300px; + } + button-bar { + -webkit-align-items: baseline; + border-top: 1px solid #ccc; + display: -webkit-flex; + -webkit-flex: 0 0 auto; + -webkit-flex-direction: row-reverse; + padding: 4px; + } + </style> +<overlay-mask> +<overlay-vertical-centering-container> +<overlay-frame> +<title-bar> +<title></title> +<close-button>✕</close-button> +</title-bar> +<overlay-content> +<content></content> +</overlay-content> +<button-bar></button-bar> +</overlay-frame> +</overlay-vertical-centering-container> +</overlay-mask> +</template> + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +x-drag-handle { + -webkit-user-select: none; + box-sizing: border-box; + display: block; +} + +x-drag-handle.horizontal-drag-handle { + background-image: -webkit-gradient(linear, + 0 0, 0 100%, + from(#E5E5E5), + to(#D1D1D1)); + border-bottom: 1px solid #8e8e8e; + border-top: 1px solid white; + cursor: ns-resize; + height: 7px; + position: relative; + z-index: 10; +} + +x-drag-handle.vertical-drag-handle { + background-image: -webkit-gradient(linear, + 0 0, 100% 0, + from(#E5E5E5), + to(#D1D1D1)); + border-left: 1px solid white; + border-right: 1px solid #8e8e8e; + cursor: ew-resize; + position: relative; + width: 7px; + z-index: 10; +} + +</style> + + + + + + + +<polymer-element name="tracing-analysis-tab-view" constructor="TracingAnalysisTabView"> +<template> +<style> + :host { + display: flex; + flex-flow: column nowrap; + overflow: hidden; + box-sizing: border-box; + } + + tab-strip[tabs-hidden] { + display: none; + } + + tab-strip { + background-color: rgb(236, 236, 236); + border-bottom: 1px solid #8e8e8e; + display: flex; + flex: 0 0 auto; + flex-flow: row; + overflow-x: auto; + padding: 0 10px 0 10px; + font-size: 12px; + } + + tab-button { + display: block; + flex: 0 0 auto; + padding: 4px 15px 1px 15px; + margin-top: 2px; + } + + tab-button[selected=true] { + background-color: white; + border: 1px solid rgb(163, 163, 163); + border-bottom: none; + padding: 3px 14px 1px 14px; + } + + tabs-content-container { + display: flex; + flex: 1 1 auto; + overflow: auto; + width: 100%; + } + + ::content > * { + flex: 1 1 auto; + } + + ::content > *:not([selected]) { + display: none; + } + + button-label { + display: inline; + } + </style> +<tab-strip> +<template repeat="{{tab in tabs_}}"> +<tab-button button-id="{{ tab.id }}" on-click="{{ tabButtonSelectHandler_ }}" selected="{{ selectedTab_.id === tab.id }}"> +<button-label>{{ tab.label ? tab.label : 'No Label'}}</button-label> +</tab-button> +</template> +</tab-strip> +<tabs-content-container id="content-container"> +<content></content> +</tabs-content-container> +</template> + +</polymer-element> + + + +<polymer-element name="tracing-analysis-sub-view" constructor="TracingAnalysisSubView"> + +</polymer-element> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.analysis-link { + color: -webkit-link; + cursor: pointer; + text-decoration: underline; +} + +.analysis-link:hover { + cursor: pointer; +} + +</style> + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +x-generic-object-view { + display: block; + font-family: monospace; +} + +x-generic-object-view-with-label { + display: block; +} + +</style> + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.analysis-header { + font-weight: bold; +} + +.analysis-results { + font-family: monospace; + white-space: pre; +} + +.analysis-results * { + -webkit-user-select: text !important; + cursor: text; +} + +.analysis-table { + border-collapse: collapse; + border-width: 0; + margin-bottom: 25px; + width: 100%; +} + +.analysis-table tr > td:first-child { + padding-left: 2px; +} + +.analysis-table tr > td { + padding: 2px 4px 2px 4px; + vertical-align: text-top; + width: 150px; +} + +/* Shrink back nested cells (used to display Args) */ +.analysis-table td td { + padding: 0 0 0 0; + width: auto; +} + +.analysis-table-header { + text-align: left; +} + +.analysis-table-row { + vertical-align: top; +} + +.analysis-table-row:nth-child(2n+0) { + background-color: #e2e2e2; +} + +.analysis-table-row-inverted:nth-child(2n+1) { + background-color: #e2e2e2; +} + +.selection-changing-link { + color: -webkit-link; + cursor: pointer; + text-decoration: underline; +} + +.analysis-table thead { + background-color: #e2e2e2; + font-weight: bold; +} + +.analysis-table tfoot { + font-weight: bold; +} + +</style> + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.sortable-table > thead > tr > td { + cursor: pointer !important; +} + +</style> + + + + + + + + + +<polymer-element name="tv-c-single-slice-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + + + + + +<polymer-element name="tv-c-multi-slice-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + + + + + + + +<polymer-element name="tv-c-single-thread-time-slice-sub-view" extends="tracing-analysis-sub-view"> +<template> +<style> + table { + border-collapse: collapse; + border-width: 0; + margin-bottom: 25px; + width: 100%; + } + + table tr > td:first-child { + padding-left: 2px; + } + + table tr > td { + padding: 2px 4px 2px 4px; + vertical-align: text-top; + width: 150px; + } + + table td td { + padding: 0 0 0 0; + width: auto; + } + tr { + vertical-align: top; + } + + tr:nth-child(2n+0) { + background-color: #e2e2e2; + } + </style> +<table> +<tr> +<td>Running process:</td><td id="process-name"></td> +</tr> +<tr> +<td>Running thread:</td><td id="thread-name"></td> +</tr> +<tr> +<td>State:</td> +<td><b><span id="state"></span></b></td> +</tr> +<tr> +<td>Start:</td><td id="start"></td> +</tr> +<tr> +<td>Duration:</td><td id="duration"></td> +</tr> +<tr> +<td>On CPU:</td><td id="on-cpu"></td> +</tr> +<tr> +<td>Running instead:</td><td id="running-instead"></td> +</tr> +<tr> +<td>Args:</td><td id="args"></td> +</tr> +</table> +</template> + +</polymer-element> + + + + + +<polymer-element name="tv-c-single-cpu-slice-sub-view" extends="tracing-analysis-sub-view"> +<template> +<style> + table { + border-collapse: collapse; + border-width: 0; + margin-bottom: 25px; + width: 100%; + } + + table tr > td:first-child { + padding-left: 2px; + } + + table tr > td { + padding: 2px 4px 2px 4px; + vertical-align: text-top; + width: 150px; + } + + table td td { + padding: 0 0 0 0; + width: auto; + } + tr { + vertical-align: top; + } + + tr:nth-child(2n+0) { + background-color: #e2e2e2; + } + </style> +<table> +<tr> +<td>Running process:</td><td id="process-name"></td> +</tr> +<tr> +<td>Running thread:</td><td id="thread-name"></td> +</tr> +<tr> +<td>Start:</td><td id="start"></td> +</tr> +<tr> +<td>Duration:</td><td id="duration"></td> +</tr> +<tr> +<td>Active slices:</td><td id="running-thread"></td> +</tr> +</table> +</template> + +</polymer-element> + + + +<polymer-element name="tv-c-single-instant-event-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + +<polymer-element name="tv-c-multi-instant-event-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + + + +<polymer-element name="tv-c-counter-sample-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + +<polymer-element name="tv-c-single-flow-event-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + +<polymer-element name="tv-c-multi-flow-event-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + + + + + + + + + + + +<polymer-element name="tv-c-single-object-instance-sub-view" extends="tracing-analysis-sub-view"> +<template> +<style> + #snapshots > * { + display: block; + } + + :host { + overflow: auto; + display: block; + } + + * { + -webkit-user-select: text; + } + + .title { + border-bottom: 1px solid rgb(128, 128, 128); + font-size: 110%; + font-weight: bold; + } + + td, th { + font-family: monospace; + vertical-align: top; + } + </style> +</template> + +</polymer-element> + + + + + + + + +<polymer-element name="tv-c-single-object-snapshot-sub-view" extends="tracing-analysis-sub-view"> +<template> +<style> + #args { + white-space: pre; + } + + :host { + overflow: auto; + display: flex; + } + + * { + -webkit-user-select: text; + } + + .title { + border-bottom: 1px solid rgb(128, 128, 128); + font-size: 110%; + font-weight: bold; + } + + td, th { + font-family: monospace; + vertical-align: top; + } + </style> +<content></content> +</template> + +</polymer-element> + + + + +<polymer-element name="tv-c-multi-object-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + +<polymer-element name="tv-c-single-sample-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + +<polymer-element name="tv-c-multi-sample-sub-view" extends="tracing-analysis-sub-view"> + +</polymer-element> + + + + + + + + + + + + + + + + + + + + + +<polymer-element name="tracing-analysis-view" constructor="TracingAnalysisView"> +<template> +<style> + :host { + background-color: white; + display: flex; + flex-direction: column; + height: 275px; + overflow: auto; + } + + :host(.tall-mode) { + height: 525px; + } + + ::content > * { + flex: 1 0 auto; + } + </style> +<content></content> +</template> + +</polymer-element> + + + + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.mouse-mode-selector { + + -webkit-user-drag: element; + -webkit-user-select: none; + + background: #DDD; + border: 1px solid #BBB; + border-radius: 4px; + box-shadow: 0 1px 2px rgba(0,0,0,0.2); + left: calc(100% - 120px); + position: absolute; + top: 100px; + user-select: none; + width: 29px; + z-index: 20; +} + +.mouse-mode-icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAChCAYAAACbBNzvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE2LzEzRNEKUwAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAA9aSURBVHic7V1rTFvl//+UrgUmZWMpbLa6cLErwpYxkqLGkjAG88WSbmumGUllvlmAJctMRtybvlHrLXiJUekMIZuYSCL5gS+EuLIXGEGjqCsllCEW6xQECgzWG7S05/+C/zkp9LTn0gsL6ych9JzznOdzPj19Luf5PN/nCN59913ixRdfRFdXFxLx/2GDgCAIYmpqCoWFhUjE/4cNae+99x4AIFH/Hzak7nDqDu+wOyyw2WzEdl9EMpG23ReQbKQE73Q8coJ3bfcFWK1W/Pbbb/D7/UhLi/37DwaDEIvFKC8vR0lJSdjxbRVstVoxPDyMxx9/HAUFBcjMzIRAIOCdXzAYhNvtht1ux/DwMACEid5WwSMjI3jyySdRXFwMsVgMoVAYk2CCIJCZmYns7GyMjo5iZGQkPoKXl5exd+9e3hdGIhgMIj8/H5mZmRCJRIyCyQ5NJBAEgUAgAKFQiIKCAiwsLISl4VxoHA4H+vv74Xa7uZ4aBqFQiOzsbIhEIojFYojFYohEItq/8fFxXLlyBUtLSxHThOaxZ88eCIXC2AWPj48DAH799deYBaelpUEoFLL6++qrrwAAH3zwAav0YrGYthLkJHh6ehpzc3MAgPn5eUxPT8csWiAQMJbboaEhmM1mAIDFYsHQ0BDvPDkJtlgsYdt+v59LFrxw/fr1sG2Xy8UrL06C6+vrw7bFYjEvYi747rvvwrYlEgmvvDjV0g6HI+p2ohBP3qh32OFwoLe3l1VGvb29sNvtvC8kFCMjI9DpdKzS6nQ6mEwm1nnTPg/7/X6MjY1hcnKS/VX+P/bu3YuysjLk5uYypv36669x8uRJZGRkQCQSwev1oqOjAz09PZx5CwsLcenSJRw+fBh+vx+rq6swmUx46aWXNqWjvcMDAwO8xAIbnZKBgQFeNXhzczMvscBGp6S5uRk//vhj1HS0grVaLYqLi3kRy+Vy1NXVRe0RRcKNGzeg0Wh48apUKnR1daG6ujpqOtpKy+VyQa1Wo6SkBLdv38aFCxeoY5988gn1+fLly9TnL774ApWVlXjiiSfgdDqxtrbG+aJ9Ph/0ej3OnDkDvV6PW7duUceOHDlCfR4dHaU+v/DCC7h27RrUajWcTidWV1ejctAKJggCKysryMzMhE6nw+zsLO3Joft1Oh0ePHiApaUlduqi8BYVFaGvr48Vb19fHyfeqM2Sz+dj3QTEs4lKJC+njsfWJoptkxUrtjZRbJssOnASXFtbG3U7UXjrrbeibnMBJ8FZWVkoKysDABQUFCArK4s3MRcoFArqrlZXV0OhUPDOi5Ngn8+Hw4cPQyqV4tlnn4XP5+NNTIIgmH0An8+HV155BUqlEq+++ior3kAgQLuf84jH2toajh8/jvX1da6n0sLj8SAjI4MxHUEQ+PTTT1nlSRAEHjx4QHtsW8e0RCIR7HY79uzZE/GOcEUgEEAgEMDff/8NkUgUdnxbBR85cgRmsxkCgQD5+fkRh2XYIhAI4P79+5iamoLD4cCxY8fC0myr4KeeegoCgQBWqxVzc3NIS0uLedQyGAxi165dKC8vR1FRUVialHu405ESvNPxyAlOuYfJRMo9fFjdw3iBq3vIBDbu4bYK3uoextKtJEH2yWNyD8nyEG8wuYcffvgha3cxru6h3W5Hf39/QoyzaE6fyWRCQ0MDZ+MsLu7h8vIyent7sby8zIk8VkxNTUGn08Fms8UlP04Nn9/vR39/f9w8JLZwu91obGzk5CFFAq+Wfnh4mDKok4mWlha0trbGlAfvrs3k5CQGBgaSYoiHoqenB1evXk2OIb4VDocDJpMp6eXaYrGgsbGRV7mOufPq8XgwMDCQ9HI9NzeHq1evci7XvDseUqkUWq0W6enpCAaDcDqd8Hq9fLNjDaVSiRs3bkAikfDi5XSHxWIxampqAAALCwsYGhrC7Ows5ufnEypWIpHAYDAAACYmJnD9+nXevJwEnzp1CjKZDBUVFQCAsbGxpJTfjz76CFVVVWhqagIAdHR08G6XWQuuqanB7t274fV6UVpaiuzsbAAbTzyJhMFggEKhgNfrRX19PWQyGQDAaDTyyo+V4JqaGshkMsricLlcOH78OICNCWp8p0cwwWAwoKqqahPvG2+8AWDji+7u7uacJyvBMpksrKxkZWVR0yLGxsY4E7NBVVVVGK9CoaCmRXR0dHDOk5VguorB5/OhoqICYrE4YZ2PSLxXrlyBRCLhNcE1pufh1dVVXLx4EWlpaRGnJzCBjXtId87g4GBU3ri5h1uJ5+fnY8mCtXvIhTflHoYg5R4mEyn3MAl45KyWlOCdjkdOcMo9TCZS7mHKPeSGhLmH5LBOrAGXXN1DcliHrgdFgsk95CzYbrfDbDbD7/ejrKwstpmtNO5hJJhMJrS2tsLtdqOpqQlarTZi2mjuIWvBfr8fZrN50/iz2WzG9PQ0nn/+edonEzZgij10uVwwGo2bxp+NRiOGhobw+uuv005hjtk9JENz6AbbyWCuRESp2Ww2NDc30w62WywW6HQ6zoOIrO5wbm4uzp8/j5WVFXR2dm46VldXh3379mF5eTku86dDUVxcjK6uLthstrClqrq6unDo0CHOvKwE+/1+LC4uUqG0oZiYmIhaicQCkvfu3bthxwYGBnhVmpy6NnSD7kxxQvEA3Zo+fIsQJ8F040j379/nRcwFdF4037FwToLphkUXFxd5EXMB3chkUgQ7nc6wfT6fL+Gm+H///Re2z+Vy8TLFGSut/v5+RsPsm2++AbDR84pXLFNDQwPjelxnz54FsBFK+/nnn7PKl/EOa7VaVmHvYrE4au+HK27evMkq7F0ikeDmzZus82UU7HK5qG8yGs6ePct73gUdfD4f2tvbGdO1t7dzaocZBRMEAaFQSBnhdKipqYFQKORlm0TjzcvLo4xwOhgMBuTl5XHiZVVp+f1+yGQy2iDq4uJiyGSyhFRcfr8fVVVVtEHUGo0GVVVVnHlZ19JerxdqtRpSqZTaJ5VKoVarEzrdwev1Qq/XQ6lUUvuUSiX0ej0vXk7N0srKCjQaDbXmjUajwcrKCmfSULD5Oa6srKCtrQ0SiQQSiQRtbW2MvHFzD0MrsXhUUmzdw9BKjKmSiqt7SBBE3Conru4hOa8kWqBnyj3cgl0EQcQ0cMYWW3kIgkiKe7iVV2C1Won09PSYxLCB1+tFZmYmtb22tobt4E1LBimATaQAkiKWjveR85ZSgnc6Uu5hMpFyD1PuITekYg/ZxB52dXXFTMo2n1D38NSpU7zjDEP/yHzisnJpIsBm5dJ45rntgpONuITTJirctqWlJabjdGAUvNUEp0NouxcvtLa2MgZhmUwmzqKjCrbb7aw9HC5pmWAymVivb2kymTgFe0RslrbeNTa1rtlshkgkQn5+PusL2Iqtd42NdWM0GpGVlYWTJ08ypo14h/nGI8Uax8Q3XJbteREFV1ZW8iLmex6Ja9euJfS8iD9puVyOmpoa3L59G8DmVUq3glzNlAzoimVgvrq6GmlpadDr9QA2r1K6FeRqpmRAFxveiIK9Xi8VZ/jLL78whulUVFTELJbkJeMMjUYjI29TUxNrsQBDX5qMM4w0qE2iuLgYpaWlcXMPyThDphWMNRoN6uvrOfGyskvVanXUNGq1Oq5WKclL/qwjQa/Xc+Zl1dNi8nFi9ZeSyZvqS0erjbmAbT6kT7X1lQp8QeYTyasKE8w3aJJvPh6PBwRBYGZmJi68MzMzqdjDUDx67mEsFxwrUrGHSUCqWdrpSAne6dix7uFzzz1HW0s/FO7h/v37UVBQgMceeyxm99DlcsFut2NwcBACgSDsnTHb7h4ePHgQxcXFcTPTMjIyIJFIcOfOHfz+++8Pl2DSPSTftxQv93DXrl0oKirCnTt3wtIwFhq62aputxtms5maCR8pHROEQiEkEgntew/X1tbC3mu4tLSE9vZ2nD9/njZd6Pn79u3jHoo3OTmJsbExnDlzBsDGWLXdbqcNoent7YVCocChQ4dYh+VFij3s7u5GR0cH9YWaTCbcunVr0yMkmfbChQvQarXQarVUWF4wGER6ejp7wdPT0zCbzfB4PJv2R7NT/H4/rFYrJicnUVZWxnowPtTpGxoagtFoDAsIi2anuN1ufPnll+ju7salS5dw4sQJKk+64hH2FTgcDgwPD4eJZQu/3w+bzcZ5JSSLxYL333+fNvqNDdxuN3p6ehjPDxMsl8tjjkw5ceIENfOVLVQqFd58882YeA0GA7WiWiSECfb5fPjpp58AbKyBx/bCpVIp6urqAADff/895wf6tbU1fPbZZwCAjz/+mPHCSSiVSsr3eueddxh5aWtpMrwuJyeH9cuczp07R5UZvktO/fnnnwCAY8eOoa+vj9U5nZ2d1CsH2fhaUZulwcFB1kGNi4uLjK/gYwuDwcCJ9+2332add9RmyW63w+12Q6FQIC8vD5cvX8bCwgI19VcqlcJms8HhcGBycjJuSz6aTCbMzs5Cq9Xi6NGjGB0dxcTEBJxOJyQSCZRKJUZGRjAyMoL//e9/jBFsoaAVLJfLKZvD4XBQ37ZEItlUph0OB238gVwu5ySQhEqlopo+i8VCtbsymWxTmb579y6t46BSqRg5aAXX1tbi22+/DZvY5XQ6aQMuQyGVSlFbW8trgb6WlhY0NDRgYmJi0/6ZmRnGYVylUomWlhbGeGbaMuzxeKDRaKhVDdkgOzsblZWVOHfuHO82fH19HW1tbWhqamL9ul2ZTIbXXnsNnZ2drN7yFfFFjy6XC6WlpVCpVFhaWsK///5LVfnz8/PIy8sDAOzevRu5ubnIycmBx+OJKZ6YIAj4fD7U19ejsbERf/zxB4aHhykrdHx8HE8//TQAYP/+/VAqlVAoFJx4I1ZapGiyrBw4cAD37t2DXC7HgQMHAGx0QXNycrC+vh63VR5Cecnw3J6eHqhUKpSXlwPY6OI+88wzALiHxnN6PPz555/D9h08eJATIR/Qzd9gE/FKh9SYFlvI5XKqPMUCrlFuKpUKp0+fZkwXDAZp93MSLBaLUVJSgqNHjyIjIwNerzfmOR0ul4sx9lAikeD06dN4+eWXIZVKGXnj5h5evHgRXq8XHo+Hd9MTCpFIhHv37iEnJydqp/+HH36A1+uFy+VirKTi6h7Gug7tVpDuIUEQKCwsjOge/vPPP6zyCwQCWF5exl9//YX5+Xla93DbzTSbzQar1Yr19fW4uoclJSUp9xB4BJullOCdjkdO8P8BGCQ0hnF1DxUAAAAASUVORK5CYII=); +} + +.mouse-mode-selector .drag-handle { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAChCAYAAACbBNzvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE2LzEzRNEKUwAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAA9aSURBVHic7V1rTFvl//+UrgUmZWMpbLa6cLErwpYxkqLGkjAG88WSbmumGUllvlmAJctMRtybvlHrLXiJUekMIZuYSCL5gS+EuLIXGEGjqCsllCEW6xQECgzWG7S05/+C/zkp9LTn0gsL6ych9JzznOdzPj19Luf5PN/nCN59913ixRdfRFdXFxLx/2GDgCAIYmpqCoWFhUjE/4cNae+99x4AIFH/Hzak7nDqDu+wOyyw2WzEdl9EMpG23ReQbKQE73Q8coJ3bfcFWK1W/Pbbb/D7/UhLi/37DwaDEIvFKC8vR0lJSdjxbRVstVoxPDyMxx9/HAUFBcjMzIRAIOCdXzAYhNvtht1ux/DwMACEid5WwSMjI3jyySdRXFwMsVgMoVAYk2CCIJCZmYns7GyMjo5iZGQkPoKXl5exd+9e3hdGIhgMIj8/H5mZmRCJRIyCyQ5NJBAEgUAgAKFQiIKCAiwsLISl4VxoHA4H+vv74Xa7uZ4aBqFQiOzsbIhEIojFYojFYohEItq/8fFxXLlyBUtLSxHThOaxZ88eCIXC2AWPj48DAH799deYBaelpUEoFLL6++qrrwAAH3zwAav0YrGYthLkJHh6ehpzc3MAgPn5eUxPT8csWiAQMJbboaEhmM1mAIDFYsHQ0BDvPDkJtlgsYdt+v59LFrxw/fr1sG2Xy8UrL06C6+vrw7bFYjEvYi747rvvwrYlEgmvvDjV0g6HI+p2ohBP3qh32OFwoLe3l1VGvb29sNvtvC8kFCMjI9DpdKzS6nQ6mEwm1nnTPg/7/X6MjY1hcnKS/VX+P/bu3YuysjLk5uYypv36669x8uRJZGRkQCQSwev1oqOjAz09PZx5CwsLcenSJRw+fBh+vx+rq6swmUx46aWXNqWjvcMDAwO8xAIbnZKBgQFeNXhzczMvscBGp6S5uRk//vhj1HS0grVaLYqLi3kRy+Vy1NXVRe0RRcKNGzeg0Wh48apUKnR1daG6ujpqOtpKy+VyQa1Wo6SkBLdv38aFCxeoY5988gn1+fLly9TnL774ApWVlXjiiSfgdDqxtrbG+aJ9Ph/0ej3OnDkDvV6PW7duUceOHDlCfR4dHaU+v/DCC7h27RrUajWcTidWV1ejctAKJggCKysryMzMhE6nw+zsLO3Joft1Oh0ePHiApaUlduqi8BYVFaGvr48Vb19fHyfeqM2Sz+dj3QTEs4lKJC+njsfWJoptkxUrtjZRbJssOnASXFtbG3U7UXjrrbeibnMBJ8FZWVkoKysDABQUFCArK4s3MRcoFArqrlZXV0OhUPDOi5Ngn8+Hw4cPQyqV4tlnn4XP5+NNTIIgmH0An8+HV155BUqlEq+++ior3kAgQLuf84jH2toajh8/jvX1da6n0sLj8SAjI4MxHUEQ+PTTT1nlSRAEHjx4QHtsW8e0RCIR7HY79uzZE/GOcEUgEEAgEMDff/8NkUgUdnxbBR85cgRmsxkCgQD5+fkRh2XYIhAI4P79+5iamoLD4cCxY8fC0myr4KeeegoCgQBWqxVzc3NIS0uLedQyGAxi165dKC8vR1FRUVialHu405ESvNPxyAlOuYfJRMo9fFjdw3iBq3vIBDbu4bYK3uoextKtJEH2yWNyD8nyEG8wuYcffvgha3cxru6h3W5Hf39/QoyzaE6fyWRCQ0MDZ+MsLu7h8vIyent7sby8zIk8VkxNTUGn08Fms8UlP04Nn9/vR39/f9w8JLZwu91obGzk5CFFAq+Wfnh4mDKok4mWlha0trbGlAfvrs3k5CQGBgaSYoiHoqenB1evXk2OIb4VDocDJpMp6eXaYrGgsbGRV7mOufPq8XgwMDCQ9HI9NzeHq1evci7XvDseUqkUWq0W6enpCAaDcDqd8Hq9fLNjDaVSiRs3bkAikfDi5XSHxWIxampqAAALCwsYGhrC7Ows5ufnEypWIpHAYDAAACYmJnD9+nXevJwEnzp1CjKZDBUVFQCAsbGxpJTfjz76CFVVVWhqagIAdHR08G6XWQuuqanB7t274fV6UVpaiuzsbAAbTzyJhMFggEKhgNfrRX19PWQyGQDAaDTyyo+V4JqaGshkMsricLlcOH78OICNCWp8p0cwwWAwoKqqahPvG2+8AWDji+7u7uacJyvBMpksrKxkZWVR0yLGxsY4E7NBVVVVGK9CoaCmRXR0dHDOk5VguorB5/OhoqICYrE4YZ2PSLxXrlyBRCLhNcE1pufh1dVVXLx4EWlpaRGnJzCBjXtId87g4GBU3ri5h1uJ5+fnY8mCtXvIhTflHoYg5R4mEyn3MAl45KyWlOCdjkdOcMo9TCZS7mHKPeSGhLmH5LBOrAGXXN1DcliHrgdFgsk95CzYbrfDbDbD7/ejrKwstpmtNO5hJJhMJrS2tsLtdqOpqQlarTZi2mjuIWvBfr8fZrN50/iz2WzG9PQ0nn/+edonEzZgij10uVwwGo2bxp+NRiOGhobw+uuv005hjtk9JENz6AbbyWCuRESp2Ww2NDc30w62WywW6HQ6zoOIrO5wbm4uzp8/j5WVFXR2dm46VldXh3379mF5eTku86dDUVxcjK6uLthstrClqrq6unDo0CHOvKwE+/1+LC4uUqG0oZiYmIhaicQCkvfu3bthxwYGBnhVmpy6NnSD7kxxQvEA3Zo+fIsQJ8F040j379/nRcwFdF4037FwToLphkUXFxd5EXMB3chkUgQ7nc6wfT6fL+Gm+H///Re2z+Vy8TLFGSut/v5+RsPsm2++AbDR84pXLFNDQwPjelxnz54FsBFK+/nnn7PKl/EOa7VaVmHvYrE4au+HK27evMkq7F0ikeDmzZus82UU7HK5qG8yGs6ePct73gUdfD4f2tvbGdO1t7dzaocZBRMEAaFQSBnhdKipqYFQKORlm0TjzcvLo4xwOhgMBuTl5XHiZVVp+f1+yGQy2iDq4uJiyGSyhFRcfr8fVVVVtEHUGo0GVVVVnHlZ19JerxdqtRpSqZTaJ5VKoVarEzrdwev1Qq/XQ6lUUvuUSiX0ej0vXk7N0srKCjQaDbXmjUajwcrKCmfSULD5Oa6srKCtrQ0SiQQSiQRtbW2MvHFzD0MrsXhUUmzdw9BKjKmSiqt7SBBE3Conru4hOa8kWqBnyj3cgl0EQcQ0cMYWW3kIgkiKe7iVV2C1Won09PSYxLCB1+tFZmYmtb22tobt4E1LBimATaQAkiKWjveR85ZSgnc6Uu5hMpFyD1PuITekYg/ZxB52dXXFTMo2n1D38NSpU7zjDEP/yHzisnJpIsBm5dJ45rntgpONuITTJirctqWlJabjdGAUvNUEp0NouxcvtLa2MgZhmUwmzqKjCrbb7aw9HC5pmWAymVivb2kymTgFe0RslrbeNTa1rtlshkgkQn5+PusL2Iqtd42NdWM0GpGVlYWTJ08ypo14h/nGI8Uax8Q3XJbteREFV1ZW8iLmex6Ja9euJfS8iD9puVyOmpoa3L59G8DmVUq3glzNlAzoimVgvrq6GmlpadDr9QA2r1K6FeRqpmRAFxveiIK9Xi8VZ/jLL78whulUVFTELJbkJeMMjUYjI29TUxNrsQBDX5qMM4w0qE2iuLgYpaWlcXMPyThDphWMNRoN6uvrOfGyskvVanXUNGq1Oq5WKclL/qwjQa/Xc+Zl1dNi8nFi9ZeSyZvqS0erjbmAbT6kT7X1lQp8QeYTyasKE8w3aJJvPh6PBwRBYGZmJi68MzMzqdjDUDx67mEsFxwrUrGHSUCqWdrpSAne6dix7uFzzz1HW0s/FO7h/v37UVBQgMceeyxm99DlcsFut2NwcBACgSDsnTHb7h4ePHgQxcXFcTPTMjIyIJFIcOfOHfz+++8Pl2DSPSTftxQv93DXrl0oKirCnTt3wtIwFhq62aputxtms5maCR8pHROEQiEkEgntew/X1tbC3mu4tLSE9vZ2nD9/njZd6Pn79u3jHoo3OTmJsbExnDlzBsDGWLXdbqcNoent7YVCocChQ4dYh+VFij3s7u5GR0cH9YWaTCbcunVr0yMkmfbChQvQarXQarVUWF4wGER6ejp7wdPT0zCbzfB4PJv2R7NT/H4/rFYrJicnUVZWxnowPtTpGxoagtFoDAsIi2anuN1ufPnll+ju7salS5dw4sQJKk+64hH2FTgcDgwPD4eJZQu/3w+bzcZ5JSSLxYL333+fNvqNDdxuN3p6ehjPDxMsl8tjjkw5ceIENfOVLVQqFd58882YeA0GA7WiWiSECfb5fPjpp58AbKyBx/bCpVIp6urqAADff/895wf6tbU1fPbZZwCAjz/+mPHCSSiVSsr3eueddxh5aWtpMrwuJyeH9cuczp07R5UZvktO/fnnnwCAY8eOoa+vj9U5nZ2d1CsH2fhaUZulwcFB1kGNi4uLjK/gYwuDwcCJ9+2332add9RmyW63w+12Q6FQIC8vD5cvX8bCwgI19VcqlcJms8HhcGBycjJuSz6aTCbMzs5Cq9Xi6NGjGB0dxcTEBJxOJyQSCZRKJUZGRjAyMoL//e9/jBFsoaAVLJfLKZvD4XBQ37ZEItlUph0OB238gVwu5ySQhEqlopo+i8VCtbsymWxTmb579y6t46BSqRg5aAXX1tbi22+/DZvY5XQ6aQMuQyGVSlFbW8trgb6WlhY0NDRgYmJi0/6ZmRnGYVylUomWlhbGeGbaMuzxeKDRaKhVDdkgOzsblZWVOHfuHO82fH19HW1tbWhqamL9ul2ZTIbXXnsNnZ2drN7yFfFFjy6XC6WlpVCpVFhaWsK///5LVfnz8/PIy8sDAOzevRu5ubnIycmBx+OJKZ6YIAj4fD7U19ejsbERf/zxB4aHhykrdHx8HE8//TQAYP/+/VAqlVAoFJx4I1ZapGiyrBw4cAD37t2DXC7HgQMHAGx0QXNycrC+vh63VR5Cecnw3J6eHqhUKpSXlwPY6OI+88wzALiHxnN6PPz555/D9h08eJATIR/Qzd9gE/FKh9SYFlvI5XKqPMUCrlFuKpUKp0+fZkwXDAZp93MSLBaLUVJSgqNHjyIjIwNerzfmOR0ul4sx9lAikeD06dN4+eWXIZVKGXnj5h5evHgRXq8XHo+Hd9MTCpFIhHv37iEnJydqp/+HH36A1+uFy+VirKTi6h7Gug7tVpDuIUEQKCwsjOge/vPPP6zyCwQCWF5exl9//YX5+Xla93DbzTSbzQar1Yr19fW4uoclJSUp9xB4BJullOCdjkdO8P8BGCQ0hnF1DxUAAAAASUVORK5CYII=) 2px 3px no-repeat; + background-repeat: no-repeat; + border-bottom: 1px solid #BCBCBC; + cursor: move; + display: block; + height: 13px; + width: 27px; +} + +.mouse-mode-selector .pan-scan-mode-button { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAChCAYAAACbBNzvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE2LzEzRNEKUwAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAA9aSURBVHic7V1rTFvl//+UrgUmZWMpbLa6cLErwpYxkqLGkjAG88WSbmumGUllvlmAJctMRtybvlHrLXiJUekMIZuYSCL5gS+EuLIXGEGjqCsllCEW6xQECgzWG7S05/+C/zkp9LTn0gsL6ych9JzznOdzPj19Luf5PN/nCN59913ixRdfRFdXFxLx/2GDgCAIYmpqCoWFhUjE/4cNae+99x4AIFH/Hzak7nDqDu+wOyyw2WzEdl9EMpG23ReQbKQE73Q8coJ3bfcFWK1W/Pbbb/D7/UhLi/37DwaDEIvFKC8vR0lJSdjxbRVstVoxPDyMxx9/HAUFBcjMzIRAIOCdXzAYhNvtht1ux/DwMACEid5WwSMjI3jyySdRXFwMsVgMoVAYk2CCIJCZmYns7GyMjo5iZGQkPoKXl5exd+9e3hdGIhgMIj8/H5mZmRCJRIyCyQ5NJBAEgUAgAKFQiIKCAiwsLISl4VxoHA4H+vv74Xa7uZ4aBqFQiOzsbIhEIojFYojFYohEItq/8fFxXLlyBUtLSxHThOaxZ88eCIXC2AWPj48DAH799deYBaelpUEoFLL6++qrrwAAH3zwAav0YrGYthLkJHh6ehpzc3MAgPn5eUxPT8csWiAQMJbboaEhmM1mAIDFYsHQ0BDvPDkJtlgsYdt+v59LFrxw/fr1sG2Xy8UrL06C6+vrw7bFYjEvYi747rvvwrYlEgmvvDjV0g6HI+p2ohBP3qh32OFwoLe3l1VGvb29sNvtvC8kFCMjI9DpdKzS6nQ6mEwm1nnTPg/7/X6MjY1hcnKS/VX+P/bu3YuysjLk5uYypv36669x8uRJZGRkQCQSwev1oqOjAz09PZx5CwsLcenSJRw+fBh+vx+rq6swmUx46aWXNqWjvcMDAwO8xAIbnZKBgQFeNXhzczMvscBGp6S5uRk//vhj1HS0grVaLYqLi3kRy+Vy1NXVRe0RRcKNGzeg0Wh48apUKnR1daG6ujpqOtpKy+VyQa1Wo6SkBLdv38aFCxeoY5988gn1+fLly9TnL774ApWVlXjiiSfgdDqxtrbG+aJ9Ph/0ej3OnDkDvV6PW7duUceOHDlCfR4dHaU+v/DCC7h27RrUajWcTidWV1ejctAKJggCKysryMzMhE6nw+zsLO3Joft1Oh0ePHiApaUlduqi8BYVFaGvr48Vb19fHyfeqM2Sz+dj3QTEs4lKJC+njsfWJoptkxUrtjZRbJssOnASXFtbG3U7UXjrrbeibnMBJ8FZWVkoKysDABQUFCArK4s3MRcoFArqrlZXV0OhUPDOi5Ngn8+Hw4cPQyqV4tlnn4XP5+NNTIIgmH0An8+HV155BUqlEq+++ior3kAgQLuf84jH2toajh8/jvX1da6n0sLj8SAjI4MxHUEQ+PTTT1nlSRAEHjx4QHtsW8e0RCIR7HY79uzZE/GOcEUgEEAgEMDff/8NkUgUdnxbBR85cgRmsxkCgQD5+fkRh2XYIhAI4P79+5iamoLD4cCxY8fC0myr4KeeegoCgQBWqxVzc3NIS0uLedQyGAxi165dKC8vR1FRUVialHu405ESvNPxyAlOuYfJRMo9fFjdw3iBq3vIBDbu4bYK3uoextKtJEH2yWNyD8nyEG8wuYcffvgha3cxru6h3W5Hf39/QoyzaE6fyWRCQ0MDZ+MsLu7h8vIyent7sby8zIk8VkxNTUGn08Fms8UlP04Nn9/vR39/f9w8JLZwu91obGzk5CFFAq+Wfnh4mDKok4mWlha0trbGlAfvrs3k5CQGBgaSYoiHoqenB1evXk2OIb4VDocDJpMp6eXaYrGgsbGRV7mOufPq8XgwMDCQ9HI9NzeHq1evci7XvDseUqkUWq0W6enpCAaDcDqd8Hq9fLNjDaVSiRs3bkAikfDi5XSHxWIxampqAAALCwsYGhrC7Ows5ufnEypWIpHAYDAAACYmJnD9+nXevJwEnzp1CjKZDBUVFQCAsbGxpJTfjz76CFVVVWhqagIAdHR08G6XWQuuqanB7t274fV6UVpaiuzsbAAbTzyJhMFggEKhgNfrRX19PWQyGQDAaDTyyo+V4JqaGshkMsricLlcOH78OICNCWp8p0cwwWAwoKqqahPvG2+8AWDji+7u7uacJyvBMpksrKxkZWVR0yLGxsY4E7NBVVVVGK9CoaCmRXR0dHDOk5VguorB5/OhoqICYrE4YZ2PSLxXrlyBRCLhNcE1pufh1dVVXLx4EWlpaRGnJzCBjXtId87g4GBU3ri5h1uJ5+fnY8mCtXvIhTflHoYg5R4mEyn3MAl45KyWlOCdjkdOcMo9TCZS7mHKPeSGhLmH5LBOrAGXXN1DcliHrgdFgsk95CzYbrfDbDbD7/ejrKwstpmtNO5hJJhMJrS2tsLtdqOpqQlarTZi2mjuIWvBfr8fZrN50/iz2WzG9PQ0nn/+edonEzZgij10uVwwGo2bxp+NRiOGhobw+uuv005hjtk9JENz6AbbyWCuRESp2Ww2NDc30w62WywW6HQ6zoOIrO5wbm4uzp8/j5WVFXR2dm46VldXh3379mF5eTku86dDUVxcjK6uLthstrClqrq6unDo0CHOvKwE+/1+LC4uUqG0oZiYmIhaicQCkvfu3bthxwYGBnhVmpy6NnSD7kxxQvEA3Zo+fIsQJ8F040j379/nRcwFdF4037FwToLphkUXFxd5EXMB3chkUgQ7nc6wfT6fL+Gm+H///Re2z+Vy8TLFGSut/v5+RsPsm2++AbDR84pXLFNDQwPjelxnz54FsBFK+/nnn7PKl/EOa7VaVmHvYrE4au+HK27evMkq7F0ikeDmzZus82UU7HK5qG8yGs6ePct73gUdfD4f2tvbGdO1t7dzaocZBRMEAaFQSBnhdKipqYFQKORlm0TjzcvLo4xwOhgMBuTl5XHiZVVp+f1+yGQy2iDq4uJiyGSyhFRcfr8fVVVVtEHUGo0GVVVVnHlZ19JerxdqtRpSqZTaJ5VKoVarEzrdwev1Qq/XQ6lUUvuUSiX0ej0vXk7N0srKCjQaDbXmjUajwcrKCmfSULD5Oa6srKCtrQ0SiQQSiQRtbW2MvHFzD0MrsXhUUmzdw9BKjKmSiqt7SBBE3Conru4hOa8kWqBnyj3cgl0EQcQ0cMYWW3kIgkiKe7iVV2C1Won09PSYxLCB1+tFZmYmtb22tobt4E1LBimATaQAkiKWjveR85ZSgnc6Uu5hMpFyD1PuITekYg/ZxB52dXXFTMo2n1D38NSpU7zjDEP/yHzisnJpIsBm5dJ45rntgpONuITTJirctqWlJabjdGAUvNUEp0NouxcvtLa2MgZhmUwmzqKjCrbb7aw9HC5pmWAymVivb2kymTgFe0RslrbeNTa1rtlshkgkQn5+PusL2Iqtd42NdWM0GpGVlYWTJ08ypo14h/nGI8Uax8Q3XJbteREFV1ZW8iLmex6Ja9euJfS8iD9puVyOmpoa3L59G8DmVUq3glzNlAzoimVgvrq6GmlpadDr9QA2r1K6FeRqpmRAFxveiIK9Xi8VZ/jLL78whulUVFTELJbkJeMMjUYjI29TUxNrsQBDX5qMM4w0qE2iuLgYpaWlcXMPyThDphWMNRoN6uvrOfGyskvVanXUNGq1Oq5WKclL/qwjQa/Xc+Zl1dNi8nFi9ZeSyZvqS0erjbmAbT6kT7X1lQp8QeYTyasKE8w3aJJvPh6PBwRBYGZmJi68MzMzqdjDUDx67mEsFxwrUrGHSUCqWdrpSAne6dix7uFzzz1HW0s/FO7h/v37UVBQgMceeyxm99DlcsFut2NwcBACgSDsnTHb7h4ePHgQxcXFcTPTMjIyIJFIcOfOHfz+++8Pl2DSPSTftxQv93DXrl0oKirCnTt3wtIwFhq62aputxtms5maCR8pHROEQiEkEgntew/X1tbC3mu4tLSE9vZ2nD9/njZd6Pn79u3jHoo3OTmJsbExnDlzBsDGWLXdbqcNoent7YVCocChQ4dYh+VFij3s7u5GR0cH9YWaTCbcunVr0yMkmfbChQvQarXQarVUWF4wGER6ejp7wdPT0zCbzfB4PJv2R7NT/H4/rFYrJicnUVZWxnowPtTpGxoagtFoDAsIi2anuN1ufPnll+ju7salS5dw4sQJKk+64hH2FTgcDgwPD4eJZQu/3w+bzcZ5JSSLxYL333+fNvqNDdxuN3p6ehjPDxMsl8tjjkw5ceIENfOVLVQqFd58882YeA0GA7WiWiSECfb5fPjpp58AbKyBx/bCpVIp6urqAADff/895wf6tbU1fPbZZwCAjz/+mPHCSSiVSsr3eueddxh5aWtpMrwuJyeH9cuczp07R5UZvktO/fnnnwCAY8eOoa+vj9U5nZ2d1CsH2fhaUZulwcFB1kGNi4uLjK/gYwuDwcCJ9+2332add9RmyW63w+12Q6FQIC8vD5cvX8bCwgI19VcqlcJms8HhcGBycjJuSz6aTCbMzs5Cq9Xi6NGjGB0dxcTEBJxOJyQSCZRKJUZGRjAyMoL//e9/jBFsoaAVLJfLKZvD4XBQ37ZEItlUph0OB238gVwu5ySQhEqlopo+i8VCtbsymWxTmb579y6t46BSqRg5aAXX1tbi22+/DZvY5XQ6aQMuQyGVSlFbW8trgb6WlhY0NDRgYmJi0/6ZmRnGYVylUomWlhbGeGbaMuzxeKDRaKhVDdkgOzsblZWVOHfuHO82fH19HW1tbWhqamL9ul2ZTIbXXnsNnZ2drN7yFfFFjy6XC6WlpVCpVFhaWsK///5LVfnz8/PIy8sDAOzevRu5ubnIycmBx+OJKZ6YIAj4fD7U19ejsbERf/zxB4aHhykrdHx8HE8//TQAYP/+/VAqlVAoFJx4I1ZapGiyrBw4cAD37t2DXC7HgQMHAGx0QXNycrC+vh63VR5Cecnw3J6eHqhUKpSXlwPY6OI+88wzALiHxnN6PPz555/D9h08eJATIR/Qzd9gE/FKh9SYFlvI5XKqPMUCrlFuKpUKp0+fZkwXDAZp93MSLBaLUVJSgqNHjyIjIwNerzfmOR0ul4sx9lAikeD06dN4+eWXIZVKGXnj5h5evHgRXq8XHo+Hd9MTCpFIhHv37iEnJydqp/+HH36A1+uFy+VirKTi6h7Gug7tVpDuIUEQKCwsjOge/vPPP6zyCwQCWF5exl9//YX5+Xla93DbzTSbzQar1Yr19fW4uoclJSUp9xB4BJullOCdjkdO8P8BGCQ0hnF1DxUAAAAASUVORK5CYII=); + background-position: 0 -10px; +} + +.mouse-mode-selector .pan-scan-mode-button.active { + background-position: -30px -10px; +} + +.mouse-mode-selector .selection-mode-button { + background-image: url(data:image/png;base64,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); + background-position: 0 -40px; +} + +.mouse-mode-selector .selection-mode-button.active { + background-position: -30px -40px; +} + +.mouse-mode-selector .zoom-mode-button { + background-image: url(data:image/png;base64,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); + background-position: 0 -70px; +} + +.mouse-mode-selector .zoom-mode-button.active { + background-position: -30px -70px; +} + +.mouse-mode-selector .timing-mode-button { + background-image: url(data:image/png;base64,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); + background-position: 0 -100px; + border-bottom: none; +} + +.mouse-mode-selector .timing-mode-button.active { + background-position: -30px -100px; +} + +.mouse-mode-selector .rotate-mode-button { + background-image: url(data:image/png;base64,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); + background-position: 0 -130px; + border-bottom: none; +} + +.mouse-mode-selector .rotate-mode-button.active { + background-position: -30px -130px; +} + +</style> +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.tool-button { + background-position: center center; + background-repeat: no-repeat; + border-bottom: 1px solid #BCBCBC; + border-top: 1px solid #F1F1F1; + cursor: pointer; + height: 30px; +} + +.tool-button.active { + cursor: auto; +} + +</style> +<template id="mouse-mode-selector-template"> +<div class="drag-handle"></div> +<div class="buttons"> +</div> +</template> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.track-button { + background-color: rgba(255, 255, 255, 0.5); + border: 1px solid rgba(0, 0, 0, 0.1); + color: rgba(0,0,0,0.2); + font-size: 10px; + height: 12px; + text-align: center; + width: 12px; +} + +.track-button:hover { + background-color: rgba(255, 255, 255, 1.0); + border: 1px solid rgba(0, 0, 0, 0.5); + box-shadow: 0 0 .05em rgba(0, 0, 0, 0.4); + color: rgba(0, 0, 0, 1); +} + +.track-close-button { + left: 2px; + position: absolute; + top: 2px; +} + +.track-collapse-button { + left: 3px; + position: absolute; + top: 2px; +} + +</style> + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.drawing-container { + -webkit-box-flex: 1; + display: inline; + overflow: auto; + position: relative; +} + +.drawing-container-canvas { + -webkit-box-flex: 1; + display: block; + pointer-events: none; + position: absolute; + top: 0; +} + +</style> + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.heading-track { + -webkit-box-align: stretch; + -webkit-box-orient: horizontal; + display: -webkit-box; + margin: 0; + padding: 0 5px 0 0; +} + +.heading-track > heading { + -webkit-box-sizing: border-box; + background-color: rgb(243, 245, 247); + border-right: 1px solid #8e8e8e; + box-sizing: border-box; + display: -webkit-flex; + -webkit-flex-direction: row; + align-items: center; + overflow-x: hidden; + padding-right: 5px; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; +} + +.heading-track > heading > .heading-arrow { + -webkit-flex: 0 0 auto; + margin-left: 5px; + margin-right: 5px; + width: 8px; + font-family: sans-serif; +} + +</style> + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.counter-track { + height: 30px; + position: relative; +} + +</style> + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.object-instance-track { + height: 18px; +} + +</style> + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +.spacing-track { + height: 4px; +} + +</style> + + + + + + + + +<style> +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.rect-track { + height: 18px; +} + +</style> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.thread-track { + -webkit-box-orient: vertical; + display: -webkit-box; + position: relative; +} + +</style> + + + + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.process-track-header { + -webkit-flex: 0 0 auto; + background-image: -webkit-gradient(linear, + 0 0, 100% 0, + from(#E5E5E5), + to(#D1D1D1)); + border-bottom: 1px solid #8e8e8e; + border-top: 1px solid white; + font-size: 75%; +} + +.process-track-base:not(.expanded) > .track { + display: none; +} + +.process-track-name:before { + content: '\25B8'; /* Right triangle */ + padding: 0 5px; +} + +.process-track-base.expanded .process-track-name:before { + content: '\25BE'; /* Down triangle */ +} + +</style> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +.model-track { + -webkit-box-flex: 1; +} + +</style> + + + + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.ruler-track { + height: 12px; +} + +.ruler-track.tall-mode { + height: 30px; +} + +</style> + + + + + + + + +<style> +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Global TVCM CSS values, applied application-wide */ + +body * { + -webkit-user-select: none; + box-sizing: border-box; +} + +</style> +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +.timeline-track-view * { + -webkit-user-select: none; + cursor: default; +} + +.timeline-track-view .tool-button { + cursor: pointer; +} + +.timeline-track-view { + -webkit-box-orient: vertical; + display: -webkit-box; + position: relative; +} + +.model-track-container { + -webkit-box-flex: 1; + overflow: auto; +} + +.drag-box { + background-color: rgba(0, 0, 255, 0.25); + border: 1px solid rgb(0, 0, 96); + font-size: 75%; + position: fixed; +} + +.timeline-track-view > .hint-text { + position: absolute; + bottom: 6px; + right: 6px; + font-size: 8pt; +} +</style> + + + + + + + + + + + + + + + + + + + + +<polymer-element name="tracing-find-control" constructor="TracingFindControl"> +<template> +<style> + div.root { + -webkit-user-select: none; + display: -webkit-flex; + position: relative; + } + input { + -webkit-user-select: auto; + background-color: #f8f8f8; + border: 1px solid rgba(0, 0, 0, 0.5); + box-sizing: border-box; + height: 19px; + margin-bottom: 1px; + margin-left: 0; + margin-right: 0; + margin-top: 1px; + padding: 0; + width: 170px; + } + input:focus { + background-color: white; + } + .button { + background-color: #f8f8f8; + border: 1px solid rgba(0, 0, 0, 0.5); + border-left: none; + font-size: 14px; + height: 17px; + margin-left: 0; + margin-top: 1px; + } + .button :first-of-type { + margin-right: 0; + } + #hitCount { + height: 19px; + left: 0; + opacity: 0.25; + pointer-events: none; + position: absolute; + text-align: right; + top: 2px; + width: 170px; + z-index: 1; + } + #spinner { + visibility: hidden; + width: 8px; + height: 8px; + left: 154px; + pointer-events: none; + position: absolute; + top: 4px; + z-index: 1; + + border: 2px solid transparent; + border-bottom: 2px solid rgba(0, 0, 0, 0.5); + border-right: 2px solid rgba(0, 0, 0, 0.5); + border-radius: 50%; + + animation: spin 1s linear infinite; + } + @keyframes spin { 100% { transform: rotate(360deg); } } + </style> +<div class="root"> +<input type="text" id="filter" on-input="{{ filterTextChanged }}" on-keypress="{{ filterKeyPress }}" on-keydown="{{ filterKeyDown }}" on-blur="{{ filterBlur }}" on-focus="{{ filterFocus }}" on-mouseup="{{ filterMouseUp }}" /> +<div id="spinner"></div> +<div class="button" on-click="{{ findPrevious }}">←</div> +<div class="button" on-click="{{ findNext }}">→</div> +<div id="hitCount">0 of 0</div> +</div> +</template> + +</polymer-element> + + + + + + + +<style> +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +x-side-panel-container { + align-items: stretch; + display: -webkit-flex; +} + +x-side-panel-container[expanded] > active-panel-container { + -webkit-flex: 1 1 auto; + border-left: 1px solid black; + display: -webkit-flex; +} + +x-side-panel-container:not([expanded]) > active-panel-container { + display: none; +} + +x-side-panel-container > tab-strip { + -webkit-flex: 0 0 auto; + -webkit-flex-direction: column; + -webkit-user-select: none; + background-color: rgb(236, 236, 236); + border-left: 1px solid black; + cursor: default; + display: -webkit-flex; + min-width: 18px; /* workaround for flexbox and writing-mode mixing bug */ + padding: 10px 0 10px 0; + font-size: 12px; +} + +x-side-panel-container > tab-strip > tab-strip-label { + -webkit-writing-mode: vertical-rl; + display: inline; + margin-right: 1px; + min-height: 20px; + padding: 15px 3px 15px 1px; +} + +x-side-panel-container > tab-strip > + tab-strip-label:not([enabled]) { + color: rgb(128, 128, 128); +} + +x-side-panel-container > tab-strip > tab-strip-label[selected] { + background-color: white; + border: 1px solid rgb(163, 163, 163); + border-left: none; + padding: 14px 2px 14px 1px; +} + +</style> + + + + + + +<style> +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +x-timeline-view { + -webkit-flex-direction: column; + cursor: default; + display: -webkit-flex; + font-family: sans-serif; + padding: 0; +} + +x-timeline-view > .control > .title { + font-size: 14px; + height: 22px; + padding-left: 2px; + padding-right: 8px; + padding-top: 2px; + flex: 1 0 auto; +} + +x-timeline-view > .control { + flex: 0 0 auto; + background-color: #e6e6e6; + background-image: -webkit-gradient(linear, + 0 0, + 0 100%, + from(#E5E5E5), + to(#D1D1D1)); + border-bottom: 1px solid #8e8e8e; + display: flex; + padding-top: 1px; + overflow-x: auto; +} +x-timeline-view > .control::-webkit-scrollbar{ + height: 0px; +} + +x-timeline-view > .control > #right-controls { + margin-left: auto; +} + +x-timeline-view > .control > .controls { + display: -webkit-flex; + flex: 0 0 auto; +} + +x-timeline-view > .control > span { + padding-left: 5px; + padding-right: 10px; +} + +x-timeline-view > .control > .controls button, +x-timeline-view > .control > .controls label { + font-size: 14px; + height: 22px; + margin: 1px 2px 1px 2px; +} + +x-timeline-view > .control > .spacer { + -webkit-flex: 1 1 auto; +} + +x-timeline-view > middle-container { + -webkit-flex: 1 1 auto; + -webkit-flex-direction: row; + border-bottom: 1px solid #8e8e8e; + display: -webkit-flex; + min-height: 0; +} + +x-timeline-view > middle-container > track-view-container { + -webkit-flex: 1 1 auto; + display: -webkit-flex; + min-height: 0; + min-width: 0; +} + +x-timeline-view > middle-container > track-view-container > * { + -webkit-flex: 1 1 auto; +} + +x-timeline-view > middle-container > x-timeline-view-side-panel-container { + -webkit-flex: 0 0 auto; +} + +x-timeline-view > x-drag-handle { + -webkit-flex: 0 0 auto; +} + +x-timeline-view > tracing-analysis-view { + -webkit-flex: 0 0 auto; +} + +x-timeline-view .selection { + margin: 2px; +} + +x-timeline-view .selection ul { + margin: 0; +} + +.button { + background-color: #f8f8f8; + border: 1px solid rgba(0, 0, 0, 0.5); + color: rgba(0,0,0,0.8); + font-size: 14px; + height: 19px; + margin: 1px; + min-width: 23px; + text-align: center; +} + +.button:hover { + background-color: rgba(255, 255, 255, 1.0); + border: 1px solid rgba(0, 0, 0, 0.8); + box-shadow: 0 0 .05em rgba(0, 0, 0, 0.4); + color: rgba(0, 0, 0, 1); +} + +.view-info-button { + padding-left: 4px; + padding-right: 4px; + width: auto; +} + +.view-info-button:hover { + border: solid 1px; +} + +.metadata-dialog-text { + font-family: monospace; + overflow: auto; + white-space: pre; +} + +.view-help-text { + -webkit-flex: 1 1 auto; + -webkit-flex-direction: row; + display: -webkit-flex; + width: 700px; +} +.view-help-text .column { + width: 50%; +} +.view-help-text h2 { + font-size: 1.2em; + margin: 0; + margin-top: 5px; + text-align: center; +} +.view-help-text h3 { + margin: 0; + margin-left: 126px; + margin-top: 10px; +} +.view-help-text .pair { + -webkit-flex: 1 1 auto; + -webkit-flex-direction: row; + display: -webkit-flex; +} +.view-help-text .command { + font-family: monospace; + margin-right: 5px; + text-align: right; + width: 150px; +} +.view-help-text .action { + font-size: 0.9em; + text-align: left; + width: 200px; +} +.view-help-text .mouse-mode-icon { + border: 1px solid #888; + border-radius: 3px; + box-shadow: inset 0 0 2px rgba(0,0,0,0.3); + display: inline-block; + height: 26px; + margin-right: 1px; + position: relative; + top: 4px; + width: 27px; + zoom: 0.75; +} +.view-help-text .mouse-mode-icon.pan-mode { + background-position: -1px -11px; +} +.view-help-text .mouse-mode-icon.select-mode { + background-position: -1px -41px; +} +.view-help-text .mouse-mode-icon.zoom-mode { + background-position: -1px -71px; +} +.view-help-text .mouse-mode-icon.timing-mode { + background-position: -1px -101px; +} + + +</style> + + + + + + + + + + +<template id="timeline-view-template"> +<div class="control"> +<div id="left-controls" class="controls"></div> +<div class="title">^_^</div> +<div id="right-controls" class="controls"></div> +</div> +<middle-container> +<track-view-container></track-view-container> +<x-side-panel-container></x-side-panel-container> +</middle-container> +<x-drag-handle></x-drag-handle> +<tracing-analysis-view id="analysis"></tracing-analysis-view> +</template> +<template id="help-btn-template"> +<div class="button view-help-button">?</div> +<div class="view-help-text"> +<div class="column left"> +<h2>Navigation</h2> +<div class="pair"> +<div class="command">w/s</div> +<div class="action">Zoom in/out (+shift: faster)</div> +</div> +<div class="pair"> +<div class="command">a/d</div> +<div class="action">Pan left/right (+shift: faster)</div> +</div> +<div class="pair"> +<div class="command">→/shift-TAB</div> +<div class="action">Select previous event</div> +</div> +<div class="pair"> +<div class="command">←/TAB</div> +<div class="action">Select next event</div> +</div> +<h2>Mouse Controls</h2> +<div class="pair"> +<div class="command">click</div> +<div class="action">Select event</div> +</div> +<div class="pair"> +<div class="command">alt-mousewheel</div> +<div class="action">Zoom in/out</div> +</div> +<h3> +<span class="mouse-mode-icon select-mode"></span> + Select mode + </h3> +<div class="pair"> +<div class="command">drag</div> +<div class="action">Box select</div> +</div> +<div class="pair"> +<div class="command">double click</div> +<div class="action">Select all events with same title</div> +</div> +<h3> +<span class="mouse-mode-icon pan-mode"></span> + Pan mode + </h3> +<div class="pair"> +<div class="command">drag</div> +<div class="action">Pan the view</div> +</div> +<h3> +<span class="mouse-mode-icon zoom-mode"></span> + Zoom mode + </h3> +<div class="pair"> +<div class="command">drag</div> +<div class="action">Zoom in/out by dragging up/down</div> +</div> +<h3> +<span class="mouse-mode-icon timing-mode"></span> + Timing mode + </h3> +<div class="pair"> +<div class="command">drag</div> +<div class="action">Create or move markers</div> +</div> +<div class="pair"> +<div class="command">double click</div> +<div class="action">Set marker range to slice</div> +</div> +</div> +<div class="column right"> +<h2>General</h2> +<div class="pair"> +<div class="command">1-4</div> +<div class="action">Switch mouse mode</div> +</div> +<div class="pair"> +<div class="command">shift</div> +<div class="action">Hold for temporary select</div> +</div> +<div class="pair"> +<div class="command">space</div> +<div class="action">Hold for temporary pan</div> +</div> +<div class="pair"> +<div class="command"><span class="mod"></span></div> +<div class="action">Hold for temporary zoom</div> +</div> +<div class="pair"> +<div class="command">/</div> +<div class="action">Search</div> +</div> +<div class="pair"> +<div class="command">enter</div> +<div class="action">Step through search results</div> +</div> +<div class="pair"> +<div class="command">f</div> +<div class="action">Zoom into selection</div> +</div> +<div class="pair"> +<div class="command">z/0</div> +<div class="action">Reset zoom and pan</div> +</div> +<div class="pair"> +<div class="command">g/G</div> +<div class="action">Toggle 60hz grid</div> +</div> +<div class="pair"> +<div class="command">v</div> +<div class="action">Highlight VSync</div> +</div> +<div class="pair"> +<div class="command">h</div> +<div class="action">Toggle low/high details</div> +</div> +<div class="pair"> +<div class="command">m</div> +<div class="action">Mark current selection</div> +</div> +<div class="pair"> +<div class="command">?</div> +<div class="action">Show help</div> +</div> +</div> +</div> +</template> +<template id="metadata-btn-template"> +<div class="button view-metadata-button view-info-button">Metadata</div> +<div class="info-button-text metadata-dialog-text"></div> +</template> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<script> + +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/* WARNING: This file is auto generated. + * + * Do not edit directly. + */ + +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version: 0.4.1 +window.PolymerGestures={},function(a){var b=!1,c=document.createElement("meta");if(c.createShadowRoot){var d=c.createShadowRoot(),e=document.createElement("span");d.appendChild(e),c.addEventListener("testpath",function(a){a.path&&(b=a.path[0]===e),a.stopPropagation()});var f=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(c),e.dispatchEvent(f),c.parentNode.removeChild(c),d=e=null}c=null;var g={shadow:function(a){return a?a.shadowRoot||a.webkitShadowRoot:void 0},canTarget:function(a){return a&&Boolean(a.elementFromPoint)},targetingShadow:function(a){var b=this.shadow(a);return this.canTarget(b)?b:void 0},olderShadow:function(a){var b=a.olderShadowRoot;if(!b){var c=a.querySelector("shadow");c&&(b=c.olderShadowRoot)}return b},allShadows:function(a){for(var b=[],c=this.shadow(a);c;)b.push(c),c=this.olderShadow(c);return b},searchRoot:function(a,b,c){var d,e;return a?(d=a.elementFromPoint(b,c),d?e=this.targetingShadow(d):a!==document&&(e=this.olderShadow(a)),this.searchRoot(e,b,c)||d):void 0},owner:function(a){if(!a)return document;for(var b=a;b.parentNode;)b=b.parentNode;return b.nodeType!=Node.DOCUMENT_NODE&&b.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(b=document),b},findTarget:function(a){if(b&&a.path&&a.path.length)return a.path[0];var c=a.clientX,d=a.clientY,e=this.owner(a.target);return e.elementFromPoint(c,d)||(e=document),this.searchRoot(e,c,d)},findTouchAction:function(a){var c;if(b&&a.path&&a.path.length){for(var d=a.path,e=0;e<d.length;e++)if(c=d[e],c.nodeType===Node.ELEMENT_NODE&&c.hasAttribute("touch-action"))return c.getAttribute("touch-action")}else for(c=a.target;c;){if(c.nodeType===Node.ELEMENT_NODE&&c.hasAttribute("touch-action"))return c.getAttribute("touch-action");c=c.parentNode||c.host}return"auto"},LCA:function(a,b){if(a===b)return a;if(a&&!b)return a;if(b&&!a)return b;if(!b&&!a)return document;if(a.contains&&a.contains(b))return a;if(b.contains&&b.contains(a))return b;var c=this.depth(a),d=this.depth(b),e=c-d;for(e>=0?a=this.walk(a,e):b=this.walk(b,-e);a&&b&&a!==b;)a=a.parentNode||a.host,b=b.parentNode||b.host;return a},walk:function(a,b){for(var c=0;a&&b>c;c++)a=a.parentNode||a.host;return a},depth:function(a){for(var b=0;a;)b++,a=a.parentNode||a.host;return b},deepContains:function(a,b){var c=this.LCA(a,b);return c===a},insideNode:function(a,b,c){var d=a.getBoundingClientRect();return d.left<=b&&b<=d.right&&d.top<=c&&c<=d.bottom},path:function(a){var c;if(b&&a.path&&a.path.length)c=a.path;else{c=[];for(var d=this.findTarget(a);d;)c.push(d),d=d.parentNode||d.host}return c}};a.targetFinding=g,a.findTarget=g.findTarget.bind(g),a.deepContains=g.deepContains.bind(g),a.insideNode=g.insideNode}(window.PolymerGestures),function(){function a(a){return"html /deep/ "+b(a)}function b(a){return'[touch-action="'+a+'"]'}function c(a){return"{ -ms-touch-action: "+a+"; touch-action: "+a+";}"}var d=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],e="",f="string"==typeof document.head.style.touchAction,g=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(f){d.forEach(function(d){String(d)===d?(e+=b(d)+c(d)+"\n",g&&(e+=a(d)+c(d)+"\n")):(e+=d.selectors.map(b)+c(d.rule)+"\n",g&&(e+=d.selectors.map(a)+c(d.rule)+"\n"))});var h=document.createElement("style");h.textContent=e,document.head.appendChild(h)}}(),function(a){var b=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],c=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],d=function(){return function(){}},e={preventTap:d,makeBaseEvent:function(a,b){var c=document.createEvent("Event");return c.initEvent(a,b.bubbles||!1,b.cancelable||!1),c.preventTap=e.preventTap(c),c},makeGestureEvent:function(a,b){b=b||Object.create(null);for(var c,d=this.makeBaseEvent(a,b),e=0,f=Object.keys(b);e<f.length;e++)c=f[e],d[c]=b[c];return d},makePointerEvent:function(a,d){d=d||Object.create(null);for(var e,f=this.makeBaseEvent(a,d),g=0;g<b.length;g++)e=b[g],f[e]=d[e]||c[g];f.buttons=d.buttons||0;var h=0;return h=d.pressure?d.pressure:f.buttons?.5:0,f.x=f.clientX,f.y=f.clientY,f.pointerId=d.pointerId||0,f.width=d.width||0,f.height=d.height||0,f.pressure=h,f.tiltX=d.tiltX||0,f.tiltY=d.tiltY||0,f.pointerType=d.pointerType||"",f.hwTimestamp=d.hwTimestamp||0,f.isPrimary=d.isPrimary||!1,f._source=d._source||"",f}};a.eventFactory=e}(window.PolymerGestures),function(a){function b(){if(c){var a=new Map;return a.pointers=d,a}this.keys=[],this.values=[]}var c=window.Map&&window.Map.prototype.forEach,d=function(){return this.size};b.prototype={set:function(a,b){var c=this.keys.indexOf(a);c>-1?this.values[c]=b:(this.keys.push(a),this.values.push(b))},has:function(a){return this.keys.indexOf(a)>-1},"delete":function(a){var b=this.keys.indexOf(a);b>-1&&(this.keys.splice(b,1),this.values.splice(b,1))},get:function(a){var b=this.keys.indexOf(a);return this.values[b]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(a,b){this.values.forEach(function(c,d){a.call(b,c,this.keys[d],this)},this)},pointers:function(){return this.keys.length}},a.PointerMap=b}(window.PolymerGestures),function(a){var b,c=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],d=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],e="undefined"!=typeof SVGElementInstance,f=a.eventFactory,g={IS_IOS:!1,pointermap:new a.PointerMap,requiredGestures:new a.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(a,b){var c=b,d=c.events;d&&(d.forEach(function(a){c[a]&&(this.eventMap[a]=c[a].bind(c))},this),this.eventSources[a]=c,this.eventSourceList.push(c))},registerGesture:function(a,b){var c=Object.create(null);c.listeners=0,c.index=this.gestures.length;for(var d,e=0;e<b.exposes.length;e++)d=b.exposes[e].toLowerCase(),this.dependencyMap[d]=c;this.gestures.push(b)},register:function(a,b){for(var c,d=this.eventSourceList.length,e=0;d>e&&(c=this.eventSourceList[e]);e++)c.register.call(c,a,b)},unregister:function(a){for(var b,c=this.eventSourceList.length,d=0;c>d&&(b=this.eventSourceList[d]);d++)b.unregister.call(b,a)},down:function(a){this.requiredGestures.set(a.pointerId,b),this.fireEvent("down",a)},move:function(a){a.type="move",this.fillGestureQueue(a)},up:function(a){this.fireEvent("up",a),this.requiredGestures.delete(a.pointerId)},cancel:function(a){a.tapPrevented=!0,this.fireEvent("up",a),this.requiredGestures.delete(a.pointerId)},addGestureDependency:function(a,b){var c=a._pgEvents;if(c)for(var d,e,f,g=Object.keys(c),h=0;h<g.length;h++)f=g[h],c[f]>0&&(d=this.dependencyMap[f],e=d?d.index:-1,b[e]=!0)},eventHandler:function(c){var d=c.type;if("touchstart"===d||"mousedown"===d||"pointerdown"===d||"MSPointerDown"===d)if(c._handledByPG||(b={}),this.IS_IOS)for(var e,f=a.targetFinding.path(c),g=0;g<f.length;g++)e=f[g],this.addGestureDependency(e,b);else this.addGestureDependency(c.currentTarget,b);if(!c._handledByPG){var h=this.eventMap&&this.eventMap[d];h&&h(c),c._handledByPG=!0}},listen:function(a,b){for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.addEvent(a,c)},unlisten:function(a,b){for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.removeEvent(a,c)},addEvent:function(a,b){a.addEventListener(b,this.boundHandler)},removeEvent:function(a,b){a.removeEventListener(b,this.boundHandler)},makeEvent:function(a,b){var c=f.makePointerEvent(a,b);return c.preventDefault=b.preventDefault,c.tapPrevented=b.tapPrevented,c._target=c._target||b.target,c},fireEvent:function(a,b){var c=this.makeEvent(a,b);return this.dispatchEvent(c)},cloneEvent:function(a){for(var b,f=Object.create(null),g=0;g<c.length;g++)b=c[g],f[b]=a[b]||d[g],("target"===b||"relatedTarget"===b)&&e&&f[b]instanceof SVGElementInstance&&(f[b]=f[b].correspondingUseElement);return f.preventDefault=function(){a.preventDefault()},f},dispatchEvent:function(a){var b=a._target;if(b){b.dispatchEvent(a);var c=this.cloneEvent(a);c.target=b,this.fillGestureQueue(c)}},gestureTrigger:function(){for(var a,b,c=0;c<this.gestureQueue.length;c++){a=this.gestureQueue[c],b=a._requiredGestures;for(var d,e,f=0;f<this.gestures.length;f++)b[f]&&(d=this.gestures[f],e=d[a.type],e&&e.call(d,a))}this.gestureQueue.length=0},fillGestureQueue:function(a){this.gestureQueue.length||requestAnimationFrame(this.boundGestureTrigger),a._requiredGestures=this.requiredGestures.get(a.pointerId),this.gestureQueue.push(a)}};g.boundHandler=g.eventHandler.bind(g),g.boundGestureTrigger=g.gestureTrigger.bind(g),a.dispatcher=g,a.activateGesture=function(a,b){var c=b.toLowerCase(),d=g.dependencyMap[c];if(d){var e=g.gestures[d.index];if(a._pgListeners||(g.register(a),a._pgListeners=0),e){var f,h=e.defaultActions&&e.defaultActions[c];switch(a.nodeType){case Node.ELEMENT_NODE:f=a;break;case Node.DOCUMENT_FRAGMENT_NODE:f=a.host;break;default:f=null}h&&f&&!f.hasAttribute("touch-action")&&f.setAttribute("touch-action",h)}a._pgEvents||(a._pgEvents={}),a._pgEvents[c]=(a._pgEvents[c]||0)+1,a._pgListeners++}return Boolean(d)},a.addEventListener=function(b,c,d,e){d&&(a.activateGesture(b,c),b.addEventListener(c,d,e))},a.deactivateGesture=function(a,b){var c=b.toLowerCase(),d=g.dependencyMap[c];return d&&(a._pgListeners>0&&a._pgListeners--,0===a._pgListeners&&g.unregister(a),a._pgEvents&&(a._pgEvents[c]>0?a._pgEvents[c]--:a._pgEvents[c]=0)),Boolean(d)},a.removeEventListener=function(b,c,d,e){d&&(a.deactivateGesture(b,c),b.removeEventListener(c,d,e))}}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d=25,e=[0,1,4,2],f=!1;try{f=1===new MouseEvent("test",{buttons:1}).buttons}catch(g){}var h={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(a){b.listen(a,this.events)},unregister:function(a){a!==document&&b.unlisten(a,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(a){for(var b,c=this.lastTouches,e=a.clientX,f=a.clientY,g=0,h=c.length;h>g&&(b=c[g]);g++){var i=Math.abs(e-b.x),j=Math.abs(f-b.y);if(d>=i&&d>=j)return!0}},prepareEvent:function(a){var c=b.cloneEvent(a);return c.pointerId=this.POINTER_ID,c.isPrimary=!0,c.pointerType=this.POINTER_TYPE,c._source="mouse",f||(c.buttons=e[c.which]||0),c},mousedown:function(d){if(!this.isEventSimulatedFromTouch(d)){var e=c.has(this.POINTER_ID);e&&this.mouseup(d);var f=this.prepareEvent(d);f.target=a.findTarget(d),c.set(this.POINTER_ID,f.target),b.down(f)}},mousemove:function(a){if(!this.isEventSimulatedFromTouch(a)){var d=c.get(this.POINTER_ID);if(d){var e=this.prepareEvent(a);e.target=d,0===e.buttons?(b.cancel(e),this.cleanupMouse()):b.move(e)}}},mouseup:function(d){if(!this.isEventSimulatedFromTouch(d)){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(this.POINTER_ID),b.up(e),this.cleanupMouse()}},cleanupMouse:function(){c["delete"](this.POINTER_ID)}};a.mouseEvents=h}(window.PolymerGestures),function(a){var b=a.dispatcher,c=(a.targetFinding.allShadows.bind(a.targetFinding),b.pointermap),d=(Array.prototype.map.call.bind(Array.prototype.map),2500),e=200,f=20,g=!1,h={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(a,c){(this.IS_IOS?c:!c)&&b.listen(a,this.events)},unregister:function(a){this.IS_IOS||b.unlisten(a,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(a){var b=a,c=this.scrollTypes;return b===c.EMITTER?"none":b===c.XSCROLLER?"X":b===c.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(a){return this.firstTouch===a.identifier},setPrimaryTouch:function(a){(0===c.pointers()||1===c.pointers()&&c.has(1))&&(this.firstTouch=a.identifier,this.firstXY={X:a.clientX,Y:a.clientY},this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(a){a.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var a=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(a,e)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(a){var b=0;return("touchstart"===a||"touchmove"===a)&&(b=1),b},findTarget:function(b,d){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(b)){var e={clientX:b.clientX,clientY:b.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return a.findTarget(e)}return a.findTarget(b)}return c.get(d)},touchToPointer:function(a){var c=this.currentTouchEvent,d=b.cloneEvent(a),e=d.pointerId=a.identifier+2;d.target=this.findTarget(a,e),d.bubbles=!0,d.cancelable=!0,d.detail=this.clickCount,d.buttons=this.typeToButtons(c.type),d.width=a.webkitRadiusX||a.radiusX||0,d.height=a.webkitRadiusY||a.radiusY||0,d.pressure=a.webkitForce||a.force||.5,d.isPrimary=this.isPrimaryTouch(a),d.pointerType=this.POINTER_TYPE,d._source="touch";var f=this;return d.preventDefault=function(){f.scrolling=!1,f.firstXY=null,c.preventDefault()},d},processTouches:function(a,b){var d=a.changedTouches;this.currentTouchEvent=a;for(var e,f,g=0;g<d.length;g++)e=d[g],f=this.touchToPointer(e),"touchstart"===a.type&&c.set(f.pointerId,f.target),c.has(f.pointerId)&&b.call(this,f),("touchend"===a.type||a._cancel)&&this.cleanUpPointer(f)},shouldScroll:function(b){if(this.firstXY){var c,d=a.targetFinding.findTouchAction(b),e=this.touchActionToScrollType(d);if("none"===e)c=!1;else if("XY"===e)c=!0;else{var f=b.changedTouches[0],g=e,h="Y"===e?"X":"Y",i=Math.abs(f["client"+g]-this.firstXY[g]),j=Math.abs(f["client"+h]-this.firstXY[h]);c=i>=j}return c}},findTouch:function(a,b){for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)if(c.identifier===b)return!0},vacuumTouches:function(a){var b=a.touches;if(c.pointers()>=b.length){var d=[];c.forEach(function(a,c){if(1!==c&&!this.findTouch(b,c-2)){var e=a;d.push(e)}},this),d.forEach(function(a){this.cancel(a),c.delete(a.pointerId)})}},touchstart:function(a){this.vacuumTouches(a),this.setPrimaryTouch(a.changedTouches[0]),this.dedupSynthMouse(a),this.scrolling||(this.clickCount++,this.processTouches(a,this.down))},down:function(a){b.down(a)},touchmove:function(a){if(g)a.cancelable&&this.processTouches(a,this.move);else if(this.scrolling){if(this.firstXY){var b=a.changedTouches[0],c=b.clientX-this.firstXY.X,d=b.clientY-this.firstXY.Y,e=Math.sqrt(c*c+d*d);e>=f&&(this.touchcancel(a),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(a)?this.scrolling=!0:(this.scrolling=!1,a.preventDefault(),this.processTouches(a,this.move))},move:function(a){b.move(a)},touchend:function(a){this.dedupSynthMouse(a),this.processTouches(a,this.up)},up:function(c){c.relatedTarget=a.findTarget(c),b.up(c)},cancel:function(a){b.cancel(a)},touchcancel:function(a){a._cancel=!0,this.processTouches(a,this.cancel)},cleanUpPointer:function(a){c["delete"](a.pointerId),this.removePrimaryPointer(a)},dedupSynthMouse:function(b){var c=a.mouseEvents.lastTouches,e=b.changedTouches[0];if(this.isPrimaryTouch(e)){var f={x:e.clientX,y:e.clientY};c.push(f);var g=function(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)}.bind(null,c,f);setTimeout(g,d)}}};a.touchEvents=h}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,e={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerCancel"],register:function(a){b.listen(a,this.events)},unregister:function(a){a!==document&&b.unlisten(a,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(a){var c=a;return c=b.cloneEvent(a),d&&(c.pointerType=this.POINTER_TYPES[a.pointerType]),c._source="ms",c},cleanup:function(a){c["delete"](a)},MSPointerDown:function(d){var e=this.prepareEvent(d);e.target=a.findTarget(d),c.set(d.pointerId,e.target),b.down(e)},MSPointerMove:function(a){var d=c.get(a.pointerId);if(d){var e=this.prepareEvent(a);e.target=d,b.move(e)}},MSPointerUp:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.up(e),this.cleanup(d.pointerId)},MSPointerCancel:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.cancel(e),this.cleanup(d.pointerId)}};a.msEvents=e}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d={events:["pointerdown","pointermove","pointerup","pointercancel"],prepareEvent:function(a){var c=b.cloneEvent(a);return c._source="pointer",c},register:function(a){b.listen(a,this.events)},unregister:function(a){a!==document&&b.unlisten(a,this.events)},cleanup:function(a){c["delete"](a)},pointerdown:function(d){var e=this.prepareEvent(d);e.target=a.findTarget(d),c.set(e.pointerId,e.target),b.down(e)},pointermove:function(a){var d=c.get(a.pointerId);if(d){var e=this.prepareEvent(a);e.target=d,b.move(e)}},pointerup:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.up(e),this.cleanup(d.pointerId)},pointercancel:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.cancel(e),this.cleanup(d.pointerId)}};a.pointerEvents=d}(window.PolymerGestures),function(a){var b=a.dispatcher,c=window.navigator;window.PointerEvent?b.registerSource("pointer",a.pointerEvents):c.msPointerEnabled?b.registerSource("ms",a.msEvents):(b.registerSource("mouse",a.mouseEvents),void 0!==window.ontouchstart&&b.registerSource("touch",a.touchEvents));var d=navigator.userAgent,e=d.match(/iPad|iPhone|iPod/)&&"ontouchstart"in window;b.IS_IOS=e,a.touchEvents.IS_IOS=e,b.register(document,!0)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d=new a.PointerMap,e={events:["down","move","up"],exposes:["trackstart","track","trackx","tracky","trackend"],defaultActions:{track:"none",trackx:"pan-y",tracky:"pan-x"},WIGGLE_THRESHOLD:4,clampDir:function(a){return a>0?1:-1},calcPositionDelta:function(a,b){var c=0,d=0;return a&&b&&(c=b.pageX-a.pageX,d=b.pageY-a.pageY),{x:c,y:d}},fireTrack:function(a,b,d){var e=d,f=this.calcPositionDelta(e.downEvent,b),g=this.calcPositionDelta(e.lastMoveEvent,b);if(g.x)e.xDirection=this.clampDir(g.x);else if("trackx"===a)return;if(g.y)e.yDirection=this.clampDir(g.y);else if("tracky"===a)return;var h={bubbles:!0,cancelable:!0,trackInfo:e.trackInfo,relatedTarget:b.relatedTarget,pointerType:b.pointerType,pointerId:b.pointerId,_source:"track"};"tracky"!==a&&(h.x=b.x,h.dx=f.x,h.ddx=g.x,h.clientX=b.clientX,h.pageX=b.pageX,h.screenX=b.screenX,h.xDirection=e.xDirection),"trackx"!==a&&(h.dy=f.y,h.ddy=g.y,h.y=b.y,h.clientY=b.clientY,h.pageY=b.pageY,h.screenY=b.screenY,h.yDirection=e.yDirection);var i=c.makeGestureEvent(a,h);e.downTarget.dispatchEvent(i)},down:function(a){if(a.isPrimary&&("mouse"===a.pointerType?1===a.buttons:!0)){var b={downEvent:a,downTarget:a.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};d.set(a.pointerId,b)}},move:function(a){var b=d.get(a.pointerId);if(b){if(!b.tracking){var c=this.calcPositionDelta(b.downEvent,a),e=c.x*c.x+c.y*c.y;e>this.WIGGLE_THRESHOLD&&(b.tracking=!0,b.lastMoveEvent=b.downEvent,this.fireTrack("trackstart",a,b))}b.tracking&&(this.fireTrack("track",a,b),this.fireTrack("trackx",a,b),this.fireTrack("tracky",a,b)),b.lastMoveEvent=a}},up:function(a){var b=d.get(a.pointerId);b&&(b.tracking&&this.fireTrack("trackend",a,b),d.delete(a.pointerId))}};b.registerGesture("track",e)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var a=Date.now()-this.heldPointer.timeStamp,b=this.held?"holdpulse":"hold";this.fireHold(b,a),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(a){a.isPrimary&&!this.heldPointer&&(this.heldPointer=a,this.target=a.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(a){this.heldPointer&&this.heldPointer.pointerId===a.pointerId&&this.cancel()},move:function(a){if(this.heldPointer&&this.heldPointer.pointerId===a.pointerId){var b=a.clientX-this.heldPointer.clientX,c=a.clientY-this.heldPointer.clientY;b*b+c*c>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(a,b){var d={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};b&&(d.holdTime=b);var e=c.makeGestureEvent(a,d);this.target.dispatchEvent(e)}};b.registerGesture("hold",d)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d=new a.PointerMap,e={events:["down","up"],exposes:["tap"],down:function(a){a.isPrimary&&!a.tapPrevented&&d.set(a.pointerId,{target:a.target,buttons:a.buttons,x:a.clientX,y:a.clientY})},shouldTap:function(a,b){return"mouse"===a.pointerType?1===b.buttons:!a.tapPrevented},up:function(b){var e=d.get(b.pointerId);if(e&&this.shouldTap(b,e)){var f=a.targetFinding.LCA(e.target,b.relatedTarget);if(f){var g=c.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:b.clientX,y:b.clientY,detail:b.detail,pointerType:b.pointerType,pointerId:b.pointerId,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey,_source:"tap"});f.dispatchEvent(g)}}d.delete(b.pointerId)}};c.preventTap=function(a){return function(){a.tapPrevented=!0,d.delete(a.pointerId)}},b.registerGesture("tap",e)}(window.PolymerGestures),function(a){"use strict";function b(a,b){if(!a)throw new Error("ASSERT: "+b)}function c(a){return a>=48&&57>=a}function d(a){return 32===a||9===a||11===a||12===a||160===a||a>=5760&&"\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff".indexOf(String.fromCharCode(a))>0}function e(a){return 10===a||13===a||8232===a||8233===a}function f(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a}function g(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a}function h(a){return"this"===a}function i(){for(;Y>X&&d(W.charCodeAt(X));)++X}function j(){var a,b;for(a=X++;Y>X&&(b=W.charCodeAt(X),g(b));)++X;return W.slice(a,X)}function k(){var a,b,c;return a=X,b=j(),c=1===b.length?S.Identifier:h(b)?S.Keyword:"null"===b?S.NullLiteral:"true"===b||"false"===b?S.BooleanLiteral:S.Identifier,{type:c,value:b,range:[a,X]}}function l(){var a,b,c=X,d=W.charCodeAt(X),e=W[X];switch(d){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:return++X,{type:S.Punctuator,value:String.fromCharCode(d),range:[c,X]};default:if(a=W.charCodeAt(X+1),61===a)switch(d){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 124:return X+=2,{type:S.Punctuator,value:String.fromCharCode(d)+String.fromCharCode(a),range:[c,X]};case 33:case 61:return X+=2,61===W.charCodeAt(X)&&++X,{type:S.Punctuator,value:W.slice(c,X),range:[c,X]}}}return b=W[X+1],e===b&&"&|".indexOf(e)>=0?(X+=2,{type:S.Punctuator,value:e+b,range:[c,X]}):"<>=!+-*%&|^/".indexOf(e)>=0?(++X,{type:S.Punctuator,value:e,range:[c,X]}):void s({},V.UnexpectedToken,"ILLEGAL")}function m(){var a,d,e;if(e=W[X],b(c(e.charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),d=X,a="","."!==e){for(a=W[X++],e=W[X],"0"===a&&e&&c(e.charCodeAt(0))&&s({},V.UnexpectedToken,"ILLEGAL");c(W.charCodeAt(X));)a+=W[X++];e=W[X]}if("."===e){for(a+=W[X++];c(W.charCodeAt(X));)a+=W[X++];e=W[X]}if("e"===e||"E"===e)if(a+=W[X++],e=W[X],("+"===e||"-"===e)&&(a+=W[X++]),c(W.charCodeAt(X)))for(;c(W.charCodeAt(X));)a+=W[X++];else s({},V.UnexpectedToken,"ILLEGAL");return f(W.charCodeAt(X))&&s({},V.UnexpectedToken,"ILLEGAL"),{type:S.NumericLiteral,value:parseFloat(a),range:[d,X]}}function n(){var a,c,d,f="",g=!1;for(a=W[X],b("'"===a||'"'===a,"String literal must starts with a quote"),c=X,++X;Y>X;){if(d=W[X++],d===a){a="";break}if("\\"===d)if(d=W[X++],d&&e(d.charCodeAt(0)))"\r"===d&&"\n"===W[X]&&++X;else switch(d){case"n":f+="\n";break;case"r":f+="\r";break;case"t":f+=" ";break;case"b":f+="\b";break;case"f":f+="\f";break;case"v":f+="";break;default:f+=d}else{if(e(d.charCodeAt(0)))break;f+=d}}return""!==a&&s({},V.UnexpectedToken,"ILLEGAL"),{type:S.StringLiteral,value:f,octal:g,range:[c,X]}}function o(a){return a.type===S.Identifier||a.type===S.Keyword||a.type===S.BooleanLiteral||a.type===S.NullLiteral}function p(){var a;return i(),X>=Y?{type:S.EOF,range:[X,X]}:(a=W.charCodeAt(X),40===a||41===a||58===a?l():39===a||34===a?n():f(a)?k():46===a?c(W.charCodeAt(X+1))?m():l():c(a)?m():l())}function q(){var a;return a=$,X=a.range[1],$=p(),X=a.range[1],a}function r(){var a;a=X,$=p(),X=a}function s(a,c){var d,e=Array.prototype.slice.call(arguments,2),f=c.replace(/%(\d)/g,function(a,c){return b(c<e.length,"Message reference must be in range"),e[c]});throw d=new Error(f),d.index=X,d.description=f,d}function t(a){s(a,V.UnexpectedToken,a.value)}function u(a){var b=q();(b.type!==S.Punctuator||b.value!==a)&&t(b)}function v(a){return $.type===S.Punctuator&&$.value===a}function w(a){return $.type===S.Keyword&&$.value===a}function x(){var a=[];for(u("[");!v("]");)v(",")?(q(),a.push(null)):(a.push(bb()),v("]")||u(","));return u("]"),Z.createArrayExpression(a)}function y(){var a;return i(),a=q(),a.type===S.StringLiteral||a.type===S.NumericLiteral?Z.createLiteral(a):Z.createIdentifier(a.value)}function z(){var a,b;return a=$,i(),(a.type===S.EOF||a.type===S.Punctuator)&&t(a),b=y(),u(":"),Z.createProperty("init",b,bb())}function A(){var a=[];for(u("{");!v("}");)a.push(z()),v("}")||u(",");return u("}"),Z.createObjectExpression(a)}function B(){var a;return u("("),a=bb(),u(")"),a}function C(){var a,b,c;return v("(")?B():(a=$.type,a===S.Identifier?c=Z.createIdentifier(q().value):a===S.StringLiteral||a===S.NumericLiteral?c=Z.createLiteral(q()):a===S.Keyword?w("this")&&(q(),c=Z.createThisExpression()):a===S.BooleanLiteral?(b=q(),b.value="true"===b.value,c=Z.createLiteral(b)):a===S.NullLiteral?(b=q(),b.value=null,c=Z.createLiteral(b)):v("[")?c=x():v("{")&&(c=A()),c?c:void t(q()))}function D(){var a=[];if(u("("),!v(")"))for(;Y>X&&(a.push(bb()),!v(")"));)u(",");return u(")"),a}function E(){var a;return a=q(),o(a)||t(a),Z.createIdentifier(a.value)}function F(){return u("."),E()}function G(){var a;return u("["),a=bb(),u("]"),a}function H(){var a,b,c;for(a=C();;)if(v("["))c=G(),a=Z.createMemberExpression("[",a,c);else if(v("."))c=F(),a=Z.createMemberExpression(".",a,c);else{if(!v("("))break;b=D(),a=Z.createCallExpression(a,b)}return a}function I(){var a,b;return $.type!==S.Punctuator&&$.type!==S.Keyword?b=ab():v("+")||v("-")||v("!")?(a=q(),b=I(),b=Z.createUnaryExpression(a.value,b)):w("delete")||w("void")||w("typeof")?s({},V.UnexpectedToken):b=ab(),b}function J(a){var b=0;if(a.type!==S.Punctuator&&a.type!==S.Keyword)return 0;switch(a.value){case"||":b=1;break;case"&&":b=2;break;case"==":case"!=":case"===":case"!==":b=6;break;case"<":case">":case"<=":case">=":case"instanceof":b=7;break;case"in":b=7;break;case"+":case"-":b=9;break;case"*":case"/":case"%":b=11}return b}function K(){var a,b,c,d,e,f,g,h;if(g=I(),b=$,c=J(b),0===c)return g;for(b.prec=c,q(),e=I(),d=[g,b,e];(c=J($))>0;){for(;d.length>2&&c<=d[d.length-2].prec;)e=d.pop(),f=d.pop().value,g=d.pop(),a=Z.createBinaryExpression(f,g,e),d.push(a);b=q(),b.prec=c,d.push(b),a=I(),d.push(a)}for(h=d.length-1,a=d[h];h>1;)a=Z.createBinaryExpression(d[h-1].value,d[h-2],a),h-=2;return a}function L(){var a,b,c;return a=K(),v("?")&&(q(),b=L(),u(":"),c=L(),a=Z.createConditionalExpression(a,b,c)),a}function M(){var a,b;return a=q(),a.type!==S.Identifier&&t(a),b=v("(")?D():[],Z.createFilter(a.value,b)}function N(){for(;v("|");)q(),M()}function O(){i(),r();var a=bb();a&&(","===$.value||"in"==$.value&&a.type===U.Identifier?Q(a):(N(),"as"===$.value?P(a):Z.createTopLevel(a))),$.type!==S.EOF&&t($)}function P(a){q();var b=q().value;Z.createAsExpression(a,b)}function Q(a){var b;","===$.value&&(q(),$.type!==S.Identifier&&t($),b=q().value),q();var c=bb();N(),Z.createInExpression(a.name,b,c)}function R(a,b){return Z=b,W=a,X=0,Y=W.length,$=null,_={labelSet:{}},O()}var S,T,U,V,W,X,Y,Z,$,_;S={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},T={},T[S.BooleanLiteral]="Boolean",T[S.EOF]="<end>",T[S.Identifier]="Identifier",T[S.Keyword]="Keyword",T[S.NullLiteral]="Null",T[S.NumericLiteral]="Numeric",T[S.Punctuator]="Punctuator",T[S.StringLiteral]="String",U={ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ThisExpression:"ThisExpression",UnaryExpression:"UnaryExpression"},V={UnexpectedToken:"Unexpected token %0",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared"};var ab=H,bb=L;a.esprima={parse:R}}(this),function(a){"use strict";function b(a,b,d,e){var f;try{if(f=c(a),f.scopeIdent&&(d.nodeType!==Node.ELEMENT_NODE||"TEMPLATE"!==d.tagName||"bind"!==b&&"repeat"!==b))throw Error("as and in can only be used within <template bind/repeat>")}catch(g){return void console.error("Invalid expression syntax: "+a,g)}return function(a,b,c){var d=f.getBinding(a,e,c);return f.scopeIdent&&d&&(b.polymerExpressionScopeIdent_=f.scopeIdent,f.indexIdent&&(b.polymerExpressionIndexIdent_=f.indexIdent)),d}}function c(a){var b=q[a];if(!b){var c=new j;esprima.parse(a,c),b=new l(c),q[a]=b}return b}function d(a){this.value=a,this.valueFn_=void 0}function e(a){this.name=a,this.path=Path.get(a)}function f(a,b,c){this.computed="["==c,this.dynamicDeps="function"==typeof a||a.dynamicDeps||this.computed&&!(b instanceof d),this.simplePath=!this.dynamicDeps&&(b instanceof e||b instanceof d)&&(a instanceof f||a instanceof e),this.object=this.simplePath?a:i(a),this.property=!this.computed||this.simplePath?b:i(b)}function g(a,b){this.name=a,this.args=[];for(var c=0;c<b.length;c++)this.args[c]=i(b[c])}function h(){throw Error("Not Implemented")}function i(a){return"function"==typeof a?a:a.valueFn()}function j(){this.expression=null,this.filters=[],this.deps={},this.currentPath=void 0,this.scopeIdent=void 0,this.indexIdent=void 0,this.dynamicDeps=!1}function k(a){this.value_=a}function l(a){if(this.scopeIdent=a.scopeIdent,this.indexIdent=a.indexIdent,!a.expression)throw Error("No expression found.");this.expression=a.expression,i(this.expression),this.filters=a.filters,this.dynamicDeps=a.dynamicDeps}function m(a){return String(a).replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})}function n(a,b){for(;a[t]&&!Object.prototype.hasOwnProperty.call(a,b);)a=a[t];return a}function o(a){switch(a){case"":return!1;case"false":case"null":case"true":return!0}return isNaN(Number(a))?!1:!0}function p(){}var q=Object.create(null);d.prototype={valueFn:function(){if(!this.valueFn_){var a=this.value;this.valueFn_=function(){return a}}return this.valueFn_}},e.prototype={valueFn:function(){if(!this.valueFn_){var a=(this.name,this.path);this.valueFn_=function(b,c){return c&&c.addPath(b,a),a.getValueFrom(b)}}return this.valueFn_},setValue:function(a,b){return 1==this.path.length,a=n(a,this.path[0]),this.path.setValueFrom(a,b)}},f.prototype={get fullPath(){if(!this.fullPath_){var a=this.object instanceof f?this.object.fullPath.slice():[this.object.name]; +a.push(this.property instanceof e?this.property.name:this.property.value),this.fullPath_=Path.get(a)}return this.fullPath_},valueFn:function(){if(!this.valueFn_){var a=this.object;if(this.simplePath){var b=this.fullPath;this.valueFn_=function(a,c){return c&&c.addPath(a,b),b.getValueFrom(a)}}else if(this.computed){var c=this.property;this.valueFn_=function(b,d,e){var f=a(b,d,e),g=c(b,d,e);return d&&d.addPath(f,[g]),f?f[g]:void 0}}else{var b=Path.get(this.property.name);this.valueFn_=function(c,d,e){var f=a(c,d,e);return d&&d.addPath(f,b),b.getValueFrom(f)}}}return this.valueFn_},setValue:function(a,b){if(this.simplePath)return this.fullPath.setValueFrom(a,b),b;var c=this.object(a),d=this.property instanceof e?this.property.name:this.property(a);return c[d]=b}},g.prototype={transform:function(a,b,c,d,e){var f=c[this.name],g=a;if(f)g=void 0;else if(f=g[this.name],!f)return void console.error("Cannot find function or filter: "+this.name);if(d?f=f.toModel:"function"==typeof f.toDOM&&(f=f.toDOM),"function"!=typeof f)return void console.error("Cannot find function or filter: "+this.name);for(var h=e||[],j=0;j<this.args.length;j++)h.push(i(this.args[j])(a,b,c));return f.apply(g,h)}};var r={"+":function(a){return+a},"-":function(a){return-a},"!":function(a){return!a}},s={"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"<":function(a,b){return b>a},">":function(a,b){return a>b},"<=":function(a,b){return b>=a},">=":function(a,b){return a>=b},"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"===":function(a,b){return a===b},"!==":function(a,b){return a!==b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b}};j.prototype={createUnaryExpression:function(a,b){if(!r[a])throw Error("Disallowed operator: "+a);return b=i(b),function(c,d,e){return r[a](b(c,d,e))}},createBinaryExpression:function(a,b,c){if(!s[a])throw Error("Disallowed operator: "+a);switch(b=i(b),c=i(c),a){case"||":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)||c(a,d,e)};case"&&":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)&&c(a,d,e)}}return function(d,e,f){return s[a](b(d,e,f),c(d,e,f))}},createConditionalExpression:function(a,b,c){return a=i(a),b=i(b),c=i(c),this.dynamicDeps=!0,function(d,e,f){return a(d,e,f)?b(d,e,f):c(d,e,f)}},createIdentifier:function(a){var b=new e(a);return b.type="Identifier",b},createMemberExpression:function(a,b,c){var d=new f(b,c,a);return d.dynamicDeps&&(this.dynamicDeps=!0),d},createCallExpression:function(a,b){if(!(a instanceof e))throw Error("Only identifier function invocations are allowed");var c=new g(a.name,b);return function(a,b,d){return c.transform(a,b,d,!1)}},createLiteral:function(a){return new d(a.value)},createArrayExpression:function(a){for(var b=0;b<a.length;b++)a[b]=i(a[b]);return function(b,c,d){for(var e=[],f=0;f<a.length;f++)e.push(a[f](b,c,d));return e}},createProperty:function(a,b,c){return{key:b instanceof e?b.name:b.value,value:c}},createObjectExpression:function(a){for(var b=0;b<a.length;b++)a[b].value=i(a[b].value);return function(b,c,d){for(var e={},f=0;f<a.length;f++)e[a[f].key]=a[f].value(b,c,d);return e}},createFilter:function(a,b){this.filters.push(new g(a,b))},createAsExpression:function(a,b){this.expression=a,this.scopeIdent=b},createInExpression:function(a,b,c){this.expression=c,this.scopeIdent=a,this.indexIdent=b},createTopLevel:function(a){this.expression=a},createThisExpression:h},k.prototype={open:function(){return this.value_},discardChanges:function(){return this.value_},deliver:function(){},close:function(){}},l.prototype={getBinding:function(a,b,c){function d(){if(h)return h=!1,g;i.dynamicDeps&&f.startReset();var c=i.getValue(a,i.dynamicDeps?f:void 0,b);return i.dynamicDeps&&f.finishReset(),c}function e(c){return i.setValue(a,c,b),c}if(c)return this.getValue(a,void 0,b);var f=new CompoundObserver,g=this.getValue(a,f,b),h=!0,i=this;return new ObserverTransform(f,d,e,!0)},getValue:function(a,b,c){for(var d=i(this.expression)(a,b,c),e=0;e<this.filters.length;e++)d=this.filters[e].transform(a,b,c,!1,[d]);return d},setValue:function(a,b,c){for(var d=this.filters?this.filters.length:0;d-->0;)b=this.filters[d].transform(a,void 0,c,!0,[b]);return this.expression.setValue?this.expression.setValue(a,b):void 0}};var t="@"+Math.random().toString(36).slice(2);p.prototype={styleObject:function(a){var b=[];for(var c in a)b.push(m(c)+": "+a[c]);return b.join("; ")},tokenList:function(a){var b=[];for(var c in a)a[c]&&b.push(c);return b.join(" ")},prepareInstancePositionChanged:function(a){var b=a.polymerExpressionIndexIdent_;if(b)return function(a,c){a.model[b]=c}},prepareBinding:function(a,c,d){var e=Path.get(a);{if(o(a)||!e.valid)return b(a,c,d,this);if(1==e.length)return function(a,b,c){if(c)return e.getValueFrom(a);var d=n(a,e[0]);return new PathObserver(d,e)}}},prepareInstanceModel:function(a){var b=a.polymerExpressionScopeIdent_;if(b){var c=a.templateInstance?a.templateInstance.model:a.model,d=a.polymerExpressionIndexIdent_;return function(a){return u(c,a,b,d)}}}};var u="__proto__"in{}?function(a,b,c,d){var e={};return e[c]=b,e[d]=void 0,e[t]=a,e.__proto__=a,e}:function(a,b,c,d){var e=Object.create(a);return Object.defineProperty(e,c,{value:b,configurable:!0,writable:!0}),Object.defineProperty(e,d,{value:void 0,configurable:!0,writable:!0}),Object.defineProperty(e,t,{value:a,configurable:!0,writable:!0}),e};a.PolymerExpressions=p,p.getExpression=c}(this),Polymer={version:"0.4.0-d62a0e4"},"function"==typeof window.Polymer&&(Polymer={}),window.Platform||(logFlags=window.logFlags||{},Platform={flush:function(){}},CustomElements={useNative:!0,ready:!0,takeRecords:function(){},"instanceof":function(a,b){return a instanceof b}},HTMLImports={useNative:!0},addEventListener("HTMLImportsLoaded",function(){document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}),ShadowDOMPolyfill=null,wrap=unwrap=function(a){return a}),function(a){function b(a,b){b=b||o,d(function(){f(a,b)},b)}function c(a){return"complete"===a.readyState||a.readyState===q}function d(a,b){if(c(b))a&&a();else{var e=function(){("complete"===b.readyState||b.readyState===q)&&(b.removeEventListener(r,e),d(a,b))};b.addEventListener(r,e)}}function e(a){a.target.__loaded=!0}function f(a,b){function c(){h==i&&a&&a()}function d(a){e(a),h++,c()}var f=b.querySelectorAll("link[rel=import]"),h=0,i=f.length;if(i)for(var j,k=0;i>k&&(j=f[k]);k++)g(j)?d.call(j,{target:j}):(j.addEventListener("load",d),j.addEventListener("error",d));else c()}function g(a){return l?a.__loaded||a.import&&"loading"!==a.import.readyState:a.__importParsed}function h(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)i(b)&&j(b)}function i(a){return"link"===a.localName&&"import"===a.rel}function j(a){var b=a.import;b?e({target:a}):(a.addEventListener("load",e),a.addEventListener("error",e))}var k="import"in document.createElement("link"),l=k;isIE=/Trident/.test(navigator.userAgent);var m=Boolean(window.ShadowDOMPolyfill),n=function(a){return m?ShadowDOMPolyfill.wrapIfNeeded(a):a},o=n(document),p={get:function(){var a=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return n(a)},configurable:!0};Object.defineProperty(document,"_currentScript",p),Object.defineProperty(o,"_currentScript",p);var q=isIE?"complete":"interactive",r="readystatechange";l&&(new MutationObserver(function(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)b.addedNodes&&h(b.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var a,b=document.querySelectorAll("link[rel=import]"),c=0,d=b.length;d>c&&(a=b[c]);c++)j(a)}()),b(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime(),o.dispatchEvent(new CustomEvent("HTMLImportsLoaded",{bubbles:!0}))}),a.useNative=l,a.isImportLoaded=g,a.whenReady=b,a.isIE=isIE,a.whenImportsReady=b}(window.HTMLImports),function(a){function b(a,b){return b=b||[],b.map||(b=[b]),a.apply(this,b.map(d))}function c(a,c,d){var e;switch(arguments.length){case 0:return;case 1:e=null;break;case 2:e=c.apply(this);break;default:e=b(d,c)}f[a]=e}function d(a){return f[a]}function e(a,c){HTMLImports.whenImportsReady(function(){b(c,a)})}var f={};a.marshal=d,a.modularize=c,a.using=e}(window),function(){var a=document.createElement("style");a.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; } \n";var b=document.querySelector("head");b.insertBefore(a,b.firstChild)}(Platform),function(a){"use strict";function b(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function c(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if("undefined"!=typeof navigator&&navigator.getDeviceStorage)return!1;try{var a=new Function("","return true;");return a()}catch(b){return!1}}function d(a){return+a===a>>>0&&""!==a}function e(a){return+a}function f(a){return a===Object(a)}function g(a,b){return a===b?0!==a||1/a===1/b:R(a)&&R(b)?!0:a!==a&&b!==b}function h(a){if(void 0===a)return"eof";var b=a.charCodeAt(0);switch(b){case 91:case 93:case 46:case 34:case 39:case 48:return a;case 95:case 36:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return b>=97&&122>=b||b>=65&&90>=b?"ident":b>=49&&57>=b?"number":"else"}function i(){}function j(a){function b(){if(!(m>=a.length)){var b=a[m+1];return"inSingleQuote"==n&&"'"==b||"inDoubleQuote"==n&&'"'==b?(m++,d=b,o.append(),!0):void 0}}for(var c,d,e,f,g,j,k,l=[],m=-1,n="beforePath",o={push:function(){void 0!==e&&(l.push(e),e=void 0)},append:function(){void 0===e?e=d:e+=d}};n;)if(m++,c=a[m],"\\"!=c||!b(n)){if(f=h(c),k=W[n],g=k[f]||k["else"]||"error","error"==g)return;if(n=g[0],j=o[g[1]]||i,d=void 0===g[2]?c:g[2],j(),"afterPath"===n)return l}}function k(a){return V.test(a)}function l(a,b){if(b!==X)throw Error("Use Path.get to retrieve path objects");for(var c=0;c<a.length;c++)this.push(String(a[c]));Q&&this.length&&(this.getValueFrom=this.compiledGetValueFromFn())}function m(a){if(a instanceof l)return a;if((null==a||0==a.length)&&(a=""),"string"!=typeof a){if(d(a.length))return new l(a,X);a=String(a)}var b=Y[a];if(b)return b;var c=j(a);if(!c)return Z;var b=new l(c,X);return Y[a]=b,b}function n(a){return d(a)?"["+a+"]":'["'+a.replace(/"/g,'\\"')+'"]'}function o(b){for(var c=0;_>c&&b.check_();)c++;return O&&(a.dirtyCheckCycleCount=c),c>0}function p(a){for(var b in a)return!1;return!0}function q(a){return p(a.added)&&p(a.removed)&&p(a.changed)}function r(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function s(){if(!ab.length)return!1;for(var a=0;a<ab.length;a++)ab[a]();return ab.length=0,!0}function t(){function a(a){b&&b.state_===fb&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),cb.push(this)}}}function u(a,b,c){var d=cb.pop()||t();return d.open(a),d.observe(b,c),d}function v(){function a(b,f){b&&(b===d&&(e[f]=!0),h.indexOf(b)<0&&(h.push(b),Object.observe(b,c)),a(Object.getPrototypeOf(b),f))}function b(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.object!==d||e[c.name]||"setPrototype"===c.type)return!1}return!0}function c(c){if(!b(c)){for(var d,e=0;e<g.length;e++)d=g[e],d.state_==fb&&d.iterateObjects_(a);for(var e=0;e<g.length;e++)d=g[e],d.state_==fb&&d.check_()}}var d,e,f=0,g=[],h=[],i={object:void 0,objects:h,open:function(b,c){d||(d=c,e={}),g.push(b),f++,b.iterateObjects_(a)},close:function(){if(f--,!(f>0)){for(var a=0;a<h.length;a++)Object.unobserve(h[a],c),x.unobservedCount++;g.length=0,h.length=0,d=void 0,e=void 0,db.push(this)}}};return i}function w(a,b){return $&&$.object===b||($=db.pop()||v(),$.object=b),$.open(a,b),$}function x(){this.state_=eb,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=ib++}function y(a){x._allObserversCount++,kb&&jb.push(a)}function z(){x._allObserversCount--}function A(a){x.call(this),this.value_=a,this.oldObject_=void 0}function B(a){if(!Array.isArray(a))throw Error("Provided object is not an Array");A.call(this,a)}function C(a,b){x.call(this),this.object_=a,this.path_=m(b),this.directObserver_=void 0}function D(a){x.call(this),this.reportChangesOnOpen_=a,this.value_=[],this.directObserver_=void 0,this.observed_=[]}function E(a){return a}function F(a,b,c,d){this.callback_=void 0,this.target_=void 0,this.value_=void 0,this.observable_=a,this.getValueFn_=b||E,this.setValueFn_=c||E,this.dontPassThroughSet_=d}function G(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];nb[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}function H(a,b,c){return{index:a,removed:b,addedCount:c}}function I(){}function J(a,b,c,d,e,f){return sb.calcSplices(a,b,c,d,e,f)}function K(a,b,c,d){return c>b||a>d?-1:b==c||d==a?0:c>a?d>b?b-c:d-c:b>d?d-a:b-a}function L(a,b,c,d){for(var e=H(b,c,d),f=!1,g=0,h=0;h<a.length;h++){var i=a[h];if(i.index+=g,!f){var j=K(e.index,e.index+e.removed.length,i.index,i.index+i.addedCount);if(j>=0){a.splice(h,1),h--,g-=i.addedCount-i.removed.length,e.addedCount+=i.addedCount-j;var k=e.removed.length+i.removed.length-j;if(e.addedCount||k){var c=i.removed;if(e.index<i.index){var l=e.removed.slice(0,i.index-e.index);Array.prototype.push.apply(l,c),c=l}if(e.index+e.removed.length>i.index+i.addedCount){var m=e.removed.slice(i.index+i.addedCount-e.index);Array.prototype.push.apply(c,m)}e.removed=c,i.index<e.index&&(e.index=i.index)}else f=!0}else if(e.index<i.index){f=!0,a.splice(h,0,e),h++;var n=e.addedCount-e.removed.length;i.index+=n,g+=n}}}f||a.push(e)}function M(a,b){for(var c=[],f=0;f<b.length;f++){var g=b[f];switch(g.type){case"splice":L(c,g.index,g.removed.slice(),g.addedCount);break;case"add":case"update":case"delete":if(!d(g.name))continue;var h=e(g.name);if(0>h)continue;L(c,h,[g.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stringify(g))}}return c}function N(a,b){var c=[];return M(a,b).forEach(function(b){return 1==b.addedCount&&1==b.removed.length?void(b.removed[0]!==a[b.index]&&c.push(b)):void(c=c.concat(J(a,b.index,b.index+b.addedCount,b.removed,0,b.removed.length)))}),c}var O=a.testingExposeCycleCount,P=b(),Q=c(),R=a.Number.isNaN||function(b){return"number"==typeof b&&a.isNaN(b)},S="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},T="[$_a-zA-Z]",U="[$_a-zA-Z0-9]",V=new RegExp("^"+T+"+"+U+"*$"),W={beforePath:{ws:["beforePath"],ident:["inIdent","append"],"[":["beforeElement"],eof:["afterPath"]},inPath:{ws:["inPath"],".":["beforeIdent"],"[":["beforeElement"],eof:["afterPath"]},beforeIdent:{ws:["beforeIdent"],ident:["inIdent","append"]},inIdent:{ident:["inIdent","append"],0:["inIdent","append"],number:["inIdent","append"],ws:["inPath","push"],".":["beforeIdent","push"],"[":["beforeElement","push"],eof:["afterPath","push"]},beforeElement:{ws:["beforeElement"],0:["afterZero","append"],number:["inIndex","append"],"'":["inSingleQuote","append",""],'"':["inDoubleQuote","append",""]},afterZero:{ws:["afterElement","push"],"]":["inPath","push"]},inIndex:{0:["inIndex","append"],number:["inIndex","append"],ws:["afterElement"],"]":["inPath","push"]},inSingleQuote:{"'":["afterElement"],eof:["error"],"else":["inSingleQuote","append"]},inDoubleQuote:{'"':["afterElement"],eof:["error"],"else":["inDoubleQuote","append"]},afterElement:{ws:["afterElement"],"]":["inPath","push"]}},X={},Y={};l.get=m,l.prototype=S({__proto__:[],valid:!0,toString:function(){for(var a="",b=0;b<this.length;b++){var c=this[b];a+=k(c)?b?"."+c:c:n(c)}return a},getValueFrom:function(a){for(var b=0;b<this.length;b++){if(null==a)return;a=a[this[b]]}return a},iterateObjects:function(a,b){for(var c=0;c<this.length;c++){if(c&&(a=a[this[c-1]]),!f(a))return;b(a,this[0])}},compiledGetValueFromFn:function(){var a="",b="obj";a+="if (obj != null";for(var c,d=0;d<this.length-1;d++)c=this[d],b+=k(c)?"."+c:n(c),a+=" &&\n "+b+" != null";a+=")\n";var c=this[d];return b+=k(c)?"."+c:n(c),a+=" return "+b+";\nelse\n return undefined;",new Function("obj",a)},setValueFrom:function(a,b){if(!this.length)return!1;for(var c=0;c<this.length-1;c++){if(!f(a))return!1;a=a[this[c]]}return f(a)?(a[this[c]]=b,!0):!1}});var Z=new l("",X);Z.valid=!1,Z.getValueFrom=Z.setValueFrom=function(){};var $,_=1e3,ab=[],bb=P?function(){var a={pingPong:!0},b=!1;return Object.observe(a,function(){s(),b=!1}),function(c){ab.push(c),b||(b=!0,a.pingPong=!a.pingPong)}}():function(){return function(a){ab.push(a)}}(),cb=[],db=[],eb=0,fb=1,gb=2,hb=3,ib=1;x.prototype={open:function(a,b){if(this.state_!=eb)throw Error("Observer has already been opened.");return y(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=fb,this.value_},close:function(){this.state_==fb&&(z(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=gb)},deliver:function(){this.state_==fb&&o(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){x._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var jb,kb=!P;x._allObserversCount=0,kb&&(jb=[]);var lb=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!lb&&kb){lb=!0;var b,c,d=0;do{d++,c=jb,jb=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==fb&&(f.check_()&&(b=!0),jb.push(f))}s()&&(b=!0)}while(_>d&&b);O&&(a.dirtyCheckCycleCount=d),lb=!1}},kb&&(a.Platform.clearObservers=function(){jb=[]}),A.prototype=S({__proto__:x.prototype,arrayObserve:!1,connect_:function(){P?this.directObserver_=u(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a){var b,c;if(P){if(!a)return!1;c={},b=G(this.value_,a,c)}else c=this.oldObject_,b=r(this.value_,this.oldObject_);return q(b)?!1:(P||(this.oldObject_=this.copyObject(this.value_)),this.report_([b.added||{},b.removed||{},b.changed||{},function(a){return c[a]}]),!0)},disconnect_:function(){P?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==fb&&(P?this.directObserver_.deliver(!1):o(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}}),B.prototype=S({__proto__:A.prototype,arrayObserve:!0,copyObject:function(a){return a.slice()},check_:function(a){var b;if(P){if(!a)return!1;b=N(this.value_,a)}else b=J(this.value_,0,this.value_.length,this.oldObject_,0,this.oldObject_.length);return b&&b.length?(P||(this.oldObject_=this.copyObject(this.value_)),this.report_([b]),!0):!1}}),B.applySplices=function(a,b,c){c.forEach(function(c){for(var d=[c.index,c.removed.length],e=c.index;e<c.index+c.addedCount;)d.push(b[e]),e++;Array.prototype.splice.apply(a,d)})},C.prototype=S({__proto__:x.prototype,get path(){return this.path_},connect_:function(){P&&(this.directObserver_=w(this,this.object_)),this.check_(void 0,!0)},disconnect_:function(){this.value_=void 0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},iterateObjects_:function(a){this.path_.iterateObjects(this.object_,a)},check_:function(a,b){var c=this.value_;return this.value_=this.path_.getValueFrom(this.object_),b||g(this.value_,c)?!1:(this.report_([this.value_,c,this]),!0)},setValue:function(a){this.path_&&this.path_.setValueFrom(this.object_,a)}});var mb={};D.prototype=S({__proto__:x.prototype,connect_:function(){if(P){for(var a,b=!1,c=0;c<this.observed_.length;c+=2)if(a=this.observed_[c],a!==mb){b=!0;break}b&&(this.directObserver_=w(this,a))}this.check_(void 0,!this.reportChangesOnOpen_)},disconnect_:function(){for(var a=0;a<this.observed_.length;a+=2)this.observed_[a]===mb&&this.observed_[a+1].close();this.observed_.length=0,this.value_.length=0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},addPath:function(a,b){if(this.state_!=eb&&this.state_!=hb)throw Error("Cannot add paths once started.");var b=m(b);if(this.observed_.push(a,b),this.reportChangesOnOpen_){var c=this.observed_.length/2-1;this.value_[c]=b.getValueFrom(a)}},addObserver:function(a){if(this.state_!=eb&&this.state_!=hb)throw Error("Cannot add observers once started.");if(this.observed_.push(mb,a),this.reportChangesOnOpen_){var b=this.observed_.length/2-1;this.value_[b]=a.open(this.deliver,this)}},startReset:function(){if(this.state_!=fb)throw Error("Can only reset while open");this.state_=hb,this.disconnect_()},finishReset:function(){if(this.state_!=hb)throw Error("Can only finishReset after startReset");return this.state_=fb,this.connect_(),this.value_},iterateObjects_:function(a){for(var b,c=0;c<this.observed_.length;c+=2)b=this.observed_[c],b!==mb&&this.observed_[c+1].iterateObjects(b,a)},check_:function(a,b){for(var c,d=0;d<this.observed_.length;d+=2){var e,f=this.observed_[d],h=this.observed_[d+1];if(f===mb){var i=h;e=this.state_===eb?i.open(this.deliver,this):i.discardChanges()}else e=h.getValueFrom(f);b?this.value_[d/2]=e:g(e,this.value_[d/2])||(c=c||[],c[d/2]=this.value_[d/2],this.value_[d/2]=e)}return c?(this.report_([this.value_,c,this.observed_]),!0):!1}}),F.prototype={open:function(a,b){return this.callback_=a,this.target_=b,this.value_=this.getValueFn_(this.observable_.open(this.observedCallback_,this)),this.value_},observedCallback_:function(a){if(a=this.getValueFn_(a),!g(a,this.value_)){var b=this.value_;this.value_=a,this.callback_.call(this.target_,this.value_,b)}},discardChanges:function(){return this.value_=this.getValueFn_(this.observable_.discardChanges()),this.value_},deliver:function(){return this.observable_.deliver()},setValue:function(a){return a=this.setValueFn_(a),!this.dontPassThroughSet_&&this.observable_.setValue?this.observable_.setValue(a):void 0},close:function(){this.observable_&&this.observable_.close(),this.callback_=void 0,this.target_=void 0,this.observable_=void 0,this.value_=void 0,this.getValueFn_=void 0,this.setValueFn_=void 0}};var nb={add:!0,update:!0,"delete":!0},ob=0,pb=1,qb=2,rb=3;I.prototype={calcEditDistances:function(a,b,c,d,e,f){for(var g=f-e+1,h=c-b+1,i=new Array(g),j=0;g>j;j++)i[j]=new Array(h),i[j][0]=j;for(var k=0;h>k;k++)i[0][k]=k;for(var j=1;g>j;j++)for(var k=1;h>k;k++)if(this.equals(a[b+k-1],d[e+j-1]))i[j][k]=i[j-1][k-1];else{var l=i[j-1][k]+1,m=i[j][k-1]+1;i[j][k]=m>l?l:m}return i},spliceOperationsFromEditDistances:function(a){for(var b=a.length-1,c=a[0].length-1,d=a[b][c],e=[];b>0||c>0;)if(0!=b)if(0!=c){var f,g=a[b-1][c-1],h=a[b-1][c],i=a[b][c-1];f=i>h?g>h?h:g:g>i?i:g,f==g?(g==d?e.push(ob):(e.push(pb),d=g),b--,c--):f==h?(e.push(rb),b--,d=h):(e.push(qb),c--,d=i)}else e.push(rb),b--;else e.push(qb),c--;return e.reverse(),e},calcSplices:function(a,b,c,d,e,f){var g=0,h=0,i=Math.min(c-b,f-e);if(0==b&&0==e&&(g=this.sharedPrefix(a,d,i)),c==a.length&&f==d.length&&(h=this.sharedSuffix(a,d,i-g)),b+=g,e+=g,c-=h,f-=h,c-b==0&&f-e==0)return[];if(b==c){for(var j=H(b,[],0);f>e;)j.removed.push(d[e++]);return[j]}if(e==f)return[H(b,[],c-b)];for(var k=this.spliceOperationsFromEditDistances(this.calcEditDistances(a,b,c,d,e,f)),j=void 0,l=[],m=b,n=e,o=0;o<k.length;o++)switch(k[o]){case ob:j&&(l.push(j),j=void 0),m++,n++;break;case pb:j||(j=H(m,[],0)),j.addedCount++,m++,j.removed.push(d[n]),n++;break;case qb:j||(j=H(m,[],0)),j.addedCount++,m++;break;case rb:j||(j=H(m,[],0)),j.removed.push(d[n]),n++}return j&&l.push(j),l},sharedPrefix:function(a,b,c){for(var d=0;c>d;d++)if(!this.equals(a[d],b[d]))return d;return c},sharedSuffix:function(a,b,c){for(var d=a.length,e=b.length,f=0;c>f&&this.equals(a[--d],b[--e]);)f++;return f},calculateSplices:function(a,b){return this.calcSplices(a,0,a.length,b,0,b.length)},equals:function(a,b){return a===b}};var sb=new I;a.Observer=x,a.Observer.runEOM_=bb,a.Observer.observerSentinel_=mb,a.Observer.hasObjectObserve=P,a.ArrayObserver=B,a.ArrayObserver.calculateSplices=function(a,b){return sb.calculateSplices(a,b)},a.ArraySplice=I,a.ObjectObserver=A,a.PathObserver=C,a.CompoundObserver=D,a.Path=l,a.ObserverTransform=F}("undefined"!=typeof global&&global&&"undefined"!=typeof module&&module?global:this||window),function(){"use strict";function a(a){for(;a.parentNode;)a=a.parentNode;return"function"==typeof a.getElementById?a:null}function b(a,b,c){var d=a.bindings_;return d||(d=a.bindings_={}),d[b]&&c[b].close(),d[b]=c}function c(a,b,c){return c}function d(a){return null==a?"":a}function e(a,b){a.data=d(b)}function f(a){return function(b){return e(a,b)}}function g(a,b,c,e){return c?void(e?a.setAttribute(b,""):a.removeAttribute(b)):void a.setAttribute(b,d(e))}function h(a,b,c){return function(d){g(a,b,c,d)}}function i(a){switch(a.type){case"checkbox":return u;case"radio":case"select-multiple":case"select-one":return"change";case"range":if(/Trident|MSIE/.test(navigator.userAgent))return"change";default:return"input"}}function j(a,b,c,e){a[b]=(e||d)(c)}function k(a,b,c){return function(d){return j(a,b,d,c)}}function l(){}function m(a,b,c,d){function e(){c.setValue(a[b]),c.discardChanges(),(d||l)(a),Platform.performMicrotaskCheckpoint()}var f=i(a);return a.addEventListener(f,e),{close:function(){a.removeEventListener(f,e),c.close()},observable_:c}}function n(a){return Boolean(a)}function o(b){if(b.form)return s(b.form.elements,function(a){return a!=b&&"INPUT"==a.tagName&&"radio"==a.type&&a.name==b.name});var c=a(b);if(!c)return[];var d=c.querySelectorAll('input[type="radio"][name="'+b.name+'"]');return s(d,function(a){return a!=b&&!a.form})}function p(a){"INPUT"===a.tagName&&"radio"===a.type&&o(a).forEach(function(a){var b=a.bindings_.checked;b&&b.observable_.setValue(!1)})}function q(a,b){var c,e,f,g=a.parentNode;g instanceof HTMLSelectElement&&g.bindings_&&g.bindings_.value&&(c=g,e=c.bindings_.value,f=c.value),a.value=d(b),c&&c.value!=f&&(e.observable_.setValue(c.value),e.observable_.discardChanges(),Platform.performMicrotaskCheckpoint())}function r(a){return function(b){q(a,b)}}var s=Array.prototype.filter.call.bind(Array.prototype.filter);Node.prototype.bind=function(a,b){console.error("Unhandled binding to Node: ",this,a,b)},Node.prototype.bindFinished=function(){};var t=c;Object.defineProperty(Platform,"enableBindingsReflection",{get:function(){return t===b},set:function(a){return t=a?b:c,a},configurable:!0}),Text.prototype.bind=function(a,b,c){if("textContent"!==a)return Node.prototype.bind.call(this,a,b,c);if(c)return e(this,b);var d=b;return e(this,d.open(f(this))),t(this,a,d)},Element.prototype.bind=function(a,b,c){var d="?"==a[a.length-1];if(d&&(this.removeAttribute(a),a=a.slice(0,-1)),c)return g(this,a,d,b);var e=b;return g(this,a,d,e.open(h(this,a,d))),t(this,a,e)};var u;!function(){var a=document.createElement("div"),b=a.appendChild(document.createElement("input"));b.setAttribute("type","checkbox");var c,d=0;b.addEventListener("click",function(){d++,c=c||"click"}),b.addEventListener("change",function(){d++,c=c||"change"});var e=document.createEvent("MouseEvent");e.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),b.dispatchEvent(e),u=1==d?"change":c}(),HTMLInputElement.prototype.bind=function(a,c,e){if("value"!==a&&"checked"!==a)return HTMLElement.prototype.bind.call(this,a,c,e);this.removeAttribute(a);var f="checked"==a?n:d,g="checked"==a?p:l;if(e)return j(this,a,c,f);var h=c,i=m(this,a,h,g);return j(this,a,h.open(k(this,a,f)),f),b(this,a,i)},HTMLTextAreaElement.prototype.bind=function(a,b,c){if("value"!==a)return HTMLElement.prototype.bind.call(this,a,b,c);if(this.removeAttribute("value"),c)return j(this,"value",b);var e=b,f=m(this,"value",e);return j(this,"value",e.open(k(this,"value",d))),t(this,a,f)},HTMLOptionElement.prototype.bind=function(a,b,c){if("value"!==a)return HTMLElement.prototype.bind.call(this,a,b,c);if(this.removeAttribute("value"),c)return q(this,b);var d=b,e=m(this,"value",d);return q(this,d.open(r(this))),t(this,a,e)},HTMLSelectElement.prototype.bind=function(a,c,d){if("selectedindex"===a&&(a="selectedIndex"),"selectedIndex"!==a&&"value"!==a)return HTMLElement.prototype.bind.call(this,a,c,d);if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(this,a,e.open(k(this,a))),b(this,a,f)}}(this),function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a){for(var b;b=a.parentNode;)a=b;return a}function d(a,b){if(b){for(var d,e="#"+b;!d&&(a=c(a),a.protoContent_?d=a.protoContent_.querySelector(e):a.getElementById&&(d=a.getElementById(b)),!d&&a.templateCreator_);)a=a.templateCreator_;return d}}function e(a){return"template"==a.tagName&&"http://www.w3.org/2000/svg"==a.namespaceURI}function f(a){return"TEMPLATE"==a.tagName&&"http://www.w3.org/1999/xhtml"==a.namespaceURI}function g(a){return Boolean(L[a.tagName]&&a.hasAttribute("template"))}function h(a){return void 0===a.isTemplate_&&(a.isTemplate_="TEMPLATE"==a.tagName||g(a)),a.isTemplate_}function i(a,b){var c=a.querySelectorAll(N);h(a)&&b(a),G(c,b)}function j(a){function b(a){HTMLTemplateElement.decorate(a)||j(a.content)}i(a,b)}function k(a,b){Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))})}function l(a){var b=a.ownerDocument;if(!b.defaultView)return b;var c=b.templateContentsOwner_;if(!c){for(c=b.implementation.createHTMLDocument("");c.lastChild;)c.removeChild(c.lastChild);b.templateContentsOwner_=c}return c}function m(a){if(!a.stagingDocument_){var b=a.ownerDocument;if(!b.stagingDocument_){b.stagingDocument_=b.implementation.createHTMLDocument(""),b.stagingDocument_.isStagingDocument=!0;var c=b.stagingDocument_.createElement("base");c.href=document.baseURI,b.stagingDocument_.head.appendChild(c),b.stagingDocument_.stagingDocument_=b.stagingDocument_}a.stagingDocument_=b.stagingDocument_}return a.stagingDocument_}function n(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];K[e.name]&&("template"!==e.name&&b.setAttribute(e.name,e.value),a.removeAttribute(e.name))}return b}function o(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];b.setAttribute(e.name,e.value),a.removeAttribute(e.name)}return a.parentNode.removeChild(a),b}function p(a,b,c){var d=a.content;if(c)return void d.appendChild(b);for(var e;e=b.firstChild;)d.appendChild(e)}function q(a){P?a.__proto__=HTMLTemplateElement.prototype:k(a,HTMLTemplateElement.prototype)}function r(a){a.setModelFn_||(a.setModelFn_=function(){a.setModelFnScheduled_=!1; +var b=z(a,a.delegate_&&a.delegate_.prepareBinding);w(a,b,a.model_)}),a.setModelFnScheduled_||(a.setModelFnScheduled_=!0,Observer.runEOM_(a.setModelFn_))}function s(a,b,c,d){if(a&&a.length){for(var e,f=a.length,g=0,h=0,i=0,j=!0;f>h;){var g=a.indexOf("{{",h),k=a.indexOf("[[",h),l=!1,m="}}";if(k>=0&&(0>g||g>k)&&(g=k,l=!0,m="]]"),i=0>g?-1:a.indexOf(m,g+2),0>i){if(!e)return;e.push(a.slice(h));break}e=e||[],e.push(a.slice(h,g));var n=a.slice(g+2,i).trim();e.push(l),j=j&&l;var o=d&&d(n,b,c);e.push(null==o?Path.get(n):null),e.push(o),h=i+2}return h===f&&e.push(""),e.hasOnePath=5===e.length,e.isSimplePath=e.hasOnePath&&""==e[0]&&""==e[4],e.onlyOneTime=j,e.combinator=function(a){for(var b=e[0],c=1;c<e.length;c+=4){var d=e.hasOnePath?a:a[(c-1)/4];void 0!==d&&(b+=d),b+=e[c+3]}return b},e}}function t(a,b,c,d){if(b.hasOnePath){var e=b[3],f=e?e(d,c,!0):b[2].getValueFrom(d);return b.isSimplePath?f:b.combinator(f)}for(var g=[],h=1;h<b.length;h+=4){var e=b[h+2];g[(h-1)/4]=e?e(d,c):b[h+1].getValueFrom(d)}return b.combinator(g)}function u(a,b,c,d){var e=b[3],f=e?e(d,c,!1):new PathObserver(d,b[2]);return b.isSimplePath?f:new ObserverTransform(f,b.combinator)}function v(a,b,c,d){if(b.onlyOneTime)return t(a,b,c,d);if(b.hasOnePath)return u(a,b,c,d);for(var e=new CompoundObserver,f=1;f<b.length;f+=4){var g=b[f],h=b[f+2];if(h){var i=h(d,c,g);g?e.addPath(i):e.addObserver(i)}else{var j=b[f+1];g?e.addPath(j.getValueFrom(d)):e.addPath(d,j)}}return new ObserverTransform(e,b.combinator)}function w(a,b,c,d){for(var e=0;e<b.length;e+=2){var f=b[e],g=b[e+1],h=v(f,g,a,c),i=a.bind(f,h,g.onlyOneTime);i&&d&&d.push(i)}if(a.bindFinished(),b.isTemplate){a.model_=c;var j=a.processBindingDirectives_(b);d&&j&&d.push(j)}}function x(a,b,c){var d=a.getAttribute(b);return s(""==d?"{{}}":d,b,a,c)}function y(a,c){b(a);for(var d=[],e=0;e<a.attributes.length;e++){for(var f=a.attributes[e],g=f.name,i=f.value;"_"===g[0];)g=g.substring(1);if(!h(a)||g!==J&&g!==H&&g!==I){var j=s(i,g,a,c);j&&d.push(g,j)}}return h(a)&&(d.isTemplate=!0,d.if=x(a,J,c),d.bind=x(a,H,c),d.repeat=x(a,I,c),!d.if||d.bind||d.repeat||(d.bind=s("{{}}",H,a,c))),d}function z(a,b){if(a.nodeType===Node.ELEMENT_NODE)return y(a,b);if(a.nodeType===Node.TEXT_NODE){var c=s(a.data,"textContent",a,b);if(c)return["textContent",c]}return[]}function A(a,b,c,d,e,f,g){for(var h=b.appendChild(c.importNode(a,!1)),i=0,j=a.firstChild;j;j=j.nextSibling)A(j,h,c,d.children[i++],e,f,g);return d.isTemplate&&(HTMLTemplateElement.decorate(h,a),f&&h.setDelegate_(f)),w(h,d,e,g),h}function B(a,b){var c=z(a,b);c.children={};for(var d=0,e=a.firstChild;e;e=e.nextSibling)c.children[d++]=B(e,b);return c}function C(a){var b=a.id_;return b||(b=a.id_=S++),b}function D(a,b){var c=C(a);if(b){var d=b.bindingMaps[c];return d||(d=b.bindingMaps[c]=B(a,b.prepareBinding)||[]),d}var d=a.bindingMap_;return d||(d=a.bindingMap_=B(a,void 0)||[]),d}function E(a){this.closed=!1,this.templateElement_=a,this.instances=[],this.deps=void 0,this.iteratedValue=[],this.presentValue=void 0,this.arrayObserver=void 0}var F,G=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.Map&&"function"==typeof a.Map.prototype.forEach?F=a.Map:(F=function(){this.keys=[],this.values=[]},F.prototype={set:function(a,b){var c=this.keys.indexOf(a);0>c?(this.keys.push(a),this.values.push(b)):this.values[c]=b},get:function(a){var b=this.keys.indexOf(a);if(!(0>b))return this.values[b]},"delete":function(a){var b=this.keys.indexOf(a);return 0>b?!1:(this.keys.splice(b,1),this.values.splice(b,1),!0)},forEach:function(a,b){for(var c=0;c<this.keys.length;c++)a.call(b||this,this.values[c],this.keys[c],this)}});"function"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)});var H="bind",I="repeat",J="if",K={template:!0,repeat:!0,bind:!0,ref:!0},L={THEAD:!0,TBODY:!0,TFOOT:!0,TH:!0,TR:!0,TD:!0,COLGROUP:!0,COL:!0,CAPTION:!0,OPTION:!0,OPTGROUP:!0},M="undefined"!=typeof HTMLTemplateElement;M&&!function(){var a=document.createElement("template"),b=a.content.ownerDocument,c=b.appendChild(b.createElement("html")),d=c.appendChild(b.createElement("head")),e=b.createElement("base");e.href=document.baseURI,d.appendChild(e)}();var N="template, "+Object.keys(L).map(function(a){return a.toLowerCase()+"[template]"}).join(", ");document.addEventListener("DOMContentLoaded",function(){j(document),Platform.performMicrotaskCheckpoint()},!1),M||(a.HTMLTemplateElement=function(){throw TypeError("Illegal constructor")});var O,P="__proto__"in{};"function"==typeof MutationObserver&&(O=new MutationObserver(function(a){for(var b=0;b<a.length;b++)a[b].target.refChanged_()})),HTMLTemplateElement.decorate=function(a,c){if(a.templateIsDecorated_)return!1;var d=a;d.templateIsDecorated_=!0;var h=f(d)&&M,i=h,k=!h,m=!1;if(h||(g(d)?(b(!c),d=n(a),d.templateIsDecorated_=!0,h=M,m=!0):e(d)&&(d=o(a),d.templateIsDecorated_=!0,h=M)),!h){q(d);var r=l(d);d.content_=r.createDocumentFragment()}return c?d.instanceRef_=c:k?p(d,a,m):i&&j(d.content),!0},HTMLTemplateElement.bootstrap=j;var Q=a.HTMLUnknownElement||HTMLElement,R={get:function(){return this.content_},enumerable:!0,configurable:!0};M||(HTMLTemplateElement.prototype=Object.create(Q.prototype),Object.defineProperty(HTMLTemplateElement.prototype,"content",R)),k(HTMLTemplateElement.prototype,{bind:function(a,b,c){if("ref"!=a)return Element.prototype.bind.call(this,a,b,c);var d=this,e=c?b:b.open(function(a){d.setAttribute("ref",a),d.refChanged_()});return this.setAttribute("ref",e),this.refChanged_(),c?void 0:(this.bindings_?this.bindings_.ref=b:this.bindings_={ref:b},b)},processBindingDirectives_:function(a){return this.iterator_&&this.iterator_.closeDeps(),a.if||a.bind||a.repeat?(this.iterator_||(this.iterator_=new E(this)),this.iterator_.updateDependencies(a,this.model_),O&&O.observe(this,{attributes:!0,attributeFilter:["ref"]}),this.iterator_):void(this.iterator_&&(this.iterator_.close(),this.iterator_=void 0))},createInstance:function(a,b,c){b?c=this.newDelegate_(b):c||(c=this.delegate_),this.refContent_||(this.refContent_=this.ref_.content);var d=this.refContent_;if(null===d.firstChild)return T;var e=D(d,c),f=m(this),g=f.createDocumentFragment();g.templateCreator_=this,g.protoContent_=d,g.bindings_=[],g.terminator_=null;for(var h=g.templateInstance_={firstNode:null,lastNode:null,model:a},i=0,j=!1,k=d.firstChild;k;k=k.nextSibling){null===k.nextSibling&&(j=!0);var l=A(k,g,f,e.children[i++],a,c,g.bindings_);l.templateInstance_=h,j&&(g.terminator_=l)}return h.firstNode=g.firstChild,h.lastNode=g.lastChild,g.templateCreator_=void 0,g.protoContent_=void 0,g},get model(){return this.model_},set model(a){this.model_=a,r(this)},get bindingDelegate(){return this.delegate_&&this.delegate_.raw},refChanged_:function(){this.iterator_&&this.refContent_!==this.ref_.content&&(this.refContent_=void 0,this.iterator_.valueChanged(),this.iterator_.updateIteratedValue(this.iterator_.getUpdatedValue()))},clear:function(){this.model_=void 0,this.delegate_=void 0,this.bindings_&&this.bindings_.ref&&this.bindings_.ref.close(),this.refContent_=void 0,this.iterator_&&(this.iterator_.valueChanged(),this.iterator_.close(),this.iterator_=void 0)},setDelegate_:function(a){this.delegate_=a,this.bindingMap_=void 0,this.iterator_&&(this.iterator_.instancePositionChangedFn_=void 0,this.iterator_.instanceModelFn_=void 0)},newDelegate_:function(a){function b(b){var c=a&&a[b];if("function"==typeof c)return function(){return c.apply(a,arguments)}}if(a)return{bindingMaps:{},raw:a,prepareBinding:b("prepareBinding"),prepareInstanceModel:b("prepareInstanceModel"),prepareInstancePositionChanged:b("prepareInstancePositionChanged")}},set bindingDelegate(a){if(this.delegate_)throw Error("Template must be cleared before a new bindingDelegate can be assigned");this.setDelegate_(this.newDelegate_(a))},get ref_(){var a=d(this,this.getAttribute("ref"));if(a||(a=this.instanceRef_),!a)return this;var b=a.ref_;return b?b:a}});var S=1;Object.defineProperty(Node.prototype,"templateInstance",{get:function(){var a=this.templateInstance_;return a?a:this.parentNode?this.parentNode.templateInstance:void 0}});var T=document.createDocumentFragment();T.bindings_=[],T.terminator_=null,E.prototype={closeDeps:function(){var a=this.deps;a&&(a.ifOneTime===!1&&a.ifValue.close(),a.oneTime===!1&&a.value.close())},updateDependencies:function(a,b){this.closeDeps();var c=this.deps={},d=this.templateElement_,e=!0;if(a.if){if(c.hasIf=!0,c.ifOneTime=a.if.onlyOneTime,c.ifValue=v(J,a.if,d,b),e=c.ifValue,c.ifOneTime&&!e)return void this.valueChanged();c.ifOneTime||(e=e.open(this.updateIfValue,this))}a.repeat?(c.repeat=!0,c.oneTime=a.repeat.onlyOneTime,c.value=v(I,a.repeat,d,b)):(c.repeat=!1,c.oneTime=a.bind.onlyOneTime,c.value=v(H,a.bind,d,b));var f=c.value;return c.oneTime||(f=f.open(this.updateIteratedValue,this)),e?void this.updateValue(f):void this.valueChanged()},getUpdatedValue:function(){var a=this.deps.value;return this.deps.oneTime||(a=a.discardChanges()),a},updateIfValue:function(a){return a?void this.updateValue(this.getUpdatedValue()):void this.valueChanged()},updateIteratedValue:function(a){if(this.deps.hasIf){var b=this.deps.ifValue;if(this.deps.ifOneTime||(b=b.discardChanges()),!b)return void this.valueChanged()}this.updateValue(a)},updateValue:function(a){this.deps.repeat||(a=[a]);var b=this.deps.repeat&&!this.deps.oneTime&&Array.isArray(a);this.valueChanged(a,b)},valueChanged:function(a,b){Array.isArray(a)||(a=[]),a!==this.iteratedValue&&(this.unobserve(),this.presentValue=a,b&&(this.arrayObserver=new ArrayObserver(this.presentValue),this.arrayObserver.open(this.handleSplices,this)),this.handleSplices(ArrayObserver.calculateSplices(this.presentValue,this.iteratedValue)))},getLastInstanceNode:function(a){if(-1==a)return this.templateElement_;var b=this.instances[a],c=b.terminator_;if(!c)return this.getLastInstanceNode(a-1);if(c.nodeType!==Node.ELEMENT_NODE||this.templateElement_===c)return c;var d=c.iterator_;return d?d.getLastTemplateNode():c},getLastTemplateNode:function(){return this.getLastInstanceNode(this.instances.length-1)},insertInstanceAt:function(a,b){var c=this.getLastInstanceNode(a-1),d=this.templateElement_.parentNode;this.instances.splice(a,0,b),d.insertBefore(b,c.nextSibling)},extractInstanceAt:function(a){for(var b=this.getLastInstanceNode(a-1),c=this.getLastInstanceNode(a),d=this.templateElement_.parentNode,e=this.instances.splice(a,1)[0];c!==b;){var f=b.nextSibling;f==c&&(c=b),e.appendChild(d.removeChild(f))}return e},getDelegateFn:function(a){return a=a&&a(this.templateElement_),"function"==typeof a?a:null},handleSplices:function(a){if(!this.closed&&a.length){var b=this.templateElement_;if(!b.parentNode)return void this.close();ArrayObserver.applySplices(this.iteratedValue,this.presentValue,a);var c=b.delegate_;void 0===this.instanceModelFn_&&(this.instanceModelFn_=this.getDelegateFn(c&&c.prepareInstanceModel)),void 0===this.instancePositionChangedFn_&&(this.instancePositionChangedFn_=this.getDelegateFn(c&&c.prepareInstancePositionChanged));for(var d=new F,e=0,f=0;f<a.length;f++){for(var g=a[f],h=g.removed,i=0;i<h.length;i++){var j=h[i],k=this.extractInstanceAt(g.index+e);k!==T&&d.set(j,k)}e-=g.addedCount}for(var f=0;f<a.length;f++)for(var g=a[f],l=g.index;l<g.index+g.addedCount;l++){var j=this.iteratedValue[l],k=d.get(j);k?d.delete(j):(this.instanceModelFn_&&(j=this.instanceModelFn_(j)),k=void 0===j?T:b.createInstance(j,void 0,c)),this.insertInstanceAt(l,k)}d.forEach(function(a){this.closeInstanceBindings(a)},this),this.instancePositionChangedFn_&&this.reportInstancesMoved(a)}},reportInstanceMoved:function(a){var b=this.instances[a];b!==T&&this.instancePositionChangedFn_(b.templateInstance_,a)},reportInstancesMoved:function(a){for(var b=0,c=0,d=0;d<a.length;d++){var e=a[d];if(0!=c)for(;b<e.index;)this.reportInstanceMoved(b),b++;else b=e.index;for(;b<e.index+e.addedCount;)this.reportInstanceMoved(b),b++;c+=e.addedCount-e.removed.length}if(0!=c)for(var f=this.instances.length;f>b;)this.reportInstanceMoved(b),b++},closeInstanceBindings:function(a){for(var b=a.bindings_,c=0;c<b.length;c++)b[c].close()},unobserve:function(){this.arrayObserver&&(this.arrayObserver.close(),this.arrayObserver=void 0)},close:function(){if(!this.closed){this.unobserve();for(var a=0;a<this.instances.length;a++)this.closeInstanceBindings(this.instances[a]);this.instances.length=0,this.closeDeps(),this.templateElement_.iterator_=void 0,this.closed=!0}}},HTMLTemplateElement.forAllTemplatesFrom_=i}(this),function(a){function b(a){f.textContent=d++,e.push(a)}function c(){for(;e.length;)e.shift()()}var d=0,e=[],f=document.createTextNode("");new(window.MutationObserver||JsMutationObserver)(c).observe(f,{characterData:!0}),a.endOfMicrotask=b}(Platform),function(a){function b(){e||(e=!0,a.endOfMicrotask(function(){e=!1,logFlags.data&&console.group("Platform.flush()"),a.performMicrotaskCheckpoint(),logFlags.data&&console.groupEnd()}))}var c=document.createElement("style");c.textContent="template {display: none !important;} /* injected by platform.js */";var d=document.querySelector("head");d.insertBefore(c,d.firstChild);var e;if(Observer.hasObjectObserve)b=function(){};else{var f=125;window.addEventListener("WebComponentsReady",function(){b(),a.flushPoll=setInterval(b,f)})}if(window.CustomElements&&!CustomElements.useNative){var g=Document.prototype.importNode;Document.prototype.importNode=function(a,b){var c=g.call(this,a,b);return CustomElements.upgradeAll(c),c}}a.flush=b}(window.Platform),function(a){function b(a,b,d,e){return a.replace(e,function(a,e,f,g){var h=f.replace(/["']/g,"");return h=c(b,h,d),e+"'"+h+"'"+g})}function c(a,b,c){if(b&&"/"===b[0])return b;var e=new URL(b,a);return c?e.href:d(e.href)}function d(a){var b=new URL(document.baseURI),c=new URL(a,b);return c.host===b.host&&c.port===b.port&&c.protocol===b.protocol?e(b,c):a}function e(a,b){for(var c=a.pathname,d=b.pathname,e=c.split("/"),f=d.split("/");e.length&&e[0]===f[0];)e.shift(),f.shift();for(var g=0,h=e.length-1;h>g;g++)f.unshift("..");return f.join("/")+b.search+b.hash}var f={resolveDom:function(a,b){b=b||a.ownerDocument.baseURI,this.resolveAttributes(a,b),this.resolveStyles(a,b);var c=a.querySelectorAll("template");if(c)for(var d,e=0,f=c.length;f>e&&(d=c[e]);e++)d.content&&this.resolveDom(d.content,b)},resolveTemplate:function(a){this.resolveDom(a.content,a.ownerDocument.baseURI)},resolveStyles:function(a,b){var c=a.querySelectorAll("style");if(c)for(var d,e=0,f=c.length;f>e&&(d=c[e]);e++)this.resolveStyle(d,b)},resolveStyle:function(a,b){b=b||a.ownerDocument.baseURI,a.textContent=this.resolveCssText(a.textContent,b)},resolveCssText:function(a,c,d){return a=b(a,c,d,g),b(a,c,d,h)},resolveAttributes:function(a,b){a.hasAttributes&&a.hasAttributes()&&this.resolveElementAttributes(a,b);var c=a&&a.querySelectorAll(j);if(c)for(var d,e=0,f=c.length;f>e&&(d=c[e]);e++)this.resolveElementAttributes(d,b)},resolveElementAttributes:function(a,d){d=d||a.ownerDocument.baseURI,i.forEach(function(e){var f,h=a.attributes[e],i=h&&h.value;i&&i.search(k)<0&&(f="style"===e?b(i,d,!1,g):c(d,i),h.value=f)})}},g=/(url\()([^)]*)(\))/g,h=/(@import[\s]+(?!url\())([^;]*)(;)/g,i=["href","src","action","style","url"],j="["+i.join("],[")+"]",k="{{.*}}";a.urlResolver=f}(Polymer),function(a){function b(a){this.cache=Object.create(null),this.map=Object.create(null),this.requests=0,this.regex=a}var c=Platform.endOfMicrotask;b.prototype={extractUrls:function(a,b){for(var c,d,e=[];c=this.regex.exec(a);)d=new URL(c[1],b),e.push({matched:c[0],url:d.href});return e},process:function(a,b,c){var d=this.extractUrls(a,b),e=c.bind(null,this.map);this.fetch(d,e)},fetch:function(a,b){var c=a.length;if(!c)return b();for(var d,e,f,g=function(){0===--c&&b()},h=0;c>h;h++)d=a[h],f=d.url,e=this.cache[f],e||(e=this.xhr(f),e.match=d,this.cache[f]=e),e.wait(g)},handleXhr:function(a){var b=a.match,c=b.url,d=a.response||a.responseText||"";this.map[c]=d,this.fetch(this.extractUrls(d,c),a.resolve)},xhr:function(a){this.requests++;var b=new XMLHttpRequest;return b.open("GET",a,!0),b.send(),b.onerror=b.onload=this.handleXhr.bind(this,b),b.pending=[],b.resolve=function(){for(var a=b.pending,c=0;c<a.length;c++)a[c]();b.pending=null},b.wait=function(a){b.pending?b.pending.push(a):c(a)},b}},a.Loader=b}(Polymer),function(a){function b(){this.loader=new d(this.regex)}var c=a.urlResolver,d=a.Loader;b.prototype={regex:/@import\s+(?:url)?["'\(]*([^'"\)]*)['"\)]*;/g,resolve:function(a,b,c){var d=function(d){c(this.flatten(a,b,d))}.bind(this);this.loader.process(a,b,d)},resolveNode:function(a,b,c){var d=a.textContent,e=function(b){a.textContent=b,c(a)};this.resolve(d,b,e)},flatten:function(a,b,d){for(var e,f,g,h=this.loader.extractUrls(a,b),i=0;i<h.length;i++)e=h[i],f=e.url,g=c.resolveCssText(d[f],f,!0),g=this.flatten(g,b,d),a=a.replace(e.matched,g);return a},loadStyles:function(a,b,c){function d(){f++,f===g&&c&&c()}for(var e,f=0,g=a.length,h=0;g>h&&(e=a[h]);h++)this.resolveNode(e,b,d)}};var e=new b;a.styleResolver=e}(Polymer),function(a){function b(a,b){return a&&b&&Object.getOwnPropertyNames(b).forEach(function(c){var d=Object.getOwnPropertyDescriptor(b,c);d&&(Object.defineProperty(a,c,d),"function"==typeof d.value&&(d.value.nom=c))}),a}function c(a){for(var b=a||{},c=1;c<arguments.length;c++){var e=arguments[c];try{for(var f in e)d(f,e,b)}catch(g){}}return b}function d(a,b,c){var d=e(b,a);Object.defineProperty(c,a,d)}function e(a,b){if(a){var c=Object.getOwnPropertyDescriptor(a,b);return c||e(Object.getPrototypeOf(a),b)}}a.extend=b,a.mixin=c,Platform.mixin=c}(Polymer),function(a){function b(a,b,d){return a?a.stop():a=new c(this),a.go(b,d),a}var c=function(a){this.context=a,this.boundComplete=this.complete.bind(this)};c.prototype={go:function(a,b){this.callback=a;var c;b?(c=setTimeout(this.boundComplete,b),this.handle=function(){clearTimeout(c)}):(c=requestAnimationFrame(this.boundComplete),this.handle=function(){cancelAnimationFrame(c)})},stop:function(){this.handle&&(this.handle(),this.handle=null)},complete:function(){this.handle&&(this.stop(),this.callback.call(this.context))}},a.job=b}(Polymer),function(a){function b(a,b,c){var d="string"==typeof a?document.createElement(a):a.cloneNode(!0);if(d.innerHTML=b,c)for(var e in c)d.setAttribute(e,c[e]);return d}var c={};HTMLElement.register=function(a,b){c[a]=b},HTMLElement.getPrototypeForTag=function(a){var b=a?c[a]:HTMLElement.prototype;return b||Object.getPrototypeOf(document.createElement(a))};var d=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){this.cancelBubble=!0,d.apply(this,arguments)};var e=DOMTokenList.prototype.add,f=DOMTokenList.prototype.remove;DOMTokenList.prototype.add=function(){for(var a=0;a<arguments.length;a++)e.call(this,arguments[a])},DOMTokenList.prototype.remove=function(){for(var a=0;a<arguments.length;a++)f.call(this,arguments[a])},DOMTokenList.prototype.toggle=function(a,b){1==arguments.length&&(b=!this.contains(a)),b?this.add(a):this.remove(a)},DOMTokenList.prototype.switch=function(a,b){a&&this.remove(a),b&&this.add(b)};var g=function(){return Array.prototype.slice.call(this)},h=window.NamedNodeMap||window.MozNamedAttrMap||{};NodeList.prototype.array=g,h.prototype.array=g,HTMLCollection.prototype.array=g,a.createDOM=b}(Polymer),function(a){function b(a){var e=b.caller,g=e.nom,h=e._super;h||(g||(g=e.nom=c.call(this,e)),g||console.warn("called super() on a method not installed declaratively (has no .nom property)"),h=d(e,g,f(this)));var i=h[g];return i?(i._super||d(i,g,h),i.apply(this,a||[])):void 0}function c(a){for(var b=this.__proto__;b&&b!==HTMLElement.prototype;){for(var c,d=Object.getOwnPropertyNames(b),e=0,f=d.length;f>e&&(c=d[e]);e++){var g=Object.getOwnPropertyDescriptor(b,c);if("function"==typeof g.value&&g.value===a)return c}b=b.__proto__}}function d(a,b,c){var d=e(c,b,a);return d[b]&&(d[b].nom=b),a._super=d}function e(a,b,c){for(;a;){if(a[b]!==c&&a[b])return a;a=f(a)}return Object}function f(a){return a.__proto__}a.super=b}(Polymer),function(a){function b(a){return a}function c(a,b){var c=typeof b;return b instanceof Date&&(c="date"),d[c](a,b)}var d={string:b,undefined:b,date:function(a){return new Date(Date.parse(a)||Date.now())},"boolean":function(a){return""===a?!0:"false"===a?!1:!!a},number:function(a){var b=parseFloat(a);return 0===b&&(b=parseInt(a)),isNaN(b)?a:b},object:function(a,b){if(null===b)return a;try{return JSON.parse(a.replace(/'/g,'"'))}catch(c){return a}},"function":function(a,b){return b}};a.deserializeValue=c}(Polymer),function(a){var b=a.extend,c={};c.declaration={},c.instance={},c.publish=function(a,c){for(var d in a)b(c,a[d])},a.api=c}(Polymer),function(a){var b={async:function(a,b,c){Platform.flush(),b=b&&b.length?b:[b];var d=function(){(this[a]||a).apply(this,b)}.bind(this),e=c?setTimeout(d,c):requestAnimationFrame(d);return c?e:~e},cancelAsync:function(a){0>a?cancelAnimationFrame(~a):clearTimeout(a)},fire:function(a,b,c,d,e){var f=c||this,b=null===b||void 0===b?{}:b,g=new CustomEvent(a,{bubbles:void 0!==d?d:!0,cancelable:void 0!==e?e:!0,detail:b});return f.dispatchEvent(g),g},asyncFire:function(){this.async("fire",arguments)},classFollows:function(a,b,c){b&&b.classList.remove(c),a&&a.classList.add(c)},injectBoundHTML:function(a,b){var c=document.createElement("template");c.innerHTML=a;var d=this.instanceTemplate(c);return b&&(b.textContent="",b.appendChild(d)),d}},c=function(){},d={};b.asyncMethod=b.async,a.api.instance.utils=b,a.nop=c,a.nob=d}(Polymer),function(a){var b=window.logFlags||{},c="on-",d={EVENT_PREFIX:c,addHostListeners:function(){var a=this.eventDelegates;b.events&&Object.keys(a).length>0&&console.log("[%s] addHostListeners:",this.localName,a);for(var c in a){var d=a[c];PolymerGestures.addEventListener(this,c,this.element.getEventHandler(this,this,d))}},dispatchMethod:function(a,c,d){if(a){b.events&&console.group("[%s] dispatch [%s]",a.localName,c);var e="function"==typeof c?c:a[c];e&&e[d?"apply":"call"](a,d),b.events&&console.groupEnd(),Platform.flush()}}};a.api.instance.events=d,a.addEventListener=function(a,b,c,d){PolymerGestures.addEventListener(wrap(a),b,c,d)},a.removeEventListener=function(a,b,c,d){PolymerGestures.removeEventListener(wrap(a),b,c,d)}}(Polymer),function(a){var b={copyInstanceAttributes:function(){var a=this._instanceAttributes;for(var b in a)this.hasAttribute(b)||this.setAttribute(b,a[b])},takeAttributes:function(){if(this._publishLC)for(var a,b=0,c=this.attributes,d=c.length;(a=c[b])&&d>b;b++)this.attributeToProperty(a.name,a.value)},attributeToProperty:function(b,c){var b=this.propertyForAttribute(b);if(b){if(c&&c.search(a.bindPattern)>=0)return;var d=this[b],c=this.deserializeValue(c,d);c!==d&&(this[b]=c)}},propertyForAttribute:function(a){var b=this._publishLC&&this._publishLC[a];return b},deserializeValue:function(b,c){return a.deserializeValue(b,c)},serializeValue:function(a,b){return"boolean"===b?a?"":void 0:"object"!==b&&"function"!==b&&void 0!==a?a:void 0},reflectPropertyToAttribute:function(a){var b=typeof this[a],c=this.serializeValue(this[a],b);void 0!==c?this.setAttribute(a,c):"boolean"===b&&this.removeAttribute(a)}};a.api.instance.attributes=b}(Polymer),function(a){function b(a,b){return a===b?0!==a||1/a===1/b:f(a)&&f(b)?!0:a!==a&&b!==b}function c(a,b){return void 0===b&&null===a?b:null===b||void 0===b?a:b}var d=window.logFlags||{},e={object:void 0,type:"update",name:void 0,oldValue:void 0},f=Number.isNaN||function(a){return"number"==typeof a&&isNaN(a)},g={createPropertyObserver:function(){var a=this._observeNames;if(a&&a.length){var b=this._propertyObserver=new CompoundObserver(!0);this.registerObserver(b);for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)b.addPath(this,c),this.observeArrayValue(c,this[c],null)}},openPropertyObserver:function(){this._propertyObserver&&this._propertyObserver.open(this.notifyPropertyChanges,this)},notifyPropertyChanges:function(a,b,c){var d,e,f={};for(var g in b)if(d=c[2*g+1],e=this.observe[d]){var h=b[g],i=a[g];this.observeArrayValue(d,i,h),f[e]||(void 0!==h&&null!==h||void 0!==i&&null!==i)&&(f[e]=!0,this.invokeMethod(e,[h,i,arguments]))}},deliverChanges:function(){this._propertyObserver&&this._propertyObserver.deliver()},propertyChanged_:function(a){this.reflect[a]&&this.reflectPropertyToAttribute(a)},observeArrayValue:function(a,b,c){var e=this.observe[a];if(e&&(Array.isArray(c)&&(d.observe&&console.log("[%s] observeArrayValue: unregister observer [%s]",this.localName,a),this.closeNamedObserver(a+"__array")),Array.isArray(b))){d.observe&&console.log("[%s] observeArrayValue: register observer [%s]",this.localName,a,b);var f=new ArrayObserver(b);f.open(function(a){this.invokeMethod(e,[a])},this),this.registerNamedObserver(a+"__array",f)}},emitPropertyChangeRecord:function(a,c,d){if(!b(c,d)&&(this.propertyChanged_(a,c,d),Observer.hasObjectObserve)){var f=this.notifier_;f||(f=this.notifier_=Object.getNotifier(this)),e.object=this,e.name=a,e.oldValue=d,f.notify(e)}},bindToAccessor:function(a,c,d){function e(b,c){j[f]=b;var d=j[h];d&&"function"==typeof d.setValue&&d.setValue(b),j.emitPropertyChangeRecord(a,b,c)}var f=a+"_",g=a+"Observable_",h=a+"ComputedBoundObservable_";this[g]=c;var i=this[f],j=this,k=c.open(e);if(d&&!b(i,k)){var l=d(i,k);b(k,l)||(k=l,c.setValue&&c.setValue(k))}e(k,i);var m={close:function(){c.close(),j[g]=void 0,j[h]=void 0}};return this.registerObserver(m),m},createComputedProperties:function(){if(this._computedNames)for(var a=0;a<this._computedNames.length;a++){var b=this._computedNames[a],c=this.computed[b];try{var d=PolymerExpressions.getExpression(c),e=d.getBinding(this,this.element.syntax);this.bindToAccessor(b,e)}catch(f){console.error("Failed to create computed property",f)}}},bindProperty:function(a,b,d){if(d)return void(this[a]=b);var e=this.element.prototype.computed;if(e&&e[a]){var f=a+"ComputedBoundObservable_";return void(this[f]=b)}return this.bindToAccessor(a,b,c)},invokeMethod:function(a,b){var c=this[a]||a;"function"==typeof c&&c.apply(this,b)},registerObserver:function(a){return this._observers?void this._observers.push(a):void(this._observers=[a])},closeObservers:function(){if(this._observers){for(var a=this._observers,b=0;b<a.length;b++){var c=a[b];c&&"function"==typeof c.close&&c.close()}this._observers=[]}},registerNamedObserver:function(a,b){var c=this._namedObservers||(this._namedObservers={});c[a]=b},closeNamedObserver:function(a){var b=this._namedObservers;return b&&b[a]?(b[a].close(),b[a]=null,!0):void 0},closeNamedObservers:function(){if(this._namedObservers){for(var a in this._namedObservers)this.closeNamedObserver(a);this._namedObservers={}}}};a.api.instance.properties=g}(Polymer),function(a){var b=window.logFlags||0,c={instanceTemplate:function(a){HTMLTemplateElement.decorate(a);for(var b=this.syntax||!a.bindingDelegate&&this.element.syntax,c=a.createInstance(this,b),d=c.bindings_,e=0;e<d.length;e++)this.registerObserver(d[e]);return c},bind:function(a,b,c){var d=this.propertyForAttribute(a);if(d){var e=this.bindProperty(d,b,c);return Platform.enableBindingsReflection&&e&&(e.path=b.path_,this._recordBinding(d,e)),this.reflect[d]&&this.reflectPropertyToAttribute(d),e}return this.mixinSuper(arguments)},bindFinished:function(){this.makeElementReady()},_recordBinding:function(a,b){this.bindings_=this.bindings_||{},this.bindings_[a]=b},asyncUnbindAll:function(){this._unbound||(b.unbind&&console.log("[%s] asyncUnbindAll",this.localName),this._unbindAllJob=this.job(this._unbindAllJob,this.unbindAll,0))},unbindAll:function(){this._unbound||(this.closeObservers(),this.closeNamedObservers(),this._unbound=!0)},cancelUnbindAll:function(){return this._unbound?void(b.unbind&&console.warn("[%s] already unbound, cannot cancel unbindAll",this.localName)):(b.unbind&&console.log("[%s] cancelUnbindAll",this.localName),void(this._unbindAllJob&&(this._unbindAllJob=this._unbindAllJob.stop())))}},d=/\{\{([^{}]*)}}/;a.bindPattern=d,a.api.instance.mdv=c}(Polymer),function(a){function b(a){return a.hasOwnProperty("PolymerBase")}function c(){}var d={PolymerBase:!0,job:function(a,b,c){if("string"!=typeof a)return Polymer.job.call(this,a,b,c);var d="___"+a;this[d]=Polymer.job.call(this,this[d],b,c)},"super":Polymer.super,created:function(){},ready:function(){},createdCallback:function(){this.templateInstance&&this.templateInstance.model&&console.warn("Attributes on "+this.localName+" were data bound prior to Polymer upgrading the element. This may result in incorrect binding types."),this.created(),this.prepareElement(),this.ownerDocument.isStagingDocument||this.makeElementReady()},prepareElement:function(){return this._elementPrepared?void console.warn("Element already prepared",this.localName):(this._elementPrepared=!0,this.shadowRoots={},this.createPropertyObserver(),this.openPropertyObserver(),this.copyInstanceAttributes(),this.takeAttributes(),void this.addHostListeners())},makeElementReady:function(){this._readied||(this._readied=!0,this.createComputedProperties(),this.parseDeclarations(this.__proto__),this.removeAttribute("unresolved"),this.ready())},attachedCallback:function(){this.cancelUnbindAll(),this.attached&&this.attached(),this.enteredView&&this.enteredView(),this.hasBeenAttached||(this.hasBeenAttached=!0,this.domReady&&this.async("domReady"))},detachedCallback:function(){this.preventDispose||this.asyncUnbindAll(),this.detached&&this.detached(),this.leftView&&this.leftView()},enteredViewCallback:function(){this.attachedCallback()},leftViewCallback:function(){this.detachedCallback()},enteredDocumentCallback:function(){this.attachedCallback()},leftDocumentCallback:function(){this.detachedCallback()},parseDeclarations:function(a){a&&a.element&&(this.parseDeclarations(a.__proto__),a.parseDeclaration.call(this,a.element))},parseDeclaration:function(a){var b=this.fetchTemplate(a);if(b){var c=this.shadowFromTemplate(b);this.shadowRoots[a.name]=c}},fetchTemplate:function(a){return a.querySelector("template")},shadowFromTemplate:function(a){if(a){var b=this.createShadowRoot(),c=this.instanceTemplate(a);return b.appendChild(c),this.shadowRootReady(b,a),b}},lightFromTemplate:function(a,b){if(a){this.eventController=this;var c=this.instanceTemplate(a);return b?this.insertBefore(c,b):this.appendChild(c),this.shadowRootReady(this),c}},shadowRootReady:function(a){this.marshalNodeReferences(a)},marshalNodeReferences:function(a){var b=this.$=this.$||{};if(a)for(var c,d=a.querySelectorAll("[id]"),e=0,f=d.length;f>e&&(c=d[e]);e++)b[c.id]=c},attributeChangedCallback:function(a){"class"!==a&&"style"!==a&&this.attributeToProperty(a,this.getAttribute(a)),this.attributeChanged&&this.attributeChanged.apply(this,arguments)},onMutation:function(a,b){var c=new MutationObserver(function(a){b.call(this,c,a),c.disconnect()}.bind(this));c.observe(a,{childList:!0,subtree:!0})}};c.prototype=d,d.constructor=c,a.Base=c,a.isBase=b,a.api.instance.base=d}(Polymer),function(a){function b(a){return a.__proto__}function c(a,b){var c="",d=!1;b&&(c=b.localName,d=b.hasAttribute("is"));var e=Platform.ShadowCSS.makeScopeSelector(c,d);return Platform.ShadowCSS.shimCssText(a,e)}var d=(window.logFlags||{},window.ShadowDOMPolyfill),e="element",f="controller",g={STYLE_SCOPE_ATTRIBUTE:e,installControllerStyles:function(){var a=this.findStyleScope();if(a&&!this.scopeHasNamedStyle(a,this.localName)){for(var c=b(this),d="";c&&c.element;)d+=c.element.cssTextForScope(f),c=b(c);d&&this.installScopeCssText(d,a)}},installScopeStyle:function(a,b,c){var c=c||this.findStyleScope(),b=b||"";if(c&&!this.scopeHasNamedStyle(c,this.localName+b)){var d="";if(a instanceof Array)for(var e,f=0,g=a.length;g>f&&(e=a[f]);f++)d+=e.textContent+"\n\n";else d=a.textContent;this.installScopeCssText(d,c,b)}},installScopeCssText:function(a,b,e){if(b=b||this.findStyleScope(),e=e||"",b){d&&(a=c(a,b.host));var g=this.element.cssTextToScopeStyle(a,f);Polymer.applyStyleToScope(g,b),this.styleCacheForScope(b)[this.localName+e]=!0}},findStyleScope:function(a){for(var b=a||this;b.parentNode;)b=b.parentNode;return b},scopeHasNamedStyle:function(a,b){var c=this.styleCacheForScope(a); +return c[b]},styleCacheForScope:function(a){if(d){var b=a.host?a.host.localName:a.localName;return h[b]||(h[b]={})}return a._scopeStyles=a._scopeStyles||{}}},h={};a.api.instance.styles=g}(Polymer),function(a){function b(a,b){if("string"!=typeof a){var c=b||document._currentScript;if(b=a,a=c&&c.parentNode&&c.parentNode.getAttribute?c.parentNode.getAttribute("name"):"",!a)throw"Element name could not be inferred."}if(f[a])throw"Already registered (Polymer) prototype for element "+a;e(a,b),d(a)}function c(a,b){i[a]=b}function d(a){i[a]&&(i[a].registerWhenReady(),delete i[a])}function e(a,b){return j[a]=b||{}}function f(a){return j[a]}function g(a,b){if("string"!=typeof b)return!1;var c=HTMLElement.getPrototypeForTag(b),d=c&&c.constructor;return d?CustomElements.instanceof?CustomElements.instanceof(a,d):a instanceof d:!1}var h=a.extend,i=(a.api,{}),j={};a.getRegisteredPrototype=f,a.waitingForPrototype=c,a.instanceOfType=g,window.Polymer=b,h(Polymer,a),Platform.consumeDeclarations&&Platform.consumeDeclarations(function(a){if(a)for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)b.apply(null,c)})}(Polymer),function(a){var b={resolveElementPaths:function(a){Polymer.urlResolver.resolveDom(a)},addResolvePathApi:function(){var a=this.getAttribute("assetpath")||"",b=new URL(a,this.ownerDocument.baseURI);this.prototype.resolvePath=function(a,c){var d=new URL(a,c||b);return d.href}}};a.api.declaration.path=b}(Polymer),function(a){function b(a,b){var c=new URL(a.getAttribute("href"),b).href;return"@import '"+c+"';"}function c(a,b){if(a){b===document&&(b=document.head),i&&(b=document.head);var c=d(a.textContent),e=a.getAttribute(h);e&&c.setAttribute(h,e);var f=b.firstElementChild;if(b===document.head){var g="style["+h+"]",j=document.head.querySelectorAll(g);j.length&&(f=j[j.length-1].nextElementSibling)}b.insertBefore(c,f)}}function d(a,b){b=b||document,b=b.createElement?b:b.ownerDocument;var c=b.createElement("style");return c.textContent=a,c}function e(a){return a&&a.__resource||""}function f(a,b){return q?q.call(a,b):void 0}var g=(window.logFlags||{},a.api.instance.styles),h=g.STYLE_SCOPE_ATTRIBUTE,i=window.ShadowDOMPolyfill,j="style",k="@import",l="link[rel=stylesheet]",m="global",n="polymer-scope",o={loadStyles:function(a){var b=this.fetchTemplate(),c=b&&this.templateContent();if(c){this.convertSheetsToStyles(c);var d=this.findLoadableStyles(c);if(d.length){var e=b.ownerDocument.baseURI;return Polymer.styleResolver.loadStyles(d,e,a)}}a&&a()},convertSheetsToStyles:function(a){for(var c,e,f=a.querySelectorAll(l),g=0,h=f.length;h>g&&(c=f[g]);g++)e=d(b(c,this.ownerDocument.baseURI),this.ownerDocument),this.copySheetAttributes(e,c),c.parentNode.replaceChild(e,c)},copySheetAttributes:function(a,b){for(var c,d=0,e=b.attributes,f=e.length;(c=e[d])&&f>d;d++)"rel"!==c.name&&"href"!==c.name&&a.setAttribute(c.name,c.value)},findLoadableStyles:function(a){var b=[];if(a)for(var c,d=a.querySelectorAll(j),e=0,f=d.length;f>e&&(c=d[e]);e++)c.textContent.match(k)&&b.push(c);return b},installSheets:function(){this.cacheSheets(),this.cacheStyles(),this.installLocalSheets(),this.installGlobalStyles()},cacheSheets:function(){this.sheets=this.findNodes(l),this.sheets.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},cacheStyles:function(){this.styles=this.findNodes(j+"["+n+"]"),this.styles.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},installLocalSheets:function(){var a=this.sheets.filter(function(a){return!a.hasAttribute(n)}),b=this.templateContent();if(b){var c="";if(a.forEach(function(a){c+=e(a)+"\n"}),c){var f=d(c,this.ownerDocument);b.insertBefore(f,b.firstChild)}}},findNodes:function(a,b){var c=this.querySelectorAll(a).array(),d=this.templateContent();if(d){var e=d.querySelectorAll(a).array();c=c.concat(e)}return b?c.filter(b):c},installGlobalStyles:function(){var a=this.styleForScope(m);c(a,document.head)},cssTextForScope:function(a){var b="",c="["+n+"="+a+"]",d=function(a){return f(a,c)},g=this.sheets.filter(d);g.forEach(function(a){b+=e(a)+"\n\n"});var h=this.styles.filter(d);return h.forEach(function(a){b+=a.textContent+"\n\n"}),b},styleForScope:function(a){var b=this.cssTextForScope(a);return this.cssTextToScopeStyle(b,a)},cssTextToScopeStyle:function(a,b){if(a){var c=d(a);return c.setAttribute(h,this.getAttribute("name")+"-"+b),c}}},p=HTMLElement.prototype,q=p.matches||p.matchesSelector||p.webkitMatchesSelector||p.mozMatchesSelector;a.api.declaration.styles=o,a.applyStyleToScope=c}(Polymer),function(a){var b=(window.logFlags||{},a.api.instance.events),c=b.EVENT_PREFIX,d={};["webkitAnimationStart","webkitAnimationEnd","webkitTransitionEnd","DOMFocusOut","DOMFocusIn","DOMMouseScroll"].forEach(function(a){d[a.toLowerCase()]=a});var e={parseHostEvents:function(){var a=this.prototype.eventDelegates;this.addAttributeDelegates(a)},addAttributeDelegates:function(a){for(var b,c=0;b=this.attributes[c];c++)this.hasEventPrefix(b.name)&&(a[this.removeEventPrefix(b.name)]=b.value.replace("{{","").replace("}}","").trim())},hasEventPrefix:function(a){return a&&"o"===a[0]&&"n"===a[1]&&"-"===a[2]},removeEventPrefix:function(a){return a.slice(f)},findController:function(a){for(;a.parentNode;){if(a.eventController)return a.eventController;a=a.parentNode}return a.host},getEventHandler:function(a,b,c){var d=this;return function(e){a&&a.PolymerBase||(a=d.findController(b));var f=[e,e.detail,e.currentTarget];a.dispatchMethod(a,c,f)}},prepareEventBinding:function(a,b){if(this.hasEventPrefix(b)){var c=this.removeEventPrefix(b);c=d[c]||c;var e=this;return function(b,d,f){function g(){return"{{ "+a+" }}"}var h=e.getEventHandler(void 0,d,a);return PolymerGestures.addEventListener(d,c,h),f?void 0:{open:g,discardChanges:g,close:function(){PolymerGestures.removeEventListener(d,c,h)}}}}}},f=c.length;a.api.declaration.events=e}(Polymer),function(a){var b={inferObservers:function(a){var b,c=a.observe;for(var d in a)"Changed"===d.slice(-7)&&(c||(c=a.observe={}),b=d.slice(0,-7),c[b]=c[b]||d)},explodeObservers:function(a){var b=a.observe;if(b){var c={};for(var d in b)for(var e,f=d.split(" "),g=0;e=f[g];g++)c[e]=b[d];a.observe=c}},optimizePropertyMaps:function(a){if(a.observe){var b=a._observeNames=[];for(var c in a.observe)for(var d,e=c.split(" "),f=0;d=e[f];f++)b.push(d)}if(a.publish){var b=a._publishNames=[];for(var c in a.publish)b.push(c)}if(a.computed){var b=a._computedNames=[];for(var c in a.computed)b.push(c)}},publishProperties:function(a,b){var c=a.publish;c&&(this.requireProperties(c,a,b),a._publishLC=this.lowerCaseMap(c))},requireProperties:function(a,b){b.reflect=b.reflect||{};for(var c in a){var d=a[c];d&&void 0!==d.reflect&&(b.reflect[c]=Boolean(d.reflect),d=d.value),void 0!==d&&(b[c]=d)}},lowerCaseMap:function(a){var b={};for(var c in a)b[c.toLowerCase()]=c;return b},createPropertyAccessor:function(a,b){var c=this.prototype,d=a+"_",e=a+"Observable_";c[d]=c[a],Object.defineProperty(c,a,{get:function(){var a=this[e];return a&&a.deliver(),this[d]},set:function(c){if(b)return this[d];var f=this[e];if(f)return void f.setValue(c);var g=this[d];return this[d]=c,this.emitPropertyChangeRecord(a,c,g),c},configurable:!0})},createPropertyAccessors:function(a){var b=a._computedNames;if(b&&b.length)for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.createPropertyAccessor(c,!0);var b=a._publishNames;if(b&&b.length)for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)a.computed&&a.computed[c]||this.createPropertyAccessor(c)}};a.api.declaration.properties=b}(Polymer),function(a){var b="attributes",c=/\s|,/,d={inheritAttributesObjects:function(a){this.inheritObject(a,"publishLC"),this.inheritObject(a,"_instanceAttributes")},publishAttributes:function(a){var d=this.getAttribute(b);if(d)for(var e,f=a.publish||(a.publish={}),g=d.split(c),h=0,i=g.length;i>h;h++)e=g[h].trim(),e&&void 0===f[e]&&(f[e]=void 0)},accumulateInstanceAttributes:function(){for(var a,b=this.prototype._instanceAttributes,c=this.attributes,d=0,e=c.length;e>d&&(a=c[d]);d++)this.isInstanceAttribute(a.name)&&(b[a.name]=a.value)},isInstanceAttribute:function(a){return!this.blackList[a]&&"on-"!==a.slice(0,3)},blackList:{name:1,"extends":1,constructor:1,noscript:1,assetpath:1,"cache-csstext":1}};d.blackList[b]=1,a.api.declaration.attributes=d}(Polymer),function(a){var b=a.api.declaration.events,c=new PolymerExpressions,d=c.prepareBinding;c.prepareBinding=function(a,e,f){return b.prepareEventBinding(a,e,f)||d.call(c,a,e,f)};var e={syntax:c,fetchTemplate:function(){return this.querySelector("template")},templateContent:function(){var a=this.fetchTemplate();return a&&a.content},installBindingDelegate:function(a){a&&(a.bindingDelegate=this.syntax)}};a.api.declaration.mdv=e}(Polymer),function(a){function b(a){if(!Object.__proto__){var b=Object.getPrototypeOf(a);a.__proto__=b,d(b)&&(b.__proto__=Object.getPrototypeOf(b))}}var c=a.api,d=a.isBase,e=a.extend,f=window.ShadowDOMPolyfill,g={register:function(a,b){this.buildPrototype(a,b),this.registerPrototype(a,b),this.publishConstructor()},buildPrototype:function(b,c){var d=a.getRegisteredPrototype(b),e=this.generateBasePrototype(c);this.desugarBeforeChaining(d,e),this.prototype=this.chainPrototypes(d,e),this.desugarAfterChaining(b,c)},desugarBeforeChaining:function(a,b){a.element=this,this.publishAttributes(a,b),this.publishProperties(a,b),this.inferObservers(a),this.explodeObservers(a)},chainPrototypes:function(a,c){this.inheritMetaData(a,c);var d=this.chainObject(a,c);return b(d),d},inheritMetaData:function(a,b){this.inheritObject("observe",a,b),this.inheritObject("publish",a,b),this.inheritObject("reflect",a,b),this.inheritObject("_publishLC",a,b),this.inheritObject("_instanceAttributes",a,b),this.inheritObject("eventDelegates",a,b)},desugarAfterChaining:function(a,b){this.optimizePropertyMaps(this.prototype),this.createPropertyAccessors(this.prototype),this.installBindingDelegate(this.fetchTemplate()),this.installSheets(),this.resolveElementPaths(this),this.accumulateInstanceAttributes(),this.parseHostEvents(),this.addResolvePathApi(),f&&Platform.ShadowCSS.shimStyling(this.templateContent(),a,b),this.prototype.registerCallback&&this.prototype.registerCallback(this)},publishConstructor:function(){var a=this.getAttribute("constructor");a&&(window[a]=this.ctor)},generateBasePrototype:function(a){var b=this.findBasePrototype(a);if(!b){var b=HTMLElement.getPrototypeForTag(a);b=this.ensureBaseApi(b),h[a]=b}return b},findBasePrototype:function(a){return h[a]},ensureBaseApi:function(a){if(a.PolymerBase)return a;var b=Object.create(a);return c.publish(c.instance,b),this.mixinMethod(b,a,c.instance.mdv,"bind"),b},mixinMethod:function(a,b,c,d){var e=function(a){return b[d].apply(this,a)};a[d]=function(){return this.mixinSuper=e,c[d].apply(this,arguments)}},inheritObject:function(a,b,c){var d=b[a]||{};b[a]=this.chainObject(d,c[a])},registerPrototype:function(a,b){var c={prototype:this.prototype},d=this.findTypeExtension(b);d&&(c.extends=d),HTMLElement.register(a,this.prototype),this.ctor=document.registerElement(a,c)},findTypeExtension:function(a){if(a&&a.indexOf("-")<0)return a;var b=this.findBasePrototype(a);return b.element?this.findTypeExtension(b.element.extends):void 0}},h={};g.chainObject=Object.__proto__?function(a,b){return a&&b&&a!==b&&(a.__proto__=b),a}:function(a,b){if(a&&b&&a!==b){var c=Object.create(b);a=e(c,a)}return a},c.declaration.prototype=g}(Polymer),function(a){function b(a){return document.contains(a)?j:i}function c(){return i.length?i[0]:j[0]}function d(a){f.waitToReady=!0,Platform.endOfMicrotask(function(){HTMLImports.whenImportsReady(function(){f.addReadyCallback(a),f.waitToReady=!1,f.check()})})}function e(a){if(void 0===a)return void f.ready();var b=setTimeout(function(){f.ready()},a);Polymer.whenReady(function(){clearTimeout(b)})}var f={wait:function(a){a.__queue||(a.__queue={},g.push(a))},enqueue:function(a,c,d){var e=a.__queue&&!a.__queue.check;return e&&(b(a).push(a),a.__queue.check=c,a.__queue.go=d),0!==this.indexOf(a)},indexOf:function(a){var c=b(a).indexOf(a);return c>=0&&document.contains(a)&&(c+=HTMLImports.useNative||HTMLImports.ready?i.length:1e9),c},go:function(a){var b=this.remove(a);b&&(a.__queue.flushable=!0,this.addToFlushQueue(b),this.check())},remove:function(a){var c=this.indexOf(a);if(0===c)return b(a).shift()},check:function(){var a=this.nextElement();return a&&a.__queue.check.call(a),this.canReady()?(this.ready(),!0):void 0},nextElement:function(){return c()},canReady:function(){return!this.waitToReady&&this.isEmpty()},isEmpty:function(){for(var a,b=0,c=g.length;c>b&&(a=g[b]);b++)if(a.__queue&&!a.__queue.flushable)return;return!0},addToFlushQueue:function(a){h.push(a)},flush:function(){if(!this.flushing){this.flushing=!0;for(var a;h.length;)a=h.shift(),a.__queue.go.call(a),a.__queue=null;this.flushing=!1}},ready:function(){var a=CustomElements.ready;CustomElements.ready=!1,this.flush(),CustomElements.useNative||CustomElements.upgradeDocumentTree(document),CustomElements.ready=a,Platform.flush(),requestAnimationFrame(this.flushReadyCallbacks)},addReadyCallback:function(a){a&&k.push(a)},flushReadyCallbacks:function(){if(k)for(var a;k.length;)(a=k.shift())()},waitingFor:function(){for(var a,b=[],c=0,d=g.length;d>c&&(a=g[c]);c++)a.__queue&&!a.__queue.flushable&&b.push(a);return b},waitToReady:!0},g=[],h=[],i=[],j=[],k=[];a.elements=g,a.waitingFor=f.waitingFor.bind(f),a.forceReady=e,a.queue=f,a.whenReady=a.whenPolymerReady=d}(Polymer),function(a){function b(a){return Boolean(HTMLElement.getPrototypeForTag(a))}function c(a){return a&&a.indexOf("-")>=0}var d=a.extend,e=a.api,f=a.queue,g=a.whenReady,h=a.getRegisteredPrototype,i=a.waitingForPrototype,j=d(Object.create(HTMLElement.prototype),{createdCallback:function(){this.getAttribute("name")&&this.init()},init:function(){this.name=this.getAttribute("name"),this.extends=this.getAttribute("extends"),f.wait(this),this.loadResources(),this.registerWhenReady()},registerWhenReady:function(){this.registered||this.waitingForPrototype(this.name)||this.waitingForQueue()||this.waitingForResources()||f.go(this)},_register:function(){c(this.extends)&&!b(this.extends)&&console.warn("%s is attempting to extend %s, an unregistered element or one that was not registered with Polymer.",this.name,this.extends),this.register(this.name,this.extends),this.registered=!0},waitingForPrototype:function(a){return h(a)?void 0:(i(a,this),this.handleNoScript(a),!0)},handleNoScript:function(a){this.hasAttribute("noscript")&&!this.noscript&&(this.noscript=!0,Polymer(a))},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return f.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=!0,this.loadStyles(function(){this._needsResources=!1,this.registerWhenReady()}.bind(this))}});e.publish(e.declaration,j),g(function(){document.body.removeAttribute("unresolved"),document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:!0}))}),document.registerElement("polymer-element",{prototype:j})}(Polymer),function(a){function b(a,b){a?(document.head.appendChild(a),d(b)):b&&b()}function c(a,c){if(a&&a.length){for(var d,e,f=document.createDocumentFragment(),g=0,h=a.length;h>g&&(d=a[g]);g++)e=document.createElement("link"),e.rel="import",e.href=d,f.appendChild(e);b(f,c)}else c&&c()}var d=a.whenPolymerReady;a.import=c,a.importElements=b}(Polymer),function(){var a=document.createElement("polymer-element");a.setAttribute("name","auto-binding"),a.setAttribute("extends","template"),a.init(),Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax(),Polymer.whenPolymerReady(function(){this.model=this,this.setAttribute("bind",""),this.async(function(){this.marshalNodeReferences(this.parentNode),this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var a=Object.create(Polymer.api.declaration.events),b=this;a.findController=function(){return b.model};var c=new PolymerExpressions,d=c.prepareBinding;return c.prepareBinding=function(b,e,f){return a.prepareEventBinding(b,e,f)||d.call(c,b,e,f)},c}})}(); +//# sourceMappingURL=polymer.js.map +window._TV_IS_COMPILED = true; +var global=this; +this.tv=function(){function d(){if(!b){var a=document.createElement("div");a.style.backgroundColor="white";a.style.border="3px solid red";a.style.boxSizing="border-box";a.style.color="black";a.style.display="-webkit-flex";a.style.height="100%";a.style.left=0;a.style.padding="8px";a.style.position="fixed";a.style.top=0;a.style.webkitFlexDirection="column";a.style.width="100%";b=document.createElement("div");b.style.webkitFlex="1 1 auto";b.style.overflow="auto";a.appendChild(b);document.body?document.body.appendChild(a): +setTimeout(function(){document.body.appendChild(a)},150)}}function c(f,e){e instanceof Error&&(e=e.stack);d();var c=document.createElement("div");c.innerHTML='<h2 id="message"></h2><pre id="details"></pre>';c.querySelector("#message").textContent=f;c.querySelector("#details").textContent=e;b.appendChild(c);a.push({title:f,details:e})}if(window.tv)return console.warn("Base was multiply initialized. First init wins."),window.tv;var b=void 0,a=[];return{initialize:function(){if(!window._TRACE_VIEWER_IS_COMPILED){var a= +parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1],10),e=window.navigator.appVersion.match("77.34.5");36>a&&!e&&c("Invalid Chrome version","A Chrome version of 36 or higher is required for trace-viewer development. Please upgrade your version of Chrome and try again.")}tv.doc=document;tv.isMac=/Mac/.test(navigator.platform);tv.isWindows=/Win/.test(navigator.platform);tv.isChromeOS=/CrOS/.test(navigator.userAgent);tv.isLinux=/Linux/.test(navigator.userAgent)},exportTo:function(a,e){var b; +b=a.split(".");for(var c=global,d;b.length&&(d=b.shift());)c=d in c?c[d]:c[d]={};b=c;var c=e(),l;for(l in c)(d=Object.getOwnPropertyDescriptor(c,l))&&Object.defineProperty(b,l,d)},isDefined:function(a,e){for(var b=a.split("."),c=e||global,d=0;d<b.length;d++)if(c=c[b[d]],void 0===c)return!1;return!0},showPanic:c,hasPanic:function(){return 0!==a.length},getPanicText:function(){return a.map(function(a){return a.title}).join(", ")}}}();tv.initialize();"use strict"; +tv.exportTo("tv.b.ui",function(){return{decorate:function(d,c){var b;b="string"==typeof d?tv.doc.querySelectorAll(d):[d];for(var a=0,f;f=b[a];a++)f instanceof c||c.decorate(f)},define:function(d,c,b){function a(){if(c&&a.prototype.__proto__!=c.prototype)throw Error(d+" prototye's __proto__ field is messed up. It MUST be the prototype of "+c.tagName);var b;b=void 0===e?tv.doc.createElement(f):tv.doc.createElementNS(e,f);a.decorate.call(this,b,arguments);return b}if("function"==typeof d)throw Error("Passing functions as className is deprecated. Please use (className, opt_parentConstructor) to subclass"); +d=d.toLowerCase();if(c&&!c.tagName)throw Error("opt_parentConstructor was not created by tv.b.ui.define");var f=d,e=void 0;if(c){if(b)throw Error("Must not specify tagNS if parentConstructor is given");for(b=c;b&&b.tagName;)f=b.tagName,e=b.tagNS,b=b.parentConstructor}else e=b;a.decorate=function(e,f){e.__proto__=a.prototype;e.decorate.apply(e,f);e.constructor=a};a.className=d;a.tagName=f;a.tagNS=e;a.parentConstructor=c?c:void 0;a.toString=function(){return a.parentConstructor?a.parentConstructor.toString()+ +"::"+a.className:a.tagName};return a},elementIsChildOf:function(d,c){if(d==c)return!1;for(var b=d;b.parentNode;){if(b==c)return!0;b=b.parentNode}return!1}}});"use strict"; +tv.exportTo("tv.b",function(){function d(a,f){if(a instanceof Object)if(a instanceof Array)for(var e=0;e<a.length;e++)f(a,e,a[e]),d(a[e],f);else for(e in a){var b=a[e];f(a,e,b);d(b,f)}}function c(a){return a}function b(a,b,e){b=b||c;for(var g=0;g<a.length;g++)if(b.call(e,a[g],g))return g;return-1}return{asArray:function(a){for(var b=[],e=0;e<a.length;e++)b.push(a[e]);return b},concatenateArrays:function(){for(var a=[],b=0;b<arguments.length;b++){if(!(arguments[b]instanceof Array))throw Error("Arguments "+ +b+"is not an array");a.push.apply(a,arguments[b])}return a},concatenateObjects:function(){for(var a={},b=0;b<arguments.length;b++){var e=arguments[b],c;for(c in e)a[c]=e[c]}return a},compareArrays:function(a,b,e){for(var c=Math.min(a.length,b.length),h=0;h<c;h++){var d=e(a[h],b[h]);if(d)return d}return a.length==b.length?0:void 0===a[h]?-1:1},comparePossiblyUndefinedValues:function(a,b,e){return void 0!==a&&void 0!==b?e(a,b):void 0!==a?-1:void 0!==b?1:0},dictionaryLength:function(a){var b=0,e;for(e in a)b++; +return b},dictionaryKeys:function(a){var b=[],e;for(e in a)b.push(e);return b},dictionaryValues:function(a){var b=[],e;for(e in a)b.push(a[e]);return b},iterItems:function(a,b,e){e=e||this;for(var c in a)b.call(e,c,a[c])},iterObjectFieldsRecursively:d,findFirstIndexInArray:b,findFirstInArray:function(a,f,e){f=b(a,f,f);return-1===f?void 0:a[f]}}}); +(function(){var d;"undefined"==typeof exports?"function"==typeof define&&"object"==typeof define.amd&&define.amd?(d={},define(function(){return d})):d=window:d=exports;(function(c){if(!b)var b=1E-6;if(!a)var a="undefined"!=typeof Float32Array?Float32Array:Array;var f={setMatrixArrayType:function(l){a=l}};"undefined"!=typeof c&&(c.glMatrix=f);var e={create:function(){var l=new a(2);return l[0]=0,l[1]=0,l},clone:function(l){var b=new a(2);return b[0]=l[0],b[1]=l[1],b},fromValues:function(l,b){var e= +new a(2);return e[0]=l,e[1]=b,e},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a},set:function(a,b,e){return a[0]=b,a[1]=e,a},add:function(a,b,e){return a[0]=b[0]+e[0],a[1]=b[1]+e[1],a},subtract:function(a,b,e){return a[0]=b[0]-e[0],a[1]=b[1]-e[1],a}};e.sub=e.subtract;e.multiply=function(a,b,e){return a[0]=b[0]*e[0],a[1]=b[1]*e[1],a};e.mul=e.multiply;e.divide=function(a,b,e){return a[0]=b[0]/e[0],a[1]=b[1]/e[1],a};e.div=e.divide;e.min=function(a,b,e){return a[0]=Math.min(b[0],e[0]),a[1]=Math.min(b[1], +e[1]),a};e.max=function(a,b,e){return a[0]=Math.max(b[0],e[0]),a[1]=Math.max(b[1],e[1]),a};e.scale=function(a,b,e){return a[0]=b[0]*e,a[1]=b[1]*e,a};e.distance=function(a,b){var e=b[0]-a[0],f=b[1]-a[1];return Math.sqrt(e*e+f*f)};e.dist=e.distance;e.squaredDistance=function(a,b){var e=b[0]-a[0],f=b[1]-a[1];return e*e+f*f};e.sqrDist=e.squaredDistance;e.length=function(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)};e.len=e.length;e.squaredLength=function(a){var b=a[0];a=a[1];return b*b+a*a};e.sqrLen= +e.squaredLength;e.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a};e.normalize=function(a,b){var e=b[0],f=b[1],e=e*e+f*f;return 0<e&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e),a};e.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};e.cross=function(a,b,e){b=b[0]*e[1]-b[1]*e[0];return a[0]=a[1]=0,a[2]=b,a};e.lerp=function(a,b,e,f){var c=b[0];b=b[1];return a[0]=c+f*(e[0]-c),a[1]=b+f*(e[1]-b),a};e.transformMat2=function(a,b,e){var f=b[0];b=b[1];return a[0]=e[0]*f+e[2]*b,a[1]=e[1]*f+e[3]*b,a};e.transformMat2d= +function(a,b,e){var f=b[0];b=b[1];return a[0]=e[0]*f+e[2]*b+e[4],a[1]=e[1]*f+e[3]*b+e[5],a};e.transformMat3=function(a,b,e){var f=b[0];b=b[1];return a[0]=e[0]*f+e[3]*b+e[6],a[1]=e[1]*f+e[4]*b+e[7],a};e.transformMat4=function(a,b,e){var f=b[0];b=b[1];return a[0]=e[0]*f+e[4]*b+e[12],a[1]=e[1]*f+e[5]*b+e[13],a};e.forEach=function(){var a=e.create();return function(b,e,f,c,g,d){var h;e||(e=2);f||(f=0);for(c?h=Math.min(c*e+f,b.length):h=b.length;f<h;f+=e)a[0]=b[f],a[1]=b[f+1],g(a,a,d),b[f]=a[0],b[f+1]= +a[1];return b}}();e.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};"undefined"!=typeof c&&(c.vec2=e);var g={create:function(){var b=new a(3);return b[0]=0,b[1]=0,b[2]=0,b},clone:function(b){var e=new a(3);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e},fromValues:function(b,e,f){var c=new a(3);return c[0]=b,c[1]=e,c[2]=f,c},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,e,f){return a[0]=b,a[1]=e,a[2]=f,a},add:function(a,b,e){return a[0]=b[0]+e[0],a[1]=b[1]+e[1],a[2]=b[2]+e[2], +a},subtract:function(a,b,e){return a[0]=b[0]-e[0],a[1]=b[1]-e[1],a[2]=b[2]-e[2],a}};g.sub=g.subtract;g.multiply=function(a,b,e){return a[0]=b[0]*e[0],a[1]=b[1]*e[1],a[2]=b[2]*e[2],a};g.mul=g.multiply;g.divide=function(a,b,e){return a[0]=b[0]/e[0],a[1]=b[1]/e[1],a[2]=b[2]/e[2],a};g.div=g.divide;g.min=function(a,b,e){return a[0]=Math.min(b[0],e[0]),a[1]=Math.min(b[1],e[1]),a[2]=Math.min(b[2],e[2]),a};g.max=function(a,b,e){return a[0]=Math.max(b[0],e[0]),a[1]=Math.max(b[1],e[1]),a[2]=Math.max(b[2],e[2]), +a};g.scale=function(a,b,e){return a[0]=b[0]*e,a[1]=b[1]*e,a[2]=b[2]*e,a};g.distance=function(a,b){var e=b[0]-a[0],f=b[1]-a[1],c=b[2]-a[2];return Math.sqrt(e*e+f*f+c*c)};g.dist=g.distance;g.squaredDistance=function(a,b){var e=b[0]-a[0],f=b[1]-a[1],c=b[2]-a[2];return e*e+f*f+c*c};g.sqrDist=g.squaredDistance;g.length=function(a){var b=a[0],e=a[1];a=a[2];return Math.sqrt(b*b+e*e+a*a)};g.len=g.length;g.squaredLength=function(a){var b=a[0],e=a[1];a=a[2];return b*b+e*e+a*a};g.sqrLen=g.squaredLength;g.negate= +function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};g.normalize=function(a,b){var e=b[0],f=b[1],c=b[2],e=e*e+f*f+c*c;return 0<e&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e,a[2]=b[2]*e),a};g.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};g.cross=function(a,b,e){var f=b[0],c=b[1];b=b[2];var g=e[0],d=e[1];e=e[2];return a[0]=c*e-b*d,a[1]=b*g-f*e,a[2]=f*d-c*g,a};g.lerp=function(a,b,e,f){var c=b[0],g=b[1];b=b[2];return a[0]=c+f*(e[0]-c),a[1]=g+f*(e[1]-g),a[2]=b+f*(e[2]-b),a};g.transformMat4= +function(a,b,e){var f=b[0],c=b[1];b=b[2];return a[0]=e[0]*f+e[4]*c+e[8]*b+e[12],a[1]=e[1]*f+e[5]*c+e[9]*b+e[13],a[2]=e[2]*f+e[6]*c+e[10]*b+e[14],a};g.transformQuat=function(a,b,e){var f=b[0],c=b[1],g=b[2];b=e[0];var d=e[1],h=e[2];e=e[3];var k=e*f+d*g-h*c,p=e*c+h*f-b*g,r=e*g+b*c-d*f,f=-b*f-d*c-h*g;return a[0]=k*e+f*-b+p*-h-r*-d,a[1]=p*e+f*-d+r*-b-k*-h,a[2]=r*e+f*-h+k*-d-p*-b,a};g.forEach=function(){var a=g.create();return function(b,e,f,c,g,d){var h;e||(e=3);f||(f=0);for(c?h=Math.min(c*e+f,b.length): +h=b.length;f<h;f+=e)a[0]=b[f],a[1]=b[f+1],a[2]=b[f+2],g(a,a,d),b[f]=a[0],b[f+1]=a[1],b[f+2]=a[2];return b}}();g.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};"undefined"!=typeof c&&(c.vec3=g);var h={create:function(){var b=new a(4);return b[0]=0,b[1]=0,b[2]=0,b[3]=0,b},clone:function(b){var e=new a(4);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=b[3],e},fromValues:function(b,e,f,c){var g=new a(4);return g[0]=b,g[1]=e,g[2]=f,g[3]=c,g},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], +a[3]=b[3],a},set:function(a,b,e,f,c){return a[0]=b,a[1]=e,a[2]=f,a[3]=c,a},add:function(a,b,e){return a[0]=b[0]+e[0],a[1]=b[1]+e[1],a[2]=b[2]+e[2],a[3]=b[3]+e[3],a},subtract:function(a,b,e){return a[0]=b[0]-e[0],a[1]=b[1]-e[1],a[2]=b[2]-e[2],a[3]=b[3]-e[3],a}};h.sub=h.subtract;h.multiply=function(a,b,e){return a[0]=b[0]*e[0],a[1]=b[1]*e[1],a[2]=b[2]*e[2],a[3]=b[3]*e[3],a};h.mul=h.multiply;h.divide=function(a,b,e){return a[0]=b[0]/e[0],a[1]=b[1]/e[1],a[2]=b[2]/e[2],a[3]=b[3]/e[3],a};h.div=h.divide; +h.min=function(a,b,e){return a[0]=Math.min(b[0],e[0]),a[1]=Math.min(b[1],e[1]),a[2]=Math.min(b[2],e[2]),a[3]=Math.min(b[3],e[3]),a};h.max=function(a,b,e){return a[0]=Math.max(b[0],e[0]),a[1]=Math.max(b[1],e[1]),a[2]=Math.max(b[2],e[2]),a[3]=Math.max(b[3],e[3]),a};h.scale=function(a,b,e){return a[0]=b[0]*e,a[1]=b[1]*e,a[2]=b[2]*e,a[3]=b[3]*e,a};h.distance=function(a,b){var e=b[0]-a[0],f=b[1]-a[1],c=b[2]-a[2],g=b[3]-a[3];return Math.sqrt(e*e+f*f+c*c+g*g)};h.dist=h.distance;h.squaredDistance=function(a, +b){var e=b[0]-a[0],f=b[1]-a[1],c=b[2]-a[2],g=b[3]-a[3];return e*e+f*f+c*c+g*g};h.sqrDist=h.squaredDistance;h.length=function(a){var b=a[0],e=a[1],f=a[2];a=a[3];return Math.sqrt(b*b+e*e+f*f+a*a)};h.len=h.length;h.squaredLength=function(a){var b=a[0],e=a[1],f=a[2];a=a[3];return b*b+e*e+f*f+a*a};h.sqrLen=h.squaredLength;h.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3],a};h.normalize=function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],e=e*e+f*f+c*c+g*g;return 0<e&&(e=1/Math.sqrt(e), +a[0]=b[0]*e,a[1]=b[1]*e,a[2]=b[2]*e,a[3]=b[3]*e),a};h.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};h.lerp=function(a,b,e,f){var c=b[0],g=b[1],d=b[2];b=b[3];return a[0]=c+f*(e[0]-c),a[1]=g+f*(e[1]-g),a[2]=d+f*(e[2]-d),a[3]=b+f*(e[3]-b),a};h.transformMat4=function(a,b,e){var f=b[0],c=b[1],g=b[2];b=b[3];return a[0]=e[0]*f+e[4]*c+e[8]*g+e[12]*b,a[1]=e[1]*f+e[5]*c+e[9]*g+e[13]*b,a[2]=e[2]*f+e[6]*c+e[10]*g+e[14]*b,a[3]=e[3]*f+e[7]*c+e[11]*g+e[15]*b,a};h.transformQuat=function(a,b,e){var f= +b[0],c=b[1],g=b[2];b=e[0];var d=e[1],h=e[2];e=e[3];var k=e*f+d*g-h*c,p=e*c+h*f-b*g,r=e*g+b*c-d*f,f=-b*f-d*c-h*g;return a[0]=k*e+f*-b+p*-h-r*-d,a[1]=p*e+f*-d+r*-b-k*-h,a[2]=r*e+f*-h+k*-d-p*-b,a};h.forEach=function(){var a=h.create();return function(b,e,f,c,g,d){var h;e||(e=4);f||(f=0);for(c?h=Math.min(c*e+f,b.length):h=b.length;f<h;f+=e)a[0]=b[f],a[1]=b[f+1],a[2]=b[f+2],a[3]=b[f+3],g(a,a,d),b[f]=a[0],b[f+1]=a[1],b[f+2]=a[2],b[f+3]=a[3];return b}}();h.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+ +a[2]+", "+a[3]+")"};"undefined"!=typeof c&&(c.vec4=h);f={create:function(){var b=new a(4);return b[0]=1,b[1]=0,b[2]=0,b[3]=1,b},clone:function(b){var e=new a(4);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=b[3],e},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var e=b[1];a[1]=b[2];a[2]=e}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var e=b[0],f=b[1],c=b[2], +g=b[3],d=e*g-c*f;return d?(d=1/d,a[0]=g*d,a[1]=-f*d,a[2]=-c*d,a[3]=e*d,a):null},adjoint:function(a,b){var e=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=e,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,e){var f=b[0],c=b[1],g=b[2];b=b[3];var d=e[0],h=e[1],k=e[2];e=e[3];return a[0]=f*d+c*k,a[1]=f*h+c*e,a[2]=g*d+b*k,a[3]=g*h+b*e,a}};f.mul=f.multiply;f.rotate=function(a,b,e){var f=b[0],c=b[1],g=b[2];b=b[3];var d=Math.sin(e);e=Math.cos(e);return a[0]=f*e+c*d,a[1]=f*-d+ +c*e,a[2]=g*e+b*d,a[3]=g*-d+b*e,a};f.scale=function(a,b,e){var f=b[1],c=b[2],g=b[3],d=e[0];e=e[1];return a[0]=b[0]*d,a[1]=f*e,a[2]=c*d,a[3]=g*e,a};f.str=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};"undefined"!=typeof c&&(c.mat2=f);f={create:function(){var b=new a(6);return b[0]=1,b[1]=0,b[2]=0,b[3]=1,b[4]=0,b[5]=0,b},clone:function(b){var e=new a(6);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=b[3],e[4]=b[4],e[5]=b[5],e},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]= +b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=b[4],h=b[5],k=e*g-f*c;return k?(k=1/k,a[0]=g*k,a[1]=-f*k,a[2]=-c*k,a[3]=e*k,a[4]=(c*h-g*d)*k,a[5]=(f*d-e*h)*k,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4];b=b[5];var k=e[0],p=e[1],r=e[2],t=e[3],w=e[4];e=e[5];return a[0]=f*k+c*r,a[1]=f*p+c*t,a[2]=g*k+d*r,a[3]=g*p+d* +t,a[4]=k*h+r*b+w,a[5]=p*h+t*b+e,a}};f.mul=f.multiply;f.rotate=function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4];b=b[5];var k=Math.sin(e);e=Math.cos(e);return a[0]=f*e+c*k,a[1]=-f*k+c*e,a[2]=g*e+d*k,a[3]=-g*k+e*d,a[4]=e*h+k*b,a[5]=e*b-k*h,a};f.scale=function(a,b,e){var f=e[0];e=e[1];return a[0]=b[0]*f,a[1]=b[1]*e,a[2]=b[2]*f,a[3]=b[3]*e,a[4]=b[4]*f,a[5]=b[5]*e,a};f.translate=function(a,b,e){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4]+e[0],a[5]=b[5]+e[1],a};f.str=function(a){return"mat2d("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"};"undefined"!=typeof c&&(c.mat2d=f);f={create:function(){var b=new a(9);return b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=1,b[5]=0,b[6]=0,b[7]=0,b[8]=1,b},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(b){var e=new a(9);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=b[3],e[4]=b[4],e[5]=b[5],e[6]=b[6],e[7]=b[7],e[8]=b[8],e},copy:function(a,b){return a[0]=b[0],a[1]= +b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},transpose:function(a,b){if(a===b){var e=b[1],f=b[2],c=b[5];a[1]=b[3];a[2]=b[6];a[3]=e;a[5]=b[7];a[6]=f;a[7]=c}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=b[4],h=b[5],k=b[6],p=b[7],r=b[8],t=r*d-h*p,w=-r*g+h*k,x=p*g- +d*k,A=e*t+f*w+c*x;return A?(A=1/A,a[0]=t*A,a[1]=(-r*f+c*p)*A,a[2]=(h*f-c*d)*A,a[3]=w*A,a[4]=(r*e-c*k)*A,a[5]=(-h*e+c*g)*A,a[6]=x*A,a[7]=(-p*e+f*k)*A,a[8]=(d*e-f*g)*A,a):null},adjoint:function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=b[4],h=b[5],k=b[6],p=b[7],r=b[8];return a[0]=d*r-h*p,a[1]=c*p-f*r,a[2]=f*h-c*d,a[3]=h*k-g*r,a[4]=e*r-c*k,a[5]=c*g-e*h,a[6]=g*p-d*k,a[7]=f*k-e*p,a[8]=e*d-f*g,a},determinant:function(a){var b=a[3],e=a[4],f=a[5],c=a[6],g=a[7],d=a[8];return a[0]*(d*e-f*g)+a[1]*(-d*b+f*c)+a[2]* +(g*b-e*c)},multiply:function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4],k=b[5],p=b[6],r=b[7];b=b[8];var t=e[0],w=e[1],x=e[2],A=e[3],z=e[4],B=e[5],D=e[6],F=e[7];e=e[8];return a[0]=t*f+w*d+x*p,a[1]=t*c+w*h+x*r,a[2]=t*g+w*k+x*b,a[3]=A*f+z*d+B*p,a[4]=A*c+z*h+B*r,a[5]=A*g+z*k+B*b,a[6]=D*f+F*d+e*p,a[7]=D*c+F*h+e*r,a[8]=D*g+F*k+e*b,a}};f.mul=f.multiply;f.translate=function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4],k=b[5],p=b[6],r=b[7];b=b[8];var t=e[0];e=e[1];return a[0]=f,a[1]=c,a[2]=g,a[3]=d,a[4]= +h,a[5]=k,a[6]=t*f+e*d+p,a[7]=t*c+e*h+r,a[8]=t*g+e*k+b,a};f.rotate=function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4],k=b[5],p=b[6],r=b[7];b=b[8];var t=Math.sin(e);e=Math.cos(e);return a[0]=e*f+t*d,a[1]=e*c+t*h,a[2]=e*g+t*k,a[3]=e*d-t*f,a[4]=e*h-t*c,a[5]=e*k-t*g,a[6]=p,a[7]=r,a[8]=b,a};f.scale=function(a,b,e){var f=e[0];e=e[2];return a[0]=f*b[0],a[1]=f*b[1],a[2]=f*b[2],a[3]=e*b[3],a[4]=e*b[4],a[5]=e*b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a};f.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]= +0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};f.fromQuat=function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=e+e,h=f+f,k=c+c,p=e*d,r=e*h,e=e*k,t=f*h,f=f*k,c=c*k,d=g*d,h=g*h,g=g*k;return a[0]=1-(t+c),a[1]=r+g,a[2]=e-h,a[3]=r-g,a[4]=1-(p+c),a[5]=f+d,a[6]=e+h,a[7]=f-d,a[8]=1-(p+t),a};f.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};"undefined"!=typeof c&&(c.mat3=f);var d={create:function(){var b=new a(16);return b[0]=1, +b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,b},clone:function(b){var e=new a(16);return e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=b[3],e[4]=b[4],e[5]=b[5],e[6]=b[6],e[7]=b[7],e[8]=b[8],e[9]=b[9],e[10]=b[10],e[11]=b[11],e[12]=b[12],e[13]=b[13],e[14]=b[14],e[15]=b[15],e},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13], +a[14]=b[14],a[15]=b[15],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},transpose:function(a,b){if(a===b){var e=b[1],f=b[2],c=b[3],g=b[6],d=b[7],h=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=e;a[6]=b[9];a[7]=b[13];a[8]=f;a[9]=g;a[11]=b[14];a[12]=c;a[13]=d;a[14]=h}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]= +b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=b[4],h=b[5],k=b[6],p=b[7],r=b[8],t=b[9],w=b[10],x=b[11],A=b[12],z=b[13],B=b[14],D=b[15],F=e*h-f*d,G=e*k-c*d,H=e*p-g*d,I=f*k-c*h,L=f*p-g*h,M=c*p-g*k,N=r*z-t*A,K=r*B-w*A,O=r*D-x*A,P=t*B-w*z,Q=t*D-x*z,R=w*D-x*B,J=F*R-G*Q+H*P+I*O-L*K+M*N;return J?(J=1/J,a[0]=(h*R-k*Q+p*P)*J,a[1]=(c*Q-f*R-g*P)*J,a[2]=(z*M-B*L+D*I)*J,a[3]=(w*L-t*M-x*I)*J,a[4]=(k*O-d*R-p*K)*J,a[5]=(e*R-c*O+g*K)*J,a[6]=(B*H-A*M-D*G)*J, +a[7]=(r*M-w*H+x*G)*J,a[8]=(d*Q-h*O+p*N)*J,a[9]=(f*O-e*Q-g*N)*J,a[10]=(A*L-z*H+D*F)*J,a[11]=(t*H-r*L-x*F)*J,a[12]=(h*K-d*P-k*N)*J,a[13]=(e*P-f*K+c*N)*J,a[14]=(z*G-A*I-B*F)*J,a[15]=(r*I-t*G+w*F)*J,a):null},adjoint:function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=b[4],h=b[5],k=b[6],p=b[7],r=b[8],t=b[9],w=b[10],x=b[11],A=b[12],z=b[13],B=b[14],D=b[15];return a[0]=h*(w*D-x*B)-t*(k*D-p*B)+z*(k*x-p*w),a[1]=-(f*(w*D-x*B)-t*(c*D-g*B)+z*(c*x-g*w)),a[2]=f*(k*D-p*B)-h*(c*D-g*B)+z*(c*p-g*k),a[3]=-(f*(k*x-p*w)-h* +(c*x-g*w)+t*(c*p-g*k)),a[4]=-(d*(w*D-x*B)-r*(k*D-p*B)+A*(k*x-p*w)),a[5]=e*(w*D-x*B)-r*(c*D-g*B)+A*(c*x-g*w),a[6]=-(e*(k*D-p*B)-d*(c*D-g*B)+A*(c*p-g*k)),a[7]=e*(k*x-p*w)-d*(c*x-g*w)+r*(c*p-g*k),a[8]=d*(t*D-x*z)-r*(h*D-p*z)+A*(h*x-p*t),a[9]=-(e*(t*D-x*z)-r*(f*D-g*z)+A*(f*x-g*t)),a[10]=e*(h*D-p*z)-d*(f*D-g*z)+A*(f*p-g*h),a[11]=-(e*(h*x-p*t)-d*(f*x-g*t)+r*(f*p-g*h)),a[12]=-(d*(t*B-w*z)-r*(h*B-k*z)+A*(h*w-k*t)),a[13]=e*(t*B-w*z)-r*(f*B-c*z)+A*(f*w-c*t),a[14]=-(e*(h*B-k*z)-d*(f*B-c*z)+A*(f*k-c*h)),a[15]= +e*(h*w-k*t)-d*(f*w-c*t)+r*(f*k-c*h),a},determinant:function(a){var b=a[0],e=a[1],f=a[2],c=a[3],g=a[4],d=a[5],h=a[6],k=a[7],p=a[8],r=a[9],t=a[10],w=a[11],x=a[12],A=a[13],z=a[14];a=a[15];return(b*d-e*g)*(t*a-w*z)-(b*h-f*g)*(r*a-w*A)+(b*k-c*g)*(r*z-t*A)+(e*h-f*d)*(p*a-w*x)-(e*k-c*d)*(p*z-t*x)+(f*k-c*h)*(p*A-r*x)},multiply:function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=b[4],k=b[5],p=b[6],r=b[7],t=b[8],w=b[9],x=b[10],A=b[11],z=b[12],B=b[13],D=b[14];b=b[15];var F=e[0],G=e[1],H=e[2],I=e[3];return a[0]= +F*f+G*h+H*t+I*z,a[1]=F*c+G*k+H*w+I*B,a[2]=F*g+G*p+H*x+I*D,a[3]=F*d+G*r+H*A+I*b,F=e[4],G=e[5],H=e[6],I=e[7],a[4]=F*f+G*h+H*t+I*z,a[5]=F*c+G*k+H*w+I*B,a[6]=F*g+G*p+H*x+I*D,a[7]=F*d+G*r+H*A+I*b,F=e[8],G=e[9],H=e[10],I=e[11],a[8]=F*f+G*h+H*t+I*z,a[9]=F*c+G*k+H*w+I*B,a[10]=F*g+G*p+H*x+I*D,a[11]=F*d+G*r+H*A+I*b,F=e[12],G=e[13],H=e[14],I=e[15],a[12]=F*f+G*h+H*t+I*z,a[13]=F*c+G*k+H*w+I*B,a[14]=F*g+G*p+H*x+I*D,a[15]=F*d+G*r+H*A+I*b,a}};d.mul=d.multiply;d.translate=function(a,b,e){var f=e[0],c=e[1];e=e[2]; +var g,d,h,k,p,r,t,w,x,A,z,B;return b===a?(a[12]=b[0]*f+b[4]*c+b[8]*e+b[12],a[13]=b[1]*f+b[5]*c+b[9]*e+b[13],a[14]=b[2]*f+b[6]*c+b[10]*e+b[14],a[15]=b[3]*f+b[7]*c+b[11]*e+b[15]):(g=b[0],d=b[1],h=b[2],k=b[3],p=b[4],r=b[5],t=b[6],w=b[7],x=b[8],A=b[9],z=b[10],B=b[11],a[0]=g,a[1]=d,a[2]=h,a[3]=k,a[4]=p,a[5]=r,a[6]=t,a[7]=w,a[8]=x,a[9]=A,a[10]=z,a[11]=B,a[12]=g*f+p*c+x*e+b[12],a[13]=d*f+r*c+A*e+b[13],a[14]=h*f+t*c+z*e+b[14],a[15]=k*f+w*c+B*e+b[15]),a};d.scale=function(a,b,e){var f=e[0],c=e[1];e=e[2];return a[0]= +b[0]*f,a[1]=b[1]*f,a[2]=b[2]*f,a[3]=b[3]*f,a[4]=b[4]*c,a[5]=b[5]*c,a[6]=b[6]*c,a[7]=b[7]*c,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a};d.rotate=function(a,e,f,c){var g=c[0],d=c[1];c=c[2];var h=Math.sqrt(g*g+d*d+c*c),k,C,p,r,t,w,x,A,z,B,D,F,G,H,I,L,M,N,K,O,P,Q,R,J;return Math.abs(h)<b?null:(h=1/h,g*=h,d*=h,c*=h,k=Math.sin(f),C=Math.cos(f),p=1-C,r=e[0],t=e[1],w=e[2],x=e[3],A=e[4],z=e[5],B=e[6],D=e[7],F=e[8],G=e[9],H=e[10],I=e[11],L=g*g*p+C, +M=d*g*p+c*k,N=c*g*p-d*k,K=g*d*p-c*k,O=d*d*p+C,P=c*d*p+g*k,Q=g*c*p+d*k,R=d*c*p-g*k,J=c*c*p+C,a[0]=r*L+A*M+F*N,a[1]=t*L+z*M+G*N,a[2]=w*L+B*M+H*N,a[3]=x*L+D*M+I*N,a[4]=r*K+A*O+F*P,a[5]=t*K+z*O+G*P,a[6]=w*K+B*O+H*P,a[7]=x*K+D*O+I*P,a[8]=r*Q+A*R+F*J,a[9]=t*Q+z*R+G*J,a[10]=w*Q+B*R+H*J,a[11]=x*Q+D*R+I*J,e!==a&&(a[12]=e[12],a[13]=e[13],a[14]=e[14],a[15]=e[15]),a)};d.rotateX=function(a,b,e){var f=Math.sin(e);e=Math.cos(e);var c=b[4],g=b[5],d=b[6],h=b[7],k=b[8],p=b[9],r=b[10],t=b[11];return b!==a&&(a[0]=b[0], +a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=c*e+k*f,a[5]=g*e+p*f,a[6]=d*e+r*f,a[7]=h*e+t*f,a[8]=k*e-c*f,a[9]=p*e-g*f,a[10]=r*e-d*f,a[11]=t*e-h*f,a};d.rotateY=function(a,b,e){var f=Math.sin(e);e=Math.cos(e);var c=b[0],g=b[1],d=b[2],h=b[3],k=b[8],p=b[9],r=b[10],t=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=c*e-k*f,a[1]=g*e-p*f,a[2]=d*e-r*f,a[3]=h*e-t*f,a[8]=c*f+k*e,a[9]=g*f+p*e,a[10]=d*f+r* +e,a[11]=h*f+t*e,a};d.rotateZ=function(a,b,e){var f=Math.sin(e);e=Math.cos(e);var c=b[0],g=b[1],d=b[2],h=b[3],k=b[4],p=b[5],r=b[6],t=b[7];return b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=c*e+k*f,a[1]=g*e+p*f,a[2]=d*e+r*f,a[3]=h*e+t*f,a[4]=k*e-c*f,a[5]=p*e-g*f,a[6]=r*e-d*f,a[7]=t*e-h*f,a};d.fromRotationTranslation=function(a,b,e){var f=b[0],c=b[1],g=b[2],d=b[3],h=f+f,k=c+c,p=g+g;b=f*h;var r=f*k,f=f*p,t=c*k,c=c*p,g=g*p,h=d*h,k=d*k,d=d*p; +return a[0]=1-(t+g),a[1]=r+d,a[2]=f-k,a[3]=0,a[4]=r-d,a[5]=1-(b+g),a[6]=c+h,a[7]=0,a[8]=f+k,a[9]=c-h,a[10]=1-(b+t),a[11]=0,a[12]=e[0],a[13]=e[1],a[14]=e[2],a[15]=1,a};d.fromQuat=function(a,b){var e=b[0],f=b[1],c=b[2],g=b[3],d=e+e,h=f+f,k=c+c,p=e*d,r=e*h,e=e*k,t=f*h,f=f*k,c=c*k,d=g*d,h=g*h,g=g*k;return a[0]=1-(t+c),a[1]=r+g,a[2]=e-h,a[3]=0,a[4]=r-g,a[5]=1-(p+c),a[6]=f+d,a[7]=0,a[8]=e+h,a[9]=f-d,a[10]=1-(p+t),a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a};d.frustum=function(a,b,e,f,c,g,d){var h=1/(e-b), +k=1/(c-f),p=1/(g-d);return a[0]=2*g*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*g*k,a[6]=0,a[7]=0,a[8]=(e+b)*h,a[9]=(c+f)*k,a[10]=(d+g)*p,a[11]=-1,a[12]=0,a[13]=0,a[14]=d*g*2*p,a[15]=0,a};d.perspective=function(a,b,e,f,c){b=1/Math.tan(b/2);var g=1/(f-c);return a[0]=b/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=b,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(c+f)*g,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*c*f*g,a[15]=0,a};d.ortho=function(a,b,e,f,c,g,d){var h=1/(b-e),k=1/(f-c),p=1/(g-d);return a[0]=-2*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0, +a[5]=-2*k,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*p,a[11]=0,a[12]=(b+e)*h,a[13]=(c+f)*k,a[14]=(d+g)*p,a[15]=1,a};d.lookAt=function(a,e,f,c){var g,h,y,E,C,p,r,t,w,x,A=e[0],z=e[1];e=e[2];var B=c[0],D=c[1];c=c[2];var F=f[0],G=f[1];f=f[2];return Math.abs(A-F)<b&&Math.abs(z-G)<b&&Math.abs(e-f)<b?d.identity(a):(r=A-F,t=z-G,w=e-f,x=1/Math.sqrt(r*r+t*t+w*w),r*=x,t*=x,w*=x,g=D*w-c*t,h=c*r-B*w,y=B*t-D*r,x=Math.sqrt(g*g+h*h+y*y),x?(x=1/x,g*=x,h*=x,y*=x):(g=0,h=0,y=0),E=t*y-w*h,C=w*g-r*y,p=r*h-t*g,x=Math.sqrt(E* +E+C*C+p*p),x?(x=1/x,E*=x,C*=x,p*=x):(E=0,C=0,p=0),a[0]=g,a[1]=E,a[2]=r,a[3]=0,a[4]=h,a[5]=C,a[6]=t,a[7]=0,a[8]=y,a[9]=p,a[10]=w,a[11]=0,a[12]=-(g*A+h*z+y*e),a[13]=-(E*A+C*z+p*e),a[14]=-(r*A+t*z+w*e),a[15]=1,a)};d.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};"undefined"!=typeof c&&(c.mat4=d);f={create:function(){var b=new a(4);return b[0]=0,b[1]=0,b[2]= +0,b[3]=1,b}};f.clone=h.clone;f.fromValues=h.fromValues;f.copy=h.copy;f.set=h.set;f.identity=function(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a};f.setAxisAngle=function(a,b,e){e*=.5;var f=Math.sin(e);return a[0]=f*b[0],a[1]=f*b[1],a[2]=f*b[2],a[3]=Math.cos(e),a};f.add=h.add;f.multiply=function(a,b,e){var f=b[0],c=b[1],g=b[2];b=b[3];var d=e[0],h=e[1],k=e[2];e=e[3];return a[0]=f*e+b*d+c*k-g*h,a[1]=c*e+b*h+g*d-f*k,a[2]=g*e+b*k+f*h-c*d,a[3]=b*e-f*d-c*h-g*k,a};f.mul=f.multiply;f.scale=h.scale;f.rotateX=function(a, +b,e){e*=.5;var f=b[0],c=b[1],g=b[2];b=b[3];var d=Math.sin(e);e=Math.cos(e);return a[0]=f*e+b*d,a[1]=c*e+g*d,a[2]=g*e-c*d,a[3]=b*e-f*d,a};f.rotateY=function(a,b,e){e*=.5;var f=b[0],c=b[1],g=b[2];b=b[3];var d=Math.sin(e);e=Math.cos(e);return a[0]=f*e-g*d,a[1]=c*e+b*d,a[2]=g*e+f*d,a[3]=b*e-c*d,a};f.rotateZ=function(a,b,e){e*=.5;var f=b[0],c=b[1],g=b[2];b=b[3];var d=Math.sin(e);e=Math.cos(e);return a[0]=f*e+c*d,a[1]=c*e-f*d,a[2]=g*e+b*d,a[3]=b*e-g*d,a};f.calculateW=function(a,b){var e=b[0],f=b[1],c=b[2]; +return a[0]=e,a[1]=f,a[2]=c,a[3]=-Math.sqrt(Math.abs(1-e*e-f*f-c*c)),a};f.dot=h.dot;f.lerp=h.lerp;f.slerp=function(a,b,e,f){var c=b[0],g=b[1],d=b[2],h=b[3],k=e[0],p=e[1],r=e[2];e=e[3];var t=c*k+g*p+d*r+h*e,w,x,A,z;return 1<=Math.abs(t)?(a!==b&&(a[0]=c,a[1]=g,a[2]=d,a[3]=h),a):(w=Math.acos(t),x=Math.sqrt(1-t*t),.001>Math.abs(x)?(a[0]=.5*c+.5*k,a[1]=.5*g+.5*p,a[2]=.5*d+.5*r,a[3]=.5*h+.5*e,a):(A=Math.sin((1-f)*w)/x,z=Math.sin(f*w)/x,a[0]=c*A+k*z,a[1]=g*A+p*z,a[2]=d*A+r*z,a[3]=h*A+e*z,a))};f.invert=function(a, +b){var e=b[0],f=b[1],c=b[2],g=b[3],d=e*e+f*f+c*c+g*g,d=d?1/d:0;return a[0]=-e*d,a[1]=-f*d,a[2]=-c*d,a[3]=g*d,a};f.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};f.length=h.length;f.len=f.length;f.squaredLength=h.squaredLength;f.sqrLen=f.squaredLength;f.normalize=h.normalize;f.fromMat3=function(){var a=[1,2,0];return function(b,e){var f=e[0]+e[4]+e[8];if(0<f)f=Math.sqrt(f+1),b[3]=.5*f,f=.5/f,b[0]=(e[7]-e[5])*f,b[1]=(e[2]-e[6])*f,b[2]=(e[3]-e[1])*f;else{var c=0;e[4]>e[0]&& +(c=1);e[8]>e[3*c+c]&&(c=2);var g=a[c],d=a[g],f=Math.sqrt(e[3*c+c]-e[3*g+g]-e[3*d+d]+1);b[c]=.5*f;f=.5/f;b[3]=(e[3*d+g]-e[3*g+d])*f;b[g]=(e[3*g+c]+e[3*c+g])*f;b[d]=(e[3*d+c]+e[3*c+d])*f}return b}}();f.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};"undefined"!=typeof c&&(c.quat=f)})(d)})();"use strict"; +tv.exportTo("tv.b",function(){var d=vec2.create(),c=vec2.create(),b=vec4.create();mat2d.create();vec2.createFromArray=function(a){if(2!=a.length)throw Error("Should be length 2");var b=vec2.create();vec2.set(b,a[0],a[1]);return b};vec2.createXY=function(a,b){var e=vec2.create();vec2.set(e,a,b);return e};vec2.toString=function(a){return"["+a[0]+", "+a[1]+"]"};vec2.addTwoScaledUnitVectors=function(a,b,e,g,h){vec2.scale(d,b,e);vec2.scale(c,g,h);vec2.add(a,d,c)};vec3.createXYZ=function(a,b,e){var c=vec3.create(); +vec3.set(c,a,b,e);return c};vec3.toString=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};mat2d.translateXY=function(a,b,e){vec2.set(d,b,e);mat2d.translate(a,a,d)};mat2d.scaleXY=function(a,b,e){vec2.set(d,b,e);mat2d.scale(a,a,d)};vec4.unitize=function(a,b){a[0]=b[0]/b[3];a[1]=b[1]/b[3];a[2]=b[2]/b[3];a[3]=1;return a};vec2.copyFromVec4=function(a,f){vec4.unitize(b,f);vec2.copy(a,b)};return{}});"use strict"; +tv.exportTo("tv.b",function(){function d(){this.height=this.width=this.y=this.x=0}d.fromXYWH=function(c,b,a,f){var e=new d;e.x=c;e.y=b;e.width=a;e.height=f;return e};d.fromArray=function(c){if(4!=c.length)throw Error("ary.length must be 4");var b=new d;b.x=c[0];b.y=c[1];b.width=c[2];b.height=c[3];return b};d.prototype={__proto__:Object.prototype,get left(){return this.x},get top(){return this.y},get right(){return this.x+this.width},get bottom(){return this.y+this.height},toString:function(){return"Rect("+ +this.x+", "+this.y+", "+this.width+", "+this.height+")"},toArray:function(){return[this.x,this.y,this.width,this.height]},clone:function(){var c=new d;c.x=this.x;c.y=this.y;c.width=this.width;c.height=this.height;return c},enlarge:function(c){var b=new d;this.enlargeFast(b,c);return b},enlargeFast:function(c,b){c.x=this.x-b;c.y=this.y-b;c.width=this.width+2*b;c.height=this.height+2*b;return c},size:function(){return{width:this.width,height:this.height}},scale:function(c){var b=new d;this.scaleFast(b, +c);return b},scaleSize:function(c){return d.fromXYWH(this.x,this.y,this.width*c,this.height*c)},scaleFast:function(c,b){c.x=this.x*b;c.y=this.y*b;c.width=this.width*b;c.height=this.height*b;return c},translate:function(c){var b=new d;this.translateFast(b,c);return b},translateFast:function(c,b){c.x=this.x+b[0];c.y=this.x+b[1];c.width=this.width;c.height=this.height;return c},asUVRectInside:function(c){var b=new d;b.x=(this.x-c.x)/c.width;b.y=(this.y-c.y)/c.height;b.width=this.width/c.width;b.height= +this.height/c.height;return b},intersects:function(c){var b;b=1&this.x<c.right;b&=this.right>c.x;b&=this.y<c.bottom;return b&=this.bottom>c.y},equalTo:function(c){return c&&this.x===c.x&&this.y===c.y&&this.width===c.width&&this.height===c.height}};return{Rect:d}});"use strict"; +tv.exportTo("tv.b",function(){return{addSingletonGetter:function(d){d.getInstance=function(){return d.instance_||(d.instance_=new d)}},tracedFunction:function(d,c,b){return function(){console.time(c);try{d.apply(b,arguments)}finally{console.timeEnd(c)}}},normalizeException:function(d){return"string"==typeof d?{message:d,stack:["<unknown>"]}:{message:d.message,stack:d.stack?d.stack:["<unknown>"]}},instantiateTemplate:function(d,c){c=c||document;var b=c.querySelector(d);if(!b)throw Error("Element not found"); +return b.createInstance()},stackTrace:function(){var d=Error().stack+"",d=d.split("\n");return d.slice(2)},windowRectForElement:function(d){var c=[d.offsetLeft,d.offsetTop],b=[d.offsetWidth,d.offsetHeight];for(d=d.offsetParent;d;)c[0]+=d.offsetLeft,c[1]+=d.offsetTop,d=d.offsetParent;return tv.b.Rect.fromXYWH(c[0],c[1],b[0],b[1])},scrollIntoViewIfNeeded:function(d){var c=d.parentElement.getBoundingClientRect(),b=d.getBoundingClientRect();b.top<c.top?d.scrollIntoView(!0):b.bottom>c.bottom&&d.scrollIntoView(!1)}, +clamp:function(d,c,b){return Math.min(Math.max(d,c),b)},lerp:function(d,c,b){return c+d*(b-c)},deg2rad:function(d){return Math.PI*d/180},getUsingPath:function(d,c){for(var b=d.split("."),a=c,f;b.length&&(f=b.shift());)if(b.length)if(f in a)a=a[f];else break;else return a[f]}}});"use strict"; +tv.exportTo("tv.b",function(){function d(){return d}function c(){return c}function b(a,b){a.storage_=b;a.get=function(b,f,c){b=a.namespace_(b,c);var d=a.storage_.getItem(b);if(null===d||void 0===d)return f;try{return JSON.parse(d).value}catch(l){return a.storage_.removeItem(a.namespace_(b,c)),f}};a.set=function(b,f,c){if(void 0===f)throw Error("Settings.set: value must not be undefined");f=JSON.stringify({value:f});a.storage_.setItem(a.namespace_(b,c),f)};a.keys=function(b){var f=[];b=b||"";for(var c= +0;c<a.storage_.length;c++){var d=a.storage_.key(c);a.isnamespaced_(d,b)&&f.push(a.unnamespace_(d,b))}return f};a.isnamespaced_=function(b,f){return 0==b.indexOf(a.normalize_(f))};a.namespace_=function(b,f){return a.normalize_(f)+b};a.unnamespace_=function(b,f){return b.replace(a.normalize_(f),"")};a.normalize_=function(b){return a.NAMESPACE+(b?b+".":"")};a.setAlternativeStorageInstance=function(b){a.storage_=b};a.getAlternativeStorageInstance=function(){return a.storage_===localStorage?void 0:a.storage_}; +a.NAMESPACE="trace-viewer"}document.head.addEventListener("tv-unittest-will-run",function(){d.setAlternativeStorageInstance(global.sessionStorage)});b(d,localStorage);b(c,sessionStorage);return{Settings:d,SessionSettings:c}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(a){var b=document.createElement("span");a&&(a.className&&(b.className=a.className),a.textContent&&(b.textContent=a.textContent),a.parent&&a.parent.appendChild(b),a.bold&&(b.style.fontWeight="bold"));return b}function c(a,b){return a instanceof Array&&b instanceof Array?a.length===b.length&&JSON.stringify(a)===JSON.stringify(b):a===b}function b(a,b){var c=d({className:"edit-categories"});c.textContent="Edit categories";c.classList.add("labeled-option");c.addEventListener("click", +function(){b.onClickEditCategories()});return c}var a=1;return{createSpan:d,createDiv:function(a){var b=document.createElement("div");a&&(a.className&&(b.className=a.className),a.parent&&a.parent.appendChild(b));return b},createScopedStyle:function(a){var b=document.createElement("style");b.scoped=!0;b.innerHTML=a;return b},createSelector:function(a,b,g,d,k,l){function m(c){c=v.selectedOptions[0].targetPropertyValue;tv.b.Settings.set(g,c,l);a[b]=c}for(var n,q=0;q<k.length;q++){var u=k[q];if(c(u.value, +d)){n=q;break}}if(void 0===n)throw Error("defaultValue must be in the items list");var v=document.createElement("select");v.addEventListener("change",m);for(q=0;q<k.length;q++){var u=k[q],y=document.createElement("option");y.textContent=u.label;y.targetPropertyValue=u.value;v.appendChild(y)}a.__lookupSetter__("selectedIndex");v.__defineGetter__("selectedValue",function(a){return v.children[v.selectedIndex].targetPropertyValue});v.__defineSetter__("selectedValue",function(a){for(var b=0;b<v.children.length;b++)if(c(v.children[b].targetPropertyValue, +a)){v.selectedIndex!=b&&(v.selectedIndex=b,m());return}throw Error("Not a valid value");});k=tv.b.Settings.get(g,d,l);u=!1;for(q=0;q<v.children.length;q++)if(c(v.children[q].targetPropertyValue,k)){u=!0;a[b]=k;v.selectedIndex=q;break}u||(v.selectedIndex=n,a[b]=d);return v},createOptionGroup:function(a,e,g,h,k){function l(){var b=[];this.value.length&&(b=this.value.split(","));tv.b.Settings.set(g,b);a[e]=b}var m=d({className:"labeled-option-group"});h=tv.b.Settings.get(g,h);for(var n=0;n<k.length;++n){var q= +k[n],u="category-preset-"+q.label.replace(/ /g,"-"),v=document.createElement("input");v.type="radio";v.setAttribute("id",u);v.setAttribute("name","category-presets-group");v.setAttribute("value",q.value);v.addEventListener("change",l.bind(v,a,e,g));c(h,q.value)&&(v.checked=!0);var y=document.createElement("label");y.textContent=q.label;y.setAttribute("for",u);q=d({className:"labeled-option"});q.appendChild(v);q.appendChild(y);q.__defineSetter__("checked",function(a){v.checked!==!!a&&(v.checked=!!a, +l())});q.__defineGetter__("checked",function(){return v.checked});m.appendChild(q)}m.appendChild(b(m,a));h.length||m.classList.add("categories-expanded");a[e]=h;return m},createCheckBox:function(b,e,c,h,k){function l(){tv.b.Settings.set(c,m.checked);b&&(b[e]=m.checked)}var m=document.createElement("input");m.type="checkbox";h=tv.b.Settings.get(c,h);m.checked=!!h;b&&(b[e]=h);m.addEventListener("change",l);h="#checkbox-"+a++;var n=d({className:"labeled-checkbox"});m.setAttribute("id",h);var q=document.createElement("label"); +q.textContent=k;q.setAttribute("for",h);n.appendChild(m);n.appendChild(q);n.__defineSetter__("checked",function(a){m.checked!==!!a&&(m.checked=!!a,l())});n.__defineGetter__("checked",function(){return m.checked});return n},isElementAttachedToDocument:function(a){for(var b=a;b.parentNode;)b=b.parentNode;return b==a.ownerDocument}}});"use strict"; +tv.exportTo("tv.b",function(){function d(){}d.decorate=function(b){for(var a in d.prototype)if("decorate"!=a){var f=d.prototype[a];"function"===typeof f&&(b[a]=f)}};d.prototype={addEventListener:function(b,a){this.listeners_||(this.listeners_=Object.create(null));if(b in this.listeners_){var f=this.listeners_[b];0>f.indexOf(a)&&f.push(a)}else this.listeners_[b]=[a]},removeEventListener:function(b,a){if(this.listeners_&&b in this.listeners_){var f=this.listeners_[b],e=f.indexOf(a);0<=e&&(1==f.length? +delete this.listeners_[b]:f.splice(e,1))}},dispatchEvent:function(b){if(!this.listeners_)return!0;var a=this;b.__defineGetter__("target",function(){return a});var f=b.preventDefault;b.preventDefault=function(){f.call(this);this.rawReturnValue=!1};var e=b.type,c=0;if(e in this.listeners_)for(var e=this.listeners_[e].concat(),d=0,k;k=e[d];d++)c=k.handleEvent?c|!1===k.handleEvent.call(k,b):c|!1===k.call(this,b);return!c&&b.rawReturnValue},hasEventListener:function(b){return void 0!==this.listeners_[b]}}; +var c={decorate:function(b){for(var a in c)if("decorate"!=a){var f=c[a];"function"===typeof f&&(b[a]=f)}b.listenerCounts_={}},addEventListener:function(b,a,f){this.__proto__.addEventListener.call(this,b,a,f);void 0===this.listenerCounts_[b]&&(this.listenerCounts_[b]=0);this.listenerCounts_[b]++},removeEventListener:function(b,a,f){this.__proto__.removeEventListener.call(this,b,a,f);this.listenerCounts_[b]--},hasEventListener:function(b){return 0<this.listenerCounts_[b]}};return{EventTarget:d,EventTargetHelper:c}}); +"use strict";tv.exportTo("tv.b",function(){function d(c,b,a){var f=tv.doc.createEvent("Event");f.initEvent(c,!!b,!!a);f.__proto__=global.Event.prototype;return f}d.prototype={__proto__:global.Event.prototype};return{Event:d,dispatchSimpleEvent:function(c,b,a,f){b=new d(b,a,f);return c.dispatchEvent(b)}}});"use strict"; +tv.exportTo("tv.b",function(){function d(a,b,f,c,d,m){d=new tv.b.Event(b+"Change",d,m);d.propertyName=b;d.newValue=f;d.oldValue=c;var n;d.throwError=function(a){n=a};a.dispatchEvent(d);if(n)throw n;}function c(a){return a.replace(/([A-Z])/g,"-$1").toLowerCase()}function b(a,b){switch(b){case f.JS:var d=a+"_tv_";return function(){return this[d]};case f.ATTR:var k=c(a);return function(){return this.getAttribute(k)};case f.BOOL_ATTR:return k=c(a),function(){return this.hasAttribute(k)}}}function a(a, +b,h,k,l){switch(b){case f.JS:var m=a+"_tv_";return function(b){var f=this[m];b!==f&&(this[m]=b,h&&h.call(this,b,f),d(this,a,b,f,k,l))};case f.ATTR:var n=c(a);return function(b){var f=this.getAttribute(n);b!==f&&(void 0==b?this.removeAttribute(n):this.setAttribute(n,b),h&&h.call(this,b,f),d(this,a,b,f,k,l))};case f.BOOL_ATTR:return n=c(a),function(b){var f=this.getAttribute(n)===a;b!==f&&(b?this.setAttribute(n,a):this.removeAttribute(n),h&&h.call(this,b,f),d(this,a,b,f,k,l))}}}var f={JS:"js",ATTR:"attr", +BOOL_ATTR:"boolAttr"};return{PropertyKind:f,defineProperty:function(e,c,d,k,l,m){console.error("Don't use tv.b.defineProperty");"function"==typeof e&&(e=e.prototype);d=d||f.JS;e.__lookupGetter__(c)||e.__defineGetter__(c,b(c,d));e.__lookupSetter__(c)||e.__defineSetter__(c,a(c,d,k,l,m))},dispatchPropertyChange:d,setPropertyAndDispatchChange:function(a,b,f){var c=a[b];a[b+"_"]=f;c!==f&&tv.b.dispatchPropertyChange(a,b,f,c,!0,!1)}}});"use strict"; +tv.exportTo("tv.b.ui",function(){var d=document.currentScript.ownerDocument,c=tv.b.ui.define("overlay");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay");this.parentEl_=this.ownerDocument.body;this.visible_=!1;this.userCanClose_=!0;this.onKeyDown_=this.onKeyDown_.bind(this);this.onClick_=this.onClick_.bind(this);this.onFocusIn_=this.onFocusIn_.bind(this);this.onDocumentClick_=this.onDocumentClick_.bind(this);this.onClose_=this.onClose_.bind(this);this.addEventListener("visibleChange", +tv.b.ui.Overlay.prototype.onVisibleChange_.bind(this),!0);this.shadow_=(this.createShadowRoot||this.webkitCreateShadowRoot).call(this);this.shadow_.appendChild(tv.b.instantiateTemplate("#overlay-template",d));this.closeBtn_=this.shadow_.querySelector("close-button");this.closeBtn_.addEventListener("click",this.onClose_);this.shadow_.querySelector("overlay-frame").addEventListener("click",this.onClick_);this.observer_=new WebKitMutationObserver(this.didButtonBarMutate_.bind(this));this.observer_.observe(this.shadow_.querySelector("button-bar"), +{childList:!0});Object.defineProperty(this,"title",{get:function(){return this.shadow_.querySelector("title").textContent},set:function(b){this.shadow_.querySelector("title").textContent=b}})},set userCanClose(b){this.userCanClose_=b;this.closeBtn_.style.display=b?"block":"none"},get buttons(){return this.shadow_.querySelector("button-bar")},get visible(){return this.visible_},set visible(b){this.visible_!==b&&tv.b.setPropertyAndDispatchChange(this,"visible",b)},onVisibleChange_:function(){this.visible_? +this.show_():this.hide_()},show_:function(){this.parentEl_.appendChild(this);this.userCanClose_&&(this.addEventListener("keydown",this.onKeyDown_.bind(this)),this.addEventListener("click",this.onDocumentClick_.bind(this)));this.parentEl_.addEventListener("focusin",this.onFocusIn_);this.tabIndex=0;var b=void 0,a=this.querySelectorAll("button, input, list, select, a");0<a.length&&(a[0]===this.closeBtn_?1<a.length&&(b=a[1]):b=a[0]);void 0===b&&(b=this);b.focus()},hide_:function(){this.parentEl_.removeChild(this); +this.parentEl_.removeEventListener("focusin",this.onFocusIn_);this.closeBtn_&&this.closeBtn_.removeEventListener(this.onClose_);document.removeEventListener("keydown",this.onKeyDown_);document.removeEventListener("click",this.onDocumentClick_)},onClose_:function(b){this.visible=!1;("keydown"!=b.type||"keydown"===b.type&&27===b.keyCode)&&b.stopPropagation();b.preventDefault();tv.b.dispatchSimpleEvent(this,"closeclick")},onFocusIn_:function(b){b.target!==this&&(window.setTimeout(function(){this.focus()}, +0),b.preventDefault(),b.stopPropagation())},didButtonBarMutate_:function(b){0<this.buttons.children.length?this.shadow_.querySelector("button-bar").style.display=void 0:this.shadow_.querySelector("button-bar").style.display="none"},onKeyDown_:function(b){if(9===b.keyCode&&b.shiftKey&&b.target===this)b.preventDefault();else if(27===b.keyCode)this.onClose_(b)},onClick_:function(b){b.stopPropagation()},onDocumentClick_:function(b){if(this.userCanClose_)this.onClose_(b)}};c.showError=function(b,a){var f= +new c;f.title="Error";f.textContent=b;if(a){var e=tv.b.normalizeException(a),g=document.createElement("pre");g.textContent=e.stack;g.style.paddingLeft="8px";g.style.margin=0;f.appendChild(g)}e=document.createElement("button");e.textContent="OK";e.addEventListener("click",function(){f.visible=!1});f.buttons.appendChild(e);f.visible=!0;return f};return{Overlay:c}});"use strict"; +tv.exportTo("tv.b.ui",function(){var d=tv.b.ui.define("x-drag-handle");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.lastMousePos_=0;this.onMouseMove_=this.onMouseMove_.bind(this);this.onMouseUp_=this.onMouseUp_.bind(this);this.addEventListener("mousedown",this.onMouseDown_);this.target_=void 0;this.horizontal=!0;this.observer_=new WebKitMutationObserver(this.didTargetMutate_.bind(this));this.targetSizesByModeKey_={}},get modeKey_(){return""==this.target_.className?".": +this.target_.className},get target(){return this.target_},set target(c){this.observer_.disconnect();(this.target_=c)&&this.observer_.observe(this.target_,{attributes:!0,attributeFilter:["class"]})},get horizontal(){return this.horizontal_},set horizontal(c){this.className=(this.horizontal_=c)?"horizontal-drag-handle":"vertical-drag-handle"},get vertical(){return!this.horizontal_},set vertical(c){this.horizontal=!c},forceMutationObserverFlush_:function(){var c=this.observer_.takeRecords();c.length&& +this.didTargetMutate_(c)},didTargetMutate_:function(c){c=this.targetSizesByModeKey_[this.modeKey_];void 0!==c?this.setTargetSize_(c):this.target_.style[this.targetStyleKey_]=""},get targetStyleKey_(){return this.horizontal_?"height":"width"},getTargetSize_:function(){var c=this.targetStyleKey_;this.target_.style[c]||(this.target_.style[c]=window.getComputedStyle(this.target_)[c]);c=parseInt(this.target_.style[c]);return this.targetSizesByModeKey_[this.modeKey_]=c},setTargetSize_:function(c){this.target_.style[this.targetStyleKey_]= +c+"px";this.targetSizesByModeKey_[this.modeKey_]=c},applyDelta_:function(c){var b=this.getTargetSize_();this.setTargetSize_(this.target_===this.nextElementSibling?b+c:b-c)},onMouseMove_:function(c){var b=this.horizontal_?c.clientY:c.clientX;this.applyDelta_(this.lastMousePos_-b);this.lastMousePos_=b;c.preventDefault();return!0},onMouseDown_:function(c){if(this.target_)return this.forceMutationObserverFlush_(),this.lastMousePos_=this.horizontal_?c.clientY:c.clientX,document.addEventListener("mousemove", +this.onMouseMove_),document.addEventListener("mouseup",this.onMouseUp_),c.preventDefault(),!0},onMouseUp_:function(c){document.removeEventListener("mousemove",this.onMouseMove_);document.removeEventListener("mouseup",this.onMouseUp_);c.preventDefault()}};return{DragHandle:d}});"use strict"; +tv.exportTo("tv.b",function(){function d(){if(void 0===f||void 0===a)a={},f={},Polymer.elements.forEach(function(b){if(a[b.name])throw Error("Something is strange: dupe polymer element names");a[b.name]=b;b.extends&&(void 0===f[b.extends]&&(f[b.extends]=[]),f[b.extends].push(b.name))})}function c(b){d();return a[b]}function b(a){if(Polymer.waitingFor().length)throw Error("There are unresolved polymer elements. Wait until Polymer.whenReady");d();element=c(a);if(!element)throw Error(a+" is not a polymer element"); +opt_includeSelf=!!opt_includeSelf;void 0===e[a]&&(immediateSubElements=f[polymerElement],immediateSubElements.length?immediateSubElements.forEach(function(a){(void 0).push.apply(void 0,b(a.name))}):e[a]=immediateSubElements,e[a]=void 0);return e[a]}Object.observe(Polymer.elements,function(){a={};f=void 0;e={}});var a=void 0,f=void 0,e=void 0;return{getPolymerElementNamed:c,getPolymerElementsThatSubclass:b,getPolymerSubclassingDepthFrom:function(a,b){if(Polymer.waitingFor().length)throw Error("There are unresolved polymer elements. Wait until Polymer.whenReady"); +if(!Polymer.elements[b])throw Error(b+" is not a polymer element");if(!Polymer.elements[a])throw Error(a+" is not a polymer element");for(var e=0,f=a;f!=b;)if(e+=1,f=Polymer.elements[f].extends,!f)throw Error(a+" does not subclass "+b);return e}}});"use strict"; +Polymer("tracing-analysis-tab-view",{get selectedTab(){if(this.selectedTab_)return this.selectedTab_.content},set selectedTab(d){this.childrenUpdated_(this.childrenObserver_.takeRecords(),this.childrenObserver_);if(void 0===d||null===d)this.changeSelectedTabById_(void 0);else{for(var c=void 0,b=0;b<this.tabs_.length;b++)if(this.tabs_[b].content===d){c=this.tabs_[b].id;break}void 0===c?console.warn("Tab not in tabs list. Ignoring changed selection."):this.changeSelectedTabById_(c)}},get tabsHidden(){return this.shadowRoot.querySelector("tab-strip").hasAttribute("tabs-hidden")}, +set tabsHidden(d){d=!!d;var c=this.shadowRoot.querySelector("tab-strip");d?c.setAttribute("tabs-hidden",!0):c.removeAttribute("tabs-hidden")},ready:function(){this.tabs_=[];this.selectedTab_=void 0;for(var d=0;d<this.children.length;d++)this.processAddedChild_(this.children[d]);this.childrenObserver_=new MutationObserver(this.childrenUpdated_.bind(this));this.childrenObserver_.observe(this,{childList:"true"})},processAddedChild_:function(d){var c=new MutationObserver(this.childAttributesChanged_.bind(this)), +b=new MutationObserver(this.childAttributesChanged_.bind(this)),a={id:this.tabs_.length,content:d,label:d.getAttribute("tab-label"),observers:{forAttributeSelected:c,forAttributeTabLabel:b},savedScrollTop:0,savedScrollLeft:0};this.tabs_.push(a);d.hasAttribute("selected")&&(this.selectedTab_?d.removeAttribute("selected"):this.setSelectedTabById_(a.id));var f=d.selected,e=this;Object.defineProperty(d,"selected",{configurable:!0,set:function(b){b?e.changeSelectedTabById_(a.id):e.selectedTab_===a&&e.changeSelectedTabById_(void 0)}, +get:function(){return this.hasAttribute("selected")}});f&&(d.selected=f);c.observe(d,{attributeFilter:["selected"]});b.observe(d,{attributeFilter:["tab-label"]})},processRemovedChild_:function(d){for(var c=0;c<this.tabs_.length;c++)this.tabs_[c].id=c,this.tabs_[c].content===d&&(this.tabs_[c].observers.forAttributeSelected.disconnect(),this.tabs_[c].observers.forAttributeTabLabel.disconnect(),this.tabs_[c]===this.selectedTab_&&this.clearSelectedTab_(),d.removeAttribute("selected"),delete d.selected, +this.tabs_.splice(c,1),c--)},childAttributesChanged_:function(d,c){for(var b=void 0,a=0;a<this.tabs_.length;a++){var f=this.tabs_[a].observers;if(f.forAttributeSelected===c||f.forAttributeTabLabel===c){b=this.tabs_[a];break}}if(b)for(a=0;a<d.length;a++)f=b.content,"tab-label"===d[a].attributeName&&(b.label=f.getAttribute("tab-label")),"selected"===d[a].attributeName&&(f.hasAttribute("selected")?this.changeSelectedTabById_(b.id):this.changeSelectedTabById_(void 0))},childrenUpdated_:function(d,c){d.forEach(function(b){for(var a= +0;a<b.removedNodes.length;a++)this.processRemovedChild_(b.removedNodes[a]);for(a=0;a<b.addedNodes.length;a++)this.processAddedChild_(b.addedNodes[a])},this)},tabButtonSelectHandler_:function(d,c,b){this.changeSelectedTabById_(b.getAttribute("button-id"))},changeSelectedTabById_:function(d){var c=this.selectedTab_!==(void 0!==d?this.tabs_[d]:void 0);this.saveCurrentTabScrollPosition_();this.clearSelectedTab_();void 0!==d&&(this.setSelectedTabById_(d),this.restoreCurrentTabScrollPosition_());c&&this.fire("selected-tab-change")}, +setSelectedTabById_:function(d){this.selectedTab_=this.tabs_[d];this.selectedTab_.observers.forAttributeSelected.disconnect();this.selectedTab_.content.setAttribute("selected","selected");this.selectedTab_.observers.forAttributeSelected.observe(this.selectedTab_.content,{attributeFilter:["selected"]})},saveCurrentTabScrollPosition_:function(){this.selectedTab_&&(this.selectedTab_.savedScrollTop=this.$["content-container"].scrollTop,this.selectedTab_.savedScrollLeft=this.$["content-container"].scrollLeft)}, +restoreCurrentTabScrollPosition_:function(){this.selectedTab_&&(this.$["content-container"].scrollTop=this.selectedTab_.savedScrollTop,this.$["content-container"].scrollLeft=this.selectedTab_.savedScrollLeft)},clearSelectedTab_:function(){this.selectedTab_&&(this.selectedTab_.observers.forAttributeSelected.disconnect(),this.selectedTab_.content.removeAttribute("selected"),this.selectedTab_.observers.forAttributeSelected.observe(this.selectedTab_.content,{attributeFilter:["selected"]}),this.selectedTab_= +void 0)}});"use strict";Polymer("tracing-analysis-sub-view",{set tabLabel(d){return this.setAttribute("tab-label",d)},get tabLabel(){return this.getAttribute("tab-label")},get requiresTallView(){return!1},set selection(d){throw Error("Not implemented!");},get selection(){throw Error("Not implemented!");}});"use strict";tv.exportTo("tv.c.analysis",function(){return{tsRound:function(d){return Math.round(1E3*d)/1E3}}});"use strict";tv.exportTo("tv.b",function(){var d=1;return{GUID:{allocate:function(){return d++}}}}); +"use strict"; +tv.exportTo("tv.b",function(){function d(){this.isEmpty_=!0;this.max_=this.min_=void 0}d.prototype={__proto__:Object.prototype,reset:function(){this.isEmpty_=!0;this.max_=this.min_=void 0},get isEmpty(){return this.isEmpty_},addRange:function(c){c.isEmpty||(this.addValue(c.min),this.addValue(c.max))},addValue:function(c){this.isEmpty_?(this.min_=this.max_=c,this.isEmpty_=!1):(this.max_=Math.max(this.max_,c),this.min_=Math.min(this.min_,c))},set min(c){this.isEmpty_=!1;this.min_=c},get min(){return this.isEmpty_?void 0: +this.min_},get max(){return this.isEmpty_?void 0:this.max_},set max(c){this.isEmpty_=!1;this.max_=c},get range(){return this.isEmpty_?void 0:this.max_-this.min_},get center(){return.5*(this.min_+this.max_)},equals:function(c){return this.isEmpty&&c.isEmpty?!0:this.isEmpty!=c.isEmpty?!1:this.min===c.min&&this.max===c.max},containsRange:function(c){return this.isEmpty||c.isEmpty?!1:this.min<=c.min&&this.max>=c.max},containsExplicitRange:function(c,b){return this.isEmpty?!1:this.min<=c&&this.max>=b}, +intersectsRange:function(c){return this.isEmpty||c.isEmpty?!1:!(c.max<this.min||c.min>this.max)},intersectsExplicitRange:function(c,b){return this.isEmpty?!1:!(b<this.min||c>this.max)}};d.compareByMinTimes=function(c,b){return c.isEmpty||b.isEmpty?c.isEmpty&&!b.isEmpty?-1:!c.isEmpty&&b.isEmpty?1:0:c.min_-b.min_};return{Range:d}});"use strict"; +tv.exportTo("tv.b",function(){function d(a,b){return void 0===a?b:void 0===b?a:Math.max(a,b)}function c(a,b){this.beginPositionCb_=a;this.endPositionCb_=b;this.root_=void 0;this.size_=0}function b(b,e,c,d){this.lowValue_=c;this.data_=[{start:b,end:e,high:d,low:c}];this.colour_=a.RED;this.maxHighRight_=this.maxHighLeft_=this.rightNode_=this.leftNode_=this.parentNode_=void 0}c.prototype={insert:function(f,e){var c=this.beginPositionCb_(f),d=this.endPositionCb_(e||f),c=new b(f,e||f,c,d);this.size_++; +this.root_=this.insertNode_(this.root_,c);this.root_.colour=a.BLACK},insertNode_:function(a,b){if(void 0===a)return b;a.leftNode&&a.leftNode.isRed&&a.rightNode&&a.rightNode.isRed&&this.flipNodeColour_(a);b.key<a.key?a.leftNode=this.insertNode_(a.leftNode,b):b.key===a.key?a.merge(b):a.rightNode=this.insertNode_(a.rightNode,b);!a.rightNode||!a.rightNode.isRed||void 0!==a.leftNode&&a.leftNode.isRed||(a=this.rotateLeft_(a));a.leftNode&&a.leftNode.isRed&&a.leftNode.leftNode&&a.leftNode.leftNode.isRed&& +(a=this.rotateRight_(a));return a},rotateRight_:function(b){var e=b.leftNode;b.leftNode=e.rightNode;e.rightNode=b;e.colour=b.colour;b.colour=a.RED;return e},rotateLeft_:function(b){var e=b.rightNode;b.rightNode=e.leftNode;e.leftNode=b;e.colour=b.colour;b.colour=a.RED;return e},flipNodeColour_:function(a){a.colour=this.flipColour_(a.colour);a.leftNode.colour=this.flipColour_(a.leftNode.colour);a.rightNode.colour=this.flipColour_(a.rightNode.colour)},flipColour_:function(b){return b===a.RED?a.BLACK: +a.RED},updateHighValues:function(){this.updateHighValues_(this.root_)},updateHighValues_:function(a){if(void 0!==a)return a.maxHighLeft=this.updateHighValues_(a.leftNode),a.maxHighRight=this.updateHighValues_(a.rightNode),d(d(a.maxHighLeft,a.highValue),a.maxHighRight)},findIntersection:function(a,b){if(void 0===a||void 0===b)throw Error("lowValue and highValue must be defined");if("number"!==typeof a||"number"!==typeof b)throw Error("lowValue and highValue must be numbers");return void 0===this.root_? +[]:this.findIntersection_(this.root_,a,b)},findIntersection_:function(a,b,c){var d=[];if(a.lowValue>=c)return a.hasLeftNode?this.findIntersection_(a.leftNode,b,c):[];a.maxHighLeft>b&&(d=d.concat(this.findIntersection_(a.leftNode,b,c)));if(a.highValue>b)for(var k=a.data.length-1;0<=k&&!(a.data[k].high<b);--k)d.unshift([a.data[k].start,a.data[k].end]);a.hasRightNode&&(d=d.concat(this.findIntersection_(a.rightNode,b,c)));return d},get size(){return this.size_},get root(){return this.root_},dump_:function(){return void 0=== +this.root_?[]:this.dumpNode_(this.root_)},dumpNode_:function(a){var b={};a.hasLeftNode&&(b.left=this.dumpNode_(a.leftNode));b.node=a.dump();a.hasRightNode&&(b.right=this.dumpNode_(a.rightNode));return b}};var a={RED:"red",BLACK:"black"};b.prototype={get colour(){return this.colour_},set colour(a){this.colour_=a},get key(){return this.lowValue_},get lowValue(){return this.lowValue_},get highValue(){return this.data_[this.data_.length-1].high},set leftNode(a){this.leftNode_=a},get leftNode(){return this.leftNode_}, +get hasLeftNode(){return void 0!==this.leftNode_},set rightNode(a){this.rightNode_=a},get rightNode(){return this.rightNode_},get hasRightNode(){return void 0!==this.rightNode_},set parentNode(a){this.parentNode_=a},get parentNode(){return this.parentNode_},get isRootNode(){return void 0===this.parentNode_},set maxHighLeft(a){this.maxHighLeft_=a},get maxHighLeft(){return this.maxHighLeft_},set maxHighRight(a){this.maxHighRight_=a},get maxHighRight(){return this.maxHighRight_},get data(){return this.data_}, +get isRed(){return this.colour_===a.RED},merge:function(a){this.data_=this.data_.concat(a.data);this.data_.sort(function(a,b){return a.high-b.high})},dump:function(){return 1===this.data_.length?[this.data_[0].low,this.data[0].high]:this.data_.map(function(a){return[a.low,a.high]})}};return{IntervalTree:c}});"use strict"; +tv.exportTo("tv.b",function(){function d(){if(!k)if(k=!0,window.requestAnimationFrame)window.requestAnimationFrame(b);else{var a=Date.now()-window.performance.now();window.webkitRequestAnimationFrame(function(e){b(e-a)})}}function c(a,b){try{a.callback.call(a.context,b)}catch(e){tv.b.onAnimationFrameError(e,a.stack)}}function b(a){var b=a+10;k=!1;var n=f;h=e;f=[];e=[];for(var q=n.length||h.length,u=0;u<n.length;u++)c(n[u],a);for(;0<h.length;)c(h.shift(),a);h=void 0;if(!q)for(;0<g.length&&!(c(g.shift()), +window.performance.now()>=b););0<g.length&&d()}function a(a,b){e.push({callback:a,context:b||window,stack:""});d()}var f=[],e=[],g=[],h=void 0,k=!1;return{onAnimationFrameError:function(a,b){b&&console.log(b);a.message?console.error(a.message,a.stack):console.error(a)},requestPreAnimationFrame:function(a,b){f.push({callback:a,context:b||window,stack:""});d()},requestAnimationFrame:a,requestAnimationFrameInThisFrameIfPossible:function(b,e){h?h.push({callback:b,context:e||window,stack:""}):a(b,e)}, +requestIdleCallback:function(a,b){g.push({callback:a,context:b||window,stack:""});d()},forcePendingRAFTasksToRun:function(a){k&&b(a)}}});"use strict"; +tv.exportTo("tv.b",function(){function d(c,b){if(void 0!==c&&void 0===b)throw Error("Almost certainly, you meant to pass a thisArg.");this.runCb_=c;this.thisArg_=b;this.afterTask_=void 0;this.subTasks_=[]}d.prototype={subTask:function(c,b){c instanceof d?this.subTasks_.push(c):this.subTasks_.push(new d(c,b));return this.subTasks_[this.subTasks_.length-1]},run:function(){void 0!==this.runCb_&&this.runCb_.call(this.thisArg_,this);var c=this.subTasks_;this.subTasks_=void 0;if(!c.length)return this.afterTask_; +for(var b=1;b<c.length;b++)c[b-1].afterTask_=c[b];c[c.length-1].afterTask_=this.afterTask_;return c[0]},after:function(c,b){if(this.afterTask_)throw Error("Has an after task already");return this.afterTask_=c instanceof d?c:new d(c,b)}};d.RunSynchronously=function(c){for(;c;)c=c.run()};d.RunWhenIdle=function(c){return new Promise(function(b,a){function f(){try{e=e.run()}catch(c){a(c);console.error(c.stack);return}e?tv.b.requestIdleCallback(f):b()}var e=c;tv.b.requestIdleCallback(f)})};return{Task:d}}); +"use strict"; +tv.exportTo("tv.c",function(){function d(){}function c(a){this.text_=a.toLowerCase();if(!a.length)throw Error("Filter text is empty.");}function b(a){this.text_=a;if(!a.length)throw Error("Filter text is empty.");}d.prototype={__proto__:Object.prototype,matchCounter:function(a){return!0},matchCpu:function(a){return!0},matchProcess:function(a){return!0},matchSlice:function(a){return!0},matchThread:function(a){return!0}};c.prototype={__proto__:d.prototype,matchSlice:function(a){return void 0===a.title? +!1:-1!==a.title.toLowerCase().indexOf(this.text_)}};b.prototype={__proto__:d.prototype,matchSlice:function(a){return a.title===this.text_}};return{TitleFilter:c,ExactTitleFilter:b}});"use strict"; +tv.exportTo("tv.b",function(){function d(a,b){this.constructor=a;this.metadata=b}function c(a){if(void 0===a)throw Error("Mode is required");if(!b[a])throw Error("Not a mode.");this.mode_=a;this.defaultMetadata_={};this.defaultTypeInfo_=this.mandatoryBaseClass_=this.defaultConstructor_=void 0;this.frozen_=!1}var b={BASIC_REGISTRY_MODE:!0,TYPE_BASED_REGISTRY_MODE:!0};c.prototype={freeze:function(){if(this.frozen_)throw Error("Frozen");this.frozen_=!0},get mode(){return this.mode_},get defaultMetadata(){return this.defaultMetadata_}, +set defaultMetadata(a){if(this.frozen_)throw Error("Frozen");this.defaultMetadata_=a;this.defaultTypeInfo_=void 0},get defaultConstructor(){return this.defaultConstructor_},set defaultConstructor(a){if(this.frozen_)throw Error("Frozen");this.defaultConstructor_=a;this.defaultTypeInfo_=void 0},get defaultTypeInfo(){void 0===this.defaultTypeInfo_&&this.defaultConstructor_&&(this.defaultTypeInfo_=new d(this.defaultConstructor,this.defaultMetadata));return this.defaultTypeInfo_},validateConstructor:function(a){if(this.mandatoryBaseClass){for(var b= +a.prototype.__proto__,e=!1;b;){if(b===this.mandatoryBaseClass.prototype){e=!0;break}b=b.__proto__}if(!e)throw Error(a+"must be subclass of "+registry);}}};return{BASIC_REGISTRY_MODE:"BASIC_REGISTRY_MODE",TYPE_BASED_REGISTRY_MODE:"TYPE_BASED_REGISTRY_MODE",ExtensionRegistryOptions:c,RegisteredTypeInfo:d}});"use strict"; +tv.exportTo("tv.b",function(){var d=tv.b.RegisteredTypeInfo;return{_decorateBasicExtensionRegistry:function(c,b){var a=[];c.registeredTypeInfos_=[];c.register=function(a,e){if(void 0!==c.findIndexOfRegisteredConstructor(a))throw Error("Handler already registered for "+a);b.validateConstructor(a);var g={},h;for(h in b.defaultMetadata)g[h]=b.defaultMetadata[h];if(e)for(h in e)g[h]=e[h];g=new d(a,g);h=new Event("will-register");h.typeInfo=g;c.dispatchEvent(h);c.registeredTypeInfos_.push(g);h=new Event("registry-changed"); +c.dispatchEvent(h)};c.pushCleanStateBeforeTest=function(){a.push(c.registeredTypeInfos_);c.registeredTypeInfos_=[];var b=new Event("registry-changed");c.dispatchEvent(b)};c.popCleanStateAfterTest=function(){c.registeredTypeInfos_=a[0];a.splice(0,1);var b=new Event("registry-changed");c.dispatchEvent(b)};c.findIndexOfRegisteredConstructor=function(a){for(var b=0;b<c.registeredTypeInfos_.length;b++)if(c.registeredTypeInfos_[b].constructor==a)return b};c.unregister=function(a){var b=c.findIndexOfRegisteredConstructor(a); +if(void 0===b)throw Error(a+" not registered");c.registeredTypeInfos_.splice(b,1);a=new Event("registry-changed");c.dispatchEvent(a)};c.getAllRegisteredTypeInfos=function(){return c.registeredTypeInfos_};c.findTypeInfo=function(a){a=this.findIndexOfRegisteredConstructor(a);if(void 0!==a)return this.registeredTypeInfos_[a]};c.findTypeInfoMatching=function(a,e){e=e?e:void 0;for(var g=0;g<c.registeredTypeInfos_.length;++g){var d=c.registeredTypeInfos_[g];if(a.call(e,d))return d}return b.defaultTypeInfo}}}}); +"use strict";tv.exportTo("tv.b",function(){var d={};return{getCategoryParts:function(c){var b=d[c];if(void 0!==b)return b;b=c.split(",");return d[c]=b}}});"use strict"; +tv.exportTo("tv.b",function(){var d=tv.b.getCategoryParts,c=tv.b.RegisteredTypeInfo;return{_decorateTypeBasedExtensionRegistry:function(b,a){var f=[];b.registeredTypeInfos_=[];b.categoryPartToTypeInfoMap_={};b.typeNameToTypeInfoMap_={};b.register=function(e,f){a.validateConstructor(e);var d=new c(e,f||a.defaultMetadata);d.typeNames=[];d.categoryParts=[];f&&f.typeName&&d.typeNames.push(f.typeName);f&&f.typeNames&&d.typeNames.push.apply(d.typeNames,f.typeNames);f&&f.categoryParts&&d.categoryParts.push.apply(d.categoryParts, +f.categoryParts);if(0===d.typeNames.length&&0===d.categoryParts.length)throw Error("typeName or typeNames must be provided");d.typeNames.forEach(function(a){if(b.typeNameToTypeInfoMap_[a])throw Error("typeName "+a+" already registered");});d.categoryParts.forEach(function(a){if(b.categoryPartToTypeInfoMap_[a])throw Error("categoryPart "+a+" already registered");});var k=new Event("will-register");k.typeInfo=d;b.dispatchEvent(k);d.typeNames.forEach(function(a){b.typeNameToTypeInfoMap_[a]=d});d.categoryParts.forEach(function(a){b.categoryPartToTypeInfoMap_[a]= +d});b.registeredTypeInfos_.push(d);k=new Event("registry-changed");b.dispatchEvent(k)};b.pushCleanStateBeforeTest=function(){f.push({registeredTypeInfos:b.registeredTypeInfos_,typeNameToTypeInfoMap:b.typeNameToTypeInfoMap_,categoryPartToTypeInfoMap:b.categoryPartToTypeInfoMap_});b.registeredTypeInfos_=[];b.typeNameToTypeInfoMap_={};b.categoryPartToTypeInfoMap_={};var a=new Event("registry-changed");b.dispatchEvent(a)};b.popCleanStateAfterTest=function(){var a=f[0];f.splice(0,1);b.registeredTypeInfos_= +a.registeredTypeInfos;b.typeNameToTypeInfoMap_=a.typeNameToTypeInfoMap;b.categoryPartToTypeInfoMap_=a.categoryPartToTypeInfoMap;a=new Event("registry-changed");b.dispatchEvent(a)};b.unregister=function(a){for(var c=-1,f=0;f<b.registeredTypeInfos_.length;f++)if(b.registeredTypeInfos_[f].constructor==a){c=f;break}if(-1===c)throw Error(a+" not registered");a=b.registeredTypeInfos_[c];b.registeredTypeInfos_.splice(c,1);a.typeNames.forEach(function(a){delete b.typeNameToTypeInfoMap_[a]});a.categoryParts.forEach(function(a){delete b.categoryPartToTypeInfoMap_[a]}); +c=new Event("registry-changed");b.dispatchEvent(c)};b.getTypeInfo=function(e,c){if(e)for(var f=d(e),k=0;k<f.length;k++){var l=f[k];if(b.categoryPartToTypeInfoMap_[l])return b.categoryPartToTypeInfoMap_[l]}return b.typeNameToTypeInfoMap_[c]?b.typeNameToTypeInfoMap_[c]:a.defaultTypeInfo};b.getConstructor=function(a,c){var f=b.getTypeInfo(a,c);if(f)return f.constructor}}}});"use strict"; +tv.exportTo("tv.b",function(){return{decorateExtensionRegistry:function(d,c){if(d.register)throw Error("Already has registry");c.freeze();if(c.mode==tv.b.BASIC_REGISTRY_MODE)tv.b._decorateBasicExtensionRegistry(d,c);else if(c.mode==tv.b.TYPE_BASED_REGISTRY_MODE)tv.b._decorateTypeBasedExtensionRegistry(d,c);else throw Error("Unrecognized mode");void 0===d.addEventListener&&tv.b.EventTarget.decorate(d)}}});"use strict"; +tv.exportTo("tv.c.importer",function(){function d(){}d.prototype={__proto__:Object.prototype,isTraceDataContainer:function(){return!1},extractSubtraces:function(){return[]},importEvents:function(){},importSampleData:function(){},finalizeImport:function(){},joinRefs:function(){}};var c=new tv.b.ExtensionRegistryOptions(tv.b.BASIC_REGISTRY_MODE);c.defaultMetadata={};c.mandatoryBaseClass=d;tv.b.decorateExtensionRegistry(d,c);d.findImporterFor=function(b){var a=d.findTypeInfoMatching(function(a){return a.constructor.canImport(b)}); +if(a)return a.constructor};return{Importer:d}});"use strict";tv.exportTo("tv.c.importer",function(){function d(b){this.importPriority=0}var c=tv.c.importer.Importer;d.canImport=function(b){return b instanceof Array&&0==b.length?!0:"string"===typeof b||b instanceof String?0==b.length:!1};d.prototype={__proto__:c.prototype};c.register(d);return{EmptyImporter:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(){this.guid_=tv.b.GUID.allocate();this.selectionState=b.NONE}function c(){}var b={NONE:0,SELECTED:1,HIGHLIGHTED:2,DIMMED:3};d.prototype={get guid(){return this.guid_},get selected(){return this.selectionState===b.SELECTED}};var a=new tv.b.ExtensionRegistryOptions(tv.b.BASIC_REGISTRY_MODE);a.mandatoryBaseType=d;tv.b.decorateExtensionRegistry(c,a);c.addEventListener("will-register",function(a){var b=a.typeInfo.metadata;if(void 0===b.name)throw Error("Registered events must provide name metadata"); +if(void 0!==tv.b.findFirstInArray(c.getAllRegisteredTypeInfos(),function(a){return a.metadata.name===b.name}))throw Error("Event type with that name already registered");if(void 0===b.pluralName)throw Error("Registered events must provide pluralName metadata");if(void 0===b.singleViewElementName)throw Error("Registered events must provide singleViewElementName metadata");if(void 0===b.multiViewElementName)throw Error("Registered events must provide multiViewElementName metadata");});var f=void 0; +c.getEventTypeInfoByTypeName=function(a){void 0===f&&(f={},c.getAllRegisteredTypeInfos().forEach(function(a){f[a.metadata.name]=a}));return f[a]};c.addEventListener("registry-changed",function(){f=void 0});return{Event:d,EventRegistry:c,SelectionState:b}});"use strict"; +tv.exportTo("tv.b",function(){function d(b,a,c){if(0==b.length)return 1;for(var e=0,g=b.length-1,d,k,l=-1;e<=g;)d=Math.floor((e+g)/2),k=a(b[d])-c,0>k?e=d+1:(0<k||(l=d),g=d-1);return-1!=l?l:e}function c(b,a,c,e,g,h){if(0!=b.length&&!(e>g)){var k=d(b,a,e);if(-1!=k&&(0<k&&a(b[k-1])+c(b[k-1],k-1)>=e&&h(b[k-1]),k!=b.length))for(c=b.length;k<c&&!(a(b[k])>=g);k++)h(b[k])}}return{findLowIndexInSortedArray:d,findLowIndexInSortedIntervals:function(b,a,c,e){var g=d(b,a,e);return 0==g?e>=a(b[0])&&e<a(b[0])+c(b[0], +0)?0:-1:g<b.length?e>=a(b[g])&&e<a(b[g])+c(b[g],g)?g:e>=a(b[g-1])&&e<a(b[g-1])+c(b[g-1],g-1)?g-1:b.length:g==b.length?e>=a(b[g-1])&&e<a(b[g-1])+c(b[g-1],g-1)?g-1:b.length:b.length},iterateOverIntersectingIntervals:c,getIntersectingIntervals:function(b,a,f,e,g){var d=[];c(b,a,f,e,g,function(a){d.push(a)});return d},findClosestElementInSortedArray:function(b,a,c,e){if(0===b.length)return null;var g=d(b,a,c),h=0<g?g-1:0;g===b.length&&--g;var k=Math.abs(c-a(b[h]));a=Math.abs(c-a(b[g]));return k>e&&a> +e?null:b[k<a?h:g]},findClosestIntervalInSortedIntervals:function(b,a,c,e,g){if(0===b.length)return null;var h=d(b,a,e);0<h&&--h;var k=b[h],l=k;e>c(k)&&h+1<b.length&&(l=b[h+1]);b=Math.abs(e-a(l));c=Math.abs(e-c(k));return b>g&&c>g?null:b<c?l:k}}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a){tv.c.trace_model.Event.call(this);this.series_=c;this.timestamp_=b;this.value_=a}d.groupByTimestamp=function(c){for(var b={},a=0;a<c.length;a++){var f=c[a],e=f.timestamp;b[e]||(b[e]=[]);b[e].push(f)}c=tv.b.dictionaryKeys(b);c.sort();f=[];for(a=0;a<c.length;a++)e=c[a],e=b[e],e.sort(function(a,b){return a.series.seriesIndex-b.series.seriesIndex}),f.push(e);return f};d.prototype={__proto__:tv.c.trace_model.Event.prototype,get series(){return this.series_}, +get timestamp(){return this.timestamp_},get value(){return this.value_},set timestamp(c){this.timestamp_=c},addBoundsToRange:function(c){c.addValue(this.timestamp)},toJSON:function(){for(var c={},b=Object.keys(this),a=0;a<b.length;a++){var f=b[a];"function"!=typeof this[f]&&(c[f]="series_"==f?this[f].guid:this[f])}return c},getSampleIndex:function(){return tv.b.findLowIndexInSortedArray(this.series.timestamps,function(c){return c},this.timestamp_)}};tv.c.trace_model.EventRegistry.register(d,{name:"counterSample", +pluralName:"counterSamples",singleViewElementName:"tv-c-counter-sample-sub-view",multiViewElementName:"tv-c-counter-sample-sub-view"});return{CounterSample:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a){this.guid_=tv.b.GUID.allocate();this.name_=b;this.color_=a;this.timestamps_=[];this.samples_=[];this.seriesIndex=this.counter=void 0}var c=tv.c.trace_model.CounterSample;d.prototype={__proto__:Object.prototype,toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&(b[e]="counter"==e?this[e].guid:this[e])}return b},get length(){return this.timestamps_.length},get name(){return this.name_}, +get color(){return this.color_},get samples(){return this.samples_},get timestamps(){return this.timestamps_},getSample:function(b){return this.samples_[b]},getTimestamp:function(b){return this.timestamps_[b]},addCounterSample:function(b,a){this.timestamps_.push(b);var f=new c(this,b,a);this.samples_.push(f);return f},getStatistics:function(b){for(var a=0,c=Number.MAX_VALUE,e=-Number.MAX_VALUE,g=0;g<b.length;++g)var d=this.getSample(b[g]).value,a=a+d,c=Math.min(d,c),e=Math.max(d,e);return{min:c,max:e, +avg:a/b.length,start:this.getSample(b[0]).value,end:this.getSample(b.length-1).value}},shiftTimestampsForward:function(b){for(var a=0;a<this.timestamps_.length;++a)this.timestamps_[a]+=b,this.samples_[a].timestamp=this.timestamps_[a]},iterateAllEvents:function(b,a){this.samples_.forEach(b,a)}};return{CounterSeries:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f){this.guid_=tv.b.GUID.allocate();this.parent=c;this.id=b;this.category=a||"";this.name=f;this.series_=[];this.totals=[];this.bounds=new tv.b.Range}d.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var c={},b=Object.keys(this),a=0;a<b.length;a++){var f=b[a];"function"!=typeof this[f]&&(c[f]="parent"==f?this[f].guid:this[f])}return c},set timestamps(c){throw Error("Bad counter API. No cookie.");}, +set seriesNames(c){throw Error("Bad counter API. No cookie.");},set seriesColors(c){throw Error("Bad counter API. No cookie.");},set samples(c){throw Error("Bad counter API. No cookie.");},addSeries:function(c){c.counter=this;c.seriesIndex=this.series_.length;this.series_.push(c);return c},getSeries:function(c){return this.series_[c]},get series(){return this.series_},get numSeries(){return this.series_.length},get numSamples(){return 0===this.series_.length?0:this.series_[0].length},get timestamps(){return 0=== +this.series_.length?[]:this.series_[0].timestamps},getSampleStatistics:function(c){c.sort();var b=[];this.series_.forEach(function(a){b.push(a.getStatistics(c))});return b},shiftTimestampsForward:function(c){for(var b=0;b<this.series_.length;++b)this.series_[b].shiftTimestampsForward(c)},updateBounds:function(){this.totals=[];this.maxTotal=0;this.bounds.reset();if(0!==this.series_.length){var c=this.series_[0],b=this.series_[this.series_.length-1];this.bounds.addValue(c.getTimestamp(0));this.bounds.addValue(b.getTimestamp(b.length- +1));this.maxTotal=-Infinity;for(var a=0;a<c.length;++a){var f=0;this.series_.forEach(function(b){f+=b.getSample(a).value;this.totals.push(f)}.bind(this));this.maxTotal=Math.max(f,this.maxTotal)}}},iterateAllEvents:function(c,b){for(var a=0;a<this.series_.length;a++)this.series_[a].iterateAllEvents(c,b)}};d.compare=function(c,b){var a=c.parent.compareTo(b);if(0!=a)return a;a=c.name.localeCompare(b.name);return 0==a?c.tid-b.tid:a};return{Counter:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c){tv.c.trace_model.Event.call(this);this.start=c;this.duration=0}d.prototype={__proto__:tv.c.trace_model.Event.prototype,get end(){return this.start+this.duration},addBoundsToRange:function(c){c.addValue(this.start);c.addValue(this.end)},bounds:function(c){var b=Math.round(1E3*this.end),a=Math.round(1E3*c.end);return this.start<=c.start&&b>=a}};return{TimedEvent:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f,e,g,d,k){tv.c.trace_model.TimedEvent.call(this,f);this.category=c||"";this.title=b;this.colorId=a;this.args=e;this.endStackFrame=this.startStackFrame=void 0;this.didNotFinish=!1;void 0!==g&&(this.duration=g);void 0!==d&&(this.cpuStart=d);void 0!==k&&(this.cpuDuration=k)}d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,get analysisTypeName(){return this.title}};tv.c.trace_model.EventRegistry.register(d,{name:"slice",pluralName:"slices", +singleViewElementName:"tv-c-single-slice-sub-view",multiViewElementName:"tv-c-multi-slice-sub-view"});return{Slice:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,f,e,g,d,k){c.call(this,a,f,e,g,d,k);this.thread=b;this.cpuOnWhichThreadWasRunning=void 0}var c=tv.c.trace_model.Slice;d.prototype={__proto__:c.prototype,get analysisTypeName(){return"tv.c.analysis.ThreadTimeSlice"},toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&("thread"==e||"cpuOnWhichThreadWasRunning"==e?this[e]&&(b[e]=this[e].guid):b[e]=this[e])}return b},getAssociatedCpuSlice:function(){if(this.cpuOnWhichThreadWasRunning)for(var b= +this.cpuOnWhichThreadWasRunning.slices,a=0;a<b.length;a++){var c=b[a];if(c.start===this.start&&c.duration===this.duration)return c}},getCpuSliceThatTookCpu:function(){if(!this.cpuOnWhichThreadWasRunning){for(var b=this.thread.indexOfTimeSlice(this),a;0<=b;){var c=this.thread.timeSlices[b];if(c.cpuOnWhichThreadWasRunning){a=c.getAssociatedCpuSlice();break}else b--}if(a&&(b=a.cpu,c=b.indexOf(a),(b=b.slices[c+1])&&1E-5>Math.abs(b.start-a.end)))return b}}};tv.c.trace_model.EventRegistry.register(d,{name:"threadTimeSlice", +pluralName:"threadTimeSlices",singleViewElementName:"tv-c-single-thread-time-slice-sub-view",multiViewElementName:"tv-c-multi-slice-sub-view"});return{ThreadTimeSlice:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,f,e,g,d){c.apply(this,arguments);this.cpu=this.threadThatWasRunning=void 0}var c=tv.c.trace_model.Slice;d.prototype={__proto__:c.prototype,get analysisTypeName(){return"tv.c.analysis.CpuSlice"},toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&("cpu"==e||"threadThatWasRunning"==e?this[e]&&(b[e]=this[e].guid):b[e]=this[e])}return b},getAssociatedTimeslice:function(){if(this.threadThatWasRunning)for(var b= +this.threadThatWasRunning.timeSlices,a=0;a<b.length;a++){var c=b[a];if(c.start===this.start&&c.duration===this.duration)return c}}};tv.c.trace_model.EventRegistry.register(d,{name:"cpuSlice",pluralName:"cpuSlices",singleViewElementName:"tv-c-single-cpu-slice-sub-view",multiViewElementName:"tv-c-multi-slice-sub-view"});return{CpuSlice:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a){if(void 0===b||void 0===a)throw Error("Missing arguments");this.kernel=b;this.cpuNumber=a;this.slices=[];this.counters={};this.bounds=new tv.b.Range;this.lastActiveArgs_=this.lastActiveName_=this.lastActiveThread_=this.lastActiveTimestamp_=this.samples_=void 0}var c=tv.c.trace_model.Counter;d.prototype={getOrCreateCounter:function(b,a){var f;f=b.length?b+"."+a:a;this.counters[f]||(this.counters[f]=new c(this,f,b,a));return this.counters[f]}, +shiftTimestampsForward:function(b){for(var a=0;a<this.slices.length;a++)this.slices[a].start+=b;for(var c in this.counters)this.counters[c].shiftTimestampsForward(b)},updateBounds:function(){this.bounds.reset();this.slices.length&&(this.bounds.addValue(this.slices[0].start),this.bounds.addValue(this.slices[this.slices.length-1].end));for(var b in this.counters)this.counters[b].updateBounds(),this.bounds.addRange(this.counters[b].bounds);this.samples_&&this.samples_.length&&(this.bounds.addValue(this.samples_[0].start), +this.bounds.addValue(this.samples_[this.samples_.length-1].end))},createSubSlices:function(){this.samples_=this.kernel.model.samples.filter(function(b){return b.cpu==this},this)},addCategoriesToDict:function(b){for(var a=0;a<this.slices.length;a++)b[this.slices[a].category]=!0;for(var c in this.counters)b[this.counters[c].category]=!0;for(a=0;a<this.samples_.length;a++)b[this.samples_[a].category]=!0},get userFriendlyName(){return"CPU "+this.cpuNumber},toJSON:function(){for(var b={},a=Object.keys(this), +c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&"kernel"!=e&&(b[e]=this[e])}return b},indexOf:function(b){var a=tv.b.findLowIndexInSortedArray(this.slices,function(a){return a.start},b.start);return this.slices[a]!==b?void 0:a},iterateAllEvents:function(b,a){this.slices.forEach(b,a);for(var c in this.counters)this.counters[c].iterateAllEvents(b,a)},closeActiveThread:function(b,a){if(void 0!=this.lastActiveThread_&&0!=this.lastActiveThread_){if(b<this.lastActiveTimestamp_)throw Error("The end timestamp of a thread running on CPU "+ +this.cpuNumber+" is before its start timestamp.");for(var c in a)this.lastActiveArgs_[c]=a[c];c=b-this.lastActiveTimestamp_;c=new tv.c.trace_model.CpuSlice("",this.lastActiveName_,tv.b.ui.getStringColorId(this.lastActiveName_),this.lastActiveTimestamp_,this.lastActiveArgs_,c);c.cpu=this;this.slices.push(c);this.lastActiveArgs_=this.lastActiveName_=this.lastActiveThread_=this.lastActiveTimestamp_=void 0}},switchActiveThread:function(b,a,c,e,g){this.closeActiveThread(b,a);this.lastActiveTimestamp_= +b;this.lastActiveThread_=c;this.lastActiveName_=e;this.lastActiveArgs_=g},get samples(){return this.samples_}};d.compare=function(b,a){return b.cpuNumber-a.cpuNumber};return{Cpu:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,c){tv.c.trace_model.Event.call(this);this.objectInstance=b;this.ts=a;this.args=c}d.prototype={__proto__:tv.c.trace_model.Event.prototype,preInitialize:function(){},initialize:function(){},addBoundsToRange:function(b){b.addValue(this.ts)}};tv.c.trace_model.EventRegistry.register(d,{name:"objectSnapshot",pluralName:"objectSnapshots",singleViewElementName:"tv-c-single-object-snapshot-sub-view",multiViewElementName:"tv-c-multi-object-sub-view"}); +var c=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE);c.mandatoryBaseClass=d;c.defaultConstructor=d;tv.b.decorateExtensionRegistry(d,c);return{ObjectSnapshot:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,c,e,g,d){tv.c.trace_model.Event.call(this);this.parent=b;this.id=a;this.category=c;this.baseTypeName=d?d:e;this.name=e;this.creationTs=g;this.creationTsWasExplicit=!1;this.deletionTs=Number.MAX_VALUE;this.deletionTsWasExplicit=!1;this.colorId=0;this.bounds=new tv.b.Range;this.snapshots=[];this.hasImplicitSnapshots=!1}d.prototype={__proto__:tv.c.trace_model.Event.prototype,get typeName(){return this.name},addBoundsToRange:function(b){b.addRange(this.bounds)}, +addSnapshot:function(b,a,c,e){if(b<this.creationTs)throw Error("Snapshots must be >= instance.creationTs");if(b>=this.deletionTs)throw Error("Snapshots cannot be added after an objects deletion timestamp.");var g;if(0<this.snapshots.length){g=this.snapshots[this.snapshots.length-1];if(g.ts==b)throw Error("Snapshots already exists at this time!");if(b<g.ts)throw Error("Snapshots must be added in increasing timestamp order");}if(c&&this.name!=c){if(!e)throw Error("Must provide base type name for name update"); +if(this.baseTypeName!=e)throw Error("Cannot update type name: base types dont match");this.name=c}b=new (tv.c.trace_model.ObjectSnapshot.getConstructor(this.category,this.name))(this,b,a);this.snapshots.push(b);return b},wasDeleted:function(b){var a;if(0<this.snapshots.length&&(a=this.snapshots[this.snapshots.length-1],a.ts>b))throw Error("Instance cannot be deleted at ts="+b+". A snapshot exists that is older.");this.deletionTs=b;this.deletionTsWasExplicit=!0},preInitialize:function(){for(var b= +0;b<this.snapshots.length;b++)this.snapshots[b].preInitialize()},initialize:function(){for(var b=0;b<this.snapshots.length;b++)this.snapshots[b].initialize()},getSnapshotAt:function(b){if(b<this.creationTs){if(this.creationTsWasExplicit)throw Error("ts must be within lifetime of this instance");return this.snapshots[0]}if(b>this.deletionTs)throw Error("ts must be within lifetime of this instance");var a=this.snapshots;b=tv.b.findLowIndexInSortedIntervals(a,function(a){return a.ts},function(b,e){return e== +a.length-1?a[e].objectInstance.deletionTs:a[e+1].ts-a[e].ts},b);return 0>b?this.snapshots[0]:b>=this.snapshots.length?this.snapshots[this.snapshots.length-1]:this.snapshots[b]},updateBounds:function(){this.bounds.reset();this.bounds.addValue(this.creationTs);this.deletionTs!=Number.MAX_VALUE?this.bounds.addValue(this.deletionTs):0<this.snapshots.length&&this.bounds.addValue(this.snapshots[this.snapshots.length-1].ts)},shiftTimestampsForward:function(b){this.creationTs+=b;this.deletionTs!=Number.MAX_VALUE&& +(this.deletionTs+=b);this.snapshots.forEach(function(a){a.ts+=b})}};tv.c.trace_model.EventRegistry.register(d,{name:"objectInstance",pluralName:"objectInstances",singleViewElementName:"tv-c-single-object-instance-sub-view",multiViewElementName:"tv-c-multi-object-sub-view"});var c=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE);c.mandatoryBaseClass=d;c.defaultConstructor=d;tv.b.decorateExtensionRegistry(d,c);return{ObjectInstance:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a){this.createObjectInstanceFunction_=c;this.parent=b;this.id=a;this.instances=[]}d.prototype={idWasCreated:function(c,b,a){if(0==this.instances.length)return this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,c,b,a)),this.instances[0].creationTsWasExplicit=!0,this.instances[0];var f=this.instances[this.instances.length-1];if(a<f.deletionTs)throw Error("Mutation of the TimeToObjectInstanceMap must be done in ascending timestamp order."); +f=this.createObjectInstanceFunction_(this.parent,this.id,c,b,a);f.creationTsWasExplicit=!0;this.instances.push(f);return f},addSnapshot:function(c,b,a,f,e){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,c,b,a,e));var g=tv.b.findLowIndexInSortedIntervals(this.instances,function(a){return a.creationTs},function(a){return a.deletionTs-a.creationTs},a);if(0>g){g=this.instances[0];if(a>g.deletionTs||g.creationTsWasExplicit)throw Error("At the provided timestamp, no instance was still alive"); +if(0!=g.snapshots.length)throw Error("Cannot shift creationTs forward, snapshots have been added. First snap was at ts="+g.snapshots[0].ts+" and creationTs was "+g.creationTs);g.creationTs=a}else if(g>=this.instances.length)if(g=this.instances[this.instances.length-1],a>=g.deletionTs)g=this.createObjectInstanceFunction_(this.parent,this.id,c,b,a,e),this.instances.push(g);else{for(var d,g=this.instances.length-1;0<=g;g--){c=this.instances[g];if(a>=c.deletionTs)break;0==c.creationTsWasExplicit&&0== +c.snapshots.length&&(d=g)}if(void 0===d)throw Error("Cannot add snapshot. No instance was alive that was mutable.");g=this.instances[d];g.creationTs=a}else g=this.instances[g];return g.addSnapshot(a,f,b,e)},get lastInstance(){return 0==this.instances.length?void 0:this.instances[this.instances.length-1]},idWasDeleted:function(c,b,a){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,c,b,a));var f=this.instances[this.instances.length-1];if(a<f.creationTs)throw Error("Cannot delete a id before it was crated"); +if(f.deletionTs==Number.MAX_VALUE)return f.wasDeleted(a),f;if(a<f.deletionTs)throw Error("id was already deleted earlier.");f=this.createObjectInstanceFunction_(this.parent,this.id,c,b,a);this.instances.push(f);f.wasDeleted(a);return f},getInstanceAt:function(c){c=tv.b.findLowIndexInSortedIntervals(this.instances,function(b){return b.creationTs},function(b){return b.deletionTs-b.creationTs},c);return 0>c?this.instances[0].creationTsWasExplicit?void 0:this.instances[0]:c>=this.instances.length?void 0: +this.instances[c]},logToConsole:function(){for(var c=0;c<this.instances.length;c++){var b=this.instances[c],a="",f="";b.creationTsWasExplicit&&(a="(explicitC)");b.deletionTsWasExplicit&&(f="(explicit)");console.log(b.creationTs,a,b.deletionTs,f,b.category,b.name,b.snapshots.length+" snapshots")}}};return{TimeToObjectInstanceMap:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c){this.parent=c;this.bounds=new tv.b.Range;this.instanceMapsById_={};this.instancesByTypeName_={};this.createObjectInstance_=this.createObjectInstance_.bind(this)}d.prototype={__proto__:Object.prototype,createObjectInstance_:function(c,b,a,f,e,g){c=new (tv.c.trace_model.ObjectInstance.getConstructor(a,f))(c,b,a,f,e,g);b=c.typeName;a=this.instancesByTypeName_[b];a||(a=[],this.instancesByTypeName_[b]=a);a.push(c);return c},getOrCreateInstanceMap_:function(c){var b= +this.instanceMapsById_[c];if(b)return b;b=new tv.c.trace_model.TimeToObjectInstanceMap(this.createObjectInstance_,this.parent,c);return this.instanceMapsById_[c]=b},idWasCreated:function(c,b,a,f){return this.getOrCreateInstanceMap_(c).idWasCreated(b,a,f)},addSnapshot:function(c,b,a,f,e,g){c=this.getOrCreateInstanceMap_(c).addSnapshot(b,a,f,e,g);if(c.objectInstance.category!=b)throw Error("Added snapshot name="+a+" with cat="+b+" impossible. It instance was created/snapshotted with cat="+c.objectInstance.category+ +" name="+c.objectInstance.name);if(g&&c.objectInstance.baseTypeName!=g)throw Error("Could not add snapshot with baseTypeName="+g+". It was previously created with name="+c.objectInstance.baseTypeName);if(c.objectInstance.name!=a)throw Error("Could not add snapshot with name="+a+". It was previously created with name="+c.objectInstance.name);return c},idWasDeleted:function(c,b,a,f){if(c=this.getOrCreateInstanceMap_(c).idWasDeleted(b,a,f)){if(c.category!=b)throw Error("Deleting object "+c.name+" with a different category than when it was created. It previous had cat="+ +c.category+" but the delete command had cat="+b);if(c.baseTypeName!=a)throw Error("Deletion requested for name="+a+" could not proceed: An existing object with baseTypeName="+c.baseTypeName+" existed.");}},autoDeleteObjects:function(c){tv.b.iterItems(this.instanceMapsById_,function(b,a){var f=a.lastInstance;f.deletionTs==Number.MAX_VALUE&&(a.idWasDeleted(f.category,f.name,c),f.deletionTsWasExplicit=!1)})},getObjectInstanceAt:function(c,b){var a=this.instanceMapsById_[c];return a?a.getInstanceAt(b): +void 0},getSnapshotAt:function(c,b){var a=this.getObjectInstanceAt(c,b);return a?a.getSnapshotAt(b):void 0},iterObjectInstances:function(c,b){b=b||this;tv.b.iterItems(this.instanceMapsById_,function(a,f){f.instances.forEach(c,b)})},getAllObjectInstances:function(){var c=[];this.iterObjectInstances(function(b){c.push(b)});return c},getAllInstancesNamed:function(c){return this.instancesByTypeName_[c]},getAllInstancesByTypeName:function(){return this.instancesByTypeName_},preInitializeAllObjects:function(){this.iterObjectInstances(function(c){c.preInitialize()})}, +initializeAllObjects:function(){this.iterObjectInstances(function(c){c.initialize()})},initializeInstances:function(){this.iterObjectInstances(function(c){c.initialize()})},updateBounds:function(){this.bounds.reset();this.iterObjectInstances(function(c){c.updateBounds();this.bounds.addRange(c.bounds)},this)},shiftTimestampsForward:function(c){this.iterObjectInstances(function(b){b.shiftTimestampsForward(c)})},addCategoriesToDict:function(c){this.iterObjectInstances(function(b){c[b.category]=!0})}, +toJSON:function(){return{}},iterateAllEvents:function(c,b){this.iterObjectInstances(function(a){c.call(this,a);a.snapshots.forEach(c)},b)}};return{ObjectCollection:d}});"use strict";tv.exportTo("tv.c.trace_model",function(){function d(){}d.prototype={get stableId(){throw Error("Not implemented");}};return{EventContainer:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,f,e,g,d,k,l){c.call(this,b,a,f,e,g,d,k,l);this.subSlices=[]}var c=tv.c.trace_model.Slice;d.prototype={__proto__:c.prototype};return{ThreadSlice:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(a){return"rgb("+a.r+","+a.g+","+a.b+")"}function c(a){for(var b=0,e=0;e<a.length;++e)b=(b+37*b+11*a.charCodeAt(e))%4294967295;return b}var b=[{r:138,g:113,b:152},{r:175,g:112,b:133},{r:127,g:135,b:225},{r:93,g:81,b:137},{r:116,g:143,b:119},{r:178,g:214,b:122},{r:87,g:109,b:147},{r:119,g:155,b:95},{r:114,g:180,b:160},{r:132,g:85,b:103},{r:157,g:210,b:150},{r:148,g:94,b:86},{r:164,g:108,b:138},{r:139,g:191,b:150},{r:110,g:99,b:145},{r:80,g:129,b:109},{r:125, +g:140,b:149},{r:93,g:124,b:132},{r:140,g:85,b:140},{r:104,g:163,b:162},{r:132,g:141,b:178},{r:131,g:105,b:147},{r:135,g:183,b:98},{r:152,g:134,b:177},{r:141,g:188,b:141},{r:133,g:160,b:210},{r:126,g:186,b:148},{r:112,g:198,b:205},{r:180,g:122,b:195},{r:203,g:144,b:152},{r:182,g:125,b:143},{r:126,g:200,b:148},{r:133,g:160,b:210},{r:240,g:240,b:240},{r:199,g:155,b:125}],a=b.length-5,f=b.length,e=b.concat(b.map(function(a){var b;b=240<=a.r&&240<=a.g&&240<=a.b?-.2:.45;return{r:Math.min(255,a.r+Math.floor(a.r* +b)),g:Math.min(255,a.g+Math.floor(a.g*b)),b:Math.min(255,a.b+Math.floor(a.b*b))}})),g=e.map(d),h={};return{colorToRGBString:d,colorToRGBAString:function(a,b){return"rgba("+a.r+","+a.g+","+a.b+","+b+")"},getRawColorPalette:function(){return e},getColorPalette:function(){return g},paletteProperties:{numRegularColorIds:a,highlightIdBoost:f},getColorPaletteHighlightIdBoost:function(){return f},getColorIdByName:function(b){if("iowait"==b)return a;if("running"==b)return a+1;if("runnable"==b)return a+2; +if("sleeping"==b)return a+3;if("UNKNOWN"==b)return a+4;throw Error("Unrecognized color ")+b;},getStringHash:c,getStringColorId:function(b){if(void 0===h[b]){var e=c(b);h[b]=e%a}return h[b]}}});"use strict"; +tv.exportTo("tv.c",function(){var d=tv.b.ui.getRawColorPalette(),c=tv.b.ui.getColorPalette(),b=tv.c.trace_model.SelectionState;return{EventPresenter:{getAlpha_:function(a){return a.selectionState===b.DIMMED?.3:1},getColorIdOffset_:function(a){return a.selectionState===b.SELECTED?tv.b.ui.paletteProperties.highlightIdBoost:0},getTextColor:function(a){return a.selectionState===b.DIMMED?"rgb(60,60,60)":"rgb(0,0,0)"},getSliceColorId:function(a){return a.colorId+this.getColorIdOffset_(a)},getSliceAlpha:function(a, +b){var e=this.getAlpha_(a);b&&(e*=.3);return e},getInstantSliceColor:function(a){var b=a.colorId+this.getColorIdOffset_(a);return tv.b.ui.colorToRGBAString(d[b],this.getAlpha_(a))},getObjectInstanceColor:function(a){a=a.colorId+this.getColorIdOffset_(a);return tv.b.ui.colorToRGBAString(d[a],.25)},getObjectSnapshotColor:function(a){a=a.objectInstance.colorId+this.getColorIdOffset_(a);return c[a]},getCounterSeriesColor:function(a,b,e){b={selectionState:b};return tv.b.ui.colorToRGBAString(d[a+this.getColorIdOffset_(b)], +this.getAlpha_(b)*(void 0!==e?e:1))},getBarSnapshotColor:function(a,b){var e=(a.objectInstance.colorId+b)%tv.b.ui.paletteProperties.numRegularColorIds,e=e+this.getColorIdOffset_(a);return tv.b.ui.colorToRGBAString(d[e],this.getAlpha_(a))}}}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,f){this.guid_=tv.b.GUID.allocate();this.parentThread_=b;this.sliceConstructor=a||c;this.openPartialSlices_=[];this.slices=[];this.bounds=new tv.b.Range;this.topLevelSlices=[];this.name_=f}var c=tv.c.trace_model.Slice;d.prototype={__proto__:tv.c.trace_model.EventContainer.prototype,get guid(){return this.guid_},get parentThread(){return this.parentThread_},get model(){return this.parentThread_.parent.model},get stableId(){return this.parentThread_.stableId+ +".SliceGroup"},getSettingsKey:function(){if(this.name_){var b=this.parentThread_.getSettingsKey();return b?b+"."+this.name:void 0}},get length(){return this.slices.length},pushSlice:function(b){this.slices.push(b);return b},pushSlices:function(b){this.slices.push.apply(this.slices,b)},beginSlice:function(b,a,c,e,g){if(this.openPartialSlices_.length&&c<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");var d=tv.b.ui.getStringColorId(a); +b=new this.sliceConstructor(b,a,d,c,e?e:{},null,g);this.openPartialSlices_.push(b);b.didNotFinish=!0;this.pushSlice(b);return b},isTimestampValidForBeginOrEnd:function(b){return this.openPartialSlices_.length?b>=this.openPartialSlices_[this.openPartialSlices_.length-1].start:!0},get openSliceCount(){return this.openPartialSlices_.length},get mostRecentlyOpenedPartialSlice(){return this.openPartialSlices_.length?this.openPartialSlices_[this.openPartialSlices_.length-1]:void 0},endSlice:function(b, +a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var c=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-1,1);if(b<c.start)throw Error("Slice "+c.title+" end time is before its start.");c.duration=b-c.start;c.didNotFinish=!1;a&&void 0!==c.cpuStart&&(c.cpuDuration=a-c.cpuStart);return c},pushCompleteSlice:function(b,a,c,e,g,d,k){var l=tv.b.ui.getStringColorId(a);b=new this.sliceConstructor(b,a,l,c,k?k:{},e,g,d);void 0=== +e&&(b.didNotFinish=!0);this.pushSlice(b);return b},autoCloseOpenSlices:function(b){b||(this.updateBounds(),b=this.bounds.max);for(var a=0;a<this.slices.length;a++){var c=this.slices[a];c.didNotFinish&&(c.duration=b-c.start)}this.openPartialSlices_=[]},shiftTimestampsForward:function(b){for(var a=0;a<this.slices.length;a++){var c=this.slices[a];c.start+=b}},updateBounds:function(){this.bounds.reset();for(var b=0;b<this.slices.length;b++)this.bounds.addValue(this.slices[b].start),this.bounds.addValue(this.slices[b].end)}, +copySlice:function(b){var a=new this.sliceConstructor(b.category,b.title,b.colorId,b.start,b.args,b.duration,b.cpuStart,b.cpuDuration);a.didNotFinish=b.didNotFinish;return a},iterateAllEvents:function(b,a){this.slices.forEach(b,a)},iterateAllEventContainers:function(b){b(this)},toJSON:function(){return{}},createSubSlices:function(){function b(a,e){if(a.bounds(e)){if(a.subSlices&&0<a.subSlices.length&&b(a.subSlices[a.subSlices.length-1],e))return!0;a.selfTime||(a.selfTime=a.duration);!a.cpuSelfTime&& +a.cpuDuration&&(a.cpuSelfTime=a.cpuDuration);e.parentSlice=a;a.subSlices||(a.subSlices=[]);a.subSlices.push(e);a.selfTime-=e.duration;e.cpuDuration&&(a.cpuSelfTime-=e.cpuDuration);return!0}return!1}if(this.slices.length){for(var a=[],c=0;c<this.slices.length;c++)this.slices[c].subSlices&&this.slices[c].subSlices.splice(0,this.slices[c].subSlices.length),a.push(c);var e=this.slices;a.sort(function(a,b){var c=e[a],f=e[b];return c.start!=f.start?c.start-f.start:a-b});var g=this.slices[a[0]];this.topLevelSlices= +[];this.topLevelSlices.push(g);for(c=1;c<a.length;c++){var d=this.slices[a[c]];b(g,d)||(g=d,this.topLevelSlices.push(g))}}}};d.merge=function(b,a){if(0<b.openPartialSlices_.length)throw Error("groupA has open partial slices");if(0<a.openPartialSlices_.length)throw Error("groupB has open partial slices");if(b.parentThread!=a.parentThread)throw Error("Different parent threads. Cannot merge");for(var c=new d(b.parentThread),e=b.slices,g=a.slices,h=0,k=0,l=[],m=[],n=function(a){for(var b=0;b<m.length;b++){var e= +m[b],g=e.end;if(a<e.start||g<a)throw Error("slice should not be split");var d=c.copySlice(e);d.start=a;d.duration=g-a;-1==d.title.indexOf(" (cont.)")&&(d.title+=" (cont.)");e.duration=a-e.start;m[b]=d;c.pushSlice(d)}},q=function(a){for(;0<l.length||0<m.length;){var b=l[l.length-1],e=m[m.length-1],b=b&&b.end,e=e&&e.end;if((void 0===b||b>a)&&(void 0===e||e>a))break;void 0===e||b<e?(n(b),l.pop()):m.pop()}};h<e.length||k<g.length;){var u=e[h],v=g[k];void 0===u||void 0!==v&&u.start>v.start?(u=c.copySlice(v), +v=!0,k++):(u=c.copySlice(u),v=!1,h++);q(u.start);c.pushSlice(u);v?m.push(u):(n(u.start),l.push(u))}q();return c};return{SliceGroup:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a,c,e,g){tv.c.trace_model.Slice.apply(this,arguments)}d.prototype={__proto__:tv.c.trace_model.Slice.prototype,toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&(b[e]="startThread"==e||"endThread"==e?this[e].guid:this[e])}return b},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0,get viewSubGroupTitle(){return this.title}};tv.c.trace_model.EventRegistry.register(d,{name:"asyncSlice", +pluralName:"asyncSlices",singleViewElementName:"tv-c-single-slice-sub-view",multiViewElementName:"tv-c-multi-slice-sub-view"});var c=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE);c.mandatoryBaseClass=d;c.defaultConstructor=d;tv.b.decorateExtensionRegistry(d,c);return{AsyncSlice:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b){this.parentThread_=c;this.guid_=tv.b.GUID.allocate();this.slices=[];this.bounds=new tv.b.Range;this.name_=b;this.viewSubGroups_=void 0}d.prototype={__proto__:tv.c.trace_model.EventContainer.prototype,get guid(){return this.guid_},get parentThread(){return this.parentThread_},get model(){return this.parentThread_.parent.model},get stableId(){return this.parentThread_.stableId+".AsyncSliceGroup"},getSettingsKey:function(){if(this.name_){var c= +this.parentThread_.getSettingsKey();return c?c+"."+this.name_:void 0}},push:function(c){this.slices.push(c)},get length(){return this.slices.length},shiftTimestampsForward:function(c){for(var b=0;b<this.slices.length;b++){var a=this.slices[b];a.start+=c;var f=function(a){if(void 0!==a&&0!==a.length)for(var b=0;b<a.length;b++)a[b].start+=c,f(a[b].subSlices)};f(a.subSlices)}},updateBounds:function(){this.bounds.reset();for(var c=0;c<this.slices.length;c++)this.bounds.addValue(this.slices[c].start), +this.bounds.addValue(this.slices[c].end)},get viewSubGroups(){if(void 0===this.viewSubGroups_){for(var c="",c=void 0!==this.name?this.name+".":"",b={},a=0;a<this.slices.length;++a){var f=this.slices[a],e=f.viewSubGroupTitle;b[e]||(b[e]=new d(this.parentThread_,c+e));b[e].slices.push(f)}this.viewSubGroups_=tv.b.dictionaryValues(b)}return this.viewSubGroups_},iterateAllEvents:function(c,b){for(var a=0;a<this.slices.length;a++){var f=this.slices[a];c.call(b,f);f.subSlices&&f.subSlices.forEach(c,b)}}, +iterateAllEventContainers:function(c){c(this)},toJSON:function(){return{}}};return{AsyncSliceGroup:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(a,c,f,d,l,m,n,q){b.call(this,a,c,f,d,l,m,n,q);this.subSlices=[]}function c(b,c){function h(a,b,e,c,f,g,h,E){d.call(this,a,b,e,c,f,g,h,E);this.parentThread=k}this.guid_=tv.b.GUID.allocate();if(!b)throw Error("Parent must be provided.");this.parent=b;this.sortIndex=0;this.tid=c;this.samples_=this.name=void 0;var k=this;h.prototype={__proto__:d.prototype};this.sliceGroup=new a(this,h,"slices");this.timeSlices=void 0;this.kernelSliceGroup=new a(this, +void 0,"kernel-slices");this.asyncSliceGroup=new f(this,"async-slices");this.bounds=new tv.b.Range}var b=tv.c.trace_model.Slice,a=tv.c.trace_model.SliceGroup,f=tv.c.trace_model.AsyncSliceGroup,d=tv.c.trace_model.ThreadSlice;d.prototype={__proto__:b.prototype};c.prototype={__proto__:tv.c.trace_model.EventContainer.prototype,get guid(){return this.guid_},get stableId(){return this.parent.stableId+"."+this.tid},compareTo:function(a){return c.compare(this,a)},toJSON:function(){for(var a={},b=Object.keys(this), +c=0;c<b.length;c++){var f=b[c];"function"!=typeof this[f]&&(a[f]="parent"==f?this[f].guid:this[f])}return a},shiftTimestampsForward:function(a){this.sliceGroup.shiftTimestampsForward(a);if(this.timeSlices)for(var b=0;b<this.timeSlices.length;b++)this.timeSlices[b].start+=a;this.kernelSliceGroup.shiftTimestampsForward(a);this.asyncSliceGroup.shiftTimestampsForward(a)},get isEmpty(){return this.sliceGroup.length||this.sliceGroup.openSliceCount||this.timeSlices&&this.timeSlices.length||this.kernelSliceGroup.length|| +this.asyncSliceGroup.length||this.samples_.length?!1:!0},updateBounds:function(){this.bounds.reset();this.sliceGroup.updateBounds();this.bounds.addRange(this.sliceGroup.bounds);this.kernelSliceGroup.updateBounds();this.bounds.addRange(this.kernelSliceGroup.bounds);this.asyncSliceGroup.updateBounds();this.bounds.addRange(this.asyncSliceGroup.bounds);this.timeSlices&&this.timeSlices.length&&(this.bounds.addValue(this.timeSlices[0].start),this.bounds.addValue(this.timeSlices[this.timeSlices.length-1].end)); +this.samples_&&this.samples_.length&&(this.bounds.addValue(this.samples_[0].start),this.bounds.addValue(this.samples_[this.samples_.length-1].end))},addCategoriesToDict:function(a){for(var b=0;b<this.sliceGroup.length;b++)a[this.sliceGroup.slices[b].category]=!0;for(b=0;b<this.kernelSliceGroup.length;b++)a[this.kernelSliceGroup.slices[b].category]=!0;for(b=0;b<this.asyncSliceGroup.length;b++)a[this.asyncSliceGroup.slices[b].category]=!0;if(this.samples_)for(b=0;b<this.samples_.length;b++)a[this.samples_[b].category]= +!0},autoCloseOpenSlices:function(a){this.sliceGroup.autoCloseOpenSlices(a);this.kernelSliceGroup.autoCloseOpenSlices(a)},mergeKernelWithUserland:function(){if(0<this.kernelSliceGroup.length){var b=a.merge(this.sliceGroup,this.kernelSliceGroup);this.sliceGroup.slices=b.slices;this.kernelSliceGroup=new a(this);this.updateBounds()}},createSubSlices:function(){this.sliceGroup.createSubSlices();this.samples_=this.parent.model.samples.filter(function(a){return a.thread==this},this)},get userFriendlyName(){return this.name|| +this.tid},get userFriendlyDetails(){return"tid: "+this.tid+(this.name?", name: "+this.name:"")},getSettingsKey:function(){if(this.name){var a=this.parent.getSettingsKey();return a?a+"."+this.name:void 0}},indexOfTimeSlice:function(a){var b=tv.b.findLowIndexInSortedArray(this.timeSlices,function(a){return a.start},a.start);return this.timeSlices[b]!==a?void 0:b},iterateAllEvents:function(a,b){this.sliceGroup.iterateAllEvents(a,b);this.kernelSliceGroup.iterateAllEvents(a,b);this.asyncSliceGroup.iterateAllEvents(a, +b);this.timeSlices&&this.timeSlices.length&&this.timeSlices.forEach(a,b)},iterateAllPersistableObjects:function(a){a(this);this.sliceGroup.length&&a(this.sliceGroup);this.asyncSliceGroup.viewSubGroups.forEach(a)},iterateAllEventContainers:function(a){a(this);this.sliceGroup.length&&this.sliceGroup.iterateAllEventContainers(a);this.kernelSliceGroup.length&&this.kernelSliceGroup.iterateAllEventContainers(a);this.asyncSliceGroup.length&&this.asyncSliceGroup.iterateAllEventContainers(a)},get samples(){return this.samples_}}; +c.compare=function(a,b){var c=a.parent.compareTo(b.parent);return c||(c=a.sortIndex-b.sortIndex)?c:(c=tv.b.comparePossiblyUndefinedValues(a.name,b.name,function(a,b){return a.localeCompare(b)}))?c:a.tid-b.tid};return{Thread:c}});"use strict"; +tv.exportTo("tv.c",function(){function d(b){this.model=b;this.objectsByKey_=[];this.nonuniqueKeys_=[];this.buildObjectsByKeyMap_();this.removeNonuniqueKeysFromSettings_();this.ephemeralSettingsByGUID_={}}var c=tv.b.Settings;d.prototype={buildObjectsByKeyMap_:function(){var b=[];this.model.iterateAllPersistableObjects(function(a){b.push(a)});for(var a={},c=0;c<b.length;c++){var e=b[c],g=e.getSettingsKey();g&&(a[g]=void 0===a[g]?e:"nonuniqueKey")}var d={};tv.b.dictionaryKeys(a).forEach(function(b){"nonuniqueKey"=== +a[b]&&(delete a[b],d[b]=!0)});this.nonuniqueKeys=d;this.objectsByKey_=a},removeNonuniqueKeysFromSettings_:function(){var b=c.get("trace_model_settings",{}),a=!1;tv.b.dictionaryKeys(b).forEach(function(c){this.nonuniqueKeys[c]&&(a=!0,delete b[c])},this);a&&c.set("trace_model_settings",b)},hasUniqueSettingKey:function(b){return(b=b.getSettingsKey())?void 0!==this.objectsByKey_[b]:!1},getSettingFor:function(b,a,f){var e=b.getSettingsKey();if(!e||!this.objectsByKey_[e])return b=this.getEphemeralSettingsFor_(b), +a=b[a],void 0!==a?a:f;b=c.get("trace_model_settings",{});b[e]||(b[e]={});a=b[e][a];return void 0!==a?a:f},setSettingFor:function(b,a,f){var e=b.getSettingsKey();e&&this.objectsByKey_[e]?(b=c.get("trace_model_settings",{}),b[e]||(b[e]={}),b[e][a]!==f&&(b[e][a]=f,c.set("trace_model_settings",b))):this.getEphemeralSettingsFor_(b)[a]=f},getEphemeralSettingsFor_:function(b){if(void 0===b.guid)throw Error("Only objects with GUIDs can be persisted");void 0===this.ephemeralSettingsByGUID_[b.guid]&&(this.ephemeralSettingsByGUID_[b.guid]= +{});return this.ephemeralSettingsByGUID_[b.guid]}};return{TraceModelSettings:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(a){if(!a)throw Error("Must provide a model");this.guid_=tv.b.GUID.allocate();this.model=a;this.threads={};this.counters={};this.objects=new tv.c.trace_model.ObjectCollection(this);this.bounds=new tv.b.Range;this.sortIndex=0}var c=tv.c.trace_model.Thread,b=tv.c.trace_model.Counter;d.compare=function(a,b){return a.sortIndex-b.sortIndex};d.prototype={__proto__:tv.c.trace_model.EventContainer.prototype,get guid(){return this.guid_},get stableId(){throw Error("Not implemented"); +},get numThreads(){var a=0,b;for(b in this.threads)a++;return a},toJSON:function(){for(var a={},b=Object.keys(this),e=0;e<b.length;e++){var c=b[e];"function"!=typeof this[c]&&"model"!=c&&(a[c]=this[c])}return a},shiftTimestampsForward:function(a){for(var b in this.threads)this.threads[b].shiftTimestampsForward(a);for(var e in this.counters)this.counters[e].shiftTimestampsForward(a);this.objects.shiftTimestampsForward(a)},autoCloseOpenSlices:function(a){for(var b in this.threads)this.threads[b].autoCloseOpenSlices(a)}, +autoDeleteObjects:function(a){this.objects.autoDeleteObjects(a)},preInitializeObjects:function(){this.objects.preInitializeAllObjects()},initializeObjects:function(){this.objects.initializeAllObjects()},mergeKernelWithUserland:function(){for(var a in this.threads)this.threads[a].mergeKernelWithUserland()},updateBounds:function(){this.bounds.reset();for(var a in this.threads)this.threads[a].updateBounds(),this.bounds.addRange(this.threads[a].bounds);for(var b in this.counters)this.counters[b].updateBounds(), +this.bounds.addRange(this.counters[b].bounds);this.objects.updateBounds();this.bounds.addRange(this.objects.bounds)},addCategoriesToDict:function(a){for(var b in this.threads)this.threads[b].addCategoriesToDict(a);for(var e in this.counters)a[this.counters[e].category]=!0;this.objects.addCategoriesToDict(a)},findAllThreadsNamed:function(a){var b=[],e;for(e in this.threads){var c=this.threads[e];c.name==a&&b.push(c)}return b},pruneEmptyContainers:function(){var a={},b;for(b in this.threads){var e= +this.threads[b];e.isEmpty||(a[b]=e)}this.threads=a},getThread:function(a){return this.threads[a]},getOrCreateThread:function(a){this.threads[a]||(this.threads[a]=new c(this,a));return this.threads[a]},getOrCreateCounter:function(a,c){var e=a+"."+c;this.counters[e]||(this.counters[e]=new b(this,e,a,c));return this.counters[e]},getSettingsKey:function(){throw Error("Not implemented");},createSubSlices:function(){for(var a in this.threads)this.threads[a].createSubSlices()},iterateAllEvents:function(a, +b){for(var e in this.threads)this.threads[e].iterateAllEvents(a,b);for(var c in this.counters)this.counters[c].iterateAllEvents(a,b);this.objects.iterateAllEvents(a,b)},iterateAllPersistableObjects:function(a){a(this);for(var b in this.threads)this.threads[b].iterateAllPersistableObjects(a)}};return{ProcessBase:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(a){if(void 0===a)throw Error("model must be provided");b.call(this,a);this.cpus={};this.softwareMeasuredCpuCount_=void 0}var c=tv.c.trace_model.Cpu,b=tv.c.trace_model.ProcessBase;d.compare=function(a,b){return 0};d.prototype={__proto__:b.prototype,compareTo:function(a){return d.compare(this,a)},get userFriendlyName(){return"Kernel"},get userFriendlyDetails(){return"Kernel"},get stableId(){return"Kernel"},getOrCreateCpu:function(a){this.cpus[a]|| +(this.cpus[a]=new c(this,a));return this.cpus[a]},get softwareMeasuredCpuCount(){return this.softwareMeasuredCpuCount_},set softwareMeasuredCpuCount(a){if(void 0!==this.softwareMeasuredCpuCount_&&this.softwareMeasuredCpuCount_!==a)throw Error("Cannot change the softwareMeasuredCpuCount once it is set");this.softwareMeasuredCpuCount_=a},get bestGuessAtCpuCount(){var a=tv.b.dictionaryLength(this.cpus);return 0!==a?a:this.softwareMeasuredCpuCount},shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this); +for(var c in this.cpus)this.cpus[c].shiftTimestampsForward(a)},updateBounds:function(){b.prototype.updateBounds.call(this);for(var a in this.cpus){var c=this.cpus[a];c.updateBounds();this.bounds.addRange(c.bounds)}},createSubSlices:function(){b.prototype.createSubSlices.call(this);for(var a in this.cpus)this.cpus[a].createSubSlices()},addCategoriesToDict:function(a){b.prototype.addCategoriesToDict.call(this,a);for(var c in this.cpus)this.cpus[c].addCategoriesToDict(a)},getSettingsKey:function(){return"kernel"}, +iterateAllEvents:function(a,c){for(var e in this.cpus)this.cpus[e].iterateAllEvents(a,c);b.prototype.iterateAllEvents.call(this,a,c)},iterateAllEventContainers:function(a){a(this)}};return{Kernel:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(b,a){if(void 0===b)throw Error("model must be provided");if(void 0===a)throw Error("pid must be provided");tv.c.trace_model.ProcessBase.call(this,b);this.pid=a;this.name=void 0;this.labels=[];this.instantEvents=[];this.memoryDumps=[]}var c=tv.c.trace_model.ProcessBase;d.compare=function(b,a){var c=tv.c.trace_model.ProcessBase.compare(b,a);return c||(c=tv.b.comparePossiblyUndefinedValues(b.name,a.name,function(a,b){return a.localeCompare(b)}))?c: +(c=tv.b.compareArrays(b.labels,a.labels,function(a,b){return a.localeCompare(b)}))?c:b.pid-a.pid};d.prototype={__proto__:tv.c.trace_model.ProcessBase.prototype,get stableId(){return this.pid},compareTo:function(b){return d.compare(this,b)},pushInstantEvent:function(b){this.instantEvents.push(b)},addLabelIfNeeded:function(b){for(var a=0;a<this.labels.length;a++)if(this.labels[a]===b)return;this.labels.push(b)},get userFriendlyName(){var b;b=this.name?this.name+" (pid "+this.pid+")":"Process "+this.pid; +this.labels.length&&(b+=": "+this.labels.join(", "));return b},get userFriendlyDetails(){return this.name?this.name+" (pid "+this.pid+")":"pid: "+this.pid},getSettingsKey:function(){return this.name?this.labels.length?"processes."+this.name+"."+this.labels.join("."):"processes."+this.name:void 0},shiftTimestampsForward:function(b){for(var a in this.instantEvents)this.instantEvents[a].start+=b;for(a=0;a<this.memoryDumps.length;a++)this.memoryDumps[a].shiftTimestampsForward(b);tv.c.trace_model.ProcessBase.prototype.shiftTimestampsForward.apply(this, +arguments)},updateBounds:function(){tv.c.trace_model.ProcessBase.prototype.updateBounds.apply(this);for(var b=0;b<this.memoryDumps.length;b++)this.memoryDumps[b].addBoundsToRange(this.bounds)},iterateAllEvents:function(b,a){this.instantEvents.forEach(b,a);this.memoryDumps.forEach(b,a);c.prototype.iterateAllEvents.call(this,b,a)},iterateAllEventContainers:function(b){b(this);for(var a in this.threads)this.threads[a].iterateAllEventContainers(b)},sortMemoryDumps:function(){this.memoryDumps.sort(function(b, +a){return b.start-a.start})}};return{Process:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f,e,g,d){tv.c.trace_model.TimedEvent.call(this,f);this.title=a;this.cpu=c;this.thread=b;this.leafStackFrame=e;this.weight=g;this.args=d||{}}d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,get colorId(){return this.leafStackFrame.colorId},toJSON:function(){return{}},get stackTrace(){return this.leafStackFrame.stackTrace},getUserFriendlyStackTrace:function(){return this.leafStackFrame.getUserFriendlyStackTrace()}};tv.c.trace_model.EventRegistry.register(d, +{name:"sample",pluralName:"samples",singleViewElementName:"tv-c-single-sample-sub-view",multiViewElementName:"tv-c-multi-sample-sub-view"});return{Sample:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f,e){if(void 0===b)throw Error("id must be given");this.parentFrame_=c;this.id=b;this.category=a||"";this.title=f;this.colorId=e;this.children=[];this.parentFrame_&&this.parentFrame_.addChild(this)}d.prototype={get parentFrame(){return this.parentFrame_},set parentFrame(c){this.parentFrame_&&this.parentFrame_.removeChild(this);(this.parentFrame_=c)&&this.parentFrame_.addChild(this)},addChild:function(c){this.children.push(c)},removeChild:function(c){c= +this.children.indexOf(c.id);if(-1==c)throw Error("omg");this.children.splice(c,1)},removeAllChildren:function(){for(var c=0;c<this.children.length;c++)this.children[c].parentFrame_=void 0;this.children.splice(0,this.children.length)},toJSON:function(){return{}},get stackTrace(){for(var c=[],b=this;b;)c.push(b),b=b.parentFrame;c.reverse();return c},getUserFriendlyStackTrace:function(){return this.stackTrace.map(function(c){return c.category+": "+c.title})}};return{StackFrame:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(a,b,c,d,k){tv.c.trace_model.TimedEvent.call(this);this.category=a||"";this.title=b;this.colorId=c;this.start=d;this.args=k;this.type=void 0}function c(b,e,c,h,k){d.apply(this,arguments);this.type=a.GLOBAL}function b(b,e,c,h,k){d.apply(this,arguments);this.type=a.PROCESS}var a={GLOBAL:1,PROCESS:2};d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,selected:!1};c.prototype={__proto__:d.prototype};b.prototype={__proto__:d.prototype};tv.c.trace_model.EventRegistry.register(d, +{name:"instantEvent",pluralName:"instantEvents",singleViewElementName:"tv-c-single-instant-event-sub-view",multiViewElementName:"tv-c-multi-instant-event-sub-view"});return{GlobalInstantEvent:c,ProcessInstantEvent:b,InstantEventType:a,InstantEvent:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f,e,g){tv.c.trace_model.TimedEvent.call(this,e);this.category=c||"";this.title=a;this.colorId=f;this.start=e;this.args=g;this.id=b;this.previousFlowEvent_=this.nextFlowEvent_=void 0}d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,set nextFlowEvent(c){this.nextFlowEvent_=c},set previousFlowEvent(c){this.previousFlowEvent_=c},get nextFlowEvent(){return this.nextFlowEvent_},get previousFlowEvent(){return this.previousFlowEvent_}}; +tv.c.trace_model.EventRegistry.register(d,{name:"flowEvent",pluralName:"flowEvents",singleViewElementName:"tv-c-single-flow-event-sub-view",multiViewElementName:"tv-c-multi-flow-event-sub-view"});return{FlowEvent:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a){tv.c.trace_model.TimedEvent.call(this,b);this.model=c;this.processMemoryDumps={};this.args=a}d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,shiftTimestampsForward:function(c){this.start+=c},toJSON:function(){for(var c={},b=Object.keys(this),a=0;a<b.length;a++){var f=b[a];"function"!=typeof this[f]&&"model"!=f&&"processMemoryDumps"!=f&&(c[f]=this[f])}return c}};tv.c.trace_model.EventRegistry.register(d,{name:"globalMemoryDump", +pluralName:"globalMemoryDumps",singleViewElementName:"tv-c-single-global-memory-dump-sub-view",multiViewElementName:"tv-c-multi-global-memory-dump-sub-view"});return{GlobalMemoryDump:d}});"use strict"; +tv.exportTo("tv.c.trace_model",function(){function d(c,b,a,f){tv.c.trace_model.TimedEvent.call(this,a);this.process=b;this.globalMemoryDump=c;this.args=f}d.prototype={__proto__:tv.c.trace_model.TimedEvent.prototype,shiftTimestampsForward:function(c){this.start+=c},toJSON:function(){for(var c={},b=Object.keys(this),a=0;a<b.length;a++){var f=b[a];"function"!=typeof this[f]&&"process"!=f&&"globalMemoryDump"!=f&&(c[f]=this[f])}return c}};tv.c.trace_model.EventRegistry.register(d,{name:"processMemoryDump", +pluralName:"processMemoryDumps",singleViewElementName:"tv-c-single-process-memory-dump-sub-view",multiViewElementName:"tv-c-multi-process-memory-dump-sub-view"});return{ProcessMemoryDump:d}});"use strict"; +tv.exportTo("tv.c",function(){function d(){this.pruneEmptyContainers=this.shiftWorldToZero=!0;this.customizeModelCallback=void 0}function c(b,e){this.kernel=new a(this);this.processes={};this.metadata=[];this.categories=[];this.bounds=new tv.b.Range;this.instantEvents=[];this.flowEvents=[];this.stackFrames={};this.samples=[];this.eventContainerByStableId_={};this.flowIntervalTree=new tv.b.IntervalTree(function(a){return a.start},function(a){return a.start});this.globalMemoryDumps=[];this.importWarnings_= +[];this.reportedImportWarnings_={};var c=d.fromArguments(arguments,1);b&&this.importTraces([b],c)}var b=tv.c.trace_model.Process,a=tv.c.trace_model.Kernel;d.fromArguments=function(a,b){var c=a[b+0];if("object"===typeof c){if(!(c instanceof d))throw Error("Unexpected");return c}c=new d;void 0!==a[b]&&(c.shiftWorldToZero=a[b]);void 0!==a[b+1]&&(c.pruneEmptyContainers=a[b+1]);a[b+2]&&(c.customizeModelCallback=a[b+2]);return c};c.prototype={__proto__:tv.b.EventTarget.prototype,get numProcesses(){var a= +0,b;for(b in this.processes)a++;return a},getProcess:function(a){return this.processes[a]},getOrCreateProcess:function(a){this.processes[a]||(this.processes[a]=new b(this,a));return this.processes[a]},getEventContainerByStableId:function(a){return this.eventContainerByStableId_[a]},pushInstantEvent:function(a){this.instantEvents.push(a)},addStackFrame:function(a){if(this.stackFrames[a.id])throw Error("Stack frame already exists");return this.stackFrames[a.id]=a},updateCategories_:function(){var a= +{};this.kernel.addCategoriesToDict(a);for(var b in this.processes)this.processes[b].addCategoriesToDict(a);this.categories=[];for(var c in a)""!=c&&this.categories.push(c)},updateBounds:function(){this.bounds.reset();this.kernel.updateBounds();this.bounds.addRange(this.kernel.bounds);for(var a in this.processes)this.processes[a].updateBounds(),this.bounds.addRange(this.processes[a].bounds);for(a=0;a<this.globalMemoryDumps.length;a++)this.globalMemoryDumps[a].addBoundsToRange(this.bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var a= +this.bounds.min;this.kernel.shiftTimestampsForward(-a);for(var b in this.instantEvents)this.instantEvents[b].start-=a;for(var c in this.processes)this.processes[c].shiftTimestampsForward(-a);for(b=0;b<this.samples.length;b++)this.samples[b].start-=a;for(b=0;b<this.globalMemoryDumps.length;b++)this.globalMemoryDumps[b].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],b;for(b in this.kernel.threads)a.push(d.threads[b]);for(var c in this.processes){var d=this.processes[c]; +for(b in d.threads)a.push(d.threads[b])}return a},getAllProcesses:function(){var a=[],b;for(b in this.processes)a.push(this.processes[b]);return a},getAllCounters:function(){var a=[];a.push.apply(a,tv.b.dictionaryValues(this.kernel.counters));for(var b in this.processes){var c=this.processes[b],d;for(d in c.counters)a.push(c.counters[d])}return a},findAllThreadsNamed:function(a){var b=[];b.push.apply(b,this.kernel.findAllThreadsNamed(a));for(var c in this.processes)b.push.apply(b,this.processes[c].findAllThreadsNamed(a)); +return b},createImporter_:function(a){var b=tv.c.importer.Importer.findImporterFor(a);if(!b)throw Error("Could not find an importer for the provided eventData.");return new b(this,a)},importTraces:function(a,b){var c=d.fromArguments(arguments,1),c=this.createImportTracesTask({update:function(a){}},a,c);tv.b.Task.RunSynchronously(c)},importTracesWithProgressDialog:function(a,b){var c=d.fromArguments(arguments,1),h=tv.b.ui.Overlay();h.title="Importing...";h.userCanClose=!1;h.msgEl=document.createElement("div"); +h.appendChild(h.msgEl);h.msgEl.style.margin="20px";h.update=function(a){this.msgEl.textContent=a};h.visible=!0;c=this.createImportTracesTask(h,a,c);c=tv.b.Task.RunWhenIdle(c);c.then(function(){h.visible=!1},function(a){h.visible=!1});return c},hasEventDataDecoder_:function(a){if(0===a.length)return!1;for(var b=0;b<a.length;++b)if(!a[b].isTraceDataContainer())return!0;return!1},createImportTracesTask:function(a,b,c){var h=d.fromArguments(arguments,2);if(this.importing_)throw Error("Already importing."); +this.importing_=!0;var k=new tv.b.Task(function(){a.update("I will now import your traces for you...")},this),l,m=[];l=k.after(function(){b=b.slice(0);a.update("Creating importers...");for(var c=0;c<b.length;++c)m.push(this.createImporter_(b[c]));for(c=0;c<m.length;c++)for(var g=m[c].extractSubtraces(),d=0;d<g.length;d++)try{b.push(g[d]),m.push(this.createImporter_(g[d]))}catch(h){console.warn(h.name+": "+h.message)}if(b.length&&!this.hasEventDataDecoder_(m))throw Error("Could not find an importer for the provided eventData."); +m.sort(function(a,b){return a.importPriority-b.importPriority})},this);l=l.after(function(b){m.forEach(function(e,c){b.subTask(function(){a.update("Importing "+(c+1)+" of "+m.length);e.importEvents(0<c)},this)},this)},this);h.customizeModelCallback&&(l=l.after(function(a){h.customizeModelCallback(this)},this));l=l.after(function(b){m.forEach(function(b,c){a.update("Importing sample data "+(c+1)+"/"+m.length);b.importSampleData()},this)},this);l=l.after(function(){a.update("Autoclosing open slices..."); +this.samples.sort(function(a,b){return a.start-b.start});this.updateBounds();this.kernel.autoCloseOpenSlices(this.bounds.max);for(var b in this.processes)this.processes[b].autoCloseOpenSlices(this.bounds.max);this.kernel.createSubSlices();for(b in this.processes)this.processes[b].createSubSlices()},this);l=l.after(function(b){m.forEach(function(b,c){a.update("Finalizing import "+(c+1)+"/"+m.length);b.finalizeImport()},this)},this);l=l.after(function(a){this.iterateAllEventContainers(function(a){this.eventContainerByStableId_[a.stableId]= +a}.bind(this))},this);l=l.after(function(){a.update("Initializing objects (step 1/2)...");for(var b in this.processes)this.processes[b].preInitializeObjects()},this);h.pruneEmptyContainers&&(l=l.after(function(){a.update("Pruning empty containers...");this.kernel.pruneEmptyContainers();for(var b in this.processes)this.processes[b].pruneEmptyContainers()},this));l=l.after(function(){a.update("Merging kernel with userland...");for(var b in this.processes)this.processes[b].mergeKernelWithUserland()}, +this);l=l.after(function(){a.update("Computing final world bounds...");this.updateBounds();this.updateCategories_();h.shiftWorldToZero&&this.shiftWorldToZero()},this);l=l.after(function(){a.update("Building flow event map...");for(var b=0;b<this.flowEvents.length;++b){var c=this.flowEvents[b];this.flowIntervalTree.insert(c[0],c[1])}this.flowIntervalTree.updateHighValues()},this);l=l.after(function(){a.update("Joining object refs...");for(var b=0;b<m.length;b++)m[b].joinRefs()},this);l=l.after(function(){a.update("Cleaning up undeleted objects..."); +for(var b in this.processes)this.processes[b].autoDeleteObjects(this.bounds.max)},this);l=l.after(function(){a.update("Sorting memory dumps...");this.globalMemoryDumps.sort(function(a,b){return a.start-b.start});for(var b in this.processes)this.processes[b].sortMemoryDumps()},this);l=l.after(function(){a.update("Initializing objects (step 2/2)...");for(var b in this.processes)this.processes[b].initializeObjects()},this);l.after(function(){this.importing_=!1},this);return k},importWarning:function(a){this.importWarnings_.push(a); +!0!==this.reportedImportWarnings_[a.type]&&(console.warn(a.message),this.reportedImportWarnings_[a.type]=!0)},get hasImportWarnings(){return 0<this.importWarnings_.length},get importWarnings(){return this.importWarnings_},iterateAllEvents:function(a,b){this.instantEvents.forEach(a,b);this.kernel.iterateAllEvents(a,b);for(var c in this.processes)this.processes[c].iterateAllEvents(a,b);this.samples.forEach(a,b);this.globalMemoryDumps.forEach(a,b)},iterateAllPersistableObjects:function(a){this.kernel.iterateAllPersistableObjects(a); +for(var b in this.processes)this.processes[b].iterateAllPersistableObjects(a)},iterateAllEventContainers:function(a){this.kernel.iterateAllEventContainers(a);for(var b in this.processes)this.processes[b].iterateAllEventContainers(a)}};return{ImportOptions:d,TraceModel:c}});"use strict"; +tv.exportTo("tv.c",function(){function d(a){this.sunburst_zoom_level=void 0;this.bounds_dirty_=!0;this.bounds_=new tv.b.Range;this.length_=0;this.guid_=tv.b.GUID.allocate();this.pushed_guids_={};if(a)for(var b=0;b<a.length;b++)this.push(a[b])}var c=tv.c.trace_model.EventRegistry,b=tv.b.Event.bind(void 0,"requestSelectionChange",!0,!1);d.prototype={__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var a=0;a<this.length_;a++)this[a].addBoundsToRange(this.bounds_); +this.bounds_dirty_=!1}return this.bounds_},get duration(){return this.bounds_.isEmpty?0:this.bounds_.max-this.bounds_.min},get length(){return this.length_},get guid(){return this.guid_},clear:function(){for(var a=0;a<this.length_;++a)delete this[a];this.length_=0;this.bounds_dirty_=!0},push:function(a){if(void 0==a.guid)throw Error("Event must have a GUID");if(this.pushed_guids_[a.guid])return a;this.pushed_guids_[a.guid]=!0;this[this.length_++]=a;this.bounds_dirty_=!0;return a},addSelection:function(a){for(var b= +0;b<a.length;b++)this.push(a[b])},subSelection:function(a,b){b=b||1;var c=new d;c.bounds_dirty_=!0;if(0>a||a+b>this.length_)throw Error("Index out of bounds");for(var g=a;g<a+b;g++)c.push(this[g]);return c},getEventsOrganizedByBaseType:function(a){var b={},e=c.getAllRegisteredTypeInfos();e.forEach(function(a){b[a.metadata.name]=new d;void 0!==this.sunburst_zoom_level&&(b[a.metadata.name].sunburst_zoom_level=this.sunburst_zoom_level)},this);this.forEach(function(a,c){var g=-1,d=void 0;e.forEach(function(b, +c){a instanceof b.constructor&&c>g&&(g=c,d=b)});if(-1==g)throw Error("Unrecgonized event type");b[d.metadata.name].push(a)});if(a){a={};for(var g in b)0<b[g].length&&(a[g]=b[g]);return a}return b},enumEventsOfType:function(a,b){for(var c=0;c<this.length_;c++)this[c]instanceof a&&b(this[c])},getShiftedSelection:function(a,b){for(var c=new d,g=0;g<this.length_;g++){var h=this[g];if(h instanceof tv.c.trace_model.FlowEvent)if(0<b&&h.nextFlowEvent){c.push(h.nextFlowEvent);continue}else if(0>b&&h.previousFlowEvent){c.push(h.previousFlowEvent); +continue}a.trackForEvent(h).addItemNearToProvidedEventToSelection(h,b,c)}return 0==c.length?void 0:c},forEach:function(a,b){for(var c=0;c<this.length;c++)a.call(b,this[c],c)},map:function(a,b){for(var c=[],g=0;g<this.length;g++)c.push(a.call(b,this[g],g));return c},every:function(a,b){for(var c=0;c<this.length;c++)if(!a.call(b,this[c],c))return!1;return!0},some:function(a,b){for(var c=0;c<this.length;c++)if(a.call(b,this[c],c))return!0;return!1}};return{Selection:d,RequestSelectionChangeEvent:b}}); +"use strict"; +tv.exportTo("tv.c.analysis",function(){var d=tv.c.analysis.tsRound,c=tv.c.RequestSelectionChangeEvent,b=tv.b.ui.define("a");b.prototype={__proto__:HTMLAnchorElement.prototype,decorate:function(){this.classList.add("analysis-link");this.addEventListener("click",this.onClicked_.bind(this))},onClicked_:function(){var a=new c;a.selection=this.selectionGenerator();this.dispatchEvent(a)}};var a=tv.b.ui.define("object-snapshot-link",b);a.prototype={__proto__:b.prototype,decorate:function(){b.prototype.decorate.apply(this)},set objectSnapshot(a){this.textContent= +a.objectInstance.typeName+" "+a.objectInstance.id+" @ "+d(a.ts)+" ms";this.selectionGenerator=function(){var b=new tv.c.Selection;b.push(a);return b}.bind(this)}};var f=tv.b.ui.define("object-instance-link",b);f.prototype={__proto__:b.prototype,decorate:function(){b.prototype.decorate.apply(this)},set objectInstance(a){this.textContent=a.typeName+" "+a.id;this.selectionGenerator=function(){var b=new tv.c.Selection;b.push(a);return b}.bind(this)}};return{RequestSelectionChangeEvent:c,AnalysisLink:b, +ObjectSnapshotLink:a,ObjectInstanceLink:f}});"use strict"; +tv.exportTo("tv.c.analysis",function(){var d=tv.b.ui.define("x-generic-object-view");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.object_=void 0},get object(){return this.object_},set object(b){this.object_=b;this.updateContents_()},updateContents_:function(){this.textContent="";this.appendElementsForType_("",this.object_,0,0,5,"")},appendElementsForType_:function(b,a,c,e,g,d){if(e>g)this.appendSimpleText_(b,c,"<recursion limit reached>",d);else if(void 0===a)this.appendSimpleText_(b, +c,"undefined",d);else if(null===a)this.appendSimpleText_(b,c,"null",d);else{if(!(a instanceof Object))if("string"==typeof a){var k=!1;if("{"==a[0]&&"}"==a[a.length-1]||"["==a[0]&&"]"==a[a.length-1])try{a=JSON.parse(a),k=!0}catch(l){}if(!k)return this.appendSimpleText_(b,c,'"'+a+'"',d)}else return this.appendSimpleText_(b,c,a,d);a instanceof tv.c.trace_model.ObjectSnapshot?(e=new tv.c.analysis.ObjectSnapshotLink(a),e.objectSnapshot=a,this.appendElementWithLabel_(b,c,e,d)):a instanceof tv.c.trace_model.ObjectInstance? +(e=new tv.c.analysis.ObjectInstanceLink(a),e.objectInstance=a,this.appendElementWithLabel_(b,c,e,d)):a instanceof tv.b.Rect?this.appendSimpleText_(b,c,a.toString(),d):a instanceof Array?this.appendElementsForArray_(b,a,c,e,g,d):this.appendElementsForObject_(b,a,c,e,g,d)}},appendElementsForArray_:function(b,a,c,e,d,h){if(0==a.length)this.appendSimpleText_(b,c,"[]",h);else{this.appendElementsForType_(b+"[",a[0],c,e+1,d,1<a.length?",":"]"+h);for(var k=1;k<a.length;k++)this.appendElementsForType_("", +a[k],c+b.length+1,e+1,d,k<a.length-1?",":"]"+h)}},appendElementsForObject_:function(b,a,c,e,d,h){var k=tv.b.dictionaryKeys(a);if(0==k.length)this.appendSimpleText_(b,c,"{}",h);else{this.appendElementsForType_(b+"{"+k[0]+": ",a[k[0]],c,e,d,1<k.length?",":"}"+h);for(var l=1;l<k.length;l++)this.appendElementsForType_(k[l]+": ",a[k[l]],c+b.length+1,e+1,d,l<k.length-1?",":"}"+h)}},appendElementWithLabel_:function(b,a,c,e){var d=document.createElement("div"),h=document.createElement("span");h.style.whiteSpace= +"pre";for(var k=0;k<a;k++)h.textContent+=" ";d.appendChild(h);a=document.createElement("span");a.textContent=b;d.appendChild(a);d.appendChild(c);b=document.createElement("span");b.textContent=e;d.appendChild(b);d.dataElement=c;this.appendChild(d)},appendSimpleText_:function(b,a,c,e){var d=this.ownerDocument.createElement("span");d.textContent=c;this.appendElementWithLabel_(b,a,d,e);return d}};var c=tv.b.ui.define("x-generic-object-view-with-label");c.prototype={__proto__:HTMLUnknownElement.prototype, +decorate:function(){this.labelEl_=document.createElement("div");this.genericObjectView_=new tv.c.analysis.GenericObjectView;this.appendChild(this.labelEl_);this.appendChild(this.genericObjectView_)},get label(){return this.labelEl_.textContent},set label(b){this.labelEl_.textContent=b},get object(){return this.genericObjectView_.object},set object(b){this.genericObjectView_.object=b}};return{GenericObjectView:d,GenericObjectViewWithLabel:c}});"use strict"; +tv.exportTo("tv.c.analysis",function(){var d=tv.b.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis-results"},get requiresTallView(){return!0},clear:function(){this.textContent=""},createSelectionChangingLink:function(c,b,a){var f=this.ownerDocument.createElement("a");tv.c.analysis.AnalysisLink.decorate(f);f.textContent=c;f.selectionGenerator=b;a&&(f.title=a);return f},appendElement_:function(c,b,a){b=c.ownerDocument.createElement(b);c.appendChild(b); +void 0!=a&&(b.textContent=a);return b},appendText_:function(c,b){c.ownerDocument.createTextNode(b);c.appendChild(textNode);return textNode},appendTableCell_:function(c,b,a,f,e){b=this.appendElement_(b,"td",f);b.className=c.className+"-col-"+a;e&&(c=document.createElement("span"),c.textContent=" "+String.fromCharCode(9888),c.title=e,b.appendChild(c));return b},appendTableCell:function(c,b,a){return this.appendTableCell_(c,b,b.children.length,a)},appendTableCellWithTooltip_:function(c,b,a,f,e){return e? +(b=this.appendElement_(b,"td"),b.className=c.className+"-col-"+a,c=this.appendElement_(b,"span",f),c.className="tooltip",c.title=e,b):this.appendTableCell_(c,b,a,f)},appendHeader:function(c){c=this.appendElement_(this,"span",c);c.className="analysis-header";return c},appendInfo:function(c,b){var a=this.appendElement_(this,"div");a.label=this.appendElement_(a,"b",c);a.value=this.appendElement_(a,"span",b);return a},appendTable:function(c,b){var a=this.appendElement_(this,"table");a.className=c+" analysis-table"; +a.numColumns=b;return a},appendHeadRow:function(c){if(c.headerRow)throw Error("Only one header row allowed.");if(c.tbody||c.tfoot)throw Error("Cannot add a header row after data rows have been added.");c.headerRow=this.appendElement_(this.appendElement_(c,"thead"),"tr");c.headerRow.className="analysis-table-header";return c.headerRow},appendBodyRow:function(c){if(c.tfoot)throw Error("Cannot add a tbody row after footer rows have been added.");c.tbody||(c.tbody=this.appendElement_(c,"tbody"));var b= +this.appendElement_(c.tbody,"tr");b.className=c.headerRow?"analysis-table-row":"analysis-table-row-inverted";return b},appendFootRow:function(c){c.tfoot||(c.tfoot=this.appendElement_(c,"tfoot"),c.tfoot.rowsClassName=((c.headerRow?1:0)+(c.tbody?c.tbody.rows.length:0))%2?"analysis-table-row":"analysis-table-row-inverted");var b=this.appendElement_(c.tfoot,"tr");b.className=c.tfoot.rowsClassName;return b},appendSpacingRow:function(c,b){for(var a=c.tfoot||b?this.appendFootRow(c):this.appendBodyRow(c), +f=0;f<c.numColumns;f++)this.appendTableCell_(c,a,f," ")},appendInfoRow:function(c,b,a,f){f=c.tfoot||f?this.appendFootRow(c):this.appendBodyRow(c);this.appendTableCell_(c,f,0,b);void 0!==a?(b=new tv.c.analysis.GenericObjectView,b.object=a,b.classList.add("analysis-table-col-1"),b.style.display="table-cell",f.appendChild(b)):this.appendTableCell_(c,f,1,"");for(a=2;a<c.numColumns;a++)this.appendTableCell_(c,f,a,"")},appendInfoRowTime:function(c,b,a,f,e){f=c.tfoot||f?this.appendFootRow(c):this.appendBodyRow(c); +this.appendTableCell_(c,f,0,b);this.appendTableCell_(c,f,1,tv.c.analysis.tsRound(a)+" ms",e)},appendDetailsRow:function(c,b,a,f,e,d,h){var k=this.appendBodyRow(c);if(d){var l=this.appendTableCell(c,k,tv.c.analysis.tsRound(b));l.textContent="";l.appendChild(this.createSelectionChangingLink(tv.c.analysis.tsRound(b),d,""))}else this.appendTableCell(c,k,tv.c.analysis.tsRound(b));null!==a&&this.appendTableCell(c,k,tv.c.analysis.tsRound(a));h&&this.appendTableCell(c,k,""!=h?tv.c.analysis.tsRound(h):""); +null!==f&&this.appendTableCell(c,k,tv.c.analysis.tsRound(f));c=this.appendTableCell(c,k,"");b=0;for(var m in e)b+=1;if(0<b)for(m in e)a=e[m],b=new tv.c.analysis.GenericObjectView,b.object=a,a=this.appendElement_(this.appendElement_(c,"table"),"tr"),this.appendElement_(a,"td",m+":"),this.appendElement_(a,"td").appendChild(b)},appendDataRow:function(c,b,a,f,e,d,h,k,l,m,n){var q=void 0;l&&(q="Min Duration:\t"+tv.c.analysis.tsRound(l.min)+" ms \rMax Duration:\t"+tv.c.analysis.tsRound(l.max)+" ms \rAvg Duration:\t"+ +tv.c.analysis.tsRound(l.avg)+" ms (\u03c3 = "+tv.c.analysis.tsRound(l.avg_stddev)+")",l.start&&(q+="\rStart Time:\t"+tv.c.analysis.tsRound(l.start)+" ms"),l.end&&(q+="\rEnd Time:\t"+tv.c.analysis.tsRound(l.end)+" ms"),l.frequency&&l.frequency_stddev&&(q+="\rFrequency:\t"+tv.c.analysis.tsRound(l.frequency)+" occurrences/s (\u03c3 = "+tv.c.analysis.tsRound(l.frequency_stddev)+")"));l=c.tfoot||n?this.appendFootRow(c):this.appendBodyRow(c);n=0;if(m){var u=this.appendTableCellWithTooltip_(c,l,n,b,q);u&& +(u.textContent="",u.appendChild(this.createSelectionChangingLink(b,m,q)))}else this.appendTableCellWithTooltip_(c,l,n,b,q);n++;null!==a&&(a?a instanceof Array?this.appendTableCellWithTooltip_(c,l,n,"["+a.join(", ")+"]",q):this.appendTableCellWithTooltip_(c,l,n,tv.c.analysis.tsRound(a),q):this.appendTableCell_(c,l,n,""),n++);null!==f&&(""!=f?this.appendTableCellWithTooltip_(c,l,n,tv.c.analysis.tsRound(f),q):this.appendTableCell_(c,l,n,""),n++);null!==e&&(e?this.appendTableCellWithTooltip_(c,l,n,tv.c.analysis.tsRound(e), +q):this.appendTableCell_(c,l,n,""),n++);null!==d&&(d?this.appendTableCellWithTooltip_(c,l,n,tv.c.analysis.tsRound(d),q):this.appendTableCell_(c,l,n,""),n++);null!==k&&(k?this.appendTableCellWithTooltip_(c,l,n,k,q):this.appendTableCell_(c,l,n,""),n++);h?this.appendTableCellWithTooltip_(c,l,n,String(h),q):this.appendTableCell_(c,l,n,"")}};return{AnalysisResults:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(a,c){return b(a,c)}function c(a,c){return b(c,a)}function b(a,b){var c=parseFloat(a),d=parseFloat(b);return isNaN(c)&&isNaN(d)?a.toString().localeCompare(b.toString()):isNaN(c)?-1:isNaN(d)?1:c-d}var a=tv.b.ui.define("sortable-table");a.prototype={__proto__:HTMLTableElement.prototype,decorate:function(){this.classList.add("sortable-table");if(this.tHead){for(var a=this.tHead.rows[0],b=window.history.state,c=0;c<a.cells.length;c++)a.cells[c].addEventListener("click", +this.onItemClicked_,!0),a.cells[c].innerHTML+=" ▿";b&&b.tableSorting&&(a=this.sortingHashCode_(),b.tableSorting[a]&&this.sort(b.tableSorting[a].col,b.tableSorting[a].sortDirection))}},onItemClicked_:function(a){var b=this.parentNode;a=b.parentNode.parentNode;var b=Array.prototype.slice.call(b.cells).indexOf(this),c=a.sort(b),d=history.state;d.tableSorting||(d.tableSorting={});d.tableSorting[a.sortingHashCode_()]={col:b,sortDirection:c};window.history.pushState(d)},sort:function(a,b){var g= +this.tHead.rows[0],h=g.cells[a];if(h.hasAttribute("sort")){var k=g,g=h.getAttribute("sort");if(b!=g){g="upward"==g?"downward":"upward";h.setAttribute("sort",g);k=h.innerHTML;h.innerHTML=k.substr(0,k.length-2)+("downward"==g?"▾":"▴");for(var k=h.parentNode,h=k.parentNode.parentNode.tBodies[0],k=[],l=0;l<h.rows.length;l++)k[k.length]=h.rows[l];for(l=k.length-1;0<=l;l--)h.appendChild(k[l])}return g}k=b||"downward";for(l=0;l<g.cells.length;l++)if(g.cells[l].getAttribute("sort")){g.cells[l].removeAttribute("sort"); +var m=g.cells[l].innerHTML;g.cells[l].innerHTML=m.substr(0,m.length-2)+"▿"}m=g.cells[a].innerHTML;h.innerHTML=m.substr(0,m.length-2)+("downward"==k?"▾":"▴");h.setAttribute("sort",k);m=g.parentNode.parentNode.tBodies[0].rows;h=[];for(l=0;l<m.length;l++)h.push([m[l].cells[a].innerText,m[l]]);h.sort("downward"==k?d:c);for(l=0;l<h.length;l++)g.parentNode.parentNode.tBodies[0].appendChild(h[l][1]);return k},sortingHashCode_:function(){if(this.sortingHashValue_)return this.sortingHashValue_; +for(var a=this.tHead.rows[0].innerText,b=0,c=0;c<a.length;c++)127>a.charCodeAt(c)&&(b+=a.charCodeAt(c));return this.sortingHashValue_=Array.prototype.slice.call(document.getElementsByClassName("sortable-table")).indexOf(this)+""+b}};return{SortableTable:a}});"use strict"; +Polymer("tv-c-single-slice-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){if(1!==d.length)throw Error("Only supports single slices");if(!(d[0]instanceof tv.c.trace_model.Slice))throw Error("Only supports slices");this.setSelectionWithoutErrorChecks(d)},get selection(){return this.currentSelection_},setSelectionWithoutErrorChecks:function(d){this.currentSelection_=d;this.textContent="";var c=new tv.c.analysis.AnalysisResults;this.appendChild(c);this.analyzeSingleSlice_(c, +d[0])},analyzeSingleSlice_:function(d,c){var b=d.appendTable("analysis-slice-table",2);c.error&&d.appendInfoRow(b,"Error",c.error);c.title&&d.appendInfoRow(b,"Title",c.title);c.category&&d.appendInfoRow(b,"Category",c.category);d.appendInfoRowTime(b,"Start",c.start);d.appendInfoRowTime(b,"Wall Duration",c.duration);c.cpuDuration&&d.appendInfoRowTime(b,"CPU Duration",c.cpuDuration);c.selfTime&&d.appendInfoRowTime(b,"Self Time",c.selfTime);if(c.cpuSelfTime){var a;c.cpuSelfTime>c.selfTime&&(a="Note that CPU Self Time is larger than Self Time. This is a known limitation of this system, which occurs due to several subslices, rounding issues, and inprecise time at which we get cpu- and real-time."); +d.appendInfoRowTime(b,"CPU Self Time",c.cpuSelfTime,!1,a)}c.durationInUserTime&&d.appendInfoRowTime(b,"Duration (U)",c.durationInUserTime);c.startStackFrame&&c.endStackFrame?c.startStackFrame===c.endStackFrame?d.appendInfoRow(b,"Start+End Stack Trace",c.startStackFrame.getUserFriendlyStackTrace()):(d.appendInfoRow(b,"Start Stack Trace",c.startStackFrame.getUserFriendlyStackTrace()),d.appendInfoRow(b,"End Stack Trace",c.endStackFrame.getUserFriendlyStackTrace())):c.startStackFrame?d.appendInfoRow(b, +"Start Stack Trace",c.startStackFrame.getUserFriendlyStackTrace()):c.endStackFrame&&d.appendInfoRow(b,"End Stack Trace",c.endStackFrame.getUserFriendlyStackTrace());a=0;for(var f in c.args)a+=1;if(0<a)for(f in d.appendInfoRow(b,"Args"),c.args)d.appendInfoRow(b," "+f,c.args[f])}});"use strict"; +Polymer("tv-c-multi-slice-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){if(1>=d.length)throw Error("Only supports multiple items");if(!d.every(function(c){return c instanceof tv.c.trace_model.Slice}))throw Error("Only supports slices");this.setSelectionWithoutErrorChecks(d)},get selection(){return this.currentSelection_},setSelectionWithoutErrorChecks:function(d){this.currentSelection_=d;this.textContent="";var c=new tv.c.analysis.AnalysisResults;this.appendChild(c); +this.analyzeMultipleSlices_(c,d)},analyzeSingleTypeSlices_:function(d,c,b){d.appendInfo("Title: ",c[0].title);d.appendInfo("Category: ",c[0].category);var a=d.appendTable("analysis-slice-table",4+b),f=d.appendHeadRow(a);d.appendTableCell(a,f,"Start");d.appendTableCell(a,f,"Wall Duration (ms)");b&&d.appendTableCell(a,f,"CPU Duration (ms)");d.appendTableCell(a,f,"Self Time (ms)");d.appendTableCell(a,f,"Args");var e=0;tv.b.iterItems(c,function(b,c){e++;d.appendDetailsRow(a,c.start,c.duration,c.selfTime? +c.selfTime:c.duration,c.args,function(){return new tv.c.Selection([c])},c.cpuDuration)});1<e&&tv.b.ui.SortableTable.decorate(a)},analyzeMultipleSlices_:function(d,c){for(var b=c.bounds.min,a=c.bounds.max,f=0,e={},g=!1,h=0;h<c.length;h++){var k=c[h];void 0===e[k.title]&&(e[k.title]=[],f++);k.cpuDuration&&(g=!0);e[k.title].push(c[h])}var l=d.appendTable("analysis-slice-table",4+g),h=d.appendHeadRow(l);d.appendTableCell(l,h,"Name");d.appendTableCell(l,h,"Wall Duration (ms)");g&&d.appendTableCell(l,h, +"CPU Duration (ms)");d.appendTableCell(l,h,"Self Time (ms)");g&&d.appendTableCell(l,h,"CPU Self Time (ms)");d.appendTableCell(l,h,"Occurrences");var m=this,n=0,q=0,u=0,v=0;tv.b.iterItems(e,function(a,b){for(var c=0,e=0,h=0,k=0,w=0,x=Number.MAX_VALUE,A=-Number.MAX_VALUE,z=Number.MAX_VALUE,B=-Number.MAX_VALUE,w=0;w<b.length;w++){var D=b[w],c=c+D.duration;D.cpuDuration&&(e+=D.cpuDuration,k+=D.cpuSelfTime?D.cpuSelfTime:D.cpuDuration);h+=D.selfTime?D.selfTime:D.duration;x=Math.min(D.start,x);A=Math.max(D.start, +A);z=Math.min(D.duration,z);B=Math.max(D.duration,B)}n+=c;q+=e;u+=h;v+=k;0==b.length&&(w=0);w=c/b.length;z={min:z,max:B,avg:w,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0};for(w=B=0;w<b.length;w++)D=z.avg-b[w].duration,B+=D*D;z.avg_stddev=Math.sqrt(B/(b.length-1));A-=x;if(2<b.length&&0<A){x=b.length-1;z.frequency=1E3*x/A;B=0;for(w=1;w<b.length;w++)D=z.frequency-1E3/(b[w].start-b[w-1].start),B+=D*D;z.frequency_stddev=Math.sqrt(B/(x-1))}d.appendDataRow(l,a,c,g?0<e?e:"":null,h,g?0<k?k: +"":null,b.length,null,z,function(){return new tv.c.Selection(b)});1===f&&m.analyzeSingleTypeSlices_(d,b,g)});1!==f&&(d.appendDataRow(l,"Totals",n,g?q:null,u,g?v:null,c.length,null,null,null,!0),d.appendSpacingRow(l,!0),tv.b.ui.SortableTable.decorate(l));d.appendInfoRowTime(l,"Selection start",b,!0);d.appendInfoRowTime(l,"Selection extent",a-b,!0)}});"use strict"; +Polymer("tv-c-single-thread-time-slice-sub-view",{created:function(){this.currentSelection_=void 0},get selection(){return this.currentSelection_},set selection(d){if(1!==d.length)throw Error("Only supports single slices");if(!(d[0]instanceof tv.c.trace_model.ThreadTimeSlice))throw Error("Only supports thread time slices");this.currentSelection_=d;var c=d[0],b=c.thread;d=this.shadowRoot;d.querySelector("#state").textContent=c.title;var a=tv.b.ui.getColorPalette()[c.colorId];d.querySelector("#state").style.backgroundColor= +a;d.querySelector("#process-name").textContent=b.parent.userFriendlyName;d.querySelector("#thread-name").textContent=b.userFriendlyName;d.querySelector("#start").textContent=tv.c.analysis.tsRound(c.start)+"ms";d.querySelector("#duration").textContent=tv.c.analysis.tsRound(c.duration)+"ms";b=d.querySelector("#on-cpu");b.textContent="";a=d.querySelector("#running-instead");if(c.cpuOnWhichThreadWasRunning){a.parentElement.removeChild(a);var f=new tv.c.analysis.AnalysisLink;f.textContent=c.cpuOnWhichThreadWasRunning.userFriendlyName; +f.selectionGenerator=function(){var a=new tv.c.Selection;a.push(c.getAssociatedCpuSlice());return a}.bind(this);b.appendChild(f)}else{b.parentElement.removeChild(b);var e=c.getCpuSliceThatTookCpu();e?(f=new tv.c.analysis.AnalysisLink,f.textContent=e.thread?e.thread.userFriendlyName:e.title,f.selectionGenerator=function(){var a=new tv.c.Selection;a.push(e);return a}.bind(this),a.appendChild(f)):a.parentElement.removeChild(a)}d=d.querySelector("#args");0<tv.b.dictionaryKeys(c.args).length?(b=new tv.c.analysis.GenericObjectView, +b.object=c.args,d.parentElement.style.display="",d.textContent="",d.appendChild(b)):d.parentElement.style.display="none"}});"use strict"; +Polymer("tv-c-single-cpu-slice-sub-view",{created:function(){this.currentSelection_=void 0},get selection(){return this.currentSelection_},set selection(d){if(1!==d.length)throw Error("Only supports single slices");if(!(d[0]instanceof tv.c.trace_model.CpuSlice))throw Error("Only supports thread time slices");this.currentSelection_=d;d=d[0];var c=d.threadThatWasRunning,b=this.shadowRoot;c?(b.querySelector("#process-name").textContent=c.parent.userFriendlyName,b.querySelector("#thread-name").textContent= +c.userFriendlyName):(b.querySelector("#process-name").parentElement.style.display="none",b.querySelector("#thread-name").textContent=d.title);b.querySelector("#start").textContent=tv.c.analysis.tsRound(d.start)+"ms";b.querySelector("#duration").textContent=tv.c.analysis.tsRound(d.duration)+"ms";var c=b.querySelector("#running-thread"),a=d.getAssociatedTimeslice();a?(d=new tv.c.analysis.AnalysisLink,d.textContent="Click to select",d.selectionGenerator=function(){var b=new tv.c.Selection;b.push(a); +return b}.bind(this),c.parentElement.style.display="",c.textContent="",c.appendChild(d)):c.parentElement.style.display="none"}});"use strict";Polymer("tv-c-single-instant-event-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){this.textContent="";var c=document.createElement("tv-c-single-slice-sub-view");this.appendChild(c);c.setSelectionWithoutErrorChecks(d);this.currentSelection_=d},get selection(){return this.currentSelection_}});"use strict"; +Polymer("tv-c-multi-instant-event-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){this.textContent="";var c=document.createElement("tv-c-multi-slice-sub-view");this.appendChild(c);c.setSelectionWithoutErrorChecks(d);this.currentSelection_=d},get selection(){return this.currentSelection_}});"use strict"; +(function(){var d=tv.c.trace_model.CounterSample;Polymer("tv-c-counter-sample-sub-view",{created:function(){this.currentSelection_=void 0},get selection(){return this.currentSelection_},set selection(c){var b=new tv.c.analysis.AnalysisResults;this.appendChild(b);this.analyzeCounterSamples_(b,c)},analyzeCounterSamples_:function(c,b){for(var a={},f=0;f<b.length;f++){var e=b[f].series.counter;a[e.guid]||(a[e.guid]=[]);a[e.guid].push(b[f])}for(var g in a)f=a[g],e=f[0].series.counter,f=d.groupByTimestamp(f), +1==f.length?this.analyzeSingleCounterTimestamp_(c,e,f[0]):this.analyzeMultipleCounterTimestamps_(c,e,f)},analyzeSingleCounterTimestamp_:function(c,b,a){c.appendHeader("Selected counter:");var f=c.appendTable("analysis-counter-table",2);c.appendInfoRow(f,"Title",b.name);c.appendInfoRowTime(f,"Timestamp",a[0].timestamp);for(b=0;b<a.length;b++){var e=a[b];c.appendInfoRow(f,e.series.name,e.value)}},analyzeMultipleCounterTimestamps_:function(c,b,a){c.appendHeader("Counter "+b.name);for(var f=c.appendTable("analysis-counter-table", +2),e=[],d=0;d<a.length;d++)e.push(a[d][0].getSampleIndex());a=b.getSampleStatistics(e);for(d=0;d<a.length;d++){for(var h=[],k=0;k<e.length;++k)h.push(b.getSeries(d).getSample(e[k]).value);c.appendDataRow(f,b.name+": series("+b.getSeries(d).name+")",h,null,null,null,h.length,null,a[d])}}})})();"use strict"; +Polymer("tv-c-single-flow-event-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){this.textContent="";var c=document.createElement("tv-c-single-slice-sub-view");this.appendChild(c);c.setSelectionWithoutErrorChecks(d);this.currentSelection_=d},get selection(){return this.currentSelection_}});"use strict"; +Polymer("tv-c-multi-flow-event-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){this.textContent="";var c=document.createElement("tv-c-multi-slice-sub-view");this.appendChild(c);c.setSelectionWithoutErrorChecks(d);this.currentSelection_=d},get selection(){return this.currentSelection_}});"use strict"; +tv.exportTo("tv.c.analysis",function(){var d=tv.b.ui.define("object-instance-view");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.objectInstance_=void 0},get requiresTallView(){return!0},set modelEvent(b){this.objectInstance=b},get modelEvent(){return this.objectInstance},get objectInstance(){return this.objectInstance_},set objectInstance(b){this.objectInstance_=b;this.updateContents()},updateContents:function(){throw Error("Not implemented");}};var c=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE); +c.mandatoryBaseClass=d;c.defaultMetadata={showInTrackView:!0};tv.b.decorateExtensionRegistry(d,c);return{ObjectInstanceView:d}});"use strict"; +Polymer("tv-c-single-object-instance-sub-view",{created:function(){this.currentSelection_=void 0},get requiresTallView(){if(0===this.children.length)return!1;if(this.children[0]instanceof tv.c.analysis.ObjectInstanceView)return this.children[0].requiresTallView},get selection(){return this.currentSelection_},set selection(d){if(1!==d.length)throw Error("Only supports single item selections");if(!(d[0]instanceof tv.c.trace_model.ObjectInstance))throw Error("Only supports object instances");this.textContent= +"";this.currentSelection_=d;d=d[0];var c=tv.c.analysis.ObjectInstanceView.getTypeInfo(d.category,d.typeName);c?(c=new c.constructor,this.appendChild(c),c.modelEvent=d):this.appendGenericAnalysis_(d)},appendGenericAnalysis_:function(d){var c;c=""+('<div class="title">'+d.typeName+" "+d.id+"</div>\n");c+="<table><tr>";c+="<tr><td>creationTs:</td><td>"+d.creationTs+"</td></tr>\n";c=d.deletionTs!=Number.MAX_VALUE?c+("<tr><td>deletionTs:</td><td>"+d.deletionTs+"</td></tr>\n"):c+"<tr><td>deletionTs:</td><td>not deleted</td></tr>\n"; +c+='<tr><td>snapshots:</td><td id="snapshots"></td></tr>\n';this.innerHTML=c+="</table>";var b=this.querySelector("#snapshots");d.snapshots.forEach(function(a){var c=new tv.c.analysis.ObjectSnapshotLink;c.objectSnapshot=a;b.appendChild(c)})}});"use strict"; +Polymer("tv-c-single-object-snapshot-sub-view",{created:function(){this.currentSelection_=void 0},get requiresTallView(){if(0===this.children.length)return!1;if(this.children[0]instanceof tv.c.analysis.ObjectSnapshotView)return this.children[0].requiresTallView},get selection(){return this.currentSelection_},set selection(d){if(1!==d.length)throw Error("Only supports single item selections");if(!(d[0]instanceof tv.c.trace_model.ObjectSnapshot))throw Error("Only supports object instances");this.textContent= +"";this.currentSelection_=d;d=d[0];var c=tv.c.analysis.ObjectSnapshotView.getTypeInfo(d.objectInstance.category,d.objectInstance.typeName);c?(c=new c.constructor,this.appendChild(c),c.modelEvent=d):this.appendGenericAnalysis_(d)},appendGenericAnalysis_:function(d){var c=d.objectInstance,b;b=""+('<div class="title">Snapshot of <a id="instance-link"></a> @ '+tv.c.analysis.tsRound(d.ts)+"ms</div>\n");b+="<table><tr>";b+='<tr><td>args:</td><td id="args"></td></tr>\n';this.innerHTML=b+="</table>";b=new tv.c.analysis.ObjectInstanceLink; +b.objectInstance=c;c=this.querySelector("#instance-link");c.parentElement.replaceChild(b,c);c=this.querySelector("#args");c.textContent="";b=tv.c.analysis.GenericObjectView();b.object=d.args;c.appendChild(b)}});"use strict"; +Polymer("tv-c-multi-object-sub-view",{created:function(){this.currentSelection_=void 0},get selection(){return this.currentSelection_},set selection(d){this.currentSelection_=d;this.textContent="";var c=new tv.c.analysis.AnalysisResults;this.appendChild(c);this.analyzeObjectEvents_(c,d)},analyzeObjectEvents_:function(d,c){c=tv.b.asArray(c).sort(tv.b.Range.compareByMinTimes);var b=d.appendTable("analysis-object-sample-table",2);c.forEach(function(a){var c=d.appendBodyRow(b),e,g,h;a instanceof tv.c.trace_model.ObjectSnapshot? +(e=tv.c.analysis.tsRound(a.ts),g=a.objectInstance.typeName+" "+a.objectInstance.id,h=function(){var b=new tv.c.Selection;b.push(a);return b}):(e=a.deletionTs==Number.MAX_VALUE?"":tv.c.analysis.tsRound(a.deletionTs),e=tv.c.analysis.tsRound(a.creationTs)+"-"+e,g=a.typeName+" "+a.id,h=function(){var b=new tv.c.Selection;b.push(a);return b});d.appendTableCell(b,c,e);d.appendTableCell(b,c,"").appendChild(d.createSelectionChangingLink(g,h))})}});"use strict"; +Polymer("tv-c-single-sample-sub-view",{created:function(){this.currentSelection_=void 0},set selection(d){this.textContent="";this.currentSelection_=d;var c=new tv.c.analysis.AnalysisResults;this.appendChild(c);this.analyzeSingleSampleEvent_(c,d[0],"Sample Event")},get selection(){return this.currentSelection_},analyzeSingleSampleEvent_:function(d,c,b){d.appendHeader("Selected "+b+":");b=d.appendTable("analysis-slice-table",2);d.appendInfoRow(b,"Title",c.title);d.appendInfoRowTime(b,"Sample Time", +c.start);d.appendInfoRow(b,"Stack Trace",c.getUserFriendlyStackTrace())}});"use strict";Polymer("tv-c-multi-sample-sub-view",{created:function(){this.currentSelection_=void 0},get requiresTallView(){return!0},set selection(d){this.textContent="";this.currentSelection_=d;if(tv.isDefined("tv.e.analysis.SamplingSummaryPanel")){var c=new tv.e.analysis.SamplingSummaryPanel;this.appendChild(c);c.selection=d}else this.textContent="SamplingSummaryPanel not installed. :("},get selection(){return this.currentSelection_}}); +"use strict"; +(function(){var d=tv.c.trace_model.EventRegistry;Polymer("tracing-analysis-view",{ready:function(){this.tabView_=document.createElement("tracing-analysis-tab-view");this.tabView_.style.flex="1 1 auto";this.tabView_.addEventListener("selected-tab-change",this.onSelectedTabChange_.bind(this));this.appendChild(this.tabView_);this.currentSelection_=void 0},set tallMode(c){c?this.classList.add("tall-mode"):this.classList.remove("tall-mode")},get tallMode(){return this.classList.contains("tall-mode")},get tabView(){return this.tabView_}, +get selection(){return this.currentSelection_},set selection(c){var b,a;this.tabView_.selectedTab&&(b=this.tabView_.selectedTab.tagName,a=this.tabView_.selectedTab._eventTypeName);this.tallMode=!1;this.tabView_.textContent="";c=c.getEventsOrganizedByBaseType(!0);tv.b.dictionaryLength(c);for(var f in c){var e=c[f],d=this.createSubViewForSelection_(f,e);d._eventTypeName=f;this.tabView_.appendChild(d);d.selection=e}var h;b&&(h=this.tabView_.querySelector(b));!h&&a&&(h=tv.b.findFirstInArray(this.tabView_.children, +function(b){return b._eventTypeName===a}));h||(h=this.tabView_.firstChild);this.tabView_.selectedTab=h},createSubViewForSelection_:function(c,b){var a=d.getEventTypeInfoByTypeName(c),f;f=1===b.length?a.metadata.singleViewElementName:a.metadata.multiViewElementName;if(!tv.b.getPolymerElementNamed(f))throw Error("Element not registered: "+f);f=document.createElement(f);a=(1===b.length?a.metadata.name:a.metadata.pluralName).replace(/[A-Z]/g," $&");a=a.charAt(0).toUpperCase()+a.slice(1);f.tabLabel=a; +return f},onSelectedTabChange_:function(){this.tallMode=this.tabView_.selectedTab?this.tabView_.selectedTab.requiresTallView:!1}})})();"use strict"; +tv.exportTo("tv.c",function(){function d(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tv.c.Selection;this.filterHitsDirty_=!0;this.currentHitIndex_=-1}var c=tv.b.Task;d.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(b){this.timeline_=b;this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(b){b!=this.filterText_&&(this.filterText_=b,this.filterHitsDirty_=!0)},updateFilterHits:function(){var b=Promise.resolve(); +if(!this.filterHitsDirty_)return b;this.filterHits_=new tv.c.Selection;this.currentHitIndex_=-1;if(this.timeline_&&this.filterText.length){var b=new tv.c.TitleFilter(this.filterText),a=new tv.c.Selection,b=this.timeline.addAllObjectsMatchingFilterToSelectionAsTask(b,a),b=c.RunWhenIdle(b);b.then(function(){this.filterHitsDirty_=!1;this.filterHits_=a;this.timeline.setHighlightAndClearSelection(a)}.bind(this))}return b},get filterHits(){return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_}, +find_:function(b){-1===this.currentHitIndex_&&0>b&&(this.currentHitIndex_=0);var a=this.filterHits.length;this.currentHitIndex_=(this.currentHitIndex_+b+a)%a;this.timeline&&(this.timeline.selection=this.filterHits.subSelection(this.currentHitIndex_,1))},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)},reset:function(){this.filterText_="";this.filterHitsDirty_=!0}};return{FindController:d}});"use strict"; +tv.exportTo("tv.b",function(){function d(c){this.document_=c||document;if(d.instance)throw Error("KeyEventManager is a singleton.");this.onEvent_=this.onEvent_.bind(this);this.document_.addEventListener("keydown",this.onEvent_);this.document_.addEventListener("keypress",this.onEvent_);this.document_.addEventListener("keyup",this.onEvent_);this.listeners_=[]}d.instance=void 0;document.head.addEventListener("tv-unittest-will-run",function(){d.instance&&(d.instance.destroy(),d.instance=void 0);d.instance= +new d});d.prototype={addListener:function(c,b,a){a.keyEventManagerGuid_||(a.keyEventManagerGuid_=tv.b.GUID.allocate(),a.keyEventManagerRefCount_=0);a.classList.add("key-event-manager-target");a.keyEventManagerRefCount_++;this.listeners_.push({guid:a.keyEventManagerGuid_,type:c,handler:b})},onEvent_:function(c){var b=void 0,a=!1,f=c.preventDefault;c.preventDefault=function(){b=!1;f.call(this)};var e=c.stopPropagation;c.stopPropagation=function(){a=!0;e.call(this)};c.stopImmediatePropagation=function(){throw Error("Not implemented"); +};for(var d=this.document_.querySelectorAll(".key-event-manager-target"),h={},k=0;k<d.length;k++)h[d[k].keyEventManagerGuid_]=d[k];for(var d=this.listeners_.concat(),l=c.type,m=0,k=0;k<d.length;k++){var n=d[k];if(n.type===l){var q=h[n.guid];if(q&&(n=n.handler,m=n.handleEvent?m|!1===n.handleEvent.call(n,c):m|!1===n.call(q,c),a))break}}return!m&&b},removeListener:function(c,b,a){if(void 0===a.keyEventManagerGuid_)throw Error("Was not registered with KeyEventManager");if(0===a.keyEventManagerRefCount_)throw Error("No events were registered on the provided thisArg"); +for(var f=0;f<this.listeners_.length;f++){var e=this.listeners_[f];if(e.type==c&&e.handler==b&&e.guid==a.keyEventManagerGuid_){a.keyEventManagerRefCount_--;0===a.keyEventManagerRefCount_&&a.classList.remove("key-event-manager-target");this.listeners_.splice(f,1);return}}throw Error("Listener not found");},destroy:function(){this.listeners_.splice(0);this.document_.removeEventListener("keydown",this.onEvent_);this.document_.removeEventListener("keypress",this.onEvent_);this.document_.removeEventListener("keyup", +this.onEvent_)},dispatchFakeEvent:function(c,b){var a=new KeyboardEvent(c,b);return d.instance.onEvent_.call(void 0,a)}};d.instance=new d;return{KeyEventManager:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(c){this.onMouseDown_=this.onMouseDown_.bind(this);this.onMouseMove_=this.onMouseMove_.bind(this);this.onMouseUp_=this.onMouseUp_.bind(this);this.targetElement=c}d.prototype={get targetElement(){return this.targetElement_},set targetElement(c){this.targetElement_&&this.targetElement_.removeEventListener("mousedown",this.onMouseDown_);(this.targetElement_=c)&&this.targetElement_.addEventListener("mousedown",this.onMouseDown_)},onMouseDown_:function(c){if(0!== +c.button)return!0;c=this.remakeEvent_(c,"mouse-tracker-start");this.targetElement_.dispatchEvent(c);document.addEventListener("mousemove",this.onMouseMove_);document.addEventListener("mouseup",this.onMouseUp_);this.targetElement_.addEventListener("blur",this.onMouseUp_);this.savePreviousUserSelect_=document.body.style["-webkit-user-select"];document.body.style["-webkit-user-select"]="none";c.preventDefault();return!0},onMouseMove_:function(c){c=this.remakeEvent_(c,"mouse-tracker-move");this.targetElement_.dispatchEvent(c)}, +onMouseUp_:function(c){document.removeEventListener("mousemove",this.onMouseMove_);document.removeEventListener("mouseup",this.onMouseUp_);this.targetElement_.removeEventListener("blur",this.onMouseUp_);document.body.style["-webkit-user-select"]=this.savePreviousUserSelect_;c=this.remakeEvent_(c,"mouse-tracker-end");this.targetElement_.dispatchEvent(c)},remakeEvent_:function(c,b){var a=new tv.b.Event(b,!0,!0);a.x=c.x;a.y=c.y;a.offsetX=c.offsetX;a.offsetY=c.offsetY;a.clientX=c.clientX;a.clientY=c.clientY; +return a}};return{MouseTracker:d,trackMouseMovesUntilMouseUp:function(c,b){function a(f){document.removeEventListener("mousemove",c);document.removeEventListener("mouseup",a);b&&b(f)}document.addEventListener("mousemove",c);document.addEventListener("mouseup",a)}}});"use strict"; +tv.exportTo("tv.b.ui",function(){var d=document.currentScript.ownerDocument,c={SELECTION:1,PANSCAN:2,ZOOM:4,TIMING:8,ROTATE:16,ALL_MODES:31},b={};b[c.PANSCAN]={title:"pan",className:"pan-scan-mode-button",eventNames:{enter:"enterpan",begin:"beginpan",update:"updatepan",end:"endpan",exit:"exitpan"}};b[c.SELECTION]={title:"selection",className:"selection-mode-button",eventNames:{enter:"enterselection",begin:"beginselection",update:"updateselection",end:"endselection",exit:"exitselection"}};b[c.ZOOM]= +{title:"zoom",className:"zoom-mode-button",eventNames:{enter:"enterzoom",begin:"beginzoom",update:"updatezoom",end:"endzoom",exit:"exitzoom"}};b[c.TIMING]={title:"timing",className:"timing-mode-button",eventNames:{enter:"entertiming",begin:"begintiming",update:"updatetiming",end:"endtiming",exit:"exittiming"}};b[c.ROTATE]={title:"rotate",className:"rotate-mode-button",eventNames:{enter:"enterrotate",begin:"beginrotate",update:"updaterotate",end:"endrotate",exit:"exitrotate"}};var a={SHIFT:1,SPACE:2, +CMD_OR_CTRL:4},f=tv.b.ui.define("div");f.prototype={__proto__:HTMLDivElement.prototype,decorate:function(a){this.classList.add("mouse-mode-selector");var b=tv.b.instantiateTemplate("#mouse-mode-selector-template",d);this.appendChild(b);this.buttonsEl_=this.querySelector(".buttons");this.dragHandleEl_=this.querySelector(".drag-handle");this.supportedModeMask=c.ALL_MODES;this.initialRelativeMouseDownPos_={x:0,y:0};this.defaultMode_=c.PANSCAN;this.settingsKey_=void 0;this.mousePos_={x:0,y:0};this.mouseDownPos_= +{x:0,y:0};this.dragHandleEl_.addEventListener("mousedown",this.onDragHandleMouseDown_.bind(this));this.onMouseDown_=this.onMouseDown_.bind(this);this.onMouseMove_=this.onMouseMove_.bind(this);this.onMouseUp_=this.onMouseUp_.bind(this);this.buttonsEl_.addEventListener("mouseup",this.onButtonMouseUp_);this.buttonsEl_.addEventListener("mousedown",this.onButtonMouseDown_);this.buttonsEl_.addEventListener("click",this.onButtonPress_.bind(this));tv.b.KeyEventManager.instance.addListener("keydown",this.onKeyDown_, +this);tv.b.KeyEventManager.instance.addListener("keyup",this.onKeyUp_,this);this.mode_=this.keyCodeCondition=void 0;this.modeToKeyCodeMap_={};this.modifierToModeMap_={};this.targetElement=a;this.spacePressed_=!1;this.modeBeforeAlternativeModeActivated_=null;this.isClick_=this.isInteracting_=!1},get targetElement(){return this.targetElement_},set targetElement(a){this.targetElement_&&this.targetElement_.removeEventListener("mousedown",this.onMouseDown_);(this.targetElement_=a)&&this.targetElement_.addEventListener("mousedown", +this.onMouseDown_)},get defaultMode(){return this.defaultMode_},set defaultMode(a){this.defaultMode_=a},get settingsKey(){return this.settingsKey_},set settingsKey(a){if(this.settingsKey_=a)if(a=tv.b.Settings.get(this.settingsKey_+".mode",void 0),void 0===b[a]&&(a=void 0),0===(a&this.supportedModeMask_)&&(a=void 0),a||(a=this.defaultMode_),this.mode=a,a=tv.b.Settings.get(this.settingsKey_+".pos",void 0))this.pos=a},get supportedModeMask(){return this.supportedModeMask_},set supportedModeMask(a){function f(a){var c= +document.createElement("div");c.mode=a;c.title=b[a].title;c.classList.add("tool-button");c.classList.add(b[a].className);return c}if(this.mode&&0===(a&this.mode))throw Error("supportedModeMask must include current mode.");this.supportedModeMask_=a;this.buttonsEl_.textContent="";for(var d in c)"ALL_MODES"!=d&&(a=c[d],0!==(this.supportedModeMask_&a)&&this.buttonsEl_.appendChild(f(a)))},get mode(){return this.currentMode_},set mode(a){if(void 0!==a){if("number"!==typeof a)throw Error("Mode must be a number"); +if(0===(a&this.supportedModeMask_))throw Error("Cannot switch to this mode, it is not supported");if(void 0===b[a])throw Error("Unrecognized mode");}var c;if(this.currentMode_!==a){if(this.currentMode_){c=b[this.currentMode_];var f=this.buttonsEl_.querySelector("."+c.className);f&&f.classList.remove("active");this.isInteracting_&&(f=this.createEvent_(b[this.mode].eventNames.end),this.dispatchEvent(f));tv.b.dispatchSimpleEvent(this,c.eventNames.exit,!0)}if(this.currentMode_=a)c=b[this.currentMode_], +(f=this.buttonsEl_.querySelector("."+c.className))&&f.classList.add("active"),this.mouseDownPos_.x=this.mousePos_.x,this.mouseDownPos_.y=this.mousePos_.y,this.isInAlternativeMode_||tv.b.dispatchSimpleEvent(this,c.eventNames.enter,!0),this.isInteracting_&&(f=this.createEvent_(b[this.mode].eventNames.begin),this.dispatchEvent(f));this.settingsKey_&&!this.isInAlternativeMode_&&tv.b.Settings.set(this.settingsKey_+".mode",this.mode)}},setKeyCodeForMode:function(a,c){if(0===(a&this.supportedModeMask_))throw Error("Mode not supported"); +this.modeToKeyCodeMap_[a]=c;if(this.buttonsEl_){var f=b[a],d=this.buttonsEl_.querySelector("."+f.className);d&&(d.title=f.title+" ("+String.fromCharCode(c)+")")}},setKeyCodeCondition:function(a){this.keyCodeCondition=a},setCurrentMousePosFromEvent_:function(a){this.mousePos_.x=a.clientX;this.mousePos_.y=a.clientY},createEvent_:function(a,b){var c=new tv.b.Event(a,!0);c.clientX=this.mousePos_.x;c.clientY=this.mousePos_.y;c.deltaX=this.mousePos_.x-this.mouseDownPos_.x;c.deltaY=this.mousePos_.y-this.mouseDownPos_.y; +c.mouseDownX=this.mouseDownPos_.x;c.mouseDownY=this.mouseDownPos_.y;c.didPreventDefault=!1;c.preventDefault=function(){c.didPreventDefault=!0;b&&b.preventDefault()};c.stopPropagation=function(){b.stopPropagation()};c.stopImmediatePropagation=function(){throw Error("Not implemented");};return c},onMouseDown_:function(a){0===a.button&&(this.setCurrentMousePosFromEvent_(a),a=this.createEvent_(b[this.mode].eventNames.begin,a),this.dispatchEvent(a),this.isClick_=this.isInteracting_=!0,tv.b.ui.trackMouseMovesUntilMouseUp(this.onMouseMove_, +this.onMouseUp_))},onMouseMove_:function(a){this.setCurrentMousePosFromEvent_(a);var c=this.createEvent_(b[this.mode].eventNames.update,a);this.dispatchEvent(c);this.isInteracting_&&this.checkIsClick_(a)},onMouseUp_:function(a){if(0===a.button){var c=this.createEvent_(b[this.mode].eventNames.end,a);c.isClick=this.isClick_;this.dispatchEvent(c);this.isClick_&&!c.didPreventDefault&&this.dispatchClickEvents_(a);this.isInteracting_=!1;this.updateAlternativeModeState_(a)}},onButtonMouseDown_:function(a){a.preventDefault(); +a.stopImmediatePropagation()},onButtonMouseUp_:function(a){a.preventDefault();a.stopImmediatePropagation()},onButtonPress_:function(a){this.modeBeforeAlternativeModeActivated_=void 0;this.mode=a.target.mode;a.preventDefault()},onKeyDown_:function(a){32===a.keyCode&&(this.spacePressed_=!0);this.updateAlternativeModeState_(a)},onKeyUp_:function(a){32===a.keyCode&&(this.spacePressed_=!1);if(void 0==this.keyCodeCondition||this.keyCodeCondition()){var b=!1;tv.b.iterItems(this.modeToKeyCodeMap_,function(c, +f){a.keyCode===f&&(this.modeBeforeAlternativeModeActivated_=void 0,this.mode=parseInt(c),b=!0)},this);b?(a.preventDefault(),a.stopPropagation()):this.updateAlternativeModeState_(a)}},updateAlternativeModeState_:function(b){var c=this.spacePressed_,f=tv.isMac&&b.metaKey||!tv.isMac&&b.ctrlKey,d=this.supportedModeMask_,l=!1;b.shiftKey&&0!==(this.modifierToModeMap_[a.SHIFT]&d)?(b=this.modifierToModeMap_[a.SHIFT],l=!0):c&&0!==(this.modifierToModeMap_[a.SPACE]&d)?(b=this.modifierToModeMap_[a.SPACE],l=!0): +f&&0!==(this.modifierToModeMap_[a.CMD_OR_CTRL]&d)?(b=this.modifierToModeMap_[a.CMD_OR_CTRL],l=!0):this.isInAlternativeMode_?(b=this.modeBeforeAlternativeModeActivated_,l=!1):b=void 0;this.mode!==b&&void 0!==b&&(l&&(this.modeBeforeAlternativeModeActivated_=this.mode),this.mode=b)},get isInAlternativeMode_(){return!!this.modeBeforeAlternativeModeActivated_},setModifierForAlternateMode:function(a,b){this.modifierToModeMap_[b]=a},get pos(){return{x:parseInt(this.style.left),y:parseInt(this.style.top)}}, +set pos(a){a=this.constrainPositionToBounds_(a);this.style.left=a.x+"px";this.style.top=a.y+"px";this.settingsKey_&&tv.b.Settings.set(this.settingsKey_+".pos",this.pos)},constrainPositionToBounds_:function(a){var b=tv.b.windowRectForElement(this.offsetParent||document.body),c=b.height-this.offsetHeight,b=b.width-this.offsetWidth,f={};f.x=Math.max(a.x,0);f.x=Math.min(f.x,b);f.y=Math.max(a.y,0);f.y=Math.min(f.y,c);return f},onDragHandleMouseDown_:function(a){a.preventDefault();a.stopImmediatePropagation(); +var b=a.clientX-this.offsetLeft,c=a.clientY-this.offsetTop;tv.b.ui.trackMouseMovesUntilMouseUp(function(a){var e={};e.x=a.clientX-b;e.y=a.clientY-c;this.pos=e}.bind(this))},checkIsClick_:function(a){if(this.isInteracting_&&this.isClick_){a=this.mousePos_.x-this.mouseDownPos_.x;var b=this.mousePos_.y-this.mouseDownPos_.y;16<a*a+b*b&&(this.isClick_=!1)}},dispatchClickEvents_:function(a){if(this.isClick_){a=b[c.SELECTION].eventNames;var f=this.createEvent_(a.begin);this.dispatchEvent(f);f=this.createEvent_(a.end); +this.dispatchEvent(f)}}};return{MIN_MOUSE_SELECTION_DISTANCE:4,MouseModeSelector:f,MOUSE_SELECTOR_MODE:c,MODIFIER:a}});"use strict"; +tv.exportTo("tv.c",function(){function d(){this.textWidthMap={}}function c(a,b){this.string=a;this.width=b}var b={};new d;d.prototype={get:function(a,f,e,d,h){var k=b[e];k||(k={},b[e]=k);d=k[f];d||(k[f]={},d=k[f]);k=d[h];if(void 0===k){for(k=!1;this.labelWidthWorld(a,e,f)>h&&!(1>.75*e.length);)e=e.substring(0,.75*e.length),k=!0;k&&3<e.length&&(e=e.substring(0,e.length-3)+"...");k=new c(e,this.labelWidth(a,e));d[h]=k}return k},quickMeasureText_:function(a,b){var c=this.textWidthMap[b];c||(c=a.measureText(b).width, +this.textWidthMap[b]=c);return c},labelWidth:function(a,b){return this.quickMeasureText_(a,b)+2},labelWidthWorld:function(a,b,c){return this.labelWidth(a,b)*c}};return{ElidedTitleCache:d}});"use strict"; +tv.exportTo("tv.c",function(){function d(a,b,c,f,d){a.moveTo(b,c);a.lineTo(f,d)}function c(a,b,c,f,d,m,n){a.beginPath();a.moveTo(b,c);a.lineTo(f,d);a.lineTo(m,n);a.closePath()}var b=new tv.c.ElidedTitleCache,a=tv.b.ui.getColorPalette(),f=tv.c.EventPresenter;return{drawSlices:function(b,c,d,k,l,m,n){var q=window.devicePixelRatio||1,u=c.xViewVectorToWorld(1);l*=q;q*=4;l<q&&(q=0);var v=l-q;b.save();c.applyTransformToCanvas(b);c=new tv.c.FastRectRenderer(b,2*u,2*u,a);c.setYandH(0,l);for(d=tv.b.findLowIndexInSortedArray(m, +function(a){return a.start+a.duration},d);d<m.length;++d){var y=m[d],E=y.start;if(E>k)break;var C=u;0<y.duration&&(C=Math.max(y.duration,.001),C<u&&(C=u));var p=f.getSliceColorId(y),r=f.getSliceAlpha(y,n),t=.7*r;if(y.cpuDuration){var y=y.cpuDuration/y.duration*C,w=C-y;y<1*u&&(y=0,w=C);w<3*u&&(y=C,w=0);0<y&&c.fillRect(E,y,p,r);0<w&&(c.setYandH(0,v),c.fillRect(E+y-u,w+u,p,t),c.setYandH(v,q),c.fillRect(E+y-u,w+u,p,r),c.setYandH(0,l))}else c.fillRect(E,C,p,r)}c.flush();b.restore()},drawInstantSlicesAsLines:function(a, +b,c,d,l,m,n){var q=window.devicePixelRatio||1;l*=q;var u=b.xViewVectorToWorld(1);a.save();a.lineWidth=u*n*q;b.applyTransformToCanvas(a);a.beginPath();for(b=tv.b.findLowIndexInSortedArray(m,function(a){return a.start},c);b<m.length;++b){c=m[b];n=c.start;if(n>d)break;a.strokeStyle=f.getInstantSliceColor(c);a.moveTo(n,0);a.lineTo(n,l)}a.stroke();a.restore()},drawLabels:function(a,c,d,k,l,m,n,q){var u=window.devicePixelRatio||1,v=c.xViewVectorToWorld(1);a.save();a.textAlign="center";a.textBaseline="top"; +a.font=n*u+"px sans-serif";m&&(a.font="italic "+a.font);m=q*u;n=tv.b.findLowIndexInSortedArray(l,function(a){return a.start+a.duration},d);for(d=20*v;n<l.length;++n){u=l[n];if(u.start>k)break;if(!(u.duration<=d)){q=u.title+(u.didNotFinish?" (Did Not Finish)":"");var y=b.labelWidth(a,q);b.labelWidthWorld(a,q,v)>u.duration&&(y=b.get(a,v,q,y,u.duration),q=y.string,y=y.width);y*v<u.duration&&(a.fillStyle=f.getTextColor(u),u=c.xWorldToView(u.start+.5*u.duration),a.fillText(q,u,m,y))}}a.restore()},drawLine:d, +drawTriangle:c,drawArrow:function(a,b,f,k,l,m,n){var q=k-b,u=l-f,v=Math.sqrt(q*q+u*u),y=(v-m)/v;m=b+y*q;y=f+y*u;u=u/v*n;n*=-(q/v);a.beginPath();d(a,b,f,k,l);a.stroke();c(a,m+u,y+n,k,l,m-u,y-n);a.fill()},elidedTitleCache_:b,THIN_SLICE_HEIGHT:4}});"use strict"; +tv.exportTo("tv.c",function(){function d(c){this.viewport_=c;this.range_=new tv.b.Range;this.rightSelected_=this.leftSelected_=!1;this.rightSnapIndicator_=this.leftSnapIndicator_=void 0}d.prototype={get isEmpty(){return this.range_.isEmpty},reset:function(){this.range_.reset();this.rightSelected_=this.leftSelected_=!1;this.rightSnapIndicator_=this.leftSnapIndicator_=void 0;this.viewport_.dispatchChangeEvent()},get min(){return this.range_.min},set min(c){this.range_.min=c;this.viewport_.dispatchChangeEvent()}, +get max(){return this.range_.max},set max(c){this.range_.max=c;this.viewport_.dispatchChangeEvent()},set:function(c){this.range_.reset();this.range_.addRange(c);this.viewport_.dispatchChangeEvent()},setMinAndMax:function(c,b){this.range_.min=c;this.range_.max=b;this.viewport_.dispatchChangeEvent()},get range(){return this.range_.range},asRangeObject:function(){var c=new tv.b.Range;c.addRange(this.range_);return c},get leftSelected(){return this.leftSelected_},set leftSelected(c){this.leftSelected_!= +c&&(this.leftSelected_=c,this.viewport_.dispatchChangeEvent())},get rightSelected(){return this.rightSelected_},set rightSelected(c){this.rightSelected_!=c&&(this.rightSelected_=c,this.viewport_.dispatchChangeEvent())},get leftSnapIndicator(){return this.leftSnapIndicator_},set leftSnapIndicator(c){this.leftSnapIndicator_=c;this.viewport_.dispatchChangeEvent()},get rightSnapIndicator(){return this.rightSnapIndicator_},set rightSnapIndicator(c){this.rightSnapIndicator_=c;this.viewport_.dispatchChangeEvent()}, +draw:function(c,b,a){if(!this.range_.isEmpty){var f=this.viewport_.currentDisplayTransform,e=this.min,d=this.max,h=Math.round(f.xWorldToView(e)),k=Math.round(f.xWorldToView(d));c.fillStyle="rgba(0, 0, 0, 0.2)";e>b&&c.fillRect(f.xWorldToView(b),0,h,c.canvas.height);d<a&&c.fillRect(k,0,f.xWorldToView(a),c.canvas.height);c.lineWidth=Math.round(window.devicePixelRatio||1);0<this.range_.range?(this.drawLine_(c,b,a,c.canvas.height,this.min,this.leftSelected_),this.drawLine_(c,b,a,c.canvas.height,this.max, +this.rightSelected_)):this.drawLine_(c,b,a,c.canvas.height,this.min,this.leftSelected_||this.rightSelected_);c.lineWidth=1}},drawLine_:function(c,b,a,f,e,d){e<b||e>=a||(b=Math.round(this.viewport_.currentDisplayTransform.xWorldToView(e)),c.save(),c.translate(Math.round(c.lineWidth)%2/2,0),c.beginPath(),tv.c.drawLine(c,b,0,b,f),c.strokeStyle=d?"rgb(255, 0, 0)":"rgb(0, 0, 0)",c.stroke(),c.restore())},drawIndicators:function(c,b,a){this.leftSnapIndicator_&&this.drawIndicator_(c,b,a,this.range_.min,this.leftSnapIndicator_, +this.leftSelected_);this.rightSnapIndicator_&&this.drawIndicator_(c,b,a,this.range_.max,this.rightSnapIndicator_,this.rightSelected_)},drawIndicator_:function(c,b,a,f,e,d){b=Math.round(this.viewport_.currentDisplayTransform.xWorldToView(f));c.save();c.translate(Math.round(c.lineWidth)%2/2,0);a=e.y*devicePixelRatio;e=e.height*devicePixelRatio;f=4*(window.devicePixelRatio||1);c.fillStyle=d?"rgb(255, 0, 0)":"rgb(0, 0, 0)";tv.c.drawTriangle(c,b-.75*f,a,b+.75*f,a,b,a+f);c.fill();tv.c.drawTriangle(c,b- +.75*f,a+e,b+.75*f,a+e,b,a+e-f);c.fill();c.restore()}};return{SnapIndicator:function(c,b){this.y=c;this.height=b},TimelineInterestRange:d}});"use strict"; +tv.exportTo("tv.c",function(){function d(c){c?this.set(c):(this.scaleX=1,this.panY=this.panX=0)}d.prototype={set:function(c){this.scaleX=c.scaleX;this.panX=c.panX;this.panY=c.panY},clone:function(){return new d(this)},equals:function(c){var b;if(void 0===c||null===c)return!1;b=1&this.panX===c.panX;b&=this.panY===c.panY;b&=this.scaleX===c.scaleX;return!!b},almostEquals:function(c){var b;if(void 0===c||null===c)return!1;b=1&.001>Math.abs(this.panX-c.panX);b&=.001>Math.abs(this.panY-c.panY);b&=.001> +Math.abs(this.scaleX-c.scaleX);return!!b},incrementPanXInViewUnits:function(c){this.panX+=this.xViewVectorToWorld(c)},xPanWorldPosToViewPos:function(c,b,a){if("string"==typeof b)if("left"===b)b=0;else if("center"===b)b=a/2;else if("right"===b)b=a-1;else throw Error("viewX must be left|center|right or number.");this.panX=b/this.scaleX-c},xPanWorldBoundsIntoView:function(c,b,a){0>this.xWorldToView(c)?this.xPanWorldPosToViewPos(c,"left",a):this.xWorldToView(b)>a&&this.xPanWorldPosToViewPos(b,"right", +a)},xSetWorldBounds:function(c,b,a){this.setPanAndScale(-c,a/(b-c))},setPanAndScale:function(c,b){this.scaleX=b;this.panX=c},xWorldToView:function(c){return(c+this.panX)*this.scaleX},xWorldVectorToView:function(c){return c*this.scaleX},xViewToWorld:function(c){return c/this.scaleX-this.panX},xViewVectorToWorld:function(c){return c/this.scaleX},applyTransformToCanvas:function(c){c.transform(this.scaleX,0,0,1,this.panX*this.scaleX,0)}};return{TimelineDisplayTransform:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(){}d.prototype={canTakeOverFor:function(c){throw Error("Not implemented");},takeOverFor:function(c,b,a){throw Error("Not implemented");},start:function(c,b){throw Error("Not implemented");},didStopEarly:function(c,b,a){},tick:function(c,b){throw Error("Not implemented");}};return{Animation:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){function d(){tv.b.EventTarget.call(this);this.activeAnimation_=this.target_=void 0;this.tickScheduled_=!1}d.prototype={__proto__:tv.b.EventTarget.prototype,get target(){return this.target_},set target(c){if(this.activeAnimation_)throw Error("Cannot change target while animation is running.");if(void 0===c.cloneAnimationState||"function"!==typeof c.cloneAnimationState)throw Error("target must have a cloneAnimationState function");this.target_=c},get activeAnimation(){return this.activeAnimation_}, +get hasActiveAnimation(){return!!this.activeAnimation_},queueAnimation:function(c,b){if(void 0===this.target_)throw Error("Cannot queue animations without a target");var a;a=void 0!==b?b:window.performance.now();this.activeAnimation_&&this.activeAnimation_.tick(a,this.target_)&&(this.activeAnimation_=void 0);this.activeAnimation_&&(c.canTakeOverFor(this.activeAnimation_)?(this.activeAnimation_.didStopEarly(a,this.target_,!0),c.takeOverFor(this.activeAnimation_,a,this.target_)):this.activeAnimation_.didStopEarly(a, +this.target_,!1));this.activeAnimation_=c;this.activeAnimation_.start(a,this.target_);this.tickScheduled_||(this.tickScheduled_=!0,tv.b.requestAnimationFrame(this.tickActiveAnimation_,this))},cancelActiveAnimation:function(c){this.activeAnimation_&&(c=void 0!==c?c:window.performance.now(),this.activeAnimation_.didStopEarly(c,this.target_,!1),this.activeAnimation_=void 0)},tickActiveAnimation_:function(c){this.tickScheduled_=!1;if(this.activeAnimation_)if(void 0===this.target_)this.activeAnimation_.didStopEarly(c, +this.target_,!1);else{var b=this.target_.cloneAnimationState();this.activeAnimation_.tick(c,this.target_)&&(this.activeAnimation_=void 0);this.activeAnimation_&&(this.tickScheduled_=!0,tv.b.requestAnimationFrame(this.tickActiveAnimation_,this));b&&(c=new Event("didtick"),c.oldTargetState=b,this.dispatchEvent(c,!1,!1))}}};return{AnimationController:d}});"use strict"; +tv.exportTo("tv.c",function(){function d(){this.stableIdToTrackMap_={}}function c(c){this.parentEl_=c;this.modelTrackContainer_=void 0;this.currentDisplayTransform_=new b;this.initAnimationController_();this.highDetails_=this.highlightVSync_=this.showFlowEvents_=!1;this.gridTimebase_=0;this.gridStep_=1E3/60;this.hasCalledSetupFunction_=this.gridEnabled_=!1;this.onResize_=this.onResize_.bind(this);this.onModelTrackControllerScroll_=this.onModelTrackControllerScroll_.bind(this);this.checkForAttachInterval_= +setInterval(this.checkForAttach_.bind(this),250);this.majorMarkPositions=[];this.interestRange_=new a(this);this.eventToTrackMap_={};this.containerToTrackObj=new d}var b=tv.c.TimelineDisplayTransform,a=tv.c.TimelineInterestRange;d.prototype={addContainer:function(a,b){if(!b)throw Error("Must provide a track.");this.stableIdToTrackMap_[a.stableId]=b},clearMap:function(){this.stableIdToTrackMap_={}},getTrackByStableId:function(a){return this.stableIdToTrackMap_[a]}};c.prototype={__proto__:tv.b.EventTarget.prototype, +setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocumentOrInTestMode(){if(void 0!==this.parentEl_)return tv.b.ui.isElementAttachedToDocument(this.parentEl_)},onResize_:function(){this.dispatchChangeEvent()},checkForAttach_:function(){if(this.isAttachedToDocumentOrInTestMode&&0!=this.clientWidth){this.iframe_||(this.iframe_=document.createElement("iframe"),this.iframe_.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden;",this.parentEl_.appendChild(this.iframe_), +this.iframe_.contentWindow.addEventListener("resize",this.onResize_));var a=this.parentEl_.clientWidth+"x"+this.parentEl_.clientHeight;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(b){console.log("While running setWhenPossible:",b.message?b.message+"\n"+b.stack:b.stack)}this.pendingSetFunction_=void 0}window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){tv.b.dispatchSimpleEvent(this,"change")}, +detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=void 0);this.iframe_&&(this.iframe_.removeEventListener("resize",this.onResize_),this.parentEl_.removeChild(this.iframe_))},initAnimationController_:function(){this.dtAnimationController_=new tv.b.ui.AnimationController;this.dtAnimationController_.addEventListener("didtick",function(a){this.onCurentDisplayTransformChange_(a.oldTargetState)}.bind(this));var a=this;this.dtAnimationController_.target= +{get panX(){return a.currentDisplayTransform_.panX},set panX(b){a.currentDisplayTransform_.panX=b},get panY(){return a.currentDisplayTransform_.panY},set panY(b){a.currentDisplayTransform_.panY=b},get scaleX(){return a.currentDisplayTransform_.scaleX},set scaleX(b){a.currentDisplayTransform_.scaleX=b},cloneAnimationState:function(){return a.currentDisplayTransform_.clone()},xPanWorldPosToViewPos:function(b,c){a.currentDisplayTransform_.xPanWorldPosToViewPos(b,c,a.modelTrackContainer_.canvas.clientWidth)}}}, +get currentDisplayTransform(){return this.currentDisplayTransform_},setDisplayTransformImmediately:function(a){this.dtAnimationController_.cancelActiveAnimation();var b=this.dtAnimationController_.target.cloneAnimationState();this.currentDisplayTransform_.set(a);this.onCurentDisplayTransformChange_(b)},queueDisplayTransformAnimation:function(a){if(!(a instanceof tv.b.ui.Animation))throw Error("animation must be instanceof tv.b.ui.Animation");this.dtAnimationController_.queueAnimation(a)},onCurentDisplayTransformChange_:function(a){this.modelTrackContainer_&& +(this.currentDisplayTransform.panY=tv.b.clamp(this.currentDisplayTransform.panY,0,this.modelTrackContainer_.scrollHeight-this.modelTrackContainer_.clientHeight));var b=!this.currentDisplayTransform.equals(a);this.currentDisplayTransform.panY!==a.panY&&(this.modelTrackContainer_.scrollTop=this.currentDisplayTransform.panY);b&&this.dispatchChangeEvent()},onModelTrackControllerScroll_:function(a){this.dtAnimationController_.activeAnimation&&this.dtAnimationController_.activeAnimation.affectsPanY&&this.dtAnimationController_.cancelActiveAnimation(); +this.currentDisplayTransform_.panY=this.modelTrackContainer_.scrollTop},get modelTrackContainer(){return this.modelTrackContainer_},set modelTrackContainer(a){this.modelTrackContainer_&&this.modelTrackContainer_.removeEventListener("scroll",this.onModelTrackControllerScroll_);this.modelTrackContainer_=a;this.modelTrackContainer_.addEventListener("scroll",this.onModelTrackControllerScroll_)},get showFlowEvents(){return this.showFlowEvents_},set showFlowEvents(a){this.showFlowEvents_=a;this.dispatchChangeEvent()}, +get highlightVSync(){return this.highlightVSync_},set highlightVSync(a){this.highlightVSync_=a;this.dispatchChangeEvent()},get highDetails(){return this.highDetails_},set highDetails(a){this.highDetails_=a;this.dispatchChangeEvent()},get gridEnabled(){return this.gridEnabled_},set gridEnabled(a){this.gridEnabled_!=a&&(this.gridEnabled_=a&&!0,this.dispatchChangeEvent())},get gridTimebase(){return this.gridTimebase_},set gridTimebase(a){this.gridTimebase_!=a&&(this.gridTimebase_=a,this.dispatchChangeEvent())}, +get gridStep(){return this.gridStep_},get interestRange(){return this.interestRange_},drawMajorMarkLines:function(a){a.save();a.translate(Math.round(a.lineWidth)%2/2,0);a.beginPath();for(var b in this.majorMarkPositions){var c=Math.floor(this.majorMarkPositions[b]);tv.c.drawLine(a,c,0,c,a.canvas.height)}a.strokeStyle="#ddd";a.stroke();a.restore()},drawGridLines:function(a,b,c){if(this.gridEnabled){var d=this.currentDisplayTransform,k=this.gridTimebase;a.save();a.translate(Math.round(a.lineWidth)% +2/2,0);for(a.beginPath();k<c;){if(k>=b){var l=Math.floor(d.xWorldToView(k));tv.c.drawLine(a,l,0,l,a.canvas.height)}k+=this.gridStep}a.strokeStyle="rgba(255, 0, 0, 0.25)";a.stroke();a.restore()}},rebuildEventToTrackMap:function(){this.eventToTrackMap_=void 0;var a={addEvent:function(a,b){if(!b)throw Error("Must provide a track.");this[a.guid]=b}};this.modelTrackContainer_.addEventsToTrackMap(a);this.eventToTrackMap_=a},rebuildContainerToTrackMap:function(){this.containerToTrackObj.clearMap();this.modelTrackContainer_.addContainersToTrackMap(this.containerToTrackObj)}, +trackForEvent:function(a){return this.eventToTrackMap_[a.guid]}};return{ContainerToTrackObj:d,TimelineViewport:c}});"use strict"; +tv.exportTo("tv.c",function(){function d(b,a,c){this.deltaX=b;this.deltaY=a;this.durationMs=void 0===c?100:c;this.startTimeMs=this.startPanY=this.startPanX=void 0}function c(b,a,c,e,d){this.goalFocalPointXWorld=b;this.goalFocalPointXView=a;this.goalFocalPointY=c;this.zoomInRatioX=e;this.durationMs=void 0===d?100:d;this.goalPanY=this.startPanY=this.goalScaleX=this.startScaleX=this.startTimeMs=void 0}d.prototype={__proto__:tv.b.ui.Animation.prototype,get affectsPanY(){return 0!==this.deltaY},canTakeOverFor:function(b){return b instanceof +d},takeOverFor:function(b,a,c){var e=b.goalPanX-c.panX;c=b.goalPanY-c.panY;b=a-(b.startTimeMs+b.durationMs);b=Math.max(b,0);this.deltaX+=e;this.deltaY+=c;this.durationMs+=b},start:function(b,a){this.startTimeMs=b;this.startPanX=a.panX;this.startPanY=a.panY},tick:function(b,a){var c=(b-this.startTimeMs)/this.durationMs,c=tv.b.clamp(c,0,1);a.panX=tv.b.lerp(c,this.startPanX,this.goalPanX);this.affectsPanY&&(a.panY=tv.b.lerp(c,this.startPanY,this.goalPanY));return b>=this.startTimeMs+this.durationMs}, +get goalPanX(){return this.startPanX+this.deltaX},get goalPanY(){return this.startPanY+this.deltaY}};c.prototype={__proto__:tv.b.ui.Animation.prototype,get affectsPanY(){return this.startPanY!=this.goalPanY},canTakeOverFor:function(b){return!1},takeOverFor:function(b,a,c){this.goalScaleX=c.scaleX*this.zoomInRatioX},start:function(b,a){this.startTimeMs=b;this.startScaleX=a.scaleX;this.goalScaleX=this.zoomInRatioX*a.scaleX;this.startPanY=a.panY},tick:function(b,a){var c=(b-this.startTimeMs)/this.durationMs, +c=tv.b.clamp(c,0,1);a.scaleX=tv.b.lerp(c,this.startScaleX,this.goalScaleX);this.affectsPanY&&(a.panY=tv.b.lerp(c,this.startPanY,this.goalFocalPointY));a.xPanWorldPosToViewPos(this.goalFocalPointXWorld,this.goalFocalPointXView);return b>=this.startTimeMs+this.durationMs}};return{TimelineDisplayTransformPanAnimation:d,TimelineDisplayTransformZoomToAnimation:c}});"use strict";tv.exportTo("tv.c",function(){return{constants:{HEADING_WIDTH:250}}});"use strict"; +tv.exportTo("tv.c",function(){function d(c,b){this.viewport_=c;this.onMouseMove_=this.onMouseMove_.bind(this);this.onDblClick_=this.onDblClick_.bind(this);this.targetElement_=b;this.isMovingLeftEdge_=!1}d.prototype={onEnterTiming:function(c){this.targetElement_.addEventListener("mousemove",this.onMouseMove_);this.targetElement_.addEventListener("dblclick",this.onDblClick_)},onBeginTiming:function(c){this.isTouchPointInsideTrackBounds_(c.clientX,c.clientY)&&(c=this.getSnappedToEventPosition_(c),this.mouseDownAt_(c.x, +c.y),this.updateSnapIndicators_(c))},updateSnapIndicators_:function(c){if(c.snapped){var b=this.viewport_.interestRange;b.min===c.x&&(b.leftSnapIndicator=new tv.c.SnapIndicator(c.y,c.height));b.max===c.x&&(b.rightSnapIndicator=new tv.c.SnapIndicator(c.y,c.height))}},onUpdateTiming:function(c){c=this.getSnappedToEventPosition_(c);this.mouseMoveAt_(c.x,c.y,!0);this.updateSnapIndicators_(c)},onEndTiming:function(c){this.mouseUp_()},onExitTiming:function(c){this.targetElement_.removeEventListener("mousemove", +this.onMouseMove_);this.targetElement_.removeEventListener("dblclick",this.onDblClick_)},onMouseMove_:function(c){if(!c.button){var b=this.getWorldXFromEvent_(c);this.mouseMoveAt_(b,c.clientY,!1)}},onDblClick_:function(c){console.error("not implemented")},isTouchPointInsideTrackBounds_:function(c,b){if(!this.viewport_||!this.viewport_.modelTrackContainer||!this.viewport_.modelTrackContainer.canvas)return!1;var a=this.viewport_.modelTrackContainer.canvas.getBoundingClientRect();return c>=a.left&&c<= +a.right&&b>=a.top&&b<=a.bottom?!0:!1},mouseDownAt_:function(c,b){var a=this.viewport_.interestRange,f=this.viewport_.currentDisplayTransform.xViewVectorToWorld(6*(window.devicePixelRatio||1));a.isEmpty?(a.setMinAndMax(c,c),a.rightSelected=!0,this.isMovingLeftEdge_=!1):Math.abs(c-a.min)<f?(a.leftSelected=!0,a.min=c,this.isMovingLeftEdge_=!0):(Math.abs(c-a.max)<f?(a.rightSelected=!0,a.max=c):(a.setMinAndMax(c,c),a.rightSelected=!0),this.isMovingLeftEdge_=!1)},mouseMoveAt_:function(c,b,a){b=this.viewport_.interestRange; +a?this.updateMovingEdge_(c):(b=this.viewport_.interestRange,a=this.viewport_.currentDisplayTransform.xViewVectorToWorld(6*(window.devicePixelRatio||1)),Math.abs(c-b.min)<a?(b.leftSelected=!0,b.rightSelected=!1):Math.abs(c-b.max)<a?(b.leftSelected=!1,b.rightSelected=!0):(b.leftSelected=!1,b.rightSelected=!1))},updateMovingEdge_:function(c){var b=this.viewport_.interestRange,a=b.min,f=b.max;this.isMovingLeftEdge_?a=c:f=c;a<=f?b.setMinAndMax(a,f):b.setMinAndMax(f,a);b.min==c?(this.isMovingLeftEdge_= +!0,b.leftSelected=!0,b.rightSelected=!1):(this.isMovingLeftEdge_=!1,b.leftSelected=!1,b.rightSelected=!0)},mouseUp_:function(){var c=this.viewport_.currentDisplayTransform,b=this.viewport_.interestRange;b.leftSelected=!1;b.rightSelected=!1;c=c.xViewVectorToWorld(2*(window.devicePixelRatio||1));b.range<c&&b.reset()},getWorldXFromEvent_:function(c){var b=window.devicePixelRatio||1,a=this.viewport_.modelTrackContainer.canvas.getBoundingClientRect().left;return this.viewport_.currentDisplayTransform.xViewToWorld((c.clientX- +a)*b)},getSnappedToEventPosition_:function(c){var b=16*(window.devicePixelRatio||1),a=this.viewport_.modelTrackContainer,f=a.getBoundingClientRect(),e=this.viewport_,d=e.currentDisplayTransform,h=d.xViewVectorToWorld(b),b=this.getWorldXFromEvent_(c);c=c.clientY;var k=new tv.c.Selection;a.addClosestEventToSelection(b,h,c,c,k);k.length||a.addClosestEventToSelection(b,h,f.top,f.bottom,k);for(var l=Infinity,d=d.xViewVectorToWorld(1),m={x:b,y:c-f.top,height:0,snapped:!1},n=new tv.b.Range,q=0;q<k.length;q++){var u= +k[q],v=e.trackForEvent(u).getBoundingClientRect();n.reset();u.addBoundsToRange(n);var u=Math.abs(n.min-b)<Math.abs(n.max-b)?n.min:n.max,y=u-b,E=v.top,v=v.height,C=Math.abs(E+v/2-c);(y<=h||Math.abs(y-h)<d)&&C<l&&(h=y,l=C,m.x=u,m.y=E+a.scrollTop-f.top,m.height=v,m.snapped=!0)}return m}};return{TimingTool:d}});"use strict"; +tv.exportTo("tv.b.ui",function(){var d=tv.b.ui.define("div");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.observer_=new WebKitMutationObserver(this.didMutate_.bind(this));this.observer_.observe(this,{childList:!0});Object.defineProperty(this,"textContent",{get:void 0,set:this.onSetTextContent_})},appendChild:function(c){HTMLUnknownElement.prototype.appendChild.call(this,c);this.didMutate_(this.observer_.takeRecords())},insertBefore:function(c,b){HTMLUnknownElement.prototype.insertBefore.call(this, +c,b);this.didMutate_(this.observer_.takeRecords())},removeChild:function(c){HTMLUnknownElement.prototype.removeChild.call(this,c);this.didMutate_(this.observer_.takeRecords())},replaceChild:function(c,b){HTMLUnknownElement.prototype.replaceChild.call(this,c,b);this.didMutate_(this.observer_.takeRecords())},onSetTextContent_:function(c){if(""!=c)throw Error("textContent can only be set to ''.");this.clear()},clear:function(){for(;this.lastChild;)HTMLUnknownElement.prototype.removeChild.call(this,this.lastChild); +this.didMutate_(this.observer_.takeRecords())},didMutate_:function(c){this.beginDecorating_();for(var b=0;b<c.length;b++){var a=c[b].addedNodes;if(a)for(var f=0;f<a.length;f++)this.decorateChild_(a[f]);if(a=c[b].removedNodes)for(f=0;f<a.length;f++)this.undecorateChild_(a[f])}this.doneDecoratingForNow_()},decorateChild_:function(c){throw Error("Not implemented");},undecorateChild_:function(c){throw Error("Not implemented");},beginDecorating_:function(){},doneDecoratingForNow_:function(){}};return{ContainerThatDecoratesItsChildren:d}}); +"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("track",tv.b.ui.ContainerThatDecoratesItsChildren);d.prototype={__proto__:tv.b.ui.ContainerThatDecoratesItsChildren.prototype,decorate:function(c){tv.b.ui.ContainerThatDecoratesItsChildren.prototype.decorate.call(this);if(void 0===c)throw Error("viewport is required when creating a Track.");this.viewport_=c;this.classList.add("track")},get viewport(){return this.viewport_},get drawingContainer(){for(var c=this;c;){if(c instanceof tv.c.tracks.DrawingContainer)return c; +c=c.parentElement}},get eventContainer(){},invalidateDrawingContainer:function(){var c=this.drawingContainer;c&&c.invalidate()},context:function(){if(this.parentNode){if(!this.parentNode.context)throw Error("Parent container does not support context() method.");return this.parentNode.context()}},decorateChild_:function(c){},undecorateChild_:function(c){c.detach&&c.detach()},updateContents_:function(){},drawTrack:function(c){var b=this.context(),a=window.devicePixelRatio||1,f=this.getBoundingClientRect(), +e=b.canvas.getBoundingClientRect();b.save();b.translate(0,a*(f.top-e.top));var d=this.viewport.currentDisplayTransform,e=d.xViewToWorld(0),a=d.xViewToWorld(f.width*a);this.draw(c,e,a);b.restore()},draw:function(c,b,a){},addEventsToTrackMap:function(c){},addContainersToTrackMap:function(c){},addIntersectingItemsInRangeToSelection:function(c,b,a,f,e){var d=window.devicePixelRatio||1,h=this.viewport.currentDisplayTransform,k=h.xViewVectorToWorld(1);c=h.xViewToWorld(c*d);b=h.xViewToWorld(b*d);d=this.getBoundingClientRect(); +a=Math.max(a,d.top);f=Math.min(f,d.bottom);a>f||this.addIntersectingItemsInRangeToSelectionInWorldSpace(c,b,k,e)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(c,b,a,f){},addClosestEventToSelection:function(c,b,a,f,e){},addClosestInstantEventToSelection:function(c,b,a,f){(c=tv.b.findClosestElementInSortedArray(c,function(a){return a.start},b,a))&&f.push(c)}};return{Track:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d={SLICE:1,INSTANT_EVENT:2,BACKGROUND:3,GRID:4,FLOW_ARROWS:5,MARKERS:6,HIGHLIGHTS:7},c=tv.b.ui.define("drawing-container",tv.c.tracks.Track);c.prototype={__proto__:tv.c.tracks.Track.prototype,decorate:function(b){tv.c.tracks.Track.prototype.decorate.call(this,b);this.classList.add("drawing-container");this.canvas_=document.createElement("canvas");this.canvas_.className="drawing-container-canvas";this.canvas_.style.left=tv.c.constants.HEADING_WIDTH+"px";this.appendChild(this.canvas_); +this.ctx_=this.canvas_.getContext("2d");this.viewportChange_=this.viewportChange_.bind(this);this.viewport.addEventListener("change",this.viewportChange_)},get canvas(){return this.canvas_},context:function(){return this.ctx_},viewportChange_:function(){this.invalidate()},invalidate:function(){this.rafPending_||(this.rafPending_=!0,tv.b.requestPreAnimationFrame(this.preDraw_,this))},preDraw_:function(){this.rafPending_=!1;this.updateCanvasSizeIfNeeded_();tv.b.requestAnimationFrameInThisFrameIfPossible(this.draw_, +this)},draw_:function(){this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);var b=[d.BACKGROUND,d.HIGHLIGHTS,d.GRID,d.INSTANT_EVENT,d.SLICE,d.MARKERS];this.viewport.showFlowEvents&&b.push(d.FLOW_ARROWS);for(var a in b)for(var c=0;c<this.children.length;++c)this.children[c]instanceof tv.c.tracks.Track&&this.children[c].drawTrack(b[a]);a=window.devicePixelRatio||1;var c=this.canvas_.getBoundingClientRect(),e=this.viewport.currentDisplayTransform,b=e.xViewToWorld(0);a=e.xViewToWorld(c.width* +a);this.viewport.drawGridLines(this.ctx_,b,a)},updateCanvasSizeIfNeeded_:function(){var b=tv.b.asArray(this.children).filter(this.visibleFilter_);this.getBoundingClientRect();var a=b[0].getBoundingClientRect(),c=b[b.length-1].getBoundingClientRect(),b=a.width-tv.c.constants.HEADING_WIDTH,a=c.bottom-a.top,c=window.devicePixelRatio||1;this.canvas_.width!=b*c&&(this.canvas_.width=b*c,this.canvas_.style.width=b+"px");this.canvas_.height!=a*c&&(this.canvas_.height=a*c,this.canvas_.style.height=a+"px")}, +visibleFilter_:function(b){return b instanceof tv.c.tracks.Track?"none"!==window.getComputedStyle(b).display:!1},addClosestEventToSelection:function(b,a,c,e,d){for(var h=0;h<this.children.length;++h)if(this.children[h]instanceof tv.c.tracks.Track){var k=this.children[h].getBoundingClientRect(),l=Math.max(c,k.top),k=Math.min(e,k.bottom);l<=k&&this.children[h].addClosestEventToSelection(b,a,c,e,d)}tv.c.tracks.Track.prototype.addClosestEventToSelection.apply(this,arguments)},addEventsToTrackMap:function(b){for(var a= +0;a<this.children.length;++a)this.children[a]instanceof tv.c.tracks.Track&&this.children[a].addEventsToTrackMap(b)},addContainersToTrackMap:function(b){for(var a=0;a<this.children.length;++a)this.children[a]instanceof tv.c.tracks.Track&&this.children[a].addContainersToTrackMap(b)}};return{DrawingContainer:c,DrawType:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){function d(b){if(void 0===b)throw Error("viewport must be provided");this.viewport_=b}d.prototype={__proto__:Object.prototype,processModel:function(b){throw Error("processModel implementation missing");},drawHighlight:function(b,a,c,e,d){throw Error("drawHighlight implementation missing");}};var c=new tv.b.ExtensionRegistryOptions(tv.b.BASIC_REGISTRY_MODE);c.defaultMetadata={};c.mandatoryBaseClass=d;tv.b.decorateExtensionRegistry(d,c);return{Highlighter:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.Task,c=tv.b.ui.define("container-track",tv.c.tracks.Track);c.prototype={__proto__:tv.c.tracks.Track.prototype,decorate:function(b){tv.c.tracks.Track.prototype.decorate.call(this,b)},detach:function(){this.textContent=""},get tracks_(){for(var b=[],a=0;a<this.children.length;a++)this.children[a].classList.contains("track")&&b.push(this.children[a]);return b},drawTrack:function(b){for(var a=0;a<this.children.length;++a)this.children[a]instanceof tv.c.tracks.Track&& +this.children[a].drawTrack(b)},addIntersectingItemsInRangeToSelection:function(b,a,c,e,d){for(var h=0;h<this.tracks_.length;h++){var k=this.tracks_[h].getBoundingClientRect(),l=Math.max(c,k.top),k=Math.min(e,k.bottom);l<=k&&this.tracks_[h].addIntersectingItemsInRangeToSelection(b,a,c,e,d)}tv.c.tracks.Track.prototype.addIntersectingItemsInRangeToSelection.apply(this,arguments)},addEventsToTrackMap:function(b){for(var a=0;a<this.children.length;++a)this.children[a].addEventsToTrackMap(b)},addAllObjectsMatchingFilterToSelection:function(b, +a){for(var c=0;c<this.tracks_.length;c++)this.tracks_[c].addAllObjectsMatchingFilterToSelection(b,a)},addAllObjectsMatchingFilterToSelectionAsTask:function(b,a){for(var c=new d,e=0;e<this.tracks_.length;e++)c.subTask(function(c){return function(){this.tracks_[c].addAllObjectsMatchingFilterToSelection(b,a)}}(e),this);return c},addClosestEventToSelection:function(b,a,c,e,d){for(var h=0;h<this.tracks_.length;h++){var k=this.tracks_[h].getBoundingClientRect(),l=Math.max(c,k.top),k=Math.min(e,k.bottom); +l<=k&&this.tracks_[h].addClosestEventToSelection(b,a,c,e,d)}tv.c.tracks.Track.prototype.addClosestEventToSelection.apply(this,arguments)}};return{ContainerTrack:c}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=String.fromCharCode(9662),c=String.fromCharCode(9656),b=tv.b.ui.define("heading-track",tv.c.tracks.Track);b.prototype={__proto__:tv.c.tracks.Track.prototype,decorate:function(a){tv.c.tracks.Track.prototype.decorate.call(this,a);this.classList.add("heading-track");this.headingDiv_=document.createElement("heading");this.headingDiv_.style.width=tv.c.constants.HEADING_WIDTH+"px";this.headingDiv_.addEventListener("click",this.onHeadingDivClicked_.bind(this)); +this.heading_="";this.selectionGenerator_=this.expanded_=void 0;this.updateContents_()},get heading(){return this.heading_},set heading(a){this.heading_=a;this.updateContents_()},set tooltip(a){this.headingDiv_.title=a},set selectionGenerator(a){this.selectionGenerator_=a;this.updateContents_()},get expanded(){return this.expanded_},set expanded(a){this.expanded_!=a&&(this.expanded_=a,this.expandedStateChanged_())},expandedStateChanged_:function(){this.updateHeadigDiv_()},onHeadingDivClicked_:function(){var a= +new Event("heading-clicked",!0,!1);this.dispatchEvent(a)},updateContents_:function(){this.updateHeadigDiv_()},updateHeadigDiv_:function(){this.headingDiv_.innerHTML="";var a=document.createElement("span");a.classList.add("heading-arrow");a.textContent=!0===this.expanded?d:!1===this.expanded?c:"";this.headingDiv_.appendChild(a);this.selectionGenerator_?(this.headingLink_=document.createElement("a"),tv.c.analysis.AnalysisLink.decorate(this.headingLink_),this.headingLink_.selectionGenerator=this.selectionGenerator_, +this.headingDiv_.appendChild(this.headingLink_),this.headingLink_.appendChild(document.createTextNode(this.heading_))):(a=document.createElement("span"),a.textContent=this.heading_,this.headingDiv_.appendChild(a));this.appendChild(this.headingDiv_)},draw:function(a,b,c){throw Error("draw implementation missing");}};return{HeadingTrack:b}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.trace_model.SelectionState,c=tv.c.EventPresenter,b=tv.b.ui.define("counter-track",tv.c.tracks.HeadingTrack);b.prototype={__proto__:tv.c.tracks.HeadingTrack.prototype,decorate:function(a){tv.c.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("counter-track")},get counter(){return this.counter_},set counter(a){this.counter_=a;this.heading=a.name+": "},draw:function(a,b,c){switch(a){case tv.c.tracks.DrawType.SLICE:this.drawSlices_(b, +c)}},drawSlices_:function(a,b){var e=this.viewport.highDetails,g=this.context(),h=window.devicePixelRatio||1,k=this.getBoundingClientRect().height*h,l=k-2*h,m=this.counter_,n=this.viewport.currentDisplayTransform;n.xViewVectorToWorld(1);for(var q=n.xViewVectorToWorld(1),u=m.numSeries,v=m.numSamples,y=tv.b.findLowIndexInSortedArray(m.timestamps,function(a){return a},a),E=m.timestamps,y=0<y-1?y-1:0,C=l/m.maxTotal,p=m.numSeries-1;0<=p;p--){var r=m.series[p];g.strokeStyle=c.getCounterSeriesColor(r.color, +d.NONE);var t=function(e){for(var d=-1,t=y-1,w=0<=t?E[t]-q:-1,x=k,A=!1;;){t++;if(t>=v)break;var z=E[t],B=l-C*m.totals[t*u+p];if(z>b){A&&(w=z=b,g.lineTo(n.xWorldToView(z),x));break}if(t+1<v){var K=E[t+1];if(K-w<=q&&K<b)continue;z<a&&(z=a)}z-w<q&&w<z&&(z=w+q);K=r.samples[t].selectionState;A&&(g.lineTo(n.xWorldToView(z),x),K!=d&&(e?(g.lineTo(n.xWorldToView(z),k),g.closePath(),g.fill()):(g.lineTo(n.xWorldToView(z),B),g.stroke())));K!=d&&(g.fillStyle=c.getCounterSeriesColor(r.color,K,.5),g.lineWidth=1* +h,g.beginPath(),e?g.moveTo(n.xWorldToView(z),k):g.moveTo(n.xWorldToView(z),A?x:B));g.lineTo(n.xWorldToView(z),B);A=!0;w=z;x=B;d=K}A&&(e?(g.lineTo(n.xWorldToView(w),k),g.closePath(),g.fill()):g.stroke())};t(!0);e&&t(!1);t=tv.b.findLowIndexInSortedArray(m.timestamps,function(a){return a},b);m.timestamps[t]==b&&t++;var w=y>=m.timestamps.length?a:m.timestamps[y],x=1>t?b:m.timestamps[t-1],t=(.1-tv.b.clamp((t-y)/(n.scaleX*(w>=x?b-a:x-w)),.05,.1))/.05;g.strokeStyle=c.getCounterSeriesColor(r.color,d.NONE); +w=void 0;for(x=y;E[x]<b;x++){var A=E[x],z=l-C*m.totals[x*u+p];if(r.samples[x].selected){var B=c.getCounterSeriesColor(r.color,r.samples[x].selectionState);B!==w&&(g.fillStyle=w=B);g.beginPath();g.arc(n.xWorldToView(A),z,2*h,0,2*Math.PI);g.fill();g.stroke()}else e&&(B=c.getCounterSeriesColor(r.color,r.samples[x].selectionState,t),B!==w&&(g.fillStyle=w=B),g.fillRect(n.xWorldToView(A)-1.5*h,z-1.5*h,3*h,3*h))}}},addEventsToTrackMap:function(a){for(var b=this.counter_.series,c=0;c<b.length;c++)for(var d= +b[c].samples,h=0;h<d.length;h++)a.addEvent(d[h],this)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,c,d){function h(a,b){return b===k.timestamps.length-1?8*this.viewport.currentDisplayTransform.xViewVectorToWorld(1):k.timestamps[b+1]-k.timestamps[b]}var k=this.counter_;a=tv.b.findLowIndexInSortedIntervals(k.timestamps,function(a){return a},h.bind(this),a);for(b=tv.b.findLowIndexInSortedIntervals(k.timestamps,function(a){return a},h.bind(this),b);a<=b;a++)if(!(0>a||a>=k.timestamps.length))for(c= +0;c<this.counter.numSeries;c++)d.push(this.counter.series[c].samples[a])},addItemNearToProvidedEventToSelection:function(a,b,c){b=a.getSampleIndex()+b;if(0>b||b>=a.series.samples.length)return!1;c.push(a.series.samples[b]);return!0},addAllObjectsMatchingFilterToSelection:function(a,b){},addClosestEventToSelection:function(a,b,c,d,h){c=this.counter;if(c.numSeries)for(d=0;d<c.numSeries;d++){var k=tv.b.findClosestElementInSortedArray(c.series_[d].samples_,function(a){return a.timestamp},a,b);k&&h.push(k)}}}; +return{CounterTrack:b}});"use strict"; +tv.exportTo("tv.c.analysis",function(){var d=tv.b.ui.define("object-snapshot-view");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.objectSnapshot_=void 0},get requiresTallView(){return!0},set modelEvent(b){this.objectSnapshot=b},get modelEvent(){return this.objectSnapshot},get objectSnapshot(){return this.objectSnapshot_},set objectSnapshot(b){this.objectSnapshot_=b;this.updateContents()},updateContents:function(){throw Error("Not implemented");}};var c=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE); +c.mandatoryBaseClass=d;c.defaultMetadata={showInstances:!0,showInTrackView:!0};tv.b.decorateExtensionRegistry(d,c);return{ObjectSnapshotView:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.TraceModelSettings,c=tv.b.ui.define("multi-row-track",tv.c.tracks.ContainerTrack);c.prototype={__proto__:tv.c.tracks.ContainerTrack.prototype,decorate:function(b){tv.c.tracks.ContainerTrack.prototype.decorate.call(this,b);this.heading_=this.tooltip_="";this.itemsToGroup_=this.groupingSource_=void 0;this.defaultToCollapsedWhenSubRowCountMoreThan=1;this.itemsGroupedOnLastUpdateContents_=void 0;this.currentSubRows_=[];this.expanded_=!0},get itemsToGroup(){return this.itemsToGroup_}, +setItemsToGroup:function(b,a){this.itemsToGroup_=b;this.groupingSource_=a;this.updateContents_();this.updateExpandedStateFromGroupingSource_()},get heading(){return this.heading_},set heading(b){this.heading_=b;this.updateContents_()},get tooltip(){return this.tooltip_},set tooltip(b){this.tooltip_=b;this.updateContents_()},get subRows(){return this.currentSubRows_},get hasVisibleContent(){return 0<this.children.length},get expanded(){return this.expanded_},set expanded(b){this.expanded_!=b&&(this.expanded_= +b,this.expandedStateChanged_())},onHeadingClicked_:function(b){1>=this.subRows.length||(this.expanded=!this.expanded,this.groupingSource_&&(new d(this.groupingSource_.model)).setSettingFor(this.groupingSource_,"expanded",this.expanded),b.stopPropagation())},updateExpandedStateFromGroupingSource_:function(){if(this.groupingSource_){var b=this.subRows.length,a=new d(this.groupingSource_.model);this.expanded=1<b?a.getSettingFor(this.groupingSource_,"expanded",b>this.defaultToCollapsedWhenSubRowCountMoreThan? +!1:!0):void 0}},expandedStateChanged_:function(){for(var b=Math.max(2,Math.ceil(18/this.children.length)),b=(this.expanded_?18:b)+"px",a=0;a<this.children.length;a++)this.children[a].height=b;0<this.children.length&&(this.children[0].expanded=this.expanded)},updateContents_:function(){tv.c.tracks.ContainerTrack.prototype.updateContents_.call(this);if(this.itemsToGroup_)if(this.areArrayContentsSame_(this.itemsGroupedOnLastUpdateContents_,this.itemsToGroup_))this.updateHeadingAndTooltip_();else if(this.itemsGroupedOnLastUpdateContents_= +this.itemsToGroup_,this.detach(),this.itemsToGroup_.length){var b=this.buildSubRows_(this.itemsToGroup_);this.currentSubRows_=b;for(var a=0;a<b.length;a++){var c=b[a];c.length&&this.addSubTrack_(c).addEventListener("heading-clicked",this.onHeadingClicked_.bind(this))}this.updateHeadingAndTooltip_();this.expandedStateChanged_()}else this.currentSubRows_=[];else this.updateHeadingAndTooltip_(),this.currentSubRows_=[]},updateHeadingAndTooltip_:function(){this.firstChild&&(this.firstChild.heading=this.heading_, +this.firstChild.tooltip=this.tooltip_)},buildSubRows_:function(b){throw Error("Not implemented");},addSubTrack_:function(b){throw Error("Not implemented");},areArrayContentsSame_:function(b,a){if(!(b&&a&&b.length&&a.length)||b.length!=a.length)return!1;for(var c=0;c<b.length;++c)if(b[c]!=a[c])return!1;return!0}};return{MultiRowTrack:c}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.trace_model.SelectionState,c=tv.c.EventPresenter,b=tv.b.ui.define("object-instance-track",tv.c.tracks.HeadingTrack);b.prototype={__proto__:tv.c.tracks.HeadingTrack.prototype,decorate:function(a){tv.c.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("object-instance-track");this.objectInstances_=[];this.objectSnapshots_=[]},get objectInstances(){return this.objectInstances_},set objectInstances(a){a&&0!=a.length?(this.heading=a[0].typeName, +this.objectInstances_=a,this.objectSnapshots_=[],this.objectInstances_.forEach(function(a){this.objectSnapshots_.push.apply(this.objectSnapshots_,a.snapshots)},this),this.objectSnapshots_.sort(function(a,b){return a.ts-b.ts})):(this.heading="",this.objectInstances_=[],this.objectSnapshots_=[])},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a},get snapshotRadiusView(){return 7*(window.devicePixelRatio||1)},draw:function(a,b,c){switch(a){case tv.c.tracks.DrawType.SLICE:this.drawSlices_(b, +c)}},drawSlices_:function(a,b){var g=this.context(),h=window.devicePixelRatio||1,k=this.getBoundingClientRect(),l=k.height*h,m=.5*l,n=2*Math.PI,q=this.viewport.currentDisplayTransform,u=this.snapshotRadiusView,v=q.xViewVectorToWorld(l),y;g.save();q.applyTransformToCanvas(g);var E=this.objectInstances_;y=tv.b.findLowIndexInSortedArray(E,function(a){return a.deletionTs},a);for(g.strokeStyle="rgb(0,0,0)";y<E.length;++y){var C=E[y],p=C.creationTs;if(p>b)break;var r=C.deletionTs==Number.MAX_VALUE?b:C.deletionTs; +g.fillStyle=c.getObjectInstanceColor(C);g.fillRect(p,h,r-p,l-2*h)}g.restore();C=this.objectSnapshots_;for(y=tv.b.findLowIndexInSortedArray(C,function(a){return a.ts+v},a);y<C.length;++y){r=C[y];p=r.ts;if(p-v>b)break;p=q.xWorldToView(p);g.fillStyle=c.getObjectSnapshotColor(r);g.beginPath();g.arc(p,m,u,0,n);g.fill();r.selected?(g.lineWidth=5,g.strokeStyle="rgb(100,100,0)",g.stroke(),g.beginPath(),g.arc(p,m,u-1,0,n),g.lineWidth=2,g.strokeStyle="rgb(255,255,0)"):(g.lineWidth=1,g.strokeStyle="rgb(0,0,0)"); +g.stroke()}g.lineWidth=1;m=d.NONE;E.length&&E[0].selectionState===d.DIMMED&&(m=d.DIMMED);m===d.DIMMED&&(h*=k.width,g.fillStyle="rgba(255,255,255,0.5)",g.fillRect(0,0,h,l),g.restore())},addEventsToTrackMap:function(a){void 0!==this.objectInstance_&&this.objectInstance_.forEach(function(b){a.addEvent(b,this)},this);void 0!==this.objectSnapshots_&&this.objectSnapshots_.forEach(function(b){a.addEvent(b,this)},this)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,c,d){var k=!1,l=c*this.snapshotRadiusView; +tv.b.iterateOverIntersectingIntervals(this.objectSnapshots_,function(a){return a.ts-l},function(a){return 2*l},a,b,function(a){d.push(a);k=!0});k||tv.b.iterateOverIntersectingIntervals(this.objectInstances_,function(a){return a.creationTs},function(a){return a.deletionTs-a.creationTs},a,b,d.push.bind(d))},addItemNearToProvidedEventToSelection:function(a,b,c){var d;if(a instanceof tv.c.trace_model.ObjectSnapshot)d=this.objectSnapshots_;else if(a instanceof tv.c.trace_model.ObjectInstance)d=this.objectInstances_; +else throw Error("Unrecognized event");a=d.indexOf(a)+b;return 0<=a&&a<d.length?(c.push(d[a]),!0):!1},addAllObjectsMatchingFilterToSelection:function(a,b){},addClosestEventToSelection:function(a,b,c,d,k){(a=tv.b.findClosestElementInSortedArray(this.objectSnapshots_,function(a){return a.ts},a,b))&&k.push(a)}};var a=new tv.b.ExtensionRegistryOptions(tv.b.TYPE_BASED_REGISTRY_MODE);tv.b.decorateExtensionRegistry(b,a);return{ObjectInstanceTrack:b}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("object-instance-group-track",tv.c.tracks.MultiRowTrack);d.prototype={__proto__:tv.c.tracks.MultiRowTrack.prototype,decorate:function(c){tv.c.tracks.MultiRowTrack.prototype.decorate.call(this,c);this.classList.add("object-instance-group-track");this.objectInstances_=void 0},get objectInstances(){return this.itemsToGroup},set objectInstances(c){this.setItemsToGroup(c)},addSubTrack_:function(c){var b=new tv.c.tracks.ObjectInstanceTrack(this.viewport); +b.objectInstances=c;this.appendChild(b);return b},buildSubRows_:function(c){c.sort(function(a,b){return a.creationTs-b.creationTs});for(var b=[],a=0;a<c.length;a++){for(var d=c[a],e=!1,g=0;g<b.length;g++){var h=b[g];if(d.creationTs>=h[h.length-1].deletionTs){e=!0;h.push(d);break}}e||(h=[d],b.push(h))}return b},updateHeadingAndTooltip_:function(){}};return{ObjectInstanceGroupTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("spacing-track",tv.c.tracks.HeadingTrack);d.prototype={__proto__:tv.c.tracks.HeadingTrack.prototype,decorate:function(c){tv.c.tracks.HeadingTrack.prototype.decorate.call(this,c);this.classList.add("spacing-track")},draw:function(c,b,a){},addAllObjectsMatchingFilterToSelection:function(c,b){}};return{SpacingTrack:d}});"use strict"; +tv.exportTo("tv.c",function(){function d(c,b,a,d){this.ctx_=c;this.minRectSize_=b;this.maxMergeDist_=a;this.pallette_=d}d.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,mergedColorId_:0,mergedAlpha_:0,setYandH:function(c,b){this.flush();this.y_=c;this.h_=b},fillRect:function(c,b,a,d){var e=c+b;if(b<this.minRectSize_)if(e-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_){if(this.mergeCurRight_=e,this.mergedAlpha_<d||this.mergedAlpha_===d&&this.mergedColorId_<a)this.mergedAlpha_= +d,this.mergedColorId_=a}else this.merging_=!0,this.mergeStartX_=c,this.mergeCurRight_=e,this.mergedColorId_=a,this.mergedAlpha_=d;else this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[a],this.ctx_.globalAlpha=d,this.ctx_.fillRect(c,this.y_,b,this.h_)},flush:function(){this.merging_&&(this.ctx_.fillStyle=this.pallette_[this.mergedColorId_],this.ctx_.globalAlpha=this.mergedAlpha_,this.ctx_.fillRect(this.mergeStartX_,this.y_,this.mergeCurRight_-this.mergeStartX_,this.h_),this.merging_= +!1)}};return{FastRectRenderer:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("rect-track",tv.c.tracks.HeadingTrack);d.prototype={__proto__:tv.c.tracks.HeadingTrack.prototype,decorate:function(c){tv.c.tracks.HeadingTrack.prototype.decorate.call(this,c);this.classList.add("rect-track");this.asyncStyle_=!1;this.rects_=null},get asyncStyle(){return this.asyncStyle_},set asyncStyle(c){this.asyncStyle_=!!c},get rects(){return this.rects_},set rects(c){this.rects_=c||[];this.invalidateDrawingContainer()},get height(){return window.getComputedStyle(this).height}, +set height(c){this.style.height=c;this.invalidateDrawingContainer()},get hasVisibleContent(){return 0<this.rects_.length},addRectToSelection:function(c,b){throw Error("Not implemented.");},draw:function(c,b,a){switch(c){case tv.c.tracks.DrawType.SLICE:this.drawRects_(b,a)}},drawRects_:function(c,b){var a=this.context();a.save();var d=this.getBoundingClientRect();tv.c.drawSlices(a,this.viewport.currentDisplayTransform,c,b,d.height,this.rects_,this.asyncStyle_);a.restore();if(!(6>=d.height)){var e; +15>d.height?(d=6,e=1):(d=10,e=2.5);tv.c.drawLabels(a,this.viewport.currentDisplayTransform,c,b,this.rects_,this.asyncStyle_,d,e)}},addEventsToTrackMap:function(c){void 0!==this.rects_&&null!==this.rects_&&this.rects_.forEach(function(b){c.addEvent(b,this)},this)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(c,b,a,d){function e(a){this.addRectToSelection(a,d)}e=e.bind(this);tv.b.iterateOverIntersectingIntervals(this.rects_,function(a){return a.start},function(a){return a.duration},c, +b,e)},indexOfRect_:function(c){for(var b=tv.b.findLowIndexInSortedArray(this.rects_,function(a){return a.start},c.start);b<this.rects_.length&&c.start==this.rects_[b].start&&c.colorId!=this.rects_[b].colorId;)b++;return b<this.rects_.length?b:void 0},addItemNearToProvidedEventToSelection:function(c,b,a){c=this.indexOfRect_(c);if(void 0===c)return!1;b=c+b;if(0>b||b>=this.rects_.length)return!1;this.addRectToSelection(this.rects_[b],a);return!0},addAllObjectsMatchingFilterToSelection:function(c,b){for(var a= +0;a<this.rects_.length;++a)c.matchSlice(this.rects_[a])&&this.addRectToSelection(this.rects_[a],b)},addClosestEventToSelection:function(c,b,a,d,e){(c=tv.b.findClosestIntervalInSortedIntervals(this.rects_,function(a){return a.start},function(a){return a.end},c,b))&&this.addRectToSelection(c,e)}};return{RectTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("sample-track",tv.c.tracks.RectTrack);d.prototype={__proto__:tv.c.tracks.RectTrack.prototype,decorate:function(c){tv.c.tracks.RectTrack.prototype.decorate.call(this,c)},get samples(){return this.rects},set samples(c){this.rects=c},addRectToSelection:function(c,b){b.push(c)}};return{SampleTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("slice-track",tv.c.tracks.RectTrack);d.prototype={__proto__:tv.c.tracks.RectTrack.prototype,decorate:function(c){tv.c.tracks.RectTrack.prototype.decorate.call(this,c)},get slices(){return this.rects},set slices(c){this.rects=c},addRectToSelection:function(c,b){b.push(c)}};return{SliceTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("slice-group-track",tv.c.tracks.MultiRowTrack);d.prototype={__proto__:tv.c.tracks.MultiRowTrack.prototype,decorate:function(c){tv.c.tracks.MultiRowTrack.prototype.decorate.call(this,c);this.classList.add("slice-group-track");this.group_=void 0;this.defaultToCollapsedWhenSubRowCountMoreThan=100},addSubTrack_:function(c){var b=new tv.c.tracks.SliceTrack(this.viewport);b.slices=c;this.appendChild(b);return b},get group(){return this.group_},set group(c){this.group_= +c;this.setItemsToGroup(this.group_.slices,this.group_)},get eventContainer(){return this.group},addContainersToTrackMap:function(c){c.addContainer(this.group,this)},buildSubRows_:function(c){if(!c.length)return[];for(var b=[],a=0;a<c.length;a++)c[a].subSlices&&c[a].subSlices.splice(0,c[a].subSlices.length),b.push(a);b.sort(function(a,b){var e=c[a],d=c[b];return e.start!=d.start?e.start-d.start:a-b});var d=[[]];this.badSlices_=[];for(a=0;a<b.length;a++){for(var e=c[b[a]],g=!1,h=d.length-1;0<=h;h--)if(0!= +d[h].length){var k=d[h][d[h].length-1];e.start<k.start&&(this.badSlices_.push(e),g=!0);if(k.bounds(e)){for(;d.length<=h+1;)d.push([]);d[h+1].push(e);k.subSlices&&k.subSlices.push(e);g=!0;break}}g||d[0].push(e)}return d}};return{SliceGroupTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("async-slice-group-track",tv.c.tracks.MultiRowTrack);d.prototype={__proto__:tv.c.tracks.MultiRowTrack.prototype,decorate:function(c){tv.c.tracks.MultiRowTrack.prototype.decorate.call(this,c);this.classList.add("async-slice-group-track");this.group_=void 0},addSubTrack_:function(c){var b=new tv.c.tracks.SliceTrack(this.viewport);b.slices=c;this.appendChild(b);b.asyncStyle=!0;return b},get group(){return this.group_},set group(c){this.group_= +c;this.setItemsToGroup(this.group_.slices,this.group_)},get eventContainer(){return this.group},addContainersToTrackMap:function(c){c.addContainer(this.group,this)},buildSubRows_:function(c){c.sort(function(a,b){return a.start-b.start});for(var b=function(a,c,e){if(e>=c.length)return!0;var d=c[e];if(a.start>=d[d.length-1].end){if(void 0===a.subSlices||0===a.subSlices.length)return!0;for(d=0;d<a.subSlices.length;d++)if(!b(a.subSlices[d],c,e+1))return!1;return!0}return!1},a=[],d=0;d<c.length;d++){var e= +c[d];e.isTopLevel=!0;for(var g=!1,h=a.length,k=0;k<a.length;k++)if(b(e,a,k)){g=!0;h=k;break}g||a.push([]);a[h].push(e);var l=function(a,b,c){if(void 0!==a&&0!==a.length){b===c.length&&c.push([]);for(var e=0;e<a.length;e++)c[b].push(a[e]),l(a[e].subSlices,b+1,c)}};l(e.subSlices,h+1,a)}return a}};return{AsyncSliceGroupTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("thread-track",tv.c.tracks.ContainerTrack);d.prototype={__proto__:tv.c.tracks.ContainerTrack.prototype,decorate:function(c){tv.c.tracks.ContainerTrack.prototype.decorate.call(this,c);this.classList.add("thread-track")},get thread(){return this.thread_},set thread(c){this.thread_=c;this.updateContents_()},get hasVisibleContent(){return 0<this.tracks_.length},get eventContainer(){return this.thread},addContainersToTrackMap:function(c){c.addContainer(this.thread, +this);for(var b=0;b<this.childNodes.length;++b)this.childNodes[b].addContainersToTrackMap(c)},updateContents_:function(){this.detach();if(this.thread_){this.heading=this.thread_.userFriendlyName+": ";this.tooltip=this.thread_.userFriendlyDetails;this.thread_.asyncSliceGroup.length&&this.appendAsyncSliceTracks_();this.appendThreadSamplesTracks_();if(this.thread_.timeSlices){var c=new tv.c.tracks.SliceTrack(this.viewport);c.heading="";c.height=tv.c.THIN_SLICE_HEIGHT+"px";c.slices=this.thread_.timeSlices; +c.hasVisibleContent&&this.appendChild(c)}this.thread_.sliceGroup.length&&(c=new tv.c.tracks.SliceGroupTrack(this.viewport),c.heading=this.thread_.userFriendlyName,c.tooltip=this.thread_.userFriendlyDetails,c.group=this.thread_.sliceGroup,c.hasVisibleContent&&this.appendChild(c))}},appendAsyncSliceTracks_:function(){this.thread_.asyncSliceGroup.viewSubGroups.forEach(function(c){var b=new tv.c.tracks.AsyncSliceGroupTrack(this.viewport),a=c.slices[0].viewSubGroupTitle;b.group=c;b.heading=a;b.hasVisibleContent&& +this.appendChild(b)},this)},appendThreadSamplesTracks_:function(){var c=this.thread_.samples;if(void 0!==c&&0!==c.length){var b={};c.forEach(function(a){void 0===b[a.title]&&(b[a.title]=[]);b[a.title].push(a)});c=tv.b.dictionaryKeys(b);c.sort();c.forEach(function(a){var c=b[a],e=new tv.c.tracks.SampleTrack(this.viewport);e.group=this.thread_;e.samples=c;e.heading=this.thread_.userFriendlyName+": "+a;e.tooltip=this.thread_.userFriendlyDetails;e.selectionGenerator=function(){for(var a=new tv.c.Selection, +b=0;b<e.samples.length;b++)a.push(e.samples[b]);return a};this.appendChild(e)},this)}},collapsedDidChange:function(c){if(c){c=parseInt(this.tracks[0].height);for(var b=0;b<this.tracks.length;++b)2<c?this.tracks[b].height=Math.floor(c)+"px":this.tracks[b].style.display="none",c*=.5}else for(b=0;b<this.tracks.length;++b)this.tracks[b].height=this.tracks[0].height,this.tracks[b].style.display=""}};return{ThreadTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.analysis.ObjectSnapshotView,c=tv.c.analysis.ObjectInstanceView,b=tv.c.TraceModelSettings,a=tv.c.tracks.SpacingTrack,f=tv.b.ui.define("process-track-base",tv.c.tracks.ContainerTrack);f.prototype={__proto__:tv.c.tracks.ContainerTrack.prototype,decorate:function(a){tv.c.tracks.ContainerTrack.prototype.decorate.call(this,a);this.processBase_=void 0;this.classList.add("process-track-base");this.classList.add("expanded");this.processNameEl_=tv.b.ui.createSpan(); +this.processNameEl_.classList.add("process-track-name");this.headerEl_=tv.b.ui.createDiv({className:"process-track-header"});this.headerEl_.appendChild(this.processNameEl_);this.headerEl_.addEventListener("click",this.onHeaderClick_.bind(this));this.appendChild(this.headerEl_)},get processBase(){return this.processBase_},set processBase(a){if(this.processBase_=a)this.expanded=(new b(this.processBase_.model)).getSettingFor(this.processBase_,"expanded",void 0!==this.processBase_.labels&&1==this.processBase_.labels.length&& +"chrome://tracing"==this.processBase_.labels[0]?!1:!0);this.updateContents_()},get expanded(){return this.classList.contains("expanded")},set expanded(a){a=!!a;this.expanded!==a&&(this.classList.toggle("expanded"),this.viewport_.dispatchChangeEvent(),this.processBase_&&(new b(this.processBase_.model)).setSettingFor(this.processBase_,"expanded",a))},get hasVisibleContent(){return this.expanded?1<this.children.length:!0},onHeaderClick_:function(a){a.stopPropagation();a.preventDefault();this.expanded= +!this.expanded},updateContents_:function(){this.tracks_.forEach(function(a){this.removeChild(a)},this);this.processBase_&&(this.processNameEl_.textContent=this.processBase_.userFriendlyName,this.headerEl_.title=this.processBase_.userFriendlyDetails,this.willAppendTracks_(),this.appendObjectInstanceTracks_(),this.appendCounterTracks_(),this.appendThreadTracks_(),this.didAppendTracks_())},addEventsToTrackMap:function(a){this.tracks_.forEach(function(b){b.addEventsToTrackMap(a)})},willAppendTracks_:function(){}, +didAppendTracks_:function(){},appendObjectInstanceTracks_:function(){var b=this.processBase_.objects.getAllInstancesByTypeName(),f=tv.b.dictionaryKeys(b);f.sort();var h=!1;f.forEach(function(a){var f=b[a],g=c.getTypeInfo(void 0,a),n=d.getTypeInfo(void 0,a);g&&!g.metadata.showInTrackView&&(g=void 0);n&&!n.metadata.showInTrackView&&(n=void 0);for(var n=g||n,g=[],q=0;q<f.length;q++){var u=f[q];0!==u.snapshots.length&&(u.hasImplicitSnapshots&&!n||g.push(u))}0!==g.length&&(f=tv.c.tracks.ObjectInstanceTrack.getConstructor(void 0, +a),f||(f=(n=d.getTypeInfo(void 0,a))&&n.metadata.showInstances?tv.c.tracks.ObjectInstanceGroupTrack:tv.c.tracks.ObjectInstanceTrack),a=new f(this.viewport),a.objectInstances=g,this.appendChild(a),h=!0)},this);h&&this.appendChild(new a(this.viewport))},appendCounterTracks_:function(){var b=tv.b.dictionaryValues(this.processBase.counters);b.sort(tv.c.trace_model.Counter.compare);b.forEach(function(b){var c=new tv.c.tracks.CounterTrack(this.viewport);c.counter=b;this.appendChild(c);this.appendChild(new a(this.viewport))}.bind(this))}, +appendThreadTracks_:function(){var b=tv.b.dictionaryValues(this.processBase.threads);b.sort(tv.c.trace_model.Thread.compare);b.forEach(function(b){var c=new tv.c.tracks.ThreadTrack(this.viewport);c.thread=b;c.hasVisibleContent&&(this.appendChild(c),this.appendChild(new a(this.viewport)))}.bind(this))}};return{ProcessTrackBase:f}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("cpu-track",tv.c.tracks.ContainerTrack);d.prototype={__proto__:tv.c.tracks.ContainerTrack.prototype,decorate:function(c){tv.c.tracks.ContainerTrack.prototype.decorate.call(this,c);this.classList.add("cpu-track")},get cpu(){return this.cpu_},set cpu(c){this.cpu_=c;this.updateContents_()},get tooltip(){return this.tooltip_},set tooltip(c){this.tooltip_=c;this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},updateContents_:function(){this.detach(); +if(this.cpu_){var c=this.cpu_.slices;if(c.length){var b=new tv.c.tracks.SliceTrack(this.viewport);b.slices=c;b.heading=this.cpu_.userFriendlyName+":";this.appendChild(b)}this.appendSamplesTracks_();for(var a in this.cpu_.counters)c=this.cpu_.counters[a],b=new tv.c.tracks.CounterTrack(this.viewport),b.heading=this.cpu_.userFriendlyName+" "+c.name+":",b.counter=c,this.appendChild(b)}},appendSamplesTracks_:function(){var c=this.cpu_.samples;if(void 0!==c&&0!==c.length){var b={};c.forEach(function(a){void 0=== +b[a.title]&&(b[a.title]=[]);b[a.title].push(a)});c=tv.b.dictionaryKeys(b);c.sort();c.forEach(function(a){var c=b[a],e=new tv.c.tracks.SliceTrack(this.viewport);e.group=this.cpu_;e.slices=c;e.heading=this.cpu_.userFriendlyName+": "+a;e.tooltip=this.cpu_.userFriendlyDetails;e.selectionGenerator=function(){for(var a=new tv.c.Selection,b=0;b<e.slices.length;b++)a.push(e.slices[b]);return a};this.appendChild(e)},this)}}};return{CpuTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.tracks.ProcessTrackBase,c=tv.c.tracks.SpacingTrack,b=tv.b.ui.define("kernel-track",d);b.prototype={__proto__:d.prototype,decorate:function(a){tv.c.tracks.ProcessTrackBase.prototype.decorate.call(this,a)},set kernel(a){this.processBase=a},get kernel(){return this.processBase},get eventContainer(){return this.kernel},addContainersToTrackMap:function(a){a.addContainer(this.kernel,this)},willAppendTracks_:function(){var a=tv.b.dictionaryValues(this.kernel.cpus); +a.sort(tv.c.trace_model.Cpu.compare);for(var b=!1,e=0;e<a.length;++e){var d=a[e],h=new tv.c.tracks.CpuTrack(this.viewport);h.cpu=d;h.hasVisibleContent&&(this.appendChild(h),b=!0)}b&&this.appendChild(new c(this.viewport))}};return{KernelTrack:b}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.c.tracks.ProcessTrackBase,c=tv.b.ui.define("process-track",d);c.prototype={__proto__:d.prototype,decorate:function(b){tv.c.tracks.ProcessTrackBase.prototype.decorate.call(this,b)},drawTrack:function(b){switch(b){case tv.c.tracks.DrawType.INSTANT_EVENT:if(!this.processBase.instantEvents||0===this.processBase.instantEvents.length)break;var a=this.context(),c=window.devicePixelRatio||1,e=this.getBoundingClientRect(),d=a.canvas.getBoundingClientRect();a.save(); +a.translate(0,c*(e.top-d.top));var h=this.viewport.currentDisplayTransform,d=h.xViewToWorld(0),c=h.xViewToWorld(e.width*c);tv.c.drawInstantSlicesAsLines(a,this.viewport.currentDisplayTransform,d,c,e.height,this.processBase.instantEvents,2);a.restore();break;case tv.c.tracks.DrawType.BACKGROUND:this.drawBackground_();return}tv.c.tracks.ContainerTrack.prototype.drawTrack.call(this,b)},drawBackground_:function(){var b=this.context(),a=b.canvas.getBoundingClientRect(),c=window.devicePixelRatio||1,e=!1; +b.fillStyle="#eee";for(var d=0;d<this.children.length;++d)if(this.children[d]instanceof tv.c.tracks.Track&&!(this.children[d]instanceof tv.c.tracks.SpacingTrack)&&(e=!e)){var h=this.children[d].getBoundingClientRect();b.fillRect(0,c*(h.top-a.top),b.canvas.width,c*h.height)}},set process(b){this.processBase=b},get process(){return this.processBase},get eventContainer(){return this.process},addContainersToTrackMap:function(b){b.addContainer(this.process,this);this.tracks_.forEach(function(a){a.addContainersToTrackMap(b)})}, +addIntersectingItemsInRangeToSelectionInWorldSpace:function(b,a,c,e){tv.b.iterateOverIntersectingIntervals(this.processBase.instantEvents,function(a){return a.start},function(a){return a.duration},b,a,function(a){e.push(a)}.bind(this));tv.c.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,arguments)},addClosestEventToSelection:function(b,a,c,e,d){this.addClosestInstantEventToSelection(this.processBase.instantEvents,b,a,d);tv.c.tracks.ContainerTrack.prototype.addClosestEventToSelection.apply(this, +arguments)}};return{ProcessTrack:c}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("trace-model-track",tv.c.tracks.ContainerTrack);d.prototype={__proto__:tv.c.tracks.ContainerTrack.prototype,decorate:function(c){tv.c.tracks.ContainerTrack.prototype.decorate.call(this,c);this.classList.add("model-track");this.highlighters_=tv.c.tracks.Highlighter.getAllRegisteredTypeInfos().map(function(b){return new b.constructor(c)})},detach:function(){tv.c.tracks.ContainerTrack.prototype.detach.call(this)},get model(){return this.model_}, +set model(c){this.model_=c;this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},updateContents_:function(){this.textContent="";if(this.model_){this.appendKernelTrack_();var c=this.model_.getAllProcesses();c.sort(tv.c.trace_model.Process.compare);for(var b=0;b<c.length;++b){var a=c[b],d=new tv.c.tracks.ProcessTrack(this.viewport);d.process=a;d.hasVisibleContent&&this.appendChild(d)}this.viewport_.rebuildEventToTrackMap();this.viewport_.rebuildContainerToTrackMap();for(b=0;b< +this.highlighters_.length;b++)this.highlighters_[b].processModel(this.model_)}},addEventsToTrackMap:function(c){if(this.model_){for(var b=this.children,a=0;a<b.length;++a)b[a].addEventsToTrackMap(c);void 0!==this.instantEvents&&this.instantEvents.forEach(function(a){c.addEvent(a,this)}.bind(this))}},addContainersToTrackMap:function(c){for(var b=this.children,a=0;a<b.length;++a)b[a].addContainersToTrackMap(c)},appendKernelTrack_:function(){var c=new tv.c.tracks.KernelTrack(this.viewport);c.kernel= +this.model.kernel;c.hasVisibleContent&&this.appendChild(c)},drawTrack:function(c){var b=this.context(),a=window.devicePixelRatio||1,d=this.getBoundingClientRect(),e=b.canvas.getBoundingClientRect();b.save();b.translate(0,a*(d.top-e.top));var e=this.viewport.currentDisplayTransform,g=e.xViewToWorld(0),a=e.xViewToWorld(d.width*a);switch(c){case tv.c.tracks.DrawType.GRID:this.viewport.drawMajorMarkLines(b);b.restore();return;case tv.c.tracks.DrawType.FLOW_ARROWS:if(0===this.model_.flowIntervalTree.size){b.restore(); +return}this.drawFlowArrows_(g,a);b.restore();return;case tv.c.tracks.DrawType.INSTANT_EVENT:if(!this.model_.instantEvents||0===this.model_.instantEvents.length)break;tv.c.drawInstantSlicesAsLines(b,this.viewport.currentDisplayTransform,g,a,d.height,this.model_.instantEvents,4);break;case tv.c.tracks.DrawType.MARKERS:this.viewport.interestRange.isEmpty||(this.viewport.interestRange.draw(b,g,a),this.viewport.interestRange.drawIndicators(b,g,a));b.restore();return;case tv.c.tracks.DrawType.HIGHLIGHTS:for(c= +0;c<this.highlighters_.length;c++)this.highlighters_[c].drawHighlight(b,e,g,a,d.height);b.restore();return}b.restore();tv.c.tracks.ContainerTrack.prototype.drawTrack.call(this,c)},drawFlowArrows_:function(c,b){var a=this.context(),d=this.viewport.currentDisplayTransform;d.applyTransformToCanvas(a);d=d.xViewVectorToWorld(1);a.strokeStyle="rgba(0, 0, 0, 0.4)";a.fillStyle="rgba(0, 0, 0, 0.4)";a.lineWidth=1<d?1:d;for(var e=this.model_.flowIntervalTree.findIntersection(c,b),g=2*d,h=a.canvas.getBoundingClientRect(), +k=0;k<e.length;++k){var l=e[k][0],m=e[k][1];m.start-l.start<=g||this.drawFlowArrowBetween_(a,l,m,h,d)}},drawFlowArrowBetween_:function(c,b,a,d,e){var g=window.devicePixelRatio||1,h=this.viewport.trackForEvent(b),k=this.viewport.trackForEvent(a),l=h.getBoundingClientRect(),m=k.getBoundingClientRect();if(b.selected||a.selected)c.shadowBlur=1,c.shadowColor="red",c.shadowOffsety=2,c.strokeStyle="red";var n=m.left+m.top+m.bottom+m.right;if(0!==l.left+l.top+l.bottom+l.right||0!==n){h=this.calculateTrackY_(h, +d);d=this.calculateTrackY_(k,d);k=g*h;d*=g;h=(a.start-b.start)/2;c.beginPath();c.moveTo(b.start,k);c.bezierCurveTo(b.start+h,k,b.start+h,d,a.start,d);c.stroke();if(b.selected||a.selected)c.shadowBlur=0,c.shadowOffsetX=0,c.strokeStyle="rgba(0, 0, 0, 0.4)";e=5*e*g;a.start-b.start<=2*e||(b=a.start,g*=m.height/4,tv.c.drawTriangle(c,b,d,b-e,d-g,b-e,d+g),c.fill())}},calculateTrackY_:function(c,b){var a=c.getBoundingClientRect();return 0===a.left+a.top+a.bottom+a.right?this.calculateTrackY_(c.parentNode, +b):a.top-b.top+a.height/2},addIntersectingItemsInRangeToSelectionInWorldSpace:function(c,b,a,d){tv.b.iterateOverIntersectingIntervals(this.model_.instantEvents,function(a){return a.start},function(a){return a.duration},c,b,function(a){d.push(a)}.bind(this));tv.c.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,arguments)},addClosestEventToSelection:function(c,b,a,d,e){this.addClosestInstantEventToSelection(this.model_.instantEvents,c,b,e);tv.c.tracks.ContainerTrack.prototype.addClosestEventToSelection.apply(this, +arguments)}};return{TraceModelTrack:d}});"use strict"; +tv.exportTo("tv.c.tracks",function(){var d=tv.b.ui.define("ruler-track",tv.c.tracks.HeadingTrack),c=Math.log(10);d.prototype={__proto__:tv.c.tracks.HeadingTrack.prototype,decorate:function(b){tv.c.tracks.HeadingTrack.prototype.decorate.call(this,b);this.classList.add("ruler-track");this.strings_secs_=[];this.strings_msecs_=[];this.viewportChange_=this.viewportChange_.bind(this);b.addEventListener("change",this.viewportChange_)},detach:function(){tv.c.tracks.HeadingTrack.prototype.detach.call(this);this.viewport.removeEventListener("change", +this.viewportChange_)},viewportChange_:function(){this.viewport.interestRange.isEmpty?this.classList.remove("tall-mode"):this.classList.add("tall-mode")},draw:function(b,a,c){switch(b){case tv.c.tracks.DrawType.SLICE:this.drawSlices_(a,c);break;case tv.c.tracks.DrawType.MARKERS:this.viewport.interestRange.isEmpty||this.viewport.interestRange.draw(this.context(),a,c)}},drawSlices_:function(b,a){for(var d=this.context(),e=window.devicePixelRatio||1,g=d.canvas.getBoundingClientRect(),h=g.width*e,k=g.height* +e,l=!this.viewport.interestRange.isEmpty,m=l?2*k/5:k,n=this.viewport,g=n.currentDisplayTransform,q=150*e,e=g.xViewVectorToWorld(q),u,e=Math.pow(10,Math.ceil(Math.log(e)/c)),v=[10,5,2,1],y=0;y<v.length;++y)if(!(g.xWorldVectorToView(e/v[y])<q)){u=e/v[y-1];break}var E=void 0;100>u?(q="ms",v=1,E=this.strings_msecs_):(q="s",v=1E3,E=this.strings_secs_);var C=g.xWorldVectorToView(u/5),y=Math.floor(b/u)*u,p=Math.floor(.25*m);d.save();e=window.devicePixelRatio||1;d.lineWidth=Math.round(e);var r=d.lineWidth% +2/2;d.translate(r,-r);d.fillStyle="rgb(0, 0, 0)";d.strokeStyle="rgb(0, 0, 0)";d.textAlign="left";d.textBaseline="top";d.font=9*e+"px sans-serif";n.majorMarkPositions=[];d.beginPath();for(r=y;r<a;r+=u){var t=Math.floor(g.xWorldToView(r)),y=Math.floor(r/v*1E5)/1E5;E[y]||(E[y]=y+" "+q);d.fillText(E[y],t+2*e,0);n.majorMarkPositions.push(t);tv.c.drawLine(d,t,0,t,m);for(y=1;5>y;++y){var w=Math.floor(t+C*y);tv.c.drawLine(d,w,m-p,w,m)}}d.strokeStyle="rgb(0, 0, 0)";tv.c.drawLine(d,0,k,h,k);d.stroke();l&&(tv.c.drawLine(d, +0,m,h,m),d.stroke(),u=10*e,m*=1.75,k=3*e,l=10*e,y=2*(k+u),d.textBaseline="middle",d.font=14*e+"px sans-serif",E=n.interestRange,0===E.range?(n=E.min,g=g.xWorldToView(n),v=Math.abs(Math.floor(n/v*1E3)/1E3),q=v+" "+q,v=g+4*e,C=d.measureText(q).width,v+C>h&&(v=g-4*e-C),d.fillStyle="rgb(0,0,0)",d.fillText(q,v,m)):(q=E.max,e=g.xWorldToView(E.min),n=g.xWorldToView(q),C=E.range,E=g.xWorldVectorToView(C),g=e+E/2,100>C?(q="ms",v=1):(q="s",v=1E3),q=Math.abs(Math.floor(C/v*1E3)/1E3)+" "+q,C=d.measureText(q).width, +r=C+y+u,v=g-C/2,p=v+C,r>E?(v=n+2*u,v+C>h&&(v=e-2*u-C),d.fillStyle="rgb(0,0,0)",d.fillText(q,v,m),d.strokeStyle="rgb(128,121,121)",d.beginPath(),tv.c.drawLine(d,e,m,n,m),d.stroke(),d.fillStyle="rgb(128,121,121)",tv.c.drawArrow(d,e-1.5*u,m,e,m,l,k),tv.c.drawArrow(d,n+1.5*u,m,n,m,l,k)):y<=E&&(r<=E?(d.fillStyle="rgb(0,0,0)",d.fillText(q,v,m),h=v-u,g=p+u):h=g,d.strokeStyle="rgb(128,121,121)",d.fillStyle="rgb(128,121,121)",tv.c.drawArrow(d,h,m,e,m,l,k),tv.c.drawArrow(d,g,m,n,m,l,k)),d.restore()))},addIntersectingItemsInRangeToSelection:function(b, +a,c,e,d){},addAllObjectsMatchingFilterToSelection:function(b,a){}};return{RulerTrack:d}});"use strict"; +tv.exportTo("tv.c",function(){var d=tv.c.Selection,c=tv.c.trace_model.SelectionState,b=tv.c.TimelineViewport,a=new tv.c.TimelineDisplayTransform,f=tv.b.ui.define("div");f.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline-track-view");this.viewport_=new b(this);this.viewportDisplayTransformAtMouseDown_=null;this.rulerTrackContainer_=new tv.c.tracks.DrawingContainer(this.viewport_);this.appendChild(this.rulerTrackContainer_);this.rulerTrackContainer_.invalidate(); +this.rulerTrack_=new tv.c.tracks.RulerTrack(this.viewport_);this.rulerTrackContainer_.appendChild(this.rulerTrack_);this.modelTrackContainer_=new tv.c.tracks.DrawingContainer(this.viewport_);this.appendChild(this.modelTrackContainer_);this.modelTrackContainer_.style.display="block";this.modelTrackContainer_.invalidate();this.viewport_.modelTrackContainer=this.modelTrackContainer_;this.modelTrack_=new tv.c.tracks.TraceModelTrack(this.viewport_);this.modelTrackContainer_.appendChild(this.modelTrack_); +this.timingTool_=new tv.c.TimingTool(this.viewport_,this);this.initMouseModeSelector();this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="drag-box";this.appendChild(this.dragBox_);this.hideDragBox_();this.initHintText_();this.bindEventListener_(document,"keypress",this.onKeypress_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,"keyup",this.onKeyup_,this);this.bindEventListener_(this,"dblclick",this.onDblClick_,this); +this.bindEventListener_(this,"mousewheel",this.onMouseWheel_,this);this.addEventListener("mousemove",this.onMouseMove_);this.addEventListener("touchstart",this.onTouchStart_);this.addEventListener("touchmove",this.onTouchMove_);this.addEventListener("touchend",this.onTouchEnd_);this.mouseViewPosAtMouseDown_={x:0,y:0};this.lastMouseViewPos_={x:0,y:0};this.lastTouchViewPositions_=[];this.selection_=new d;this.highlight_=new d;this.isZooming_=this.isPanningAndScanning_=!1},bindEventListener_:function(a, +b,c,d){this.boundListeners_||(this.boundListeners_=[]);c=c.bind(d);this.boundListeners_.push({object:a,event:b,boundFunc:c});a.addEventListener(b,c)},initMouseModeSelector:function(){this.mouseModeSelector_=new tv.b.ui.MouseModeSelector(this);this.appendChild(this.mouseModeSelector_);this.mouseModeSelector_.addEventListener("beginpan",this.onBeginPanScan_.bind(this));this.mouseModeSelector_.addEventListener("updatepan",this.onUpdatePanScan_.bind(this));this.mouseModeSelector_.addEventListener("endpan", +this.onEndPanScan_.bind(this));this.mouseModeSelector_.addEventListener("beginselection",this.onBeginSelection_.bind(this));this.mouseModeSelector_.addEventListener("updateselection",this.onUpdateSelection_.bind(this));this.mouseModeSelector_.addEventListener("endselection",this.onEndSelection_.bind(this));this.mouseModeSelector_.addEventListener("beginzoom",this.onBeginZoom_.bind(this));this.mouseModeSelector_.addEventListener("updatezoom",this.onUpdateZoom_.bind(this));this.mouseModeSelector_.addEventListener("endzoom", +this.onEndZoom_.bind(this));this.mouseModeSelector_.addEventListener("entertiming",this.timingTool_.onEnterTiming.bind(this.timingTool_));this.mouseModeSelector_.addEventListener("begintiming",this.timingTool_.onBeginTiming.bind(this.timingTool_));this.mouseModeSelector_.addEventListener("updatetiming",this.timingTool_.onUpdateTiming.bind(this.timingTool_));this.mouseModeSelector_.addEventListener("endtiming",this.timingTool_.onEndTiming.bind(this.timingTool_));this.mouseModeSelector_.addEventListener("exittiming", +this.timingTool_.onExitTiming.bind(this.timingTool_));var a=tv.b.ui.MOUSE_SELECTOR_MODE;this.mouseModeSelector_.supportedModeMask=a.SELECTION|a.PANSCAN|a.ZOOM|a.TIMING;this.mouseModeSelector_.settingsKey="timelineTrackView.mouseModeSelector";this.mouseModeSelector_.setKeyCodeForMode(a.PANSCAN,50);this.mouseModeSelector_.setKeyCodeForMode(a.SELECTION,49);this.mouseModeSelector_.setKeyCodeForMode(a.ZOOM,51);this.mouseModeSelector_.setKeyCodeForMode(a.TIMING,52);this.mouseModeSelector_.setKeyCodeCondition(function(){return this.listenToKeys_}.bind(this)); +this.mouseModeSelector_.setModifierForAlternateMode(a.SELECTION,tv.b.ui.MODIFIER.SHIFT);this.mouseModeSelector_.setModifierForAlternateMode(a.PANSCAN,tv.b.ui.MODIFIER.SPACE);this.mouseModeSelector_.setModifierForAlternateMode(a.ZOOM,tv.b.ui.MODIFIER.CMD_OR_CTRL)},detach:function(){this.modelTrack_.detach();for(var a=0;a<this.boundListeners_.length;a++){var b=this.boundListeners_[a];b.object.removeEventListener(b.event,b.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_}, +get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");var b=this.model_!==a;this.model_=a;this.modelTrack_.model=a;b&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this));tv.b.setPropertyAndDispatchChange(this,"model",a)},get hasVisibleContent(){return this.modelTrack_.hasVisibleContent},setInitialViewport_:function(){this.modelTrackContainer_.updateCanvasSizeIfNeeded_();var b=this.modelTrackContainer_.canvas.width,c,d;this.model_.bounds.isEmpty?(c= +0,d=1E3):0===this.model_.bounds.range?(c=this.model_.bounds.min,d=1E3):(c=this.model_.bounds.min,d=this.model_.bounds.range);var f=.15*d;a.set(this.viewport_.currentDisplayTransform);a.xSetWorldBounds(c-f,c+d+f,b);this.viewport_.setDisplayTransformImmediately(a)},addAllObjectsMatchingFilterToSelectionAsTask:function(a,b){return this.modelTrack_.addAllObjectsMatchingFilterToSelectionAsTask(a,b)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(a){this.focusElement_= +a},get listenToKeys_(){return!this.viewport_.isAttachedToDocumentOrInTestMode||document.activeElement instanceof TracingFindControl?!1:this.focusElement_?0<=this.focusElement.tabIndex?document.activeElement==this.focusElement?!0:tv.b.ui.elementIsChildOf(document.activeElement,this.focusElement):!0:!0},onMouseMove_:function(a){this.isZooming_||this.storeLastMousePos_(a)},onTouchStart_:function(a){this.storeLastTouchPositions_(a);this.focusElements_()},onTouchMove_:function(a){a.preventDefault();this.onUpdateTransformForTouch_(a)}, +onTouchEnd_:function(a){this.storeLastTouchPositions_(a);this.focusElements_()},onKeypress_:function(a){if(this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var b=this.modelTrackContainer_.canvas.clientWidth;switch(a.keyCode){case 119:case 44:this.zoomBy_(1.5,!0);break;case 115:case 111:this.zoomBy_(1/1.5,!0);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10,!0);break;case 83:case 79:this.zoomBy_(.1,!0);break;case 97:this.queueSmoothPan_(.3* +b,0);break;case 100:case 101:this.queueSmoothPan_(-.3*b,0);break;case 65:this.queueSmoothPan_(.5*b,0);break;case 68:this.queueSmoothPan_(-.5*b,0);break;case 48:this.setInitialViewport_();break;case 102:this.zoomToSelection();break;case 109:this.setCurrentSelectionAsInterestRange_();break;case 104:this.toggleHighDetails_()}}},onKeydown_:function(a){if(this.listenToKeys_){var b,c=this.modelTrackContainer_.canvas.clientWidth;switch(a.keyCode){case 37:(b=this.selection.getShiftedSelection(this.viewport, +-1))?(this.setSelectionAndClearHighlight(b),this.panToSelection(),a.preventDefault()):this.queueSmoothPan_(.3*c,0);break;case 39:(b=this.selection.getShiftedSelection(this.viewport,1))?(this.setSelectionAndClearHighlight(b),this.panToSelection(),a.preventDefault()):this.queueSmoothPan_(.3*-c,0);break;case 9:-1==this.focusElement.tabIndex&&(a.shiftKey?this.selectPrevious_(a):this.selectNext_(a),a.preventDefault())}}},onKeyup_:function(a){this.listenToKeys_&&(a.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_, +this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},onDblClick_:function(a){if(this.mouseModeSelector_.mode===tv.b.ui.MOUSE_SELECTOR_MODE.SELECTION&&this.selection.length&&this.selection[0].title){a=new d;var b=new tv.c.ExactTitleFilter(this.selection[0].title);this.addAllObjectsMatchingFilterToSelection(b,a);this.setSelectionAndClearHighlight(a)}},onMouseWheel_:function(a){if(a.altKey){var b=Math.pow(1.5,a.wheelDelta/120);this.zoomBy_(b);a.preventDefault()}},queueSmoothPan_:function(a,b){var c= +this.viewport_.currentDisplayTransform.xViewVectorToWorld(a),c=new tv.c.TimelineDisplayTransformPanAnimation(c,b);this.viewport_.queueDisplayTransformAnimation(c)},zoomBy_:function(b,c){if(!(0>=b)){c=!!c;var d=this.viewport_,f=this.modelTrackContainer_.canvas.clientWidth,l=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),m=d.currentDisplayTransform.xViewToWorld(l);c?(f=new tv.c.TimelineDisplayTransformZoomToAnimation(m,l,d.currentDisplayTransform.panY,b),d.queueDisplayTransformAnimation(f)): +(a.set(d.currentDisplayTransform),a.scaleX*=b,a.xPanWorldPosToViewPos(m,l,f),d.setDisplayTransformImmediately(a))}},zoomToSelection:function(){if(this.selectionOfInterest.length){var a=this.selectionOfInterest.bounds;a.range&&(a=new tv.c.TimelineDisplayTransformZoomToAnimation(a.center,this.modelTrackContainer_.canvas.width/2,this.viewport_.currentDisplayTransform.panY,this.modelTrackContainer_.canvas.width/(1.25*a.range)/this.viewport_.currentDisplayTransform.scaleX),this.viewport_.queueDisplayTransformAnimation(a))}}, +panToSelection:function(){var b;if(this.selectionOfInterest.length){b=this.selectionOfInterest.bounds;var c=this.modelTrackContainer_.canvas.width,d=this.viewport_.currentDisplayTransform;a.set(d);a.xPanWorldBoundsIntoView(b.min,b.max,c);b=a.panX-d.panX;b=new tv.c.TimelineDisplayTransformPanAnimation(b,0);this.viewport_.queueDisplayTransformAnimation(b)}},setCurrentSelectionAsInterestRange_:function(){var a=this.selection.bounds;a.empty?this.viewport_.interestRange.reset():this.viewport_.interestRange.min== +a.min&&this.viewport_.interestRange.max==a.max?this.viewport_.interestRange.reset():this.viewport_.interestRange.set(a)},toggleHighDetails_:function(){this.viewport_.highDetails=!this.viewport_.highDetails},set selection(a){this.setSelectionAndHighlight(a,this.highlight_)},get selection(){return this.selection_},set highlight(a){this.setSelectionAndHighlight(this.selection_,a)},get highlight(){return this.highlight_},get selectionOfInterest(){return!this.selection_.length&&this.highlight_.length? +this.highlight_:this.selection_},setSelectionAndClearHighlight:function(a){this.setSelectionAndHighlight(a,null)},setHighlightAndClearSelection:function(a){this.setSelectionAndHighlight(null,a)},setSelectionAndHighlight:function(a,b){if(a!==this.selection_||b!==this.highlight_){if(null!==a&&!(a instanceof d)||null!==b&&!(b instanceof d))throw Error("Expected Selection");b&&b.length?(this.resetEventsTo_(c.DIMMED),b!==this.highlight_&&(this.highlight_=b),this.setSelectionState_(b,c.HIGHLIGHTED)):(this.resetEventsTo_(c.NONE), +this.highlight_=new d);a&&a.length?(a!==this.selection_&&(this.selection_=a),this.setSelectionState_(a,c.SELECTED)):this.selection_=new d;tv.b.dispatchSimpleEvent(this,"selectionChange");this.showHintText_("Press 'm' to mark current selection");if(this.selectionOfInterest.length){var f=this.viewport_.trackForEvent(this.selectionOfInterest[0]);f&&f.scrollIntoViewIfNeeded()}this.viewport_.dispatchChangeEvent()}},setSelectionState_:function(a,b){for(var c=0;c<a.length;c++)a[c].selectionState=b},resetEventsTo_:function(a){var b= +this.highlight_.length;b&&a!==c.DIMMED||!b&&a===c.DIMMED?this.model.iterateAllEvents(function(b){b.selectionState=a}):(this.setSelectionState_(this.selection_,a),this.setSelectionState_(this.highlight_,a))},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=0;this.dragBox_.style.height=0},setDragBoxPosition_:function(a,b,c,d){var f=Math.min(b,d);d=Math.max(b,d);b=Math.min(a,c);a=Math.max(a,c);this.modelTrack_.getBoundingClientRect(); +c=b+(a-b);d=f+(d-f);var m=this.modelTrackContainer_.getBoundingClientRect(),n=m.left,q=m.top,u=m.right,m=m.bottom,v=window.getComputedStyle(this.querySelector("heading")).width,v=parseInt(v),n=n+v;v={};b>u||c<n||f>m||d<q?f=!1:(v.left=Math.max(n,b),v.top=Math.max(q,f),v.right=Math.min(u,c),v.bottom=Math.min(m,d),v.width=v.right-v.left,v.height=v.bottom-v.top,f=v);this.dragBox_.style.left=f.left+"px";this.dragBox_.style.width=f.width+"px";this.dragBox_.style.top=f.top+"px";this.dragBox_.style.height= +f.height+"px";f=window.devicePixelRatio||1;c=this.modelTrackContainer_.canvas;d=this.viewport_.currentDisplayTransform;b=d.xViewToWorld((b-c.offsetLeft)*f);a=d.xViewToWorld((a-c.offsetLeft)*f);f=Math.round(100*(a-b))/100;this.dragBox_.textContent=f+"ms";f=new tv.b.Event("selectionChanging");f.loWX=b;f.hiWX=a;this.dispatchEvent(f)},onGridToggle_:function(a){var b=a?this.selection.bounds.min:this.selection.bounds.max;if(this.viewport_.gridEnabled&&this.viewport_.gridSide===a&&this.viewport_.gridInitialTimebase=== +b)this.viewport_.gridside=void 0,this.viewport_.gridEnabled=!1,this.viewport_.gridInitialTimebase=void 0;else{var c=Math.ceil((b-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridEnabled=!0;this.viewport_.gridSide=a;this.viewport_.gridInitialTimebase=b;this.viewport_.gridTimebase=b-(c+1)*this.viewport_.gridStep_}},storeLastMousePos_:function(a){this.lastMouseViewPos_=this.extractRelativeMousePosition_(a)},storeLastTouchPositions_:function(a){this.lastTouchViewPositions_=this.extractRelativeTouchPositions_(a)}, +extractRelativeMousePosition_:function(a){var b=this.modelTrackContainer_.canvas;return{x:a.clientX-b.offsetLeft,y:a.clientY-b.offsetTop}},extractRelativeTouchPositions_:function(a){for(var b=this.modelTrackContainer_.canvas,c=[],d=0;d<a.touches.length;++d)c.push({x:a.touches[d].clientX-b.offsetLeft,y:a.touches[d].clientY-b.offsetTop});return c},storeInitialMouseDownPos_:function(a){a=this.extractRelativeMousePosition_(a);this.mouseViewPosAtMouseDown_.x=a.x;this.mouseViewPosAtMouseDown_.y=a.y},focusElements_:function(){document.activeElement&& +document.activeElement.blur();0<=this.focusElement.tabIndex&&this.focusElement.focus()},storeInitialInteractionPositionsAndFocus_:function(a){this.storeInitialMouseDownPos_(a);this.storeLastMousePos_(a);this.focusElements_()},onBeginPanScan_:function(a){this.viewportDisplayTransformAtMouseDown_=this.viewport_.currentDisplayTransform.clone();this.isPanningAndScanning_=!0;this.storeInitialInteractionPositionsAndFocus_(a);a.preventDefault()},onUpdatePanScan_:function(b){if(this.isPanningAndScanning_){var c= +(window.devicePixelRatio||1)*(this.lastMouseViewPos_.x-this.mouseViewPosAtMouseDown_.x),d=this.lastMouseViewPos_.y-this.mouseViewPosAtMouseDown_.y;a.set(this.viewportDisplayTransformAtMouseDown_);a.incrementPanXInViewUnits(c);a.panY-=d;this.viewport_.setDisplayTransformImmediately(a);b.preventDefault();b.stopPropagation();this.storeLastMousePos_(b)}},onEndPanScan_:function(a){this.isPanningAndScanning_=!1;this.storeLastMousePos_(a);a.isClick||a.preventDefault()},onBeginSelection_:function(a){var b= +this.modelTrackContainer_.canvas,c=this.modelTrack_.getBoundingClientRect(),b=b.getBoundingClientRect();c&&a.clientX>=c.left&&a.clientX<c.right&&a.clientY>=c.top&&a.clientY<c.bottom&&a.clientX>=b.left&&a.clientX<b.right&&(this.dragBeginEvent_=a,this.storeInitialInteractionPositionsAndFocus_(a),a.preventDefault())},onUpdateSelection_:function(a){this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,this.dragBoxXEnd_=a.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_= +a.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},onEndSelection_:function(a){a.preventDefault();if(this.dragBeginEvent_){this.hideDragBox_();var b=this.dragBeginEvent_;this.dragBeginEvent_=null;var c=Math.min(b.clientY,a.clientY),f=Math.max(b.clientY,a.clientY),l=Math.min(b.clientX,a.clientX);a=Math.max(b.clientX,a.clientX);b=this.modelTrackContainer_.canvas.getBoundingClientRect().left;l-=b;b=a-b;a=new d;this.modelTrack_.addIntersectingItemsInRangeToSelection(l, +b,c,f,a);c=new tv.c.RequestSelectionChangeEvent;c.selection=a;this.dispatchEvent(c)}},onBeginZoom_:function(a){this.isZooming_=!0;this.storeInitialInteractionPositionsAndFocus_(a);a.preventDefault()},onUpdateZoom_:function(a){if(this.isZooming_){var b=this.extractRelativeMousePosition_(a);this.zoomBy_(1+.01*(this.lastMouseViewPos_.y-b.y),!1);this.storeLastMousePos_(a)}},onEndZoom_:function(a){this.isZooming_=!1;a.isClick||a.preventDefault()},computeTouchCenter_:function(a){for(var b=0,c=0,d=0;d<a.length;++d)b+= +a[d].x,c+=a[d].y;return{x:b/a.length,y:c/a.length}},computeTouchSpan_:function(a){for(var b=Number.MAX_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,f=Number.MIN_VALUE,m=0;m<a.length;++m)b=Math.min(b,a[m].x),c=Math.min(c,a[m].y),d=Math.max(d,a[m].x),f=Math.max(f,a[m].y);return Math.sqrt((b-d)*(b-d)+(c-f)*(c-f))},onUpdateTransformForTouch_:function(b){var c=this.extractRelativeTouchPositions_(b),d=this.lastTouchViewPositions_,f=this.computeTouchCenter_(c),l=this.computeTouchCenter_(d),m=this.computeTouchSpan_(c), +n=this.computeTouchSpan_(d),d=this.viewport_,c=this.modelTrackContainer_.canvas.clientWidth,q=window.devicePixelRatio||1,u=q*(f.x-l.x),l=f.y-l.y,m=10<n?m/n:1,f=q*f.x,q=d.currentDisplayTransform.xViewToWorld(f);a.set(d.currentDisplayTransform);a.scaleX*=m;a.xPanWorldPosToViewPos(q,f,c);a.incrementPanXInViewUnits(u);a.panY-=l;d.setDisplayTransformImmediately(a);this.storeLastTouchPositions_(b)},initHintText_:function(){this.hintTextBox_=this.ownerDocument.createElement("div");this.hintTextBox_.className= +"hint-text";this.hintTextBox_.style.display="none";this.appendChild(this.hintTextBox_);this.pendingHintTextClearTimeout_=void 0},showHintText_:function(a){this.pendingHintTextClearTimeout_&&(window.clearTimeout(this.pendingHintTextClearTimeout_),this.pendingHintTextClearTimeout_=void 0);this.pendingHintTextClearTimeout_=setTimeout(this.hideHintText_.bind(this),1E3);this.hintTextBox_.textContent=a;this.hintTextBox_.style.display=""},hideHintText_:function(){this.pendingHintTextClearTimeout_=void 0; +this.hintTextBox_.style.display="none"}};return{TimelineTrackView:f}});"use strict"; +Polymer("tracing-find-control",{filterKeyDown:function(d){d.stopPropagation();13===d.keyCode&&(d.shiftKey?this.findPrevious():this.findNext())},filterKeyPress:function(d){d.stopPropagation()},filterBlur:function(d){this.updateHitCountEl()},filterFocus:function(d){this.controller.reset();this.filterTextChanged();this.$.filter.select()},filterMouseUp:function(d){d.preventDefault()},get controller(){return this.controller_},set controller(d){this.controller_=d;this.updateHitCountEl()},focus:function(){this.$.filter.focus()}, +hasFocus:function(){return this===document.activeElement},filterTextChanged:function(){this.controller.filterText=this.$.filter.value;this.$.hitCount.textContent="";this.$.spinner.style.visibility="visible";this.controller.updateFilterHits().then(function(){this.$.spinner.style.visibility="hidden";this.updateHitCountEl()}.bind(this))},findNext:function(){this.controller&&this.controller.findNext();this.updateHitCountEl()},findPrevious:function(){this.controller&&this.controller.findPrevious();this.updateHitCountEl()}, +updateHitCountEl:function(){if(this.controller&&this.hasFocus()){var d=this.controller.filterHits.length;this.$.hitCount.textContent=(0===d?-1:this.controller.currentHitIndex)+1+" of "+d}else this.$.hitCount.textContent=""}});"use strict"; +tv.exportTo("tv.c",function(){var d=tv.b.ui.define("side-panel");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.objectInstance_=void 0},get rangeOfInterest(){throw Error("Not implemented");},set rangeOfInterest(b){throw Error("Not implemented");},get selection(){throw Error("Not implemented");},set selection(b){throw Error("Not implemented");},get model(){throw Error("Not implemented");},set model(b){throw Error("Not implemented");}};var c=new tv.b.ExtensionRegistryOptions(tv.b.BASIC_REGISTRY_MODE); +c.mandatoryBaseClass=tv.c.SidePanel;c.defaultMetadata={textLabel:"<Unknown>",supportsModel:function(b){return{supported:!0}}};tv.b.decorateExtensionRegistry(d,c);return{SidePanel:d}});"use strict"; +tv.exportTo("tv.c",function(){var d=tv.b.ui.define("x-side-panel-container");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.activePanelContainer_=document.createElement("active-panel-container");this.tabStrip_=document.createElement("tab-strip");this.appendChild(this.activePanelContainer_);this.appendChild(this.tabStrip_);this.model_=void 0;this.rangeOfInterest_=new tv.b.Range},get model(){return this.model_},set model(c){this.model_=c;this.updateContents_()},get expanded(){this.hasAttribute("expanded")}, +get activePanel(){return 0===this.activePanelContainer_.children.length?void 0:this.activePanelContainer_.children[0]},get activePanelConstructor(){return this.activePanelType?this.activePanelType.constructor:void 0},set activePanelConstructor(c){if(c){if(c=this.getPanelTypeForConstructor_(c),void 0===c)throw Error("Not registered");}else c=void 0;this.activePanelType=c},get activePanelType(){if(this.activePanel)return this.getPanelTypeForConstructor_(this.activePanel.constructor)},set activePanelType(c){if(void 0=== +this.model_)throw Error("Cannot activate panel without a model");if(c&&!c.metadata.supportsModel(this.model_))throw Error("Cannot activate panel: it doesn't support this model");this.activePanelType&&this.getLabelElementForPanelType_(this.activePanelType).removeAttribute("selected");this.activePanelContainer_.textContent="";void 0===c?this.removeAttribute("expanded"):(this.getLabelElementForPanelType_(c).setAttribute("selected",!0),this.setAttribute("expanded",!0),c=new c.constructor,this.activePanelContainer_.appendChild(c), +c.rangeOfInterest=this.rangeOfInterest_,c.selection=this.selection_,c.model=this.model_)},getPanelTypeForConstructor_:function(c){for(var b=0;b<this.tabStrip_.children.length;b++)if(this.tabStrip_.children[b].panelType.constructor==c)return this.tabStrip_.children[b].panelType},getLabelElementForPanelType_:function(c){for(var b=0;b<this.tabStrip_.children.length;b++)if(this.tabStrip_.children[b].panelType==c)return this.tabStrip_.children[b]},updateContents_:function(){var c=this.activePanelType; +this.tabStrip_.textContent="";var b=[];tv.c.SidePanel.getAllRegisteredTypeInfos().forEach(function(a){var c=document.createElement("tab-strip-label");c.textContent=a.metadata.textLabel;c.panelType=a;var e=a.metadata.supportsModel(this.model_);this.model_&&e.supported?(b.push(a),c.setAttribute("enabled",!0),c.addEventListener("click",function(){this.activePanelType=this.activePanelType===a?void 0:a}.bind(this))):c.title="Not supported for the current trace: "+e.reason;this.tabStrip_.appendChild(c)}, +this);c&&-1!=b.indexOf(c)?(this.activePanelType=c,this.setAttribute("expanded",!0)):(this.activePanelContainer_.textContent="",this.removeAttribute("expanded"))},get selection(){return this.selection_},set selection(c){this.selection_=c;this.activePanel&&(this.activePanel.selection=c)},get rangeOfInterest(){return this.rangeOfInterest_},set rangeOfInterest(c){if(void 0==c)throw Error("Must not be undefined");this.rangeOfInterest_=c;this.activePanel&&(this.activePanel.rangeOfInterest=c)}};return{SidePanelContainer:d}}); +"use strict"; +tv.exportTo("tv.c",function(){var d=document.currentScript.ownerDocument,c=tv.b.ui.define("x-timeline-view");c.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){var b=tv.b.instantiateTemplate("#timeline-view-template",d);this.appendChild(b);this.titleEl_=this.querySelector(".title");this.leftControlsEl_=this.querySelector("#left-controls");this.rightControlsEl_=this.querySelector("#right-controls");this.sidePanelContainer_=this.querySelector("x-side-panel-container");this.trackViewContainer_= +this.querySelector("track-view-container");tv.b.ui.decorate(this.sidePanelContainer_,tv.c.SidePanelContainer);this.findCtl_=new TracingFindControl;this.findCtl_.controller=new tv.c.FindController;this.showFlowEvents_=!1;this.rightControls.appendChild(tv.b.ui.createCheckBox(this,"showFlowEvents","tv.c.TimelineView.showFlowEvents",!1,"Flow events"));this.highlightVSync_=!1;this.highlightVSyncCheckbox_=tv.b.ui.createCheckBox(this,"highlightVSync","tv.c.TimelineView.highlightVSync",!1,"Highlight VSync"); +this.rightControls.appendChild(this.highlightVSyncCheckbox_);this.rightControls.appendChild(this.createMetadataButton_());this.rightControls.appendChild(this.findCtl_);this.rightControls.appendChild(this.createHelpButton_());this.dragEl_=this.querySelector("x-drag-handle");tv.b.ui.decorate(this.dragEl_,tv.b.ui.DragHandle);this.analysisEl_=this.querySelector("#analysis");this.addEventListener("requestSelectionChange",this.onRequestSelectionChange_.bind(this));this.onViewportChanged_=this.onViewportChanged_.bind(this); +this.onSelectionChanged_=this.onSelectionChanged_.bind(this);document.addEventListener("keydown",this.onKeyDown_.bind(this),!0);document.addEventListener("keypress",this.onKeypress_.bind(this),!0);this.dragEl_.target=this.analysisEl_;this.selections_={};window.addEventListener("popstate",this.onPopState_.bind(this))},get showFlowEvents(){return this.showFlowEvents_},set showFlowEvents(b){this.showFlowEvents_=b;this.trackView_&&(this.trackView_.viewport.showFlowEvents=b)},get highlightVSync(){return this.highlightVSync_}, +set highlightVSync(b){this.highlightVSync_=b;this.trackView_&&(this.trackView_.viewport.highlightVSync=b)},createHelpButton_:function(){var b=tv.b.instantiateTemplate("#help-btn-template",d),a=b.querySelector(".view-help-button"),c=b.querySelector(".view-help-text"),e=new tv.b.ui.Overlay;e.title="chrome://tracing Help";e.classList.add("view-help-overlay");e.appendChild(b);a.addEventListener("click",function(a){e.visible=!e.visible;for(var b=tv.isMac?"cmd ":"ctrl",d=c.querySelectorAll("span.mod"), +l=0;l<d.length;l++)d[l].textContent=b;a.stopPropagation();return!1}.bind(this));return a},createMetadataButton_:function(){var b=tv.b.instantiateTemplate("#metadata-btn-template",d),a=b.querySelector(".view-metadata-button"),c=b.querySelector(".info-button-text"),e=new tv.b.ui.Overlay;e.title="Metadata for trace";e.classList.add("view-metadata-overlay");e.appendChild(b);a.addEventListener("click",function(a){e.visible=!0;var b=[],d=this.model,l;for(l in d.metadata){var m=d.metadata[l],n=JSON.stringify(m.name), +m=JSON.stringify(m.value,void 0," ");b.push(n+": "+m)}c.textContent=b.join("\n");a.stopPropagation();return!1}.bind(this));b=function(){a.style.display=this.model&&this.model.metadata.length?"":"none"}.bind(this);b();this.addEventListener("modelChange",b);return a},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get viewTitle(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set viewTitle(b){void 0===b?(this.titleEl_.textContent= +"",this.titleEl_.hidden=!0):(this.titleEl_.hidden=!1,this.titleEl_.textContent=b)},get model(){if(this.trackView_)return this.trackView_.model},set model(b){var a=b!=this.model,c=b&&!b.bounds.isEmpty;a&&(this.trackViewContainer_.textContent="",this.trackView_&&(this.trackView_.viewport.removeEventListener("change",this.onViewportChanged_),this.trackView_.removeEventListener("selectionChange",this.onSelectionChanged_),this.trackView_.detach(),this.trackView_=void 0,this.findCtl_.controller.trackView= +void 0),this.sidePanelContainer_.model=void 0);c&&!this.trackView_&&(this.trackView_=new tv.c.TimelineTrackView,this.trackView_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.trackViewContainer_.appendChild(this.trackView_),this.findCtl_.controller.timeline=this.trackView_,this.trackView_.addEventListener("selectionChange",this.onSelectionChanged_),this.trackView_.viewport.addEventListener("change",this.onViewportChanged_));c&&(this.trackView_.model=b,this.sidePanelContainer_.model= +b,this.trackView_.viewport.showFlowEvents=this.showFlowEvents,this.trackView_.viewport.highlightVSync=this.highlightVSync,this.clearSelectionHistory_());tv.b.dispatchSimpleEvent(this,"modelChange");a&&(this.onSelectionChanged_(),this.onViewportChanged_())},get timeline(){return this.trackView_},get settings(){this.settings_||(this.settings_=new tv.b.Settings);return this.settings_},set focusElement(b){this.focusElement_=b;this.trackView_&&(this.trackView_.focusElement=b)},get focusElement(){return this.focusElement_? +this.focusElement_:this.parentElement},get listenToKeys_(){if(tv.b.ui.isElementAttachedToDocument(this))return this.focusElement_?0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0:!0},onKeyDown_:function(b){this.listenToKeys_&&27===b.keyCode&&(this.focus(),b.preventDefault())},onKeypress_:function(b){if(this.listenToKeys_){switch(b.keyCode){case 47:this.findCtl_.hasFocus()?this.focus():this.findCtl_.focus();b.preventDefault();break;case 63:this.querySelector(".view-help-button").click(), +b.preventDefault()}if(!this.findCtl_.hasFocus())switch(b.keyCode){case 118:this.toggleHighlightVSync_(),b.preventDefault()}}},onSelectionChanged_:function(b){b=this.trackViewContainer_.scrollTop;var a=this.trackView_?this.trackView_.selectionOfInterest:new tv.c.Selection;this.analysisEl_.selection=a;this.trackViewContainer_.scrollTop=b;this.sidePanelContainer_.selection=a},onRequestSelectionChange_:function(b){this.selections_[b.selection.guid]=b.selection;window.history.pushState({selection_guid:b.selection.guid}); +this.trackView_.selection=b.selection;b.stopPropagation()},onPopState_:function(b){if(null!==b.state){var a=this.selections_[b.state.selection_guid];a&&(this.trackView_.selection=a);b.stopPropagation()}},clearSelectionHistory_:function(){this.selections_={}},onViewportChanged_:function(b){b=this.sidePanelContainer_;if(this.trackView_){var a=this.trackView_.viewport.interestRange.asRangeObject();b.rangeOfInterest.equals(a)||(b.rangeOfInterest=a)}else b.rangeOfInterest.reset()},toggleHighlightVSync_:function(){this.highlightVSyncCheckbox_.checked= +!this.highlightVSyncCheckbox_.checked}};return{TimelineView:c}});"use strict"; +tv.exportTo("tv",function(){var d=tv.b.ui.define("trace-viewer",tv.c.TimelineView);d.prototype={__proto__:tv.c.TimelineView.prototype,decorate:function(c){function b(){e.model=k;e.viewTitle=d;e.timeline&&(e.timeline.focusElement=e)}function a(){var a=new tv.b.ui.Overlay;a.textContent=tv.b.normalizeException(err).message;a.title="Import error";a.visible=!0}tv.c.TimelineView.prototype.decorate.call(this);if(void 0!==c){var d=c,e=this,g=new XMLHttpRequest,h=/[.]gz$/.test(d)||/[.]zip$/.test(d);g.overrideMimeType("text/plain; charset=x-user-defined"); +g.open("GET",d,!0);h&&(g.responseType="arraybuffer");g.onreadystatechange=function(c){4==g.readyState&&window.setTimeout(function(){if(200==g.status){var c=h?g.response:g.responseText;k=new tv.c.TraceModel;k.importTracesWithProgressDialog([c],!0).then(b,a)}else{var c=g.status,e=new tv.b.ui.Overlay;e.textContent=c+": "+d+" could not be loaded";e.title="Failed to fetch data";e.visible=!0}},0)};g.send(null);var k}}};return{TraceViewer:d}});"use strict"; +tv.exportTo("tv.b",function(){function d(a,b,c,e){vec2.scale(k,b,e);vec2.scale(l,c,1-e);vec2.add(a,k,l);vec2.normalize(a,a);return a}function c(){this.p1=vec2.create();this.p2=vec2.create();this.p3=vec2.create();this.p4=vec2.create()}function b(a,b,c){return(a[0]-c[0])*(b[1]-c[1])-(b[0]-c[0])*(a[1]-c[1])}function a(a,c,e,d){var f=0>b(a,c,e);e=0>b(a,e,d);a=0>b(a,d,c);return f==e&&e==a}function f(b,c,e,d,f){return a(b,c,e,d)||a(b,c,d,f)}for(var e=[],g=0;8>g;g++)e[g]=vec2.create();var h=vec4.create(); +vec4.create();vec4.create();mat4.create();mat4.create();vec2.createXY(0,0);vec2.createXY(1,0);vec2.createXY(0,1);vec2.createXY(1,1);var k=vec2.create(),l=vec2.create();c.fromXYWH=function(a,b,e,d){var f=new c;vec2.set(f.p1,a,b);vec2.set(f.p2,a+e,b);vec2.set(f.p3,a+e,b+d);vec2.set(f.p4,a,b+d);return f};c.fromRect=function(a){return new c.fromXYWH(a.x,a.y,a.width,a.height)};c.from4Vecs=function(a,b,e,d){var f=new c;vec2.set(f.p1,a[0],a[1]);vec2.set(f.p2,b[0],b[1]);vec2.set(f.p3,e[0],e[1]);vec2.set(f.p4, +d[0],d[1]);return f};c.from8Array=function(a){if(8!=a.length)throw Error("Array must be 8 long");var b=new c;b.p1[0]=a[0];b.p1[1]=a[1];b.p2[0]=a[2];b.p2[1]=a[3];b.p3[0]=a[4];b.p3[1]=a[5];b.p4[0]=a[6];b.p4[1]=a[7];return b};c.prototype={pointInside:function(a){return f(a,this.p1,this.p2,this.p3,this.p4)},boundingRect:function(){var a=Math.min(this.p1[0],this.p2[0],this.p3[0],this.p4[0]),b=Math.min(this.p1[1],this.p2[1],this.p3[1],this.p4[1]),c=Math.max(this.p1[0],this.p2[0],this.p3[0],this.p4[0]), +e=Math.max(this.p1[1],this.p2[1],this.p3[1],this.p4[1]);return new tv.b.Rect.fromXYWH(a,b,c-a,e-b)},clone:function(){var a=new c;vec2.copy(a.p1,this.p1);vec2.copy(a.p2,this.p2);vec2.copy(a.p3,this.p3);vec2.copy(a.p4,this.p4);return a},scale:function(a){var b=new c;this.scaleFast(b,a);return b},scaleFast:function(a,b){vec2.copy(a.p1,this.p1,b);vec2.copy(a.p2,this.p2,b);vec2.copy(a.p3,this.p3,b);vec2.copy(a.p3,this.p3,b)},isRectangle:function(){var a=this.boundingRect();return a.x==this.p1[0]&&a.y== +this.p1[1]&&a.width==this.p2[0]-this.p1[0]&&a.y==this.p2[1]&&a.width==this.p3[0]-this.p1[0]&&a.height==this.p3[1]-this.p2[1]&&a.x==this.p4[0]&&a.height==this.p4[1]-this.p2[1]},projectUnitRect:function(a){var b=new c;this.projectUnitRectFast(b,a);return b},projectUnitRectFast:function(a,b){var c=e[0],f=e[1],g=e[2],k=e[3],l,C,p,r;vec2.sub(c,this.p2,this.p1);l=vec2.length(c);vec2.scale(c,c,1/l);vec2.sub(f,this.p4,this.p1);C=vec2.length(f);vec2.scale(f,f,1/C);vec2.sub(g,this.p3,this.p2);p=vec2.length(g); +vec2.scale(g,g,1/p);vec2.sub(k,this.p3,this.p4);r=vec2.length(k);vec2.scale(k,k,1/r);var t=e[0],w=e[1],x=e[2],A=e[3];d(t,c,k,b.y);d(A,c,k,1-b.bottom);d(w,f,g,b.x);d(x,f,g,1-b.right);vec2.addTwoScaledUnitVectors(h,t,l*b.x,w,C*b.y);vec2.add(a.p1,this.p1,h);vec2.addTwoScaledUnitVectors(h,t,l*-(1-b.right),x,p*b.y);vec2.add(a.p2,this.p2,h);vec2.addTwoScaledUnitVectors(h,A,r*-(1-b.right),x,p*-(1-b.bottom));vec2.add(a.p3,this.p3,h);vec2.addTwoScaledUnitVectors(h,A,r*b.left,w,C*-(1-b.bottom));vec2.add(a.p4, +this.p4,h)},toString:function(){return"Quad("+vec2.toString(this.p1)+", "+vec2.toString(this.p2)+", "+vec2.toString(this.p3)+", "+vec2.toString(this.p4)+")"}};return{pointInTriangle2:a,pointInImplicitQuad:f,Quad:c}});"use strict"; +tv.exportTo("tv.e.importer",function(){function d(a){if(!(a instanceof Object)){if(void 0===a||null===a)return a;if("string"==typeof a)return a.substring();if("boolean"==typeof a||"number"==typeof a)return a;throw Error("Unrecognized: "+typeof a);}if(a instanceof Array){for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=d(a[c]);return b}if(a.__proto__!=Object.prototype)throw Error("Can only clone simple types");b={};for(c in a)b[c]=d(a[c]);return b}function c(a,b){this.importPriority=1;this.model_= +a;this.systemTraceEvents_=this.stackFrameEvents_=this.sampleEvents_=this.events_=void 0;this.eventsWereFromString_=!1;this.softwareMeasuredCpuCount_=void 0;this.allAsyncEvents_=[];this.allFlowEvents_=[];this.allObjectEvents_=[];this.allMemoryDumpEvents_={};"string"===typeof b||b instanceof String?(b=b.trim(),"["===b[0]&&(b=b.replace(/\s*,\s*$/,""),"]"!==b[b.length-1]&&(b+="]")),this.events_=JSON.parse(b),this.eventsWereFromString_=!0):this.events_=b;if(this.events_.traceEvents){var c=this.events_; +this.events_=this.events_.traceEvents;this.systemTraceEvents_=c.systemTraceEvents;this.sampleEvents_=c.samples;this.stackFrameEvents_=c.stackFrames;for(var d in c)"traceEvents"!==d&&"systemTraceEvents"!==d&&"samples"!==d&&"stackFrames"!==d&&this.model_.metadata.push({name:d,value:c[d]})}}var b=tv.c.importer.Importer;c.canImport=function(a){return"string"===typeof a||a instanceof String?(a=a.trim(),"{"==a[0]||"["==a[0]):a instanceof Array&&a.length&&a[0].ph||a.traceEvents&&a.traceEvents instanceof +Array&&(a.traceEvents.length&&a.traceEvents[0].ph||a.samples.length&&void 0!==a.stackFrames)?!0:!1};c.prototype={__proto__:b.prototype,extractSubtraces:function(){var a=this.systemTraceEvents_;this.systemTraceEvents_=void 0;return a?[a]:[]},deepCopyIfNeeded_:function(a){void 0===a&&(a={});return this.eventsWereFromString_?a:d(a)},processAsyncEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allAsyncEvents_.push({sequenceNumber:this.allAsyncEvents_.length, +event:a,thread:b})},processFlowEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allFlowEvents_.push({sequenceNumber:this.allFlowEvents_.length,event:a,thread:b})},processCounterEvent:function(a){var b;b=void 0!==a.id?a.name+"["+a.id+"]":a.name;b=this.model_.getOrCreateProcess(a.pid).getOrCreateCounter(a.cat,b);if(0===b.numSeries){for(var c in a.args)b.addSeries(new tv.c.trace_model.CounterSeries(c,tv.b.ui.getStringColorId(b.name+"."+c)));if(0===b.numSeries){this.model_.importWarning({type:"counter_parse_error", +message:"Expected counter "+a.name+" to have at least one argument to use as a value."});delete b.parent.counters[b.name];return}}var d=a.ts/1E3;b.series.forEach(function(b){b.addCounterSample(d,a.args[b.name]?a.args[b.name]:0)})},processObjectEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allObjectEvents_.push({sequenceNumber:this.allObjectEvents_.length,event:a,thread:b})},processDurationEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid); +if(b.sliceGroup.isTimestampValidForBeginOrEnd(a.ts/1E3))if("B"==a.ph)b=b.sliceGroup.beginSlice(a.cat,a.name,a.ts/1E3,this.deepCopyIfNeeded_(a.args),a.tts/1E3),b.startStackFrame=this.getStackFrameForEvent_(a);else if("I"==a.ph||"i"==a.ph){if(void 0!==a.s&&"t"!==a.s)throw Error("This should never happen");b.sliceGroup.beginSlice(a.cat,a.name,a.ts/1E3,this.deepCopyIfNeeded_(a.args),a.tts/1E3);b=b.sliceGroup.endSlice(a.ts/1E3,a.tts/1E3);b.startStackFrame=this.getStackFrameForEvent_(a);b.endStackFrame= +void 0}else if(b.sliceGroup.openSliceCount){b=b.sliceGroup.endSlice(a.ts/1E3,a.tts/1E3);a.name&&b.title!=a.name&&this.model_.importWarning({type:"title_match_error",message:"Titles do not match. Title is "+b.title+" in openSlice, and is "+a.name+" in endSlice"});b.endStackFrame=this.getStackFrameForEvent_(a);for(var c in a.args)void 0!==b.args[c]&&this.model_.importWarning({type:"duration_parse_error",message:"Both the B and E phases of "+b.name+" provided values for argument "+c+". The value of the E phase event will be used."}), +b.args[c]=this.deepCopyIfNeeded_(a.args[c])}else this.model_.importWarning({type:"duration_parse_error",message:"E phase event without a matching B phase event."});else this.model_.importWarning({type:"duration_parse_error",message:"Timestamps are moving backward."})},processCompleteEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid).sliceGroup.pushCompleteSlice(a.cat,a.name,a.ts/1E3,void 0===a.dur?void 0:a.dur/1E3,void 0===a.tts?void 0:a.tts/1E3,void 0===a.tdur? +void 0:a.tdur/1E3,this.deepCopyIfNeeded_(a.args));b.startStackFrame=this.getStackFrameForEvent_(a);b.endStackFrame=this.getStackFrameForEvent_(a,!0)},processMetadataEvent:function(a){if("process_name"==a.name){var b=this.model_.getOrCreateProcess(a.pid);b.name=a.args.name}else if("process_labels"==a.name){b=this.model_.getOrCreateProcess(a.pid);a=a.args.labels.split(",");for(var c=0;c<a.length;c++)b.addLabelIfNeeded(a[c])}else"process_sort_index"==a.name?(b=this.model_.getOrCreateProcess(a.pid),b.sortIndex= +a.args.sort_index):"thread_name"==a.name?(b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid),b.name=a.args.name):"thread_sort_index"==a.name?(b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid),b.sortIndex=a.args.sort_index):"num_cpus"==a.name?(b=a.args.number,void 0!==this.softwareMeasuredCpuCount_&&(b=Math.max(b,this.softwareMeasuredCpuCount_)),this.softwareMeasuredCpuCount_=b):this.model_.importWarning({type:"metadata_parse_error",message:"Unrecognized metadata name: "+ +a.name})},processInstantEvent:function(a){if("t"==a.s||void 0===a.s)this.processDurationEvent(a);else{var b;switch(a.s){case "g":b=tv.c.trace_model.GlobalInstantEvent;break;case "p":b=tv.c.trace_model.ProcessInstantEvent;break;default:this.model_.importWarning({type:"instant_parse_error",message:'I phase event with unknown "s" field value.'});return}var c=tv.b.ui.getStringColorId(a.name);b=new b(a.cat,a.name,c,a.ts/1E3,this.deepCopyIfNeeded_(a.args));switch(b.type){case tv.c.trace_model.InstantEventType.GLOBAL:this.model_.pushInstantEvent(b); +break;case tv.c.trace_model.InstantEventType.PROCESS:this.model_.getOrCreateProcess(a.pid).pushInstantEvent(b);break;default:throw Error("Unknown instant event type: "+a.s);}}},processTraceSampleEvent:function(a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid),c=this.getStackFrameForEvent_(a);void 0===c&&(c="te-"+tv.b.GUID.allocate(),c=new tv.c.trace_model.StackFrame(void 0,c,a.cat,a.name,tv.b.ui.getStringColorId(a.name)),this.model_.addStackFrame(c));a=new tv.c.trace_model.Sample(void 0, +b,"TRACE_EVENT_SAMPLE",a.ts/1E3,c,1,this.deepCopyIfNeeded_(a.args));this.model_.samples.push(a)},getOrCreateMemoryDumpEvents_:function(a){void 0===this.allMemoryDumpEvents_[a]&&(this.allMemoryDumpEvents_[a]={global:void 0,process:[]});return this.allMemoryDumpEvents_[a]},processMemoryDumpEvent:function(a){if(void 0===a.id)this.model_.importWarning({type:"memory_dump_parse_error",message:a.ph+" phase event without a dump ID."});else{var b=this.getOrCreateMemoryDumpEvents_(a.id);if("u"===a.ph)b.process.push(a); +else if("U"===a.ph)void 0!==b.global?this.model_.importWarning({type:"memory_dump_parse_error",message:"Multiple U phase events with the same dump ID."}):b.global=a;else throw Error('Invalid memory dump event phase "'+a.ph+'".');}},importEvents:function(){this.stackFrameEvents_&&this.importStackFrames_();for(var a=this.events_,b=0;b<a.length;b++){var c=a[b];"B"===c.ph||"E"===c.ph?this.processDurationEvent(c):"X"===c.ph?this.processCompleteEvent(c):"b"===c.ph||"e"===c.ph||"n"===c.ph||"S"===c.ph||"F"=== +c.ph||"T"===c.ph||"p"===c.ph?this.processAsyncEvent(c):"I"==c.ph||"i"==c.ph?this.processInstantEvent(c):"P"==c.ph?this.processTraceSampleEvent(c):"C"==c.ph?this.processCounterEvent(c):"M"==c.ph?this.processMetadataEvent(c):"N"===c.ph||"D"===c.ph||"O"===c.ph?this.processObjectEvent(c):"s"===c.ph||"t"===c.ph||"f"===c.ph?this.processFlowEvent(c):"u"===c.ph||"U"===c.ph?this.processMemoryDumpEvent(c):this.model_.importWarning({type:"parse_error",message:"Unrecognized event phase: "+c.ph+" ("+c.name+")"})}}, +importStackFrames_:function(){var a=this.model_,b=this.stackFrameEvents_,c;for(c in b){var d=b[c],h=new tv.c.trace_model.StackFrame(void 0,"g"+c,d.category,d.name,tv.b.ui.getStringColorId(d.category?d.category:d.name));a.addStackFrame(h)}for(c in b)if(d=b[c],void 0!==d.parent){h=a.stackFrames["g"+c];if(void 0===h)throw Error("omg");if(void 0===d.parent)d=void 0;else if(d=a.stackFrames["g"+d.parent],void 0===d)throw Error("omg");h.parentFrame=d}},finalizeImport:function(){void 0!==this.softwareMeasuredCpuCount_&& +(this.model_.kernel.softwareMeasuredCpuCount=this.softwareMeasuredCpuCount_);this.createAsyncSlices_();this.createFlowSlices_();this.createExplicitObjects_();this.createImplicitObjects_();this.createMemoryDumps_()},getStackFrameForEvent_:function(a,b){var c,d;b?(c=a.esf,d=a.estack):(c=a.sf,d=a.stack);if(void 0!==d&&void 0!==c)this.model_.importWarning({type:"stack_frame_and_stack_error",message:"Event at "+a.ts+" cannot have both a stack and a stackframe."});else{if(void 0!==d)return this.model_.resolveStackToStackFrame_(a.pid, +d);if(void 0!==c)if(d=this.model_.stackFrames["g"+c],void 0===d)this.model_.importWarning({type:"sample_import_error",message:"No frame for "+c});else return d}},resolveStackToStackFrame_:function(a,b){},importSampleData:function(){if(this.sampleEvents_){var a=this.model_,b=this.sampleEvents_;if(0===this.events_.length)for(var c=0;c<b.length;c++){var d=b[c];a.getOrCreateProcess(d.tid).getOrCreateThread(d.tid)}var h={};a.getAllThreads().forEach(function(a){h[a.tid]=a});for(c=0;c<b.length;c++){var d= +b[c],k=h[d.tid];if(void 0===k)a.importWarning({type:"sample_import_error",message:"Thread "+b.tid+"not found"});else{var l;void 0!==d.cpu&&(l=a.kernel.getOrCreateCpu(d.cpu));var m=this.getStackFrameForEvent_(d),d=new tv.c.trace_model.Sample(l,k,d.name,d.ts/1E3,m,d.weight);a.samples.push(d)}}}},joinRefs:function(){this.joinObjectRefs_()},createAsyncSlices_:function(){if(0!==this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,b){var c=a.event.ts-b.event.ts;return 0!==c?c:a.sequenceNumber- +b.sequenceNumber});for(var a=[],b={},c=0;c<this.allAsyncEvents_.length;c++){var d=this.allAsyncEvents_[c],h=d.event;if("S"===h.ph||"F"===h.ph||"T"===h.ph||"p"===h.ph)a.push(d);else if(void 0===h.name)this.model_.importWarning({type:"async_slice_parse_error",message:"Nestable async events (ph: b, e, or n) require a name parameter."});else{var k=h.id;void 0===k?this.model_.importWarning({type:"async_slice_parse_error",message:"Nestable async events (ph: b, e, or n) require an id parameter."}):(void 0=== +b[k]&&(b[k]=[]),b[k].push(d))}}this.createLegacyAsyncSlices_(a);for(k in b){a=b[k];h=[];for(c=0;c<a.length;++c){d=a[c];if("e"===d.event.ph){for(var l=-1,m=h.length-1;0<=m;--m)if(h[m].event.name===d.event.name){l=m;break}if(-1===l)d.finished=!1;else for(h[l].end=d;l<h.length;)h.pop()}0<h.length&&(d.parentEntry=h[h.length-1]);"b"===d.event.ph&&h.push(d)}h=[];for(c=0;c<a.length;++c)if(d=a[c],"e"!==d.event.ph||void 0!==d.finished){var n=m=l=void 0,q=void 0;"n"===d.event.ph?(m=l=d,n=d.event.args):"b"=== +d.event.ph?(void 0===d.end?(d.end=a[a.length-1],q="Slice has no matching END. End time has been adjusted.",this.model_.importWarning({type:"async_slice_parse_error",message:"Nestable async BEGIN event at "+d.event.ts+" with name="+d.event.name+" and id="+d.event.id+" was unmatched."}),n=d.event.args):n=function(a,b){if(void 0===a.params||void 0===b.params)return tv.b.concatenateObjects(a,b);var c={};c.params=tv.b.concatenateObjects(a.params,b.params);return tv.b.concatenateObjects(a,b,c)}(d.event.args, +d.end.event.args),l=d,m=d.end):(q="Slice has no matching BEGIN. Start time has been adjusted.",this.model_.importWarning({type:"async_slice_parse_error",message:"Nestable async END event at "+d.event.ts+" with name="+d.event.name+" and id="+d.event.id+" was unmatched."}),l=a[0],m=d,n=d.event.args);n=new (tv.c.trace_model.AsyncSlice.getConstructor(d.event.cat,d.event.name))(d.event.cat,d.event.name,tv.b.ui.getStringColorId(d.event.name),l.event.ts/1E3,n,(m.event.ts-l.event.ts)/1E3);n.startThread=l.thread; +n.endThread=m.thread;n.id=k;void 0!==q&&(n.error=q);d.slice=n;void 0!==d.parentEntry&&void 0!==d.parentEntry.slice?(void 0===d.parentEntry.slice.subSlices&&(d.parentEntry.slice.subSlices=[]),d.parentEntry.slice.subSlices.push(n)):h.push(n)}for(c=0;c<h.length;c++)h[c].startThread.asyncSliceGroup.push(h[c])}}},createLegacyAsyncSlices_:function(a){if(0!==a.length){a.sort(function(a,b){var c=a.event.ts-b.event.ts;return 0!=c?c:a.sequenceNumber-b.sequenceNumber});for(var b={},c=0;c<a.length;c++){var d= +a[c],h=d.event,k=h.name;if(void 0===k)this.model_.importWarning({type:"async_slice_parse_error",message:"Async events (ph: S, T, p, or F) require a name parameter."});else{var l=h.id;if(void 0===l)this.model_.importWarning({type:"async_slice_parse_error",message:"Async events (ph: S, T, p, or F) require an id parameter."});else if("S"===h.ph)void 0===b[k]&&(b[k]={}),b[k][l]?this.model_.importWarning({type:"async_slice_parse_error",message:"At "+h.ts+", a slice of the same id "+l+" was alrady open."}): +(b[k][l]=[],b[k][l].push(d));else if(void 0===b[k])this.model_.importWarning({type:"async_slice_parse_error",message:"At "+h.ts+", no slice named "+k+" was open."});else if(void 0===b[k][l])this.model_.importWarning({type:"async_slice_parse_error",message:"At "+h.ts+", no slice named "+k+" with id="+l+" was open."});else{var m=b[k][l];m.push(d);if("F"===h.ph){var n=tv.c.trace_model.AsyncSlice.getConstructor(m[0].event.cat,k),q=new n(m[0].event.cat,k,tv.b.ui.getStringColorId(k),m[0].event.ts/1E3,tv.b.concatenateObjects(m[0].event.args, +m[m.length-1].event.args),(h.ts-m[0].event.ts)/1E3);q.startThread=m[0].thread;q.endThread=d.thread;q.id=l;q.subSlices=[];for(var d=m[1].event.ph,u=!0,v=1;v<m.length-1;++v){if("T"===m[v].event.ph||"p"===m[v].event.ph)if(u=this.assertStepTypeMatches_(d,m[v]),!u)break;if("S"===m[v].event.ph)this.model_.importWarning({type:"async_slice_parse_error",message:"At "+h.event.ts+", a slice named "+h.event.name+" with id="+h.event.id+" had a step before the start event."});else if("F"===m[v].event.ph)this.model_.importWarning({type:"async_slice_parse_error", +message:"At "+h.event.ts+", a slice named "+h.event.name+" with id="+h.event.id+" had a step after the finish event."});else{var y=v+("T"===d?0:-1),E=y+1,C=m[v].event.name;if("T"===m[v].event.ph||"p"===m[v].event.ph)C=C+":"+m[v].event.args.step;n=tv.c.trace_model.AsyncSlice.getConstructor(m[0].event.cat,C);n=new n(m[0].event.cat,C,tv.b.ui.getStringColorId(C+v),m[y].event.ts/1E3,this.deepCopyIfNeeded_(m[v].event.args),(m[E].event.ts-m[y].event.ts)/1E3);n.startThread=m[y].thread;n.endThread=m[E].thread; +n.id=l;q.subSlices.push(n)}}u&&q.startThread.asyncSliceGroup.push(q);delete b[k][l]}}}}}},assertStepTypeMatches_:function(a,b){return a!=b.event.ph?(this.model_.importWarning({type:"async_slice_parse_error",message:"At "+b.event.ts+", a slice named "+b.event.name+" with id="+b.event.id+" had both begin and end steps, which is not allowed."}),!1):!0},createFlowSlices_:function(){if(0!==this.allFlowEvents_.length){this.allFlowEvents_.sort(function(a,b){var c=a.event.ts-b.event.ts;return 0!=c?c:a.sequenceNumber- +b.sequenceNumber});for(var a={},b=0;b<this.allFlowEvents_.length;++b){var c=this.allFlowEvents_[b],d=c.event,h=c.thread;if(void 0===d.name)this.model_.importWarning({type:"flow_slice_parse_error",message:"Flow events (ph: s, t or f) require a name parameter."});else if(void 0===d.id)this.model_.importWarning({type:"flow_slice_parse_error",message:"Flow events (ph: s, t or f) require an id parameter."});else if(c=new tv.c.trace_model.FlowEvent(d.cat,d.id,d.name,tv.b.ui.getStringColorId(d.name),d.ts/ +1E3,this.deepCopyIfNeeded_(d.args)),h.sliceGroup.pushSlice(c),"s"===d.ph)void 0!==a[d.id]&&this.model_.importWarning({type:"flow_slice_start_error",message:"event id "+d.id+" already seen when encountering start of flow event."}),a[d.id]=c;else if("t"===d.ph||"f"===d.ph)h=a[d.id],void 0===h?this.model_.importWarning({type:"flow_slice_ordering_error",message:"Found flow phase "+d.ph+" for id: "+d.id+" but no flow start found."}):(this.model_.flowEvents.push([h,c]),h&&(h.nextFlowEvent=c),c&&(c.previousFlowEvent= +h),a[d.id]="f"===d.ph?void 0:c)}}},createExplicitObjects_:function(){function a(a){var b=a.event;a=a.thread;void 0===b.name&&this.model_.importWarning({type:"object_parse_error",message:"While processing "+JSON.stringify(b)+": Object events require an name parameter."});void 0===b.id&&this.model_.importWarning({type:"object_parse_error",message:"While processing "+JSON.stringify(b)+": Object events require an id parameter."});var c=a.parent,d=b.ts/1E3,e;if("N"==b.ph)try{e=c.objects.idWasCreated(b.id, +b.cat,b.name,d)}catch(f){this.model_.importWarning({type:"object_parse_error",message:"While processing create of "+b.id+" at ts="+d+": "+f});return}else if("O"==b.ph){if(void 0===b.args.snapshot){this.model_.importWarning({type:"object_parse_error",message:"While processing "+b.id+" at ts="+d+": Snapshots must have args: {snapshot: ...}"});return}var g;try{var h=this.deepCopyIfNeeded_(b.args.snapshot),E;h.cat?(E=h.cat,delete h.cat):E=b.cat;var C;h.base_type?(C=h.base_type,delete h.base_type):C=void 0; +g=c.objects.addSnapshot(b.id,E,b.name,d,h,C);g.snapshottedOnThread=a}catch(p){this.model_.importWarning({type:"object_parse_error",message:"While processing snapshot of "+b.id+" at ts="+d+": "+p});return}e=g.objectInstance}else if("D"==b.ph)try{e=c.objects.idWasDeleted(b.id,b.cat,b.name,d)}catch(r){this.model_.importWarning({type:"object_parse_error",message:"While processing delete of "+b.id+" at ts="+d+": "+r});return}e&&(e.colorId=tv.b.ui.getStringColorId(e.typeName))}if(0!=this.allObjectEvents_.length){this.allObjectEvents_.sort(function(a, +b){var c=a.event.ts-b.event.ts;return 0!=c?c:a.sequenceNumber-b.sequenceNumber});for(var b=this.allObjectEvents_,c=0;c<b.length;c++){var d=b[c];try{a.call(this,d)}catch(h){this.model_.importWarning({type:"object_parse_error",message:h.message})}}}},createImplicitObjects_:function(){tv.b.iterItems(this.model_.processes,function(a,b){this.createImplicitObjectsForProcess_(b)},this)},createImplicitObjectsForProcess_:function(a){function b(c,d,e,f){if(e){if(e instanceof tv.c.trace_model.ObjectSnapshot)return null; +if(void 0!==e.id){var m=e.id,n=/(.+)\/(.+)/.exec(m);if(!n)throw Error("Implicit snapshots must have names.");delete e.id;var q=n[1],n=n[2],u,v;v=void 0!==e.cat?e.cat:f.objectInstance.category;var y;y=e.base_type?e.base_type:void 0;try{u=a.objects.addSnapshot(n,v,q,f.ts,e,y)}catch(E){this.model_.importWarning({type:"object_snapshot_parse_error",message:"While processing implicit snapshot of "+m+" at ts="+f.ts+": "+E});return}u.objectInstance.hasImplicitSnapshots=!0;u.containingSnapshot=f;u.snapshottedOnThread= +f.snapshottedOnThread;c[d]=u;if(!(u instanceof tv.c.trace_model.ObjectSnapshot))throw Error("Created object must be instanceof snapshot");return u.args}}}function c(a,b,d,f){if(a instanceof Object)if(a instanceof Array)for(var m=0;m<a.length;m++){var n=b.call(f,a,m,a[m],d);null!==n&&(n?c(n,b,d,f):c(a[m],b,d,f))}else for(m in a)n=b.call(f,a,m,a[m],d),null!==n&&(n?c(n,b,d,f):c(a[m],b,d,f))}a.objects.iterObjectInstances(function(a){a.snapshots.forEach(function(a){if(void 0!==a.args.id)throw Error("args cannot have an id field inside it"); +c(a.args,b,a,this)},this)},this)},createMemoryDumps_:function(){tv.b.iterItems(this.allMemoryDumpEvents_,function(a,b){var c=new tv.b.Range;void 0!==b.global&&c.addValue(b.global.ts);for(var d=0;d<b.process.length;d++)c.addValue(b.process[d].ts);var h=new tv.c.trace_model.GlobalMemoryDump(this.model_,c.min,this.deepCopyIfNeeded_(b.global));h.duration=c.range;this.model_.globalMemoryDumps.push(h);0===b.process.length&&this.model_.importWarning({type:"memory_dump_parse_error",message:"No process memory dumps associated with global memory dump "+ +a+"."});for(d=0;d<b.process.length;d++){var k=b.process[d],c=k.pid;if(c in h.processMemoryDumps)this.model_.importWarning({type:"memory_dump_parse_error",message:"Multiple process memory dumps with pid="+c+" for dump id "+a+"."});else{var l=this.model_.getOrCreateProcess(c),k=new tv.c.trace_model.ProcessMemoryDump(h,l,k.ts,this.deepCopyIfNeeded_(k.args));l.memoryDumps.push(k);h.processMemoryDumps[c]=k}}},this)},joinObjectRefs_:function(){tv.b.iterItems(this.model_.processes,function(a,b){this.joinObjectRefsForProcess_(b)}, +this)},joinObjectRefsForProcess_:function(a){var b=[];tv.b.iterItems(a.threads,function(c,d){d.asyncSliceGroup.slices.forEach(function(c){this.searchItemForIDRefs_(b,a.objects,"start",c)},this);d.sliceGroup.slices.forEach(function(c){this.searchItemForIDRefs_(b,a.objects,"start",c)},this)},this);a.objects.iterObjectInstances(function(c){c.snapshots.forEach(function(c){this.searchItemForIDRefs_(b,a.objects,"ts",c)},this)},this);b.forEach(function(a){a.object[a.field]=a.value})},searchItemForIDRefs_:function(a, +b,c,d){function h(h,k,n){n&&(n.id_ref||n.idRef)&&(n=b.getSnapshotAt(n.id_ref||n.idRef,d[c]))&&a.push({object:h,field:k,value:n})}function k(a){if(a instanceof Object&&!(a instanceof tv.c.trace_model.ObjectSnapshot||a instanceof Float32Array||a instanceof tv.b.Quad))if(a instanceof Array)for(var b=0;b<a.length;b++)h(a,b,a[b]),k(a[b]);else for(b in a){var c=a[b];h(a,b,c);k(c)}}if(!d.args)throw Error("item is missing its args");k(d.args)}};tv.c.importer.Importer.register(c);return{TraceEventImporter:c}}); +"use strict"; +tv.exportTo("tv.e.highlighter",function(){function d(b){c.call(this,b);this.times_=[]}var c=tv.c.tracks.Highlighter;d.VSYNC_HIGHLIGHT_COLOR={r:0,g:0,b:255};d.VSYNC_HIGHLIGHT_ALPHA=.1;d.VSYNC_DENSITY_TRANSPARENT=.2;d.VSYNC_DENSITY_OPAQUE=.1;d.VSYNC_DENSITY_RANGE=d.VSYNC_DENSITY_TRANSPARENT-d.VSYNC_DENSITY_OPAQUE;d.VSYNC_COUNTER_PRECISIONS={"android.VSYNC":15};d.VSYNC_SLICE_PRECISIONS={"RenderWidgetHostViewAndroid::OnVSync":5,VSYNC:10,vblank:10,"DisplayLinkMac::GetVSyncParameters":5};d.findVSyncTimes=function(b){var a= +[],c=Number.NEGATIVE_INFINITY,e=void 0,g=function(b,d){if(b!=e){var g=d[b];if(void 0===g||g<=c)return g===c&&console.warn("Encountered two different VSync events ("+e+", "+b+") with the same precision, ignoring the newer one ("+b+")"),!1;c=g;e=b;a=[]}return!0},h;for(h in b.processes){var k=b.processes[h],l;for(l in k.counters)if(g(l,d.VSYNC_COUNTER_PRECISIONS))for(var m=k.counters[l],n=0;n<m.series.length;n++)Array.prototype.push.apply(a,m.series[n].timestamps);for(var q in k.threads)for(m=k.threads[q], +n=0;n<m.sliceGroup.slices.length;n++){var u=m.sliceGroup.slices[n];g(u.title,d.VSYNC_SLICE_PRECISIONS)&&a.push(u.start)}}a.sort(function(a,b){return a-b});return a};d.generateStripes=function(b,a,c){var d=[],g=tv.b.findLowIndexInSortedArray(b,function(a){return a},a);g>b.length&&(g=b.length);for(var h=g-1;b[h+1]<=c;)h++;for(var k=g-g%2;k<=h;k+=2)d.push([k<g?a:b[k],k+1>h?c:b[k+1]]);return d};d.prototype={__proto__:c.prototype,processModel:function(b){this.times_=d.findVSyncTimes(b)},drawHighlight:function(b, +a,c,e,g){if(this.viewport_.highlightVSync&&(c=d.generateStripes(this.times_,c,e),0!=c.length&&(e=tv.b.clamp(c.length/(a.scaleX*(c[c.length-1][1]-c[0][0])),d.VSYNC_DENSITY_OPAQUE,d.VSYNC_DENSITY_TRANSPARENT),e=(d.VSYNC_DENSITY_TRANSPARENT-e)/d.VSYNC_DENSITY_RANGE,0!=e)))for(g*=window.devicePixelRatio||1,b.fillStyle=tv.b.ui.colorToRGBAString(d.VSYNC_HIGHLIGHT_COLOR,d.VSYNC_HIGHLIGHT_ALPHA*e),e=0;e<c.length;e++){var h=a.xWorldToView(c[e][0]),k=a.xWorldToView(c[e][1]);b.fillRect(h,0,k-h,g)}}};tv.c.tracks.Highlighter.register(d); +return{VSyncHighlighter:d}}); +</script> +</head> + <body> + </body> +</html> diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 45de849ec5..0d6e913334 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -411,6 +411,7 @@ var goTools = map[string]targetDir{ "cmd/objwriter": toTool, "cmd/pack": toTool, "cmd/pprof": toTool, + "cmd/trace": toTool, "cmd/yacc": toTool, "golang.org/x/tools/cmd/cover": toTool, "golang.org/x/tools/cmd/godoc": toBin, diff --git a/src/cmd/ld/lib.h b/src/cmd/ld/lib.h index f6a89535da..4990a80535 100644 --- a/src/cmd/ld/lib.h +++ b/src/cmd/ld/lib.h @@ -346,4 +346,4 @@ void ldmain(int, char**); #pragma varargck argpos diag 1 -#define SYMDEF "__.GOSYMDEF"
\ No newline at end of file +#define SYMDEF "__.GOSYMDEF" diff --git a/src/cmd/trace/goroutines.go b/src/cmd/trace/goroutines.go new file mode 100644 index 0000000000..f8d1289c29 --- /dev/null +++ b/src/cmd/trace/goroutines.go @@ -0,0 +1,328 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Goroutine-related profiles. + +package main + +import ( + "fmt" + "html/template" + "internal/trace" + "net/http" + "sort" + "strconv" +) + +func init() { + http.HandleFunc("/goroutines", httpGoroutines) + http.HandleFunc("/goroutine", httpGoroutine) +} + +// gtype describes a group of goroutines grouped by start PC. +type gtype struct { + ID uint64 // Unique identifier (PC). + Name string // Start function. + N int // Total number of goroutines in this group. + ExecTime int64 // Total execution time of all goroutines in this group. +} + +type gtypeList []gtype + +func (l gtypeList) Len() int { + return len(l) +} + +func (l gtypeList) Less(i, j int) bool { + return l[i].ExecTime > l[j].ExecTime +} + +func (l gtypeList) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + +// gdesc desribes a single goroutine. +type gdesc struct { + ID uint64 + Name string + PC uint64 + CreateTime int64 + StartTime int64 + EndTime int64 + LastStart int64 + + ExecTime int64 + SchedWaitTime int64 + IOTime int64 + BlockTime int64 + SyscallTime int64 + GCTime int64 + SweepTime int64 + TotalTime int64 + + blockNetTime int64 + blockSyncTime int64 + blockSyscallTime int64 + blockSweepTime int64 + blockGCTime int64 + blockSchedTime int64 +} + +type gdescList []*gdesc + +func (l gdescList) Len() int { + return len(l) +} + +func (l gdescList) Less(i, j int) bool { + return l[i].TotalTime > l[j].TotalTime +} + +func (l gdescList) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + +var gs = make(map[uint64]*gdesc) + +// analyzeGoroutines generates list gdesc's from the trace and stores it in gs. +func analyzeGoroutines(events []*trace.Event) { + if len(gs) > 0 { //!!! racy + return + } + var lastTs int64 + var gcStartTime int64 + for _, ev := range events { + lastTs = ev.Ts + switch ev.Type { + case trace.EvGoCreate: + g := &gdesc{CreateTime: ev.Ts} + g.blockSchedTime = ev.Ts + gs[ev.Args[0]] = g + case trace.EvGoStart: + g := gs[ev.G] + if g.PC == 0 { + g.PC = ev.Stk[0].PC + g.Name = ev.Stk[0].Fn + } + g.LastStart = ev.Ts + if g.StartTime == 0 { + g.StartTime = ev.Ts + } + if g.blockSchedTime != 0 { + g.SchedWaitTime += ev.Ts - g.blockSchedTime + g.blockSchedTime = 0 + } + case trace.EvGoEnd, trace.EvGoStop: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + g.TotalTime = ev.Ts - g.CreateTime + g.EndTime = ev.Ts + case trace.EvGoBlockSend, trace.EvGoBlockRecv, trace.EvGoBlockSelect, + trace.EvGoBlockSync, trace.EvGoBlockCond: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + g.blockSyncTime = ev.Ts + case trace.EvGoSched, trace.EvGoPreempt: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + g.blockSchedTime = ev.Ts + case trace.EvGoSleep, trace.EvGoBlock: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + case trace.EvGoBlockNet: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + g.blockNetTime = ev.Ts + case trace.EvGoUnblock: + g := gs[ev.Args[0]] + if g.blockNetTime != 0 { + g.IOTime += ev.Ts - g.blockNetTime + g.blockNetTime = 0 + } + if g.blockSyncTime != 0 { + g.BlockTime += ev.Ts - g.blockSyncTime + g.blockSyncTime = 0 + } + g.blockSchedTime = ev.Ts + case trace.EvGoSysBlock: + g := gs[ev.G] + g.ExecTime += ev.Ts - g.LastStart + g.blockSyscallTime = ev.Ts + case trace.EvGoSysExit: + g := gs[ev.G] + if g.blockSyscallTime != 0 { + g.SyscallTime += ev.Ts - g.blockSyscallTime + g.blockSyscallTime = 0 + } + g.blockSchedTime = ev.Ts + case trace.EvGCSweepStart: + g := gs[ev.G] + if g != nil { + // Sweep can happen during GC on system goroutine. + g.blockSweepTime = ev.Ts + } + case trace.EvGCSweepDone: + g := gs[ev.G] + if g != nil && g.blockSweepTime != 0 { + g.SweepTime += ev.Ts - g.blockSweepTime + g.blockSweepTime = 0 + } + case trace.EvGCStart: + gcStartTime = ev.Ts + case trace.EvGCDone: + for _, g := range gs { + if g.EndTime == 0 { + g.GCTime += ev.Ts - gcStartTime + } + } + } + } + + for _, g := range gs { + if g.TotalTime == 0 { + g.TotalTime = lastTs - g.CreateTime + } + if g.EndTime == 0 { + g.EndTime = lastTs + } + if g.blockNetTime != 0 { + g.IOTime += lastTs - g.blockNetTime + g.blockNetTime = 0 + } + if g.blockSyncTime != 0 { + g.BlockTime += lastTs - g.blockSyncTime + g.blockSyncTime = 0 + } + if g.blockSyscallTime != 0 { + g.SyscallTime += lastTs - g.blockSyscallTime + g.blockSyscallTime = 0 + } + if g.blockSchedTime != 0 { + g.SchedWaitTime += lastTs - g.blockSchedTime + g.blockSchedTime = 0 + } + } +} + +// httpGoroutines serves list of goroutine groups. +func httpGoroutines(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + analyzeGoroutines(events) + gss := make(map[uint64]gtype) + for _, g := range gs { + gs1 := gss[g.PC] + gs1.ID = g.PC + gs1.Name = g.Name + gs1.N++ + gs1.ExecTime += g.ExecTime + gss[g.PC] = gs1 + } + var glist gtypeList + for k, v := range gss { + v.ID = k + glist = append(glist, v) + } + sort.Sort(glist) + templGoroutines.Execute(w, glist) +} + +var templGoroutines = template.Must(template.New("").Parse(` +<html> +<body> +Goroutines: <br> +{{range $}} + <a href="/goroutine?id={{.ID}}">{{.Name}}</a> N={{.N}} <br> +{{end}} +</body> +</html> +`)) + +// httpGoroutine serves list of goroutines in a particular group. +func httpGoroutine(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + pc, err := strconv.ParseUint(r.FormValue("id"), 10, 64) + if err != nil { + http.Error(w, fmt.Sprintf("failed to parse id parameter '%v': %v", r.FormValue("id"), err), http.StatusInternalServerError) + return + } + analyzeGoroutines(events) + var glist gdescList + for gid, g := range gs { + if g.PC != pc || g.ExecTime == 0 { + continue + } + g.ID = gid + glist = append(glist, g) + } + sort.Sort(glist) + err = templGoroutine.Execute(w, glist) + if err != nil { + http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError) + return + } +} + +var templGoroutine = template.Must(template.New("").Parse(` +<html> +<body> +<table border="1" sortable="1"> +<tr> +<th> Goroutine </th> +<th> Total time, ns </th> +<th> Execution time, ns </th> +<th> Network wait time, ns </th> +<th> Sync block time, ns </th> +<th> Blocking syscall time, ns </th> +<th> Scheduler wait time, ns </th> +<th> GC sweeping time, ns </th> +<th> GC pause time, ns </th> +</tr> +{{range $}} + <tr> + <td> <a href="/trace?goid={{.ID}}">{{.ID}}</a> </td> + <td> {{.TotalTime}} </td> + <td> {{.ExecTime}} </td> + <td> {{.IOTime}} </td> + <td> {{.BlockTime}} </td> + <td> {{.SyscallTime}} </td> + <td> {{.SchedWaitTime}} </td> + <td> {{.SweepTime}} </td> + <td> {{.GCTime}} </td> + </tr> +{{end}} +</table> +</body> +</html> +`)) + +// relatedGoroutines finds set of related goroutines that we need to include +// into trace for goroutine goid. +func relatedGoroutines(events []*trace.Event, goid uint64) map[uint64]bool { + // BFS of depth 2 over "unblock" edges + // (what goroutines unblock goroutine goid?). + gmap := make(map[uint64]bool) + gmap[goid] = true + for i := 0; i < 2; i++ { + gmap1 := make(map[uint64]bool) + for g := range gmap { + gmap1[g] = true + } + for _, ev := range events { + if ev.Type == trace.EvGoUnblock && gmap[ev.Args[0]] { + gmap1[ev.G] = true + } + } + gmap = gmap1 + } + gmap[0] = true // for GC events + return gmap +} diff --git a/src/cmd/trace/main.go b/src/cmd/trace/main.go new file mode 100644 index 0000000000..ea6eef353f --- /dev/null +++ b/src/cmd/trace/main.go @@ -0,0 +1,156 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Trace is a tool for viewing trace files. + +Trace files can be generated with: + - runtime/pprof.StartTrace + - net/http/pprof package + - go test -trace + +Example usage: +Generate a trace file with 'go test': + go test -trace trace.out pkg +View the trace in a web browser: + go tool trace pkg.test trace.out +*/ +package main + +import ( + "bufio" + "flag" + "fmt" + "internal/trace" + "net" + "net/http" + "os" + "os/exec" + "runtime" + "sync" +) + +const usageMessage = "" + + `Usage of 'go tool trace': +Given a trace file produced by 'go test': + go test -trace=trace.out pkg + +Open a web browser displaying trace: + go tool trace [flags] pkg.test trace.out + +Flags: + -http=addr: HTTP service address (e.g., ':6060') +` + +var ( + httpFlag = flag.String("http", "localhost:0", "HTTP service address (e.g., ':6060')") + + // The binary file name, left here for serveSVGProfile. + programBinary string + traceFile string +) + +func main() { + flag.Usage = func() { + fmt.Fprintln(os.Stderr, usageMessage) + os.Exit(2) + } + flag.Parse() + + // Usage information when no arguments. + if flag.NArg() != 2 { + flag.Usage() + } + programBinary = flag.Arg(0) + traceFile = flag.Arg(1) + + ln, err := net.Listen("tcp", *httpFlag) + if err != nil { + dief("failed to create server socket: %v\n", err) + } + // Open browser. + if !startBrowser("http://" + ln.Addr().String()) { + dief("failed to start browser\n") + } + + // Parse and symbolize trace asynchronously while browser opens. + go parseEvents() + + // Start http server. + http.HandleFunc("/", httpMain) + err = http.Serve(ln, nil) + dief("failed to start http server: %v\n", err) +} + +var loader struct { + once sync.Once + events []*trace.Event + err error +} + +func parseEvents() ([]*trace.Event, error) { + loader.once.Do(func() { + tracef, err := os.Open(flag.Arg(1)) + if err != nil { + loader.err = fmt.Errorf("failed to open trace file: %v", err) + return + } + defer tracef.Close() + + // Parse and symbolize. + events, err := trace.Parse(bufio.NewReader(tracef)) + if err != nil { + loader.err = fmt.Errorf("failed to parse trace: %v", err) + return + } + err = trace.Symbolize(events, programBinary) + if err != nil { + loader.err = fmt.Errorf("failed to symbolize trace: %v", err) + return + } + loader.events = events + }) + return loader.events, loader.err +} + +// httpMain serves the starting page. +func httpMain(w http.ResponseWriter, r *http.Request) { + w.Write(templMain) +} + +var templMain = []byte(` +<html> +<body> +<a href="/trace">View trace</a><br> +<a href="/goroutines">Goroutine analysis</a><br> +<a href="/io">IO blocking profile</a><br> +<a href="/block">Synchronization blocking profile</a><br> +<a href="/syscall">Syscall blocking profile</a><br> +<a href="/sched">Scheduler latency profile</a><br> +</body> +</html> +`) + +// startBrowser tries to open the URL in a browser +// and reports whether it succeeds. +// Note: copied from x/tools/cmd/cover/html.go +func startBrowser(url string) bool { + // try to start the browser + var args []string + switch runtime.GOOS { + case "darwin": + args = []string{"open"} + case "windows": + args = []string{"cmd", "/c", "start"} + default: + args = []string{"xdg-open"} + } + cmd := exec.Command(args[0], append(args[1:], url)...) + return cmd.Start() == nil +} + +func dief(msg string, args ...interface{}) { + fmt.Fprintf(os.Stderr, msg, args...) + os.Exit(1) +} diff --git a/src/cmd/trace/pprof.go b/src/cmd/trace/pprof.go new file mode 100644 index 0000000000..9e6f277978 --- /dev/null +++ b/src/cmd/trace/pprof.go @@ -0,0 +1,162 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Serving of pprof-like profiles. + +package main + +import ( + "bufio" + "fmt" + "internal/trace" + "io/ioutil" + "net/http" + "os" + "os/exec" +) + +func init() { + http.HandleFunc("/io", httpIO) + http.HandleFunc("/block", httpBlock) + http.HandleFunc("/syscall", httpSyscall) + http.HandleFunc("/sched", httpSched) +} + +// Record represents one entry in pprof-like profiles. +type Record struct { + stk []*trace.Frame + n uint64 + time int64 +} + +// httpIO serves IO pprof-like profile (time spent in IO wait). +func httpIO(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + prof := make(map[uint64]Record) + for _, ev := range events { + if ev.Type != trace.EvGoBlockNet || ev.Link == nil || ev.StkID == 0 || len(ev.Stk) == 0 { + continue + } + rec := prof[ev.StkID] + rec.stk = ev.Stk + rec.n++ + rec.time += ev.Link.Ts - ev.Ts + prof[ev.StkID] = rec + } + serveSVGProfile(w, r, prof) +} + +// httpBlock serves blocking pprof-like profile (time spent blocked on synchronization primitives). +func httpBlock(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + prof := make(map[uint64]Record) + for _, ev := range events { + switch ev.Type { + case trace.EvGoBlockSend, trace.EvGoBlockRecv, trace.EvGoBlockSelect, + trace.EvGoBlockSync, trace.EvGoBlockCond: + default: + continue + } + if ev.Link == nil || ev.StkID == 0 || len(ev.Stk) == 0 { + continue + } + rec := prof[ev.StkID] + rec.stk = ev.Stk + rec.n++ + rec.time += ev.Link.Ts - ev.Ts + prof[ev.StkID] = rec + } + serveSVGProfile(w, r, prof) +} + +// httpSyscall serves syscall pprof-like profile (time spent blocked in syscalls). +func httpSyscall(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + prof := make(map[uint64]Record) + for _, ev := range events { + if ev.Type != trace.EvGoSysCall || ev.Link == nil || ev.StkID == 0 || len(ev.Stk) == 0 { + continue + } + rec := prof[ev.StkID] + rec.stk = ev.Stk + rec.n++ + rec.time += ev.Link.Ts - ev.Ts + prof[ev.StkID] = rec + } + serveSVGProfile(w, r, prof) +} + +// httpSched serves scheduler latency pprof-like profile +// (time between a goroutine become runnable and actually scheduled for execution). +func httpSched(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + prof := make(map[uint64]Record) + for _, ev := range events { + if (ev.Type != trace.EvGoUnblock && ev.Type != trace.EvGoCreate) || + ev.Link == nil || ev.StkID == 0 || len(ev.Stk) == 0 { + continue + } + rec := prof[ev.StkID] + rec.stk = ev.Stk + rec.n++ + rec.time += ev.Link.Ts - ev.Ts + prof[ev.StkID] = rec + } + serveSVGProfile(w, r, prof) +} + +// generateSVGProfile generates pprof-like profile stored in prof and writes in to w. +func serveSVGProfile(w http.ResponseWriter, r *http.Request, prof map[uint64]Record) { + blockf, err := ioutil.TempFile("", "block") + if err != nil { + http.Error(w, fmt.Sprintf("failed to create temp file: %v", err), http.StatusInternalServerError) + return + } + defer os.Remove(blockf.Name()) + blockb := bufio.NewWriter(blockf) + fmt.Fprintf(blockb, "--- contention:\ncycles/second=1000000000\n") + for _, rec := range prof { + fmt.Fprintf(blockb, "%v %v @", rec.time, rec.n) + for _, f := range rec.stk { + fmt.Fprintf(blockb, " 0x%x", f.PC) + } + fmt.Fprintf(blockb, "\n") + } + err = blockb.Flush() + if err != nil { + http.Error(w, fmt.Sprintf("failed to flush temp file: %v", err), http.StatusInternalServerError) + return + } + err = blockf.Close() + if err != nil { + http.Error(w, fmt.Sprintf("failed to close temp file: %v", err), http.StatusInternalServerError) + return + } + + svgFilename := blockf.Name() + ".svg" + _, err = exec.Command("go", "tool", "pprof", "-svg", "-output", svgFilename, programBinary, blockf.Name()).CombinedOutput() + if err != nil { + http.Error(w, fmt.Sprintf("failed to execute go tool pprof: %v", err), http.StatusInternalServerError) + return + } + defer os.Remove(svgFilename) + w.Header().Set("Content-Type", "image/svg+xml") + http.ServeFile(w, r, svgFilename) +} diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go new file mode 100644 index 0000000000..8f8ef14687 --- /dev/null +++ b/src/cmd/trace/trace.go @@ -0,0 +1,434 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "encoding/json" + "fmt" + "internal/trace" + "net/http" + "os" + "path/filepath" + "strconv" + "strings" +) + +func init() { + http.HandleFunc("/trace", httpTrace) + http.HandleFunc("/jsontrace", httpJsonTrace) + http.HandleFunc("/trace_viewer_html", httpTraceViewerHTML) +} + +// httpTrace serves either whole trace (goid==0) or trace for goid goroutine. +func httpTrace(w http.ResponseWriter, r *http.Request) { + _, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + params := "" + if goids := r.FormValue("goid"); goids != "" { + goid, err := strconv.ParseUint(goids, 10, 64) + if err != nil { + http.Error(w, fmt.Sprintf("failed to parse goid parameter '%v': %v", goids, err), http.StatusInternalServerError) + return + } + params = fmt.Sprintf("?goid=%v", goid) + } + html := strings.Replace(templTrace, "{{PARAMS}}", params, -1) + w.Write([]byte(html)) + +} + +var templTrace = ` +<html> + <head> + <link href="/trace_viewer_html" rel="import"> + <script> + document.addEventListener("DOMContentLoaded", function(event) { + var viewer = new tv.TraceViewer('/jsontrace{{PARAMS}}'); + document.body.appendChild(viewer); + }); + </script> + </head> + <body> + </body> +</html> +` + +// httpTraceViewerHTML serves static part of trace-viewer. +// This URL is queried from templTrace HTML. +func httpTraceViewerHTML(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, filepath.Join(os.Getenv("GOROOT"), "misc", "trace", "trace_viewer_lean.html")) +} + +// httpJsonTrace serves json trace, requested from within templTrace HTML. +func httpJsonTrace(w http.ResponseWriter, r *http.Request) { + events, err := parseEvents() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + params := &traceParams{ + events: events, + endTime: int64(1<<63 - 1), + } + + if goids := r.FormValue("goid"); goids != "" { + goid, err := strconv.ParseUint(goids, 10, 64) + if err != nil { + http.Error(w, fmt.Sprintf("failed to parse goid parameter '%v': %v", goids, err), http.StatusInternalServerError) + return + } + analyzeGoroutines(events) + g := gs[goid] + params.gtrace = true + params.startTime = g.StartTime + params.endTime = g.EndTime + params.maing = goid + params.gs = relatedGoroutines(events, goid) + } + + err = json.NewEncoder(w).Encode(generateTrace(params)) + if err != nil { + http.Error(w, fmt.Sprintf("failed to serialize trace: %v", err), http.StatusInternalServerError) + return + } +} + +type traceParams struct { + events []*trace.Event + gtrace bool + startTime int64 + endTime int64 + maing uint64 + gs map[uint64]bool +} + +type traceContext struct { + *traceParams + data ViewerData + frameTree frameNode + frameSeq int + arrowSeq uint64 + heapAlloc uint64 + nextGC uint64 + gcount uint64 + grunnable uint64 + grunning uint64 + insyscall uint64 + prunning uint64 +} + +type frameNode struct { + id int + children map[uint64]frameNode +} + +type ViewerData struct { + Events []*ViewerEvent `json:"traceEvents"` + Frames map[string]ViewerFrame `json:"stackFrames"` +} + +type ViewerEvent struct { + Name string `json:"name,omitempty"` + Phase string `json:"ph"` + Scope string `json:"s,omitempty"` + Time int64 `json:"ts"` + Dur int64 `json:"dur,omitempty"` + Pid uint64 `json:"pid"` + Tid uint64 `json:"tid"` + ID uint64 `json:"id,omitempty"` + Stack int `json:"sf,omitempty"` + EndStack int `json:"esf,omitempty"` + Arg interface{} `json:"args,omitempty"` +} + +type ViewerFrame struct { + Name string `json:"name"` + Parent int `json:"parent,omitempty"` +} + +type NameArg struct { + Name string `json:"name"` +} + +type SortIndexArg struct { + Index int `json:"sort_index"` +} + +// generateTrace generates json trace for trace-viewer: +// https://github.com/google/trace-viewer +// Trace format is described at: +// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/view +// If gtrace=true, generate trace for goroutine goid, otherwise whole trace. +// startTime, endTime determine part of the trace that we are interested in. +// gset restricts goroutines that are included in the resulting trace. +func generateTrace(params *traceParams) ViewerData { + ctx := &traceContext{traceParams: params} + ctx.frameTree.children = make(map[uint64]frameNode) + ctx.data.Frames = make(map[string]ViewerFrame) + maxProc := 0 + gnames := make(map[uint64]string) + for _, ev := range ctx.events { + // Handle trace.EvGoStart separately, because we need the goroutine name + // even if ignore the event otherwise. + if ev.Type == trace.EvGoStart { + if _, ok := gnames[ev.G]; !ok { + if len(ev.Stk) > 0 { + gnames[ev.G] = fmt.Sprintf("G%v %s", ev.G, ev.Stk[0].Fn) + } else { + gnames[ev.G] = fmt.Sprintf("G%v", ev.G) + } + } + } + + // Ignore events that are from uninteresting goroutines + // or outside of the interesting timeframe. + if ctx.gs != nil && ev.P < trace.FakeP && !ctx.gs[ev.G] { + continue + } + if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime { + continue + } + + if ev.P < trace.FakeP && ev.P > maxProc { + maxProc = ev.P + } + + switch ev.Type { + case trace.EvProcStart: + if ctx.gtrace { + continue + } + ctx.prunning++ + ctx.emitThreadCounters(ev) + ctx.emitInstant(ev, "proc start") + case trace.EvProcStop: + if ctx.gtrace { + continue + } + ctx.prunning-- + ctx.emitThreadCounters(ev) + ctx.emitInstant(ev, "proc stop") + case trace.EvGCStart: + ctx.emitSlice(ev, "GC") + case trace.EvGCDone: + case trace.EvGCScanStart: + if ctx.gtrace { + continue + } + ctx.emitSlice(ev, "MARK") + case trace.EvGCScanDone: + case trace.EvGCSweepStart: + ctx.emitSlice(ev, "SWEEP") + case trace.EvGCSweepDone: + case trace.EvGoStart: + ctx.grunnable-- + ctx.grunning++ + ctx.emitGoroutineCounters(ev) + ctx.emitSlice(ev, gnames[ev.G]) + case trace.EvGoCreate: + ctx.gcount++ + ctx.grunnable++ + ctx.emitGoroutineCounters(ev) + ctx.emitArrow(ev, "go") + case trace.EvGoEnd: + ctx.gcount-- + ctx.grunning-- + ctx.emitGoroutineCounters(ev) + case trace.EvGoUnblock: + ctx.grunnable++ + ctx.emitGoroutineCounters(ev) + ctx.emitArrow(ev, "unblock") + case trace.EvGoSysCall: + ctx.emitInstant(ev, "syscall") + case trace.EvGoSysExit: + ctx.grunnable++ + ctx.emitGoroutineCounters(ev) + ctx.insyscall-- + ctx.emitThreadCounters(ev) + ctx.emitArrow(ev, "sysexit") + case trace.EvGoSysBlock: + ctx.grunning-- + ctx.emitGoroutineCounters(ev) + ctx.insyscall++ + ctx.emitThreadCounters(ev) + case trace.EvGoSched, trace.EvGoPreempt: + ctx.grunnable++ + ctx.grunning-- + ctx.emitGoroutineCounters(ev) + case trace.EvGoStop, + trace.EvGoSleep, trace.EvGoBlock, trace.EvGoBlockSend, trace.EvGoBlockRecv, + trace.EvGoBlockSelect, trace.EvGoBlockSync, trace.EvGoBlockCond, trace.EvGoBlockNet: + ctx.grunning-- + ctx.emitGoroutineCounters(ev) + case trace.EvGoWaiting: + ctx.grunnable-- + ctx.emitGoroutineCounters(ev) + case trace.EvGoInSyscall: + ctx.insyscall++ + ctx.emitThreadCounters(ev) + case trace.EvHeapAlloc: + ctx.heapAlloc = ev.Args[0] + ctx.emitHeapCounters(ev) + case trace.EvNextGC: + ctx.nextGC = ev.Args[0] + ctx.emitHeapCounters(ev) + } + } + + ctx.emit(&ViewerEvent{Name: "process_name", Phase: "M", Pid: 0, Arg: &NameArg{"PROCS"}}) + ctx.emit(&ViewerEvent{Name: "process_sort_index", Phase: "M", Pid: 0, Arg: &SortIndexArg{1}}) + + ctx.emit(&ViewerEvent{Name: "process_name", Phase: "M", Pid: 1, Arg: &NameArg{"STATS"}}) + ctx.emit(&ViewerEvent{Name: "process_sort_index", Phase: "M", Pid: 1, Arg: &SortIndexArg{0}}) + + ctx.emit(&ViewerEvent{Name: "thread_name", Phase: "M", Pid: 0, Tid: trace.NetpollP, Arg: &NameArg{"Network"}}) + ctx.emit(&ViewerEvent{Name: "thread_sort_index", Phase: "M", Pid: 0, Tid: trace.NetpollP, Arg: &SortIndexArg{-5}}) + + ctx.emit(&ViewerEvent{Name: "thread_name", Phase: "M", Pid: 0, Tid: trace.TimerP, Arg: &NameArg{"Timers"}}) + ctx.emit(&ViewerEvent{Name: "thread_sort_index", Phase: "M", Pid: 0, Tid: trace.TimerP, Arg: &SortIndexArg{-4}}) + + ctx.emit(&ViewerEvent{Name: "thread_name", Phase: "M", Pid: 0, Tid: trace.SyscallP, Arg: &NameArg{"Syscalls"}}) + ctx.emit(&ViewerEvent{Name: "thread_sort_index", Phase: "M", Pid: 0, Tid: trace.SyscallP, Arg: &SortIndexArg{-3}}) + + if !ctx.gtrace { + for i := 0; i <= maxProc; i++ { + ctx.emit(&ViewerEvent{Name: "thread_name", Phase: "M", Pid: 0, Tid: uint64(i), Arg: &NameArg{fmt.Sprintf("Proc %v", i)}}) + } + } + + if ctx.gtrace && ctx.gs != nil { + for k, v := range gnames { + if !ctx.gs[k] { + continue + } + ctx.emit(&ViewerEvent{Name: "thread_name", Phase: "M", Pid: 0, Tid: k, Arg: &NameArg{v}}) + } + ctx.emit(&ViewerEvent{Name: "thread_sort_index", Phase: "M", Pid: 0, Tid: ctx.maing, Arg: &SortIndexArg{-2}}) + ctx.emit(&ViewerEvent{Name: "thread_sort_index", Phase: "M", Pid: 0, Tid: 0, Arg: &SortIndexArg{-1}}) + } + + return ctx.data +} + +func (ctx *traceContext) emit(e *ViewerEvent) { + ctx.data.Events = append(ctx.data.Events, e) +} + +func (ctx *traceContext) time(ev *trace.Event) int64 { + if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime { + fmt.Printf("ts=%v startTime=%v endTime\n", ev.Ts, ctx.startTime, ctx.endTime) + panic("timestamp is outside of trace range") + } + // NOTE: trace viewer wants timestamps in microseconds and it does not + // handle fractional timestamps (rounds them). We give it timestamps + // in nanoseconds to avoid rounding. See: + // https://github.com/google/trace-viewer/issues/624 + return ev.Ts - ctx.startTime +} + +func (ctx *traceContext) proc(ev *trace.Event) uint64 { + if ctx.gtrace && ev.P < trace.FakeP { + return ev.G + } else { + return uint64(ev.P) + } +} + +func (ctx *traceContext) emitSlice(ev *trace.Event, name string) { + ctx.emit(&ViewerEvent{ + Name: name, + Phase: "X", + Time: ctx.time(ev), + Dur: ctx.time(ev.Link) - ctx.time(ev), + Tid: ctx.proc(ev), + //Stack: ctx.stack(ev.Stk), + EndStack: ctx.stack(ev.Link.Stk), + }) +} + +func (ctx *traceContext) emitHeapCounters(ev *trace.Event) { + type Arg struct { + Allocated uint64 + NextGC uint64 + } + if ctx.gtrace { + return + } + diff := uint64(0) + if ctx.nextGC > ctx.heapAlloc { + diff = ctx.nextGC - ctx.heapAlloc + } + ctx.emit(&ViewerEvent{Name: "Heap", Phase: "C", Time: ctx.time(ev), Pid: 1, Arg: &Arg{ctx.heapAlloc, diff}}) +} + +func (ctx *traceContext) emitGoroutineCounters(ev *trace.Event) { + type Arg struct { + Running uint64 + Runnable uint64 + } + if ctx.gtrace { + return + } + ctx.emit(&ViewerEvent{Name: "Goroutines", Phase: "C", Time: ctx.time(ev), Pid: 1, Arg: &Arg{ctx.grunning, ctx.grunnable}}) +} + +func (ctx *traceContext) emitThreadCounters(ev *trace.Event) { + type Arg struct { + Running uint64 + InSyscall uint64 + } + if ctx.gtrace { + return + } + ctx.emit(&ViewerEvent{Name: "Threads", Phase: "C", Time: ctx.time(ev), Pid: 1, Arg: &Arg{ctx.prunning, ctx.insyscall}}) +} + +func (ctx *traceContext) emitInstant(ev *trace.Event, name string) { + ctx.emit(&ViewerEvent{Name: name, Phase: "I", Scope: "t", Time: ctx.time(ev), Tid: ctx.proc(ev), Stack: ctx.stack(ev.Stk)}) +} + +func (ctx *traceContext) emitArrow(ev *trace.Event, name string) { + if ev.Link == nil { + // The other end of the arrow is not captured in the trace. + // For example, a goroutine was unblocked but was not scheduled before trace stop. + return + } + if ctx.gtrace && (!ctx.gs[ev.Link.G] || ev.Link.Ts < ctx.startTime || ev.Link.Ts > ctx.endTime) { + return + } + + ctx.arrowSeq++ + ctx.emit(&ViewerEvent{Name: name, Phase: "s", Tid: ctx.proc(ev), ID: ctx.arrowSeq, Time: ctx.time(ev), Stack: ctx.stack(ev.Stk)}) + ctx.emit(&ViewerEvent{Name: name, Phase: "t", Tid: ctx.proc(ev.Link), ID: ctx.arrowSeq, Time: ctx.time(ev.Link)}) +} + +func (ctx *traceContext) stack(stk []*trace.Frame) int { + return ctx.buildBranch(ctx.frameTree, stk) +} + +// buildBranch builds one branch in the prefix tree rooted at ctx.frameTree. +func (ctx *traceContext) buildBranch(parent frameNode, stk []*trace.Frame) int { + if len(stk) == 0 { + return parent.id + } + last := len(stk) - 1 + frame := stk[last] + stk = stk[:last] + + node, ok := parent.children[frame.PC] + if !ok { + ctx.frameSeq++ + node.id = ctx.frameSeq + node.children = make(map[uint64]frameNode) + parent.children[frame.PC] = node + ctx.data.Frames[strconv.Itoa(node.id)] = ViewerFrame{fmt.Sprintf("%v:%v", frame.Fn, frame.Line), parent.id} + } + return ctx.buildBranch(node, stk) +} diff --git a/src/internal/trace/parser.go b/src/internal/trace/parser.go new file mode 100644 index 0000000000..62d063c5d8 --- /dev/null +++ b/src/internal/trace/parser.go @@ -0,0 +1,662 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package trace + +import ( + "bufio" + "bytes" + "fmt" + "io" + "os" + "os/exec" + "sort" + "strconv" + "strings" +) + +// Event describes one event in the trace. +type Event struct { + Off int // offset in input file (for debugging and error reporting) + Type byte // one of Ev* + Ts int64 // timestamp in nanoseconds + P int // P on which the event happened (can be one of TimerP, NetpollP, SyscallP) + G uint64 // G on which the event happened + StkID uint64 // unique stack ID + Stk []*Frame // stack trace (can be empty) + Args [2]uint64 // event-type-specific arguments + // linked event (can be nil), depends on event type: + // for GCStart: the GCStop + // for GCScanStart: the GCScanDone + // for GCSweepStart: the GCSweepDone + // for GoCreate: first GoStart of the created goroutine + // for GoStart: the associated GoEnd, GoBlock or other blocking event + // for GoSched/GoPreempt: the next GoStart + // for GoBlock and other blocking events: the unblock event + // for GoUnblock: the associated GoStart + // for blocking GoSysCall: the associated GoSysExit + // for GoSysExit: the next GoStart + Link *Event +} + +// Frame is a frame in stack traces. +type Frame struct { + PC uint64 + Fn string + File string + Line int +} + +const ( + // Special P identifiers: + FakeP = 1000000 + iota + TimerP // depicts timer unblocks + NetpollP // depicts network unblocks + SyscallP // depicts returns from syscalls +) + +// parseTrace parses, post-processes and verifies the trace. +func Parse(r io.Reader) ([]*Event, error) { + rawEvents, err := readTrace(r) + if err != nil { + return nil, err + } + events, err := parseEvents(rawEvents) + if err != nil { + return nil, err + } + err = postProcessTrace(events) + if err != nil { + return nil, err + } + return events, nil +} + +// rawEvent is a helper type used during parsing. +type rawEvent struct { + off int + typ byte + args []uint64 +} + +// readTrace does wire-format parsing and verification. +// It does not care about specific event types and argument meaning. +func readTrace(r io.Reader) ([]rawEvent, error) { + // Read and validate trace header. + var buf [8]byte + off, err := r.Read(buf[:]) + if off != 8 || err != nil { + return nil, fmt.Errorf("failed to read header: read %v, err %v", off, err) + } + if bytes.Compare(buf[:], []byte("gotrace\x00")) != 0 { + return nil, fmt.Errorf("not a trace file") + } + + // Read events. + var events []rawEvent + for { + // Read event type and number of arguments (1 byte). + off0 := off + n, err := r.Read(buf[:1]) + if err == io.EOF { + break + } + if err != nil || n != 1 { + return nil, fmt.Errorf("failed to read trace at offset 0x%x: n=%v err=%v", off0, n, err) + } + off += n + typ := buf[0] << 2 >> 2 + narg := buf[0]>>6 + 1 + ev := rawEvent{typ: typ, off: off0} + if narg <= 3 { + for i := 0; i < int(narg); i++ { + var v uint64 + v, off, err = readVal(r, off) + if err != nil { + return nil, err + } + ev.args = append(ev.args, v) + } + } else { + // If narg == 4, the first value is length of the event in bytes. + var v uint64 + v, off, err = readVal(r, off) + if err != nil { + return nil, err + } + evLen := v + off1 := off + for evLen > uint64(off-off1) { + v, off, err = readVal(r, off) + if err != nil { + return nil, err + } + ev.args = append(ev.args, v) + } + if evLen != uint64(off-off1) { + return nil, fmt.Errorf("event has wrong length at offset 0x%x: want %v, got %v", off0, evLen, off-off1) + } + } + events = append(events, ev) + } + return events, nil +} + +// Parse events transforms raw events into events. +// It does analyze and verify per-event-type arguments. +func parseEvents(rawEvents []rawEvent) (events []*Event, err error) { + var ticksPerSec, lastTs int64 + var lastG, timerGoid uint64 + var lastP int + lastGs := make(map[int]uint64) // last goroutine running on P + stacks := make(map[uint64][]*Frame) + for _, raw := range rawEvents { + if raw.typ == EvNone || raw.typ >= EvCount { + err = fmt.Errorf("unknown event type %v at offset 0x%x", raw.typ, raw.off) + return + } + desc := EventDescriptions[raw.typ] + if desc.Name == "" { + err = fmt.Errorf("missing description for event type %v", raw.typ) + return + } + if raw.typ != EvStack { + narg := len(desc.Args) + if desc.Stack { + narg++ + } + if raw.typ != EvBatch && raw.typ != EvFrequency && raw.typ != EvTimerGoroutine { + narg++ // timestamp + } + if len(raw.args) != narg { + err = fmt.Errorf("%v has wrong number of arguments at offset 0x%x: want %v, got %v", + desc.Name, raw.off, narg, len(raw.args)) + return + } + } + switch raw.typ { + case EvBatch: + lastGs[lastP] = lastG + lastP = int(raw.args[0]) + lastG = lastGs[lastP] + lastTs = int64(raw.args[1]) + case EvFrequency: + ticksPerSec = int64(raw.args[0]) + if ticksPerSec <= 0 { + err = fmt.Errorf("EvFrequency contains invalid frequency %v at offset 0x%x", + ticksPerSec, raw.off) + return + } + case EvTimerGoroutine: + timerGoid = raw.args[0] + case EvStack: + if len(raw.args) < 2 { + err = fmt.Errorf("EvStack has wrong number of arguments at offset 0x%x: want at least 2, got %v", + raw.off, len(raw.args)) + return + } + size := raw.args[1] + if size > 1000 { + err = fmt.Errorf("EvStack has bad number of frames at offset 0x%x: %v", + raw.off, size) + return + } + id := raw.args[0] + if id != 0 && size > 0 { + stk := make([]*Frame, size) + for i := 0; i < int(size); i++ { + stk[i] = &Frame{PC: raw.args[i+2]} + } + stacks[id] = stk + } + default: + e := &Event{Off: raw.off, Type: raw.typ, P: lastP, G: lastG} + e.Ts = lastTs + int64(raw.args[0]) + lastTs = e.Ts + for i := range desc.Args { + e.Args[i] = raw.args[i+1] + } + if desc.Stack { + e.StkID = raw.args[len(desc.Args)+1] + } + switch raw.typ { + case EvGoStart: + lastG = e.Args[0] + e.G = lastG + case EvGCStart, EvGCDone, EvGCScanStart, EvGCScanDone: + e.G = 0 + case EvGoEnd, EvGoStop, EvGoSched, EvGoPreempt, + EvGoSleep, EvGoBlock, EvGoBlockSend, EvGoBlockRecv, + EvGoBlockSelect, EvGoBlockSync, EvGoBlockCond, EvGoBlockNet, + EvGoSysBlock: + lastG = 0 + } + events = append(events, e) + } + } + + // Attach stack traces. + for _, ev := range events { + if ev.StkID != 0 { + ev.Stk = stacks[ev.StkID] + } + } + + // Sort by time and translate cpu ticks to real time. + sort.Sort(eventList(events)) + if ticksPerSec == 0 { + err = fmt.Errorf("no EvFrequency event") + return + } + minTs := events[0].Ts + for _, ev := range events { + ev.Ts = (ev.Ts - minTs) * 1e9 / ticksPerSec + // Move timers and syscalls to separate fake Ps. + if timerGoid != 0 && ev.G == timerGoid && ev.Type == EvGoUnblock { + ev.P = TimerP + } + if ev.Type == EvGoSysExit { + ev.P = SyscallP + ev.G = ev.Args[0] + } + } + + return +} + +// postProcessTrace does inter-event verification and information restoration. +// The resulting trace is guaranteed to be consistent +// (for example, a P does not run two Gs at the same time, or a G is indeed +// blocked before an unblock event). +func postProcessTrace(events []*Event) error { + const ( + gDead = iota + gRunnable + gRunning + gWaiting + ) + type gdesc struct { + state int + ev *Event + evStart *Event + } + type pdesc struct { + running bool + g uint64 + evGC *Event + evScan *Event + evSweep *Event + } + + gs := make(map[uint64]gdesc) + ps := make(map[int]pdesc) + gs[0] = gdesc{state: gRunning} + + checkRunning := func(p pdesc, g gdesc, ev *Event) error { + name := EventDescriptions[ev.Type].Name + if g.state != gRunning { + return fmt.Errorf("g %v is not running while %v (offset %v, time %v)", ev.G, name, ev.Off, ev.Ts) + } + if p.g != ev.G { + return fmt.Errorf("p %v is not running g %v while %v (offset %v, time %v)", ev.P, ev.G, name, ev.Off, ev.Ts) + } + return nil + } + + for _, ev := range events { + g := gs[ev.G] + p := ps[ev.P] + + switch ev.Type { + case EvProcStart: + if p.running { + return fmt.Errorf("p %v is running before start (offset %v, time %v)", ev.P, ev.Off, ev.Ts) + } + p.running = true + case EvProcStop: + if !p.running { + return fmt.Errorf("p %v is not running before stop (offset %v, time %v)", ev.P, ev.Off, ev.Ts) + } + if p.g != 0 { + return fmt.Errorf("p %v is running a goroutine %v during stop (offset %v, time %v)", ev.P, p.g, ev.Off, ev.Ts) + } + p.running = false + case EvGCStart: + if p.evGC != nil { + return fmt.Errorf("previous GC is not ended before a new one (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evGC = ev + case EvGCDone: + if p.evGC == nil { + return fmt.Errorf("bogus GC end (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evGC.Link = ev + p.evGC = nil + case EvGCScanStart: + if p.evScan != nil { + return fmt.Errorf("previous scanning is not ended before a new one (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evScan = ev + case EvGCScanDone: + if p.evScan == nil { + return fmt.Errorf("bogus scanning end (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evScan.Link = ev + p.evScan = nil + case EvGCSweepStart: + if p.evSweep != nil { + return fmt.Errorf("previous sweeping is not ended before a new one (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evSweep = ev + case EvGCSweepDone: + if p.evSweep == nil { + return fmt.Errorf("bogus sweeping end (offset %v, time %v)", ev.Off, ev.Ts) + } + p.evSweep.Link = ev + p.evSweep = nil + case EvGoWaiting: + g1 := gs[ev.Args[0]] + if g1.state != gRunnable { + return fmt.Errorf("g %v is not runnable before EvGoWaiting (offset %v, time %v)", ev.Args[0], ev.Off, ev.Ts) + } + g1.state = gWaiting + gs[ev.Args[0]] = g1 + case EvGoInSyscall: + // this case is intentionally left blank + case EvGoCreate: + if err := checkRunning(p, g, ev); err != nil { + return err + } + if _, ok := gs[ev.Args[0]]; ok { + return fmt.Errorf("g %v already exists (offset %v, time %v)", ev.Args[0], ev.Off, ev.Ts) + } + gs[ev.Args[0]] = gdesc{state: gRunnable, ev: ev} + case EvGoStart: + if g.state != gRunnable { + return fmt.Errorf("g %v is not runnable before start (offset %v, time %v)", ev.G, ev.Off, ev.Ts) + } + if p.g != 0 { + return fmt.Errorf("p %v is already running g %v while start g %v (offset %v, time %v)", ev.P, p.g, ev.G, ev.Off, ev.Ts) + } + g.state = gRunning + g.evStart = ev + p.g = ev.G + if g.ev != nil { + if g.ev.Type == EvGoCreate { + // +1 because symblizer expects return pc. + ev.Stk = []*Frame{&Frame{PC: g.ev.Args[1] + 1}} + } + g.ev.Link = ev + g.ev = nil + } + case EvGoEnd, EvGoStop: + if err := checkRunning(p, g, ev); err != nil { + return err + } + g.evStart.Link = ev + g.evStart = nil + g.state = gDead + p.g = 0 + case EvGoSched, EvGoPreempt: + if err := checkRunning(p, g, ev); err != nil { + return err + } + g.state = gRunnable + g.evStart.Link = ev + g.evStart = nil + p.g = 0 + g.ev = ev + case EvGoUnblock: + if g.state != gRunning { + return fmt.Errorf("g %v is not running while unpark (offset %v, time %v)", ev.G, ev.Off, ev.Ts) + } + if ev.P != TimerP && p.g != ev.G { + return fmt.Errorf("p %v is not running g %v while unpark (offset %v, time %v)", ev.P, ev.G, ev.Off, ev.Ts) + } + g1 := gs[ev.Args[0]] + if g1.state != gWaiting { + return fmt.Errorf("g %v is not waiting before unpark (offset %v, time %v)", ev.Args[0], ev.Off, ev.Ts) + } + if g1.ev != nil && g1.ev.Type == EvGoBlockNet && ev.P != TimerP { + ev.P = NetpollP + } + if g1.ev != nil { + g1.ev.Link = ev + } + g1.state = gRunnable + g1.ev = ev + gs[ev.Args[0]] = g1 + case EvGoSysCall: + if err := checkRunning(p, g, ev); err != nil { + return err + } + g.ev = ev + case EvGoSysBlock: + if err := checkRunning(p, g, ev); err != nil { + return err + } + g.state = gRunnable + g.evStart.Link = ev + g.evStart = nil + p.g = 0 + case EvGoSysExit: + if g.state != gRunnable { + return fmt.Errorf("g %v is not runnable during syscall exit (offset %v, time %v)", ev.G, ev.Off, ev.Ts) + } + if g.ev != nil && g.ev.Type == EvGoSysCall { + g.ev.Link = ev + } + g.ev = ev + case EvGoSleep, EvGoBlock, EvGoBlockSend, EvGoBlockRecv, + EvGoBlockSelect, EvGoBlockSync, EvGoBlockCond, EvGoBlockNet: + if err := checkRunning(p, g, ev); err != nil { + return err + } + g.state = gWaiting + g.ev = ev + g.evStart.Link = ev + g.evStart = nil + p.g = 0 + } + + gs[ev.G] = g + ps[ev.P] = p + } + + // TODO(dvyukov): restore stacks for EvGoStart events. + // TODO(dvyukov): test that all EvGoStart events has non-nil Link. + + return nil +} + +// symbolizeTrace attaches func/file/line info to stack traces. +func Symbolize(events []*Event, bin string) error { + // First, collect and dedup all pcs. + pcs := make(map[uint64]*Frame) + for _, ev := range events { + for _, f := range ev.Stk { + pcs[f.PC] = nil + } + } + + // Start addr2line. + cmd := exec.Command("go", "tool", "addr2line", bin) + in, err := cmd.StdinPipe() + if err != nil { + return fmt.Errorf("failed to pipe addr2line stdin: %v", err) + } + cmd.Stderr = os.Stderr + out, err := cmd.StdoutPipe() + if err != nil { + return fmt.Errorf("failed to pipe addr2line stdout: %v", err) + } + err = cmd.Start() + if err != nil { + return fmt.Errorf("failed to start addr2line: %v", err) + } + outb := bufio.NewReader(out) + + // Write all pcs to addr2line. + // Need to copy pcs to an array, because map iteration order is non-deterministic. + var pcArray []uint64 + for pc := range pcs { + pcArray = append(pcArray, pc) + _, err := fmt.Fprintf(in, "0x%x\n", pc-1) + if err != nil { + return fmt.Errorf("failed to write to addr2line: %v", err) + } + } + in.Close() + + // Read in answers. + for _, pc := range pcArray { + fn, err := outb.ReadString('\n') + if err != nil { + return fmt.Errorf("failed to read from addr2line: %v", err) + } + file, err := outb.ReadString('\n') + if err != nil { + return fmt.Errorf("failed to read from addr2line: %v", err) + } + f := &Frame{PC: pc} + f.Fn = fn[:len(fn)-1] + f.File = file[:len(file)-1] + if colon := strings.LastIndex(f.File, ":"); colon != -1 { + ln, err := strconv.Atoi(f.File[colon+1:]) + if err == nil { + f.File = f.File[:colon] + f.Line = ln + } + } + pcs[pc] = f + } + cmd.Wait() + + // Replace frames in events array. + for _, ev := range events { + for i, f := range ev.Stk { + ev.Stk[i] = pcs[f.PC] + } + } + + return nil +} + +// readVal reads unsigned base-128 value from r. +func readVal(r io.Reader, off0 int) (v uint64, off int, err error) { + off = off0 + for i := 0; i < 10; i++ { + var buf [1]byte + var n int + n, err = r.Read(buf[:]) + if err != nil || n != 1 { + return 0, 0, fmt.Errorf("failed to read trace at offset: read %v, error %v", off0, n, err) + } + off++ + v |= uint64(buf[0]&0x7f) << (uint(i) * 7) + if buf[0]&0x80 == 0 { + return + } + } + return 0, 0, fmt.Errorf("bad value at offset 0x%x", off0) +} + +type eventList []*Event + +func (l eventList) Len() int { + return len(l) +} + +func (l eventList) Less(i, j int) bool { + return l[i].Ts < l[j].Ts +} + +func (l eventList) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + +// Event types in the trace. +// Verbatim copy from src/runtime/trace.go. +const ( + EvNone = 0 // unused + EvBatch = 1 // start of per-P batch of events [pid, timestamp] + EvFrequency = 2 // contains tracer timer frequency [frequency (ticks per second)] + EvStack = 3 // stack [stack id, number of PCs, array of PCs] + EvGomaxprocs = 4 // current value of GOMAXPROCS [timestamp, GOMAXPROCS, stack id] + EvProcStart = 5 // start of P [timestamp] + EvProcStop = 6 // stop of P [timestamp] + EvGCStart = 7 // GC start [timestamp, stack id] + EvGCDone = 8 // GC done [timestamp] + EvGCScanStart = 9 // GC scan start [timestamp] + EvGCScanDone = 10 // GC scan done [timestamp] + EvGCSweepStart = 11 // GC sweep start [timestamp, stack id] + EvGCSweepDone = 12 // GC sweep done [timestamp] + EvGoCreate = 13 // goroutine creation [timestamp, new goroutine id, start PC, stack id] + EvGoStart = 14 // goroutine starts running [timestamp, goroutine id] + EvGoEnd = 15 // goroutine ends [timestamp] + EvGoStop = 16 // goroutine stops (like in select{}) [timestamp, stack] + EvGoSched = 17 // goroutine calls Gosched [timestamp, stack] + EvGoPreempt = 18 // goroutine is preempted [timestamp, stack] + EvGoSleep = 19 // goroutine calls Sleep [timestamp, stack] + EvGoBlock = 20 // goroutine blocks [timestamp, stack] + EvGoUnblock = 21 // goroutine is unblocked [timestamp, goroutine id, stack] + EvGoBlockSend = 22 // goroutine blocks on chan send [timestamp, stack] + EvGoBlockRecv = 23 // goroutine blocks on chan recv [timestamp, stack] + EvGoBlockSelect = 24 // goroutine blocks on select [timestamp, stack] + EvGoBlockSync = 25 // goroutine blocks on Mutex/RWMutex [timestamp, stack] + EvGoBlockCond = 26 // goroutine blocks on Cond [timestamp, stack] + EvGoBlockNet = 27 // goroutine blocks on network [timestamp, stack] + EvGoSysCall = 28 // syscall enter [timestamp, stack] + EvGoSysExit = 29 // syscall exit [timestamp, goroutine id] + EvGoSysBlock = 30 // syscall blocks [timestamp, stack] + EvGoWaiting = 31 // denotes that goroutine is blocked when tracing starts [goroutine id] + EvGoInSyscall = 32 // denotes that goroutine is in syscall when tracing starts [goroutine id] + EvHeapAlloc = 33 // memstats.heap_alloc change [timestamp, heap_alloc] + EvNextGC = 34 // memstats.next_gc change [timestamp, next_gc] + EvTimerGoroutine = 35 // denotes timer goroutine [timer goroutine id] + EvCount = 36 +) + +var EventDescriptions = [EvCount]struct { + Name string + Stack bool + Args []string +}{ + EvNone: {"None", false, []string{}}, + EvBatch: {"Batch", false, []string{"p", "ticks"}}, + EvFrequency: {"Frequency", false, []string{"freq"}}, + EvStack: {"Stack", false, []string{"id", "siz"}}, + EvGomaxprocs: {"Gomaxprocs", true, []string{"procs"}}, + EvProcStart: {"ProcStart", false, []string{}}, + EvProcStop: {"ProcStop", false, []string{}}, + EvGCStart: {"GCStart", true, []string{}}, + EvGCDone: {"GCDone", false, []string{}}, + EvGCScanStart: {"GCScanStart", false, []string{}}, + EvGCScanDone: {"GCScanDone", false, []string{}}, + EvGCSweepStart: {"GCSweepStart", true, []string{}}, + EvGCSweepDone: {"GCSweepDone", false, []string{}}, + EvGoCreate: {"GoCreate", true, []string{"g", "pc"}}, + EvGoStart: {"GoStart", false, []string{"g"}}, + EvGoEnd: {"GoEnd", false, []string{}}, + EvGoStop: {"GoStop", true, []string{}}, + EvGoSched: {"GoSched", true, []string{}}, + EvGoPreempt: {"GoPreempt", true, []string{}}, + EvGoSleep: {"GoSleep", true, []string{}}, + EvGoBlock: {"GoBlock", true, []string{}}, + EvGoUnblock: {"GoUnblock", true, []string{"g"}}, + EvGoBlockSend: {"GoBlockSend", true, []string{}}, + EvGoBlockRecv: {"GoBlockRecv", true, []string{}}, + EvGoBlockSelect: {"GoBlockSelect", true, []string{}}, + EvGoBlockSync: {"GoBlockSync", true, []string{}}, + EvGoBlockCond: {"GoBlockCond", true, []string{}}, + EvGoBlockNet: {"GoBlockNet", true, []string{}}, + EvGoSysCall: {"GoSysCall", true, []string{}}, + EvGoSysExit: {"GoSysExit", false, []string{"g"}}, + EvGoSysBlock: {"GoSysBlock", true, []string{}}, + EvGoWaiting: {"GoWaiting", false, []string{"g"}}, + EvGoInSyscall: {"GoInSyscall", false, []string{"g"}}, + EvHeapAlloc: {"HeapAlloc", false, []string{"mem"}}, + EvNextGC: {"NextGC", false, []string{"mem"}}, + EvTimerGoroutine: {"TimerGoroutine", false, []string{"g"}}, +} diff --git a/src/net/http/request.go b/src/net/http/request.go index f7a7f19b9b..639a579bdf 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -25,9 +25,6 @@ import ( ) const ( - maxValueLength = 4096 - maxHeaderLines = 1024 - chunkSize = 4 << 10 // 4 KB chunks defaultMaxMemory = 32 << 20 // 32 MB ) diff --git a/src/reflect/value.go b/src/reflect/value.go index 081c4d9d7b..ad48152730 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -302,8 +302,8 @@ func (v Value) Call(in []Value) []Value { // CallSlice calls the variadic function v with the input arguments in, // assigning the slice in[len(in)-1] to v's final variadic argument. -// For example, if len(in) == 3, v.Call(in) represents the Go call v(in[0], in[1], in[2]...). -// Call panics if v's Kind is not Func or if v is not variadic. +// For example, if len(in) == 3, v.CallSlice(in) represents the Go call v(in[0], in[1], in[2]...). +// CallSlice panics if v's Kind is not Func or if v is not variadic. // It returns the output results as Values. // As in Go, each input argument must be assignable to the // type of the function's corresponding input parameter. diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 58a0d502bd..1574b3060d 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -30,6 +30,19 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0 CPUID CMPL AX, $0 JE nocpuinfo + + // Figure out how to serialize RDTSC. + // On Intel processors LFENCE is enough. AMD requires MFENCE. + // Don't know about the rest, so let's do MFENCE. + CMPL BX, $0x756E6547 // "Genu" + JNE notintel + CMPL DX, $0x49656E69 // "ineI" + JNE notintel + CMPL CX, $0x6C65746E // "ntel" + JNE notintel + MOVB $1, runtime·lfenceBeforeRdtsc(SB) +notintel: + MOVL $1, AX CPUID MOVL CX, runtime·cpuid_ecx(SB) @@ -868,9 +881,17 @@ TEXT runtime·gogetcallersp(SB),NOSPLIT,$0-8 MOVL AX, ret+4(FP) RET -// int64 runtime·cputicks(void), so really -// void runtime·cputicks(int64 *ticks) +// func cputicks() int64 TEXT runtime·cputicks(SB),NOSPLIT,$0-8 + TESTL $0x4000000, runtime·cpuid_edx(SB) // no sse2, no mfence + JEQ done + CMPB runtime·lfenceBeforeRdtsc(SB), $1 + JNE mfence + BYTE $0x0f; BYTE $0xae; BYTE $0xe8 // LFENCE + JMP done +mfence: + BYTE $0x0f; BYTE $0xae; BYTE $0xf0 // MFENCE +done: RDTSC MOVL AX, ret_lo+0(FP) MOVL DX, ret_hi+4(FP) diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 1ac4b78a4d..d3f88037ff 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -30,6 +30,19 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0 CPUID CMPQ AX, $0 JE nocpuinfo + + // Figure out how to serialize RDTSC. + // On Intel processors LFENCE is enough. AMD requires MFENCE. + // Don't know about the rest, so let's do MFENCE. + CMPL BX, $0x756E6547 // "Genu" + JNE notintel + CMPL DX, $0x49656E69 // "ineI" + JNE notintel + CMPL CX, $0x6C65746E // "ntel" + JNE notintel + MOVB $1, runtime·lfenceBeforeRdtsc(SB) +notintel: + MOVQ $1, AX CPUID MOVL CX, runtime·cpuid_ecx(SB) @@ -865,8 +878,15 @@ TEXT runtime·gogetcallersp(SB),NOSPLIT,$0-16 MOVQ AX, ret+8(FP) RET -// int64 runtime·cputicks(void) +// func cputicks() int64 TEXT runtime·cputicks(SB),NOSPLIT,$0-0 + CMPB runtime·lfenceBeforeRdtsc(SB), $1 + JNE mfence + BYTE $0x0f; BYTE $0xae; BYTE $0xe8 // LFENCE + JMP done +mfence: + BYTE $0x0f; BYTE $0xae; BYTE $0xf0 // MFENCE +done: RDTSC SHLQ $32, DX ADDQ DX, AX diff --git a/src/runtime/cgocall.h b/src/runtime/cgocall.h deleted file mode 100644 index c87a9cdc5d..0000000000 --- a/src/runtime/cgocall.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* - * Cgo interface. - */ - -void runtime·cgocall(void (*fn)(void*), void*); -int32 runtime·cgocall_errno(void (*fn)(void*), void*); -void runtime·cgocallback(void (*fn)(void), void*, uintptr); -void *runtime·cmalloc(uintptr); -void runtime·cfree(void*); diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index b65bf70656..475f97fd05 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -655,7 +655,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { } if shouldtriggergc() { - gogc(0) + startGC(gcBackgroundMode) } else if shouldhelpgc && atomicloaduint(&bggc.working) == 1 { // bggc.lock not taken since race on bggc.working is benign. // At worse we don't call gchelpwork. diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 75d6b9158e..1c1248936c 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -120,7 +120,6 @@ import "unsafe" const ( _DebugGC = 0 - _DebugGCPtrs = false // if true, print trace of every pointer load during GC _ConcurrentSweep = true _FinBlockSize = 4 * 1024 _RootData = 0 @@ -206,9 +205,7 @@ func shouldtriggergc() bool { return triggerratio*(int64(memstats.next_gc)-int64(memstats.heap_alloc)) <= int64(memstats.next_gc) && atomicloaduint(&bggc.working) == 0 } -var work workdata - -type workdata struct { +var work struct { full uint64 // lock-free list of full blocks workbuf empty uint64 // lock-free list of empty blocks workbuf partial uint64 // lock-free list of partially filled blocks workbuf @@ -226,19 +223,21 @@ type workdata struct { // GC runs a garbage collection. func GC() { - gogc(2) + startGC(gcForceBlockMode) } -// force = 0 - start concurrent GC -// force = 1 - do STW GC regardless of current heap usage -// force = 2 - go STW GC and eager sweep -func gogc(force int32) { +const ( + gcBackgroundMode = iota // concurrent GC + gcForceMode // stop-the-world GC now + gcForceBlockMode // stop-the-world GC now and wait for sweep +) + +func startGC(mode int) { // The gc is turned off (via enablegc) until the bootstrap has completed. // Also, malloc gets called in the guts of a number of libraries that might be // holding locks. To avoid deadlocks during stoptheworld, don't bother // trying to run gc while holding a lock. The next mallocgc without a lock // will do the gc instead. - mp := acquirem() if gp := getg(); gp == mp.g0 || mp.locks > 1 || !memstats.enablegc || panicking != 0 || gcpercent < 0 { releasem(mp) @@ -247,20 +246,23 @@ func gogc(force int32) { releasem(mp) mp = nil - if force == 0 { - lock(&bggc.lock) - if !bggc.started { - bggc.working = 1 - bggc.started = true - go backgroundgc() - } else if bggc.working == 0 { - bggc.working = 1 - ready(bggc.g) - } - unlock(&bggc.lock) - } else { - gcwork(force) + if mode != gcBackgroundMode { + // special synchronous cases + gc(mode) + return + } + + // trigger concurrent GC + lock(&bggc.lock) + if !bggc.started { + bggc.working = 1 + bggc.started = true + go backgroundgc() + } else if bggc.working == 0 { + bggc.working = 1 + ready(bggc.g) } + unlock(&bggc.lock) } // State of the background concurrent GC goroutine. @@ -276,15 +278,15 @@ var bggc struct { func backgroundgc() { bggc.g = getg() for { - gcwork(0) + gc(gcBackgroundMode) lock(&bggc.lock) bggc.working = 0 goparkunlock(&bggc.lock, "Concurrent GC wait", traceEvGoBlock) } } -func gcwork(force int32) { - +func gc(mode int) { + // Ok, we're doing it! Stop everybody else semacquire(&worldsema, false) // Pick up the remaining unswept/not being swept spans concurrently @@ -292,13 +294,11 @@ func gcwork(force int32) { sweep.nbgsweep++ } - // Ok, we're doing it! Stop everybody else - mp := acquirem() mp.preemptoff = "gcing" releasem(mp) gctimer.count++ - if force == 0 { + if mode == gcBackgroundMode { gctimer.cycle.sweepterm = nanotime() } @@ -307,31 +307,40 @@ func gcwork(force int32) { traceGCStart() } - // Pick up the remaining unswept/not being swept spans before we STW - for gosweepone() != ^uintptr(0) { - sweep.nbgsweep++ - } systemstack(stoptheworld) systemstack(finishsweep_m) // finish sweep before we start concurrent scan. - if force == 0 { // Do as much work concurrently as possible - gcphase = _GCscan - systemstack(starttheworld) - gctimer.cycle.scan = nanotime() - // Do a concurrent heap scan before we stop the world. - systemstack(gcscan_m) - gctimer.cycle.installmarkwb = nanotime() - systemstack(stoptheworld) - systemstack(gcinstallmarkwb) - systemstack(harvestwbufs) - systemstack(starttheworld) - gctimer.cycle.mark = nanotime() - systemstack(gcmark_m) - gctimer.cycle.markterm = nanotime() - systemstack(stoptheworld) - systemstack(gcinstalloffwb_m) + + if mode == gcBackgroundMode { // Do as much work concurrently as possible + systemstack(func() { + gcphase = _GCscan + + // Concurrent scan. + starttheworld() + gctimer.cycle.scan = nanotime() + gcscan_m() + gctimer.cycle.installmarkwb = nanotime() + + // Sync. + stoptheworld() + gcphase = _GCmark + harvestwbufs() + + // Concurrent mark. + starttheworld() + gctimer.cycle.mark = nanotime() + var gcw gcWork + gcDrain(&gcw) + gcw.dispose() + + // Begin mark termination. + gctimer.cycle.markterm = nanotime() + stoptheworld() + gcphase = _GCoff + }) } else { - // For non-concurrent GC (force != 0) g stack have not been scanned so - // set gcscanvalid such that mark termination scans all stacks. + // For non-concurrent GC (mode != gcBackgroundMode) + // g stack have not been scanned so set gcscanvalid + // such that mark termination scans all stacks. // No races here since we are in a STW phase. for _, gp := range allgs { gp.gcworkdone = false // set to true in gcphasework @@ -341,36 +350,46 @@ func gcwork(force int32) { startTime := nanotime() if mp != acquirem() { - throw("gogc: rescheduled") + throw("gcwork: rescheduled") } + // TODO(rsc): Should the concurrent GC clear pools earlier? clearpools() + _g_ := getg() + _g_.m.traceback = 2 + gp := _g_.m.curg + casgstatus(gp, _Grunning, _Gwaiting) + gp.waitreason = "garbage collection" + // Run gc on the g0 stack. We do this so that the g stack // we're currently running on will no longer change. Cuts // the root set down a bit (g0 stacks are not scanned, and // we don't need to scan gc's internal state). We also // need to switch to g0 so we can shrink the stack. - n := 1 - if debug.gctrace > 1 { - n = 2 - } - eagersweep := force >= 2 - for i := 0; i < n; i++ { - if i > 0 { - // refresh start time if doing a second GC - startTime = nanotime() + systemstack(func() { + gcMark(startTime) + if debug.gccheckmark > 0 { + // Run a full stop-the-world mark using checkmark bits, + // to check that we didn't forget to mark anything during + // the concurrent mark process. + initCheckmarks() + gcMark(startTime) + clearCheckmarks() } - // switch to g0, call gc, then switch back - systemstack(func() { - gc_m(startTime, eagersweep) - }) - } + gcSweep(mode) - systemstack(func() { - gccheckmark_m(startTime, eagersweep) + if debug.gctrace > 1 { + startTime = nanotime() + finishsweep_m() + gcMark(startTime) + gcSweep(mode) + } }) + _g_.m.traceback = 0 + casgstatus(gp, _Gwaiting, _Grunning) + if trace.enabled { traceGCDone() traceGoStart() @@ -379,13 +398,13 @@ func gcwork(force int32) { // all done mp.preemptoff = "" - if force == 0 { + if mode == gcBackgroundMode { gctimer.cycle.sweep = nanotime() } semrelease(&worldsema) - if force == 0 { + if mode == gcBackgroundMode { if gctimer.verbose > 1 { GCprinttimes() } else if gctimer.verbose > 0 { @@ -405,109 +424,24 @@ func gcwork(force int32) { } } -// For now this must be bracketed with a stoptheworld and a starttheworld to ensure -// all go routines see the new barrier. -//go:nowritebarrier -func gcinstalloffwb_m() { - gcphase = _GCoff -} - -// For now this must be bracketed with a stoptheworld and a starttheworld to ensure -// all go routines see the new barrier. -//go:nowritebarrier -func gcinstallmarkwb() { - gcphase = _GCmark -} - -// Mark all objects that are known about. -// This is the concurrent mark phase. -//go:nowritebarrier -func gcmark_m() { - var gcw gcWork - gcDrain(&gcw) - gcw.dispose() - // TODO add another harvestwbuf and reset work.nwait=0, work.ndone=0, and work.nproc=1 - // and repeat the above gcDrain. -} - -// Called from malloc.go using systemstack. -// The world is stopped. Rerun the scan and mark phases -// using the bitMarkedCheck bit instead of the -// bitMarked bit. If the marking encounters an -// bitMarked bit that is not set then we throw. -//go:nowritebarrier -func gccheckmark_m(startTime int64, eagersweep bool) { - if debug.gccheckmark == 0 { - return - } - - if checkmarkphase { - throw("gccheckmark_m, entered with checkmarkphase already true") - } - - checkmarkphase = true - initCheckmarks() - gc_m(startTime, eagersweep) // turns off checkmarkphase + calls clearcheckmarkbits -} - -// Called from malloc.go using systemstack, stopping and starting the world handled in caller. -//go:nowritebarrier -func gc_m(start_time int64, eagersweep bool) { - _g_ := getg() - gp := _g_.m.curg - casgstatus(gp, _Grunning, _Gwaiting) - gp.waitreason = "garbage collection" - - gc(start_time, eagersweep) - casgstatus(gp, _Gwaiting, _Grunning) -} - +// gcMark runs the mark (or, for concurrent GC, mark termination) // STW is in effect at this point. //TODO go:nowritebarrier -func gc(start_time int64, eagersweep bool) { - if _DebugGCPtrs { - print("GC start\n") - } - - gcphase = _GCmarktermination +func gcMark(start_time int64) { if debug.allocfreetrace > 0 { tracegc() } - _g_ := getg() - _g_.m.traceback = 2 t0 := start_time work.tstart = start_time + gcphase = _GCmarktermination var t1 int64 if debug.gctrace > 0 { t1 = nanotime() } - if !checkmarkphase { - // TODO(austin) This is a noop beceause we should - // already have swept everything to the current - // sweepgen. - finishsweep_m() // skip during checkmark debug phase. - } - - // Cache runtime.mheap_.allspans in work.spans to avoid conflicts with - // resizing/freeing allspans. - // New spans can be created while GC progresses, but they are not garbage for - // this round: - // - new stack spans can be created even while the world is stopped. - // - new malloc spans can be created during the concurrent sweep - - // Even if this is stop-the-world, a concurrent exitsyscall can allocate a stack from heap. - lock(&mheap_.lock) - // Free the old cached sweep array if necessary. - if work.spans != nil && &work.spans[0] != &h_allspans[0] { - sysFree(unsafe.Pointer(&work.spans[0]), uintptr(len(work.spans))*unsafe.Sizeof(work.spans[0]), &memstats.other_sys) - } - // Cache the current array for marking. - mheap_.gcspans = mheap_.allspans - work.spans = h_allspans - unlock(&mheap_.lock) + gcCopySpans() work.nwait = 0 work.ndone = 0 @@ -615,67 +549,63 @@ func gc(start_time int64, eagersweep bool) { sweep.nbgsweep = 0 sweep.npausesweep = 0 } +} - if debug.gccheckmark > 0 { - if !checkmarkphase { - // first half of two-pass; don't set up sweep - return - } - checkmarkphase = false // done checking marks - clearCheckmarks() - } +func gcSweep(mode int) { + gcCopySpans() - // See the comment in the beginning of this function as to why we need the following. - // Even if this is still stop-the-world, a concurrent exitsyscall can allocate a stack from heap. lock(&mheap_.lock) - // Free the old cached mark array if necessary. - if work.spans != nil && &work.spans[0] != &h_allspans[0] { - sysFree(unsafe.Pointer(&work.spans[0]), uintptr(len(work.spans))*unsafe.Sizeof(work.spans[0]), &memstats.other_sys) - } - - // Cache the current array for sweeping. - mheap_.gcspans = mheap_.allspans mheap_.sweepgen += 2 mheap_.sweepdone = 0 - work.spans = h_allspans sweep.spanidx = 0 unlock(&mheap_.lock) - if _ConcurrentSweep && !eagersweep { - lock(&gclock) - if !sweep.started { - go bgsweep() - sweep.started = true - } else if sweep.parked { - sweep.parked = false - ready(sweep.g) - } - unlock(&gclock) - } else { + if !_ConcurrentSweep || mode == gcForceBlockMode { + // Special case synchronous sweep. // Sweep all spans eagerly. for sweepone() != ^uintptr(0) { sweep.npausesweep++ } // Do an additional mProf_GC, because all 'free' events are now real as well. mProf_GC() + mProf_GC() + return } + // Background sweep. + lock(&sweep.lock) + if !sweep.started { + go bgsweep() + sweep.started = true + } else if sweep.parked { + sweep.parked = false + ready(sweep.g) + } + unlock(&sweep.lock) mProf_GC() - _g_.m.traceback = 0 +} - if _DebugGCPtrs { - print("GC end\n") +func gcCopySpans() { + // Cache runtime.mheap_.allspans in work.spans to avoid conflicts with + // resizing/freeing allspans. + // New spans can be created while GC progresses, but they are not garbage for + // this round: + // - new stack spans can be created even while the world is stopped. + // - new malloc spans can be created during the concurrent sweep + // Even if this is stop-the-world, a concurrent exitsyscall can allocate a stack from heap. + lock(&mheap_.lock) + // Free the old cached mark array if necessary. + if work.spans != nil && &work.spans[0] != &h_allspans[0] { + sysFree(unsafe.Pointer(&work.spans[0]), uintptr(len(work.spans))*unsafe.Sizeof(work.spans[0]), &memstats.other_sys) } + // Cache the current array for sweeping. + mheap_.gcspans = mheap_.allspans + work.spans = h_allspans + unlock(&mheap_.lock) } // Hooks for other packages -//go:linkname runtime_debug_freeOSMemory runtime/debug.freeOSMemory -func runtime_debug_freeOSMemory() { - gogc(2) // force GC and do eager sweep - systemstack(scavenge_m) -} - var poolcleanup func() //go:linkname sync_runtime_registerPoolCleanup sync.runtime_registerPoolCleanup diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index d790af3405..1d6c1e8e22 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -86,7 +86,7 @@ func markroot(desc *parfor, i uint32) { if s.state != mSpanInUse { continue } - if !checkmarkphase && s.sweepgen != sg { + if !useCheckmark && s.sweepgen != sg { // sweepgen was updated (+2) during non-checkmark GC pass print("sweep ", s.sweepgen, " ", sg, "\n") throw("gc: unswept span") @@ -458,7 +458,7 @@ func scanobject(b, n uintptr, ptrmask *uint8, gcw *gcWorkProducer) { } if bits&typePointer != typePointer { - print("gc checkmarkphase=", checkmarkphase, " b=", hex(b), " ptrmask=", ptrmask, "\n") + print("gc useCheckmark=", useCheckmark, " b=", hex(b), " ptrmask=", ptrmask, "\n") throw("unexpected garbage collection bits") } @@ -470,7 +470,7 @@ func scanobject(b, n uintptr, ptrmask *uint8, gcw *gcWorkProducer) { continue } - if mheap_.shadow_enabled && debug.wbshadow >= 2 && debug.gccheckmark > 0 && checkmarkphase { + if mheap_.shadow_enabled && debug.wbshadow >= 2 && debug.gccheckmark > 0 && useCheckmark { checkwbshadow((*uintptr)(unsafe.Pointer(b + i))) } @@ -528,7 +528,7 @@ func greyobject(obj, base, off uintptr, hbits heapBits, gcw *gcWorkProducer) { throw("greyobject: obj not pointer-aligned") } - if checkmarkphase { + if useCheckmark { if !hbits.isMarked() { print("runtime:greyobject: checkmarks finds unexpected unmarked object obj=", hex(obj), "\n") print("runtime: found obj at *(", hex(base), "+", hex(off), ")\n") @@ -591,7 +591,7 @@ func greyobject(obj, base, off uintptr, hbits heapBits, gcw *gcWorkProducer) { hbits.setMarked() } - if !checkmarkphase && hbits.typeBits() == typeDead { + if !useCheckmark && hbits.typeBits() == typeDead { return // noscan object } @@ -611,7 +611,7 @@ func gcmarknewobject_m(obj uintptr) { if gcphase != _GCmarktermination { throw("marking new object while not in mark termination phase") } - if checkmarkphase { // The world should be stopped so this should not happen. + if useCheckmark { // The world should be stopped so this should not happen. throw("gcmarknewobject called while doing checkmark") } @@ -636,13 +636,14 @@ func gcmarknewobject_m(obj uintptr) { // there are no more pointers in the object. This information is held // in the second nibble. -// When marking an object if the bool checkmarkphase is true one uses the above -// encoding, otherwise one uses the bitMarked bit in the lower two bits -// of the nibble. -var checkmarkphase = false +// If useCheckmark is true, marking of an object uses the +// checkmark bits (encoding above) instead of the standard +// mark bits. +var useCheckmark = false //go:nowritebarrier func initCheckmarks() { + useCheckmark = true for _, s := range work.spans { if s.state == _MSpanInUse { heapBitsForSpan(s.base()).initCheckmarkSpan(s.layout()) @@ -651,6 +652,7 @@ func initCheckmarks() { } func clearCheckmarks() { + useCheckmark = false for _, s := range work.spans { if s.state == _MSpanInUse { heapBitsForSpan(s.base()).clearCheckmarkSpan(s.layout()) diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go index 92ddc51e1f..ab18d5ff88 100644 --- a/src/runtime/mgcsweep.go +++ b/src/runtime/mgcsweep.go @@ -11,8 +11,8 @@ import "unsafe" var sweep sweepdata // State of background sweep. -// Protected by gclock. type sweepdata struct { + lock mutex g *g parked bool started bool @@ -23,8 +23,6 @@ type sweepdata struct { npausesweep uint32 } -var gclock mutex - //go:nowritebarrier func finishsweep_m() { // The world is stopped so we should be able to complete the sweeps @@ -51,16 +49,16 @@ func bgsweep() { sweep.nbgsweep++ Gosched() } - lock(&gclock) + lock(&sweep.lock) if !gosweepdone() { // This can happen if a GC runs between // gosweepone returning ^0 above // and the lock being acquired. - unlock(&gclock) + unlock(&sweep.lock) continue } sweep.parked = true - goparkunlock(&gclock, "GC sweep wait", traceEvGoBlock) + goparkunlock(&sweep.lock, "GC sweep wait", traceEvGoBlock) } } @@ -145,10 +143,6 @@ func mSpan_EnsureSwept(s *mspan) { // caller takes care of it. //TODO go:nowritebarrier func mSpan_Sweep(s *mspan, preserve bool) bool { - if checkmarkphase { - throw("MSpan_Sweep: checkmark only runs in STW and after the sweep") - } - // It's critical that we enter this function with preemption disabled, // GC must not start while we are in the middle of this function. _g_ := getg() diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index d082f8e622..ba800aacef 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -747,8 +747,10 @@ func mHeap_Scavenge(k int32, now, limit uint64) { } } -func scavenge_m() { - mHeap_Scavenge(-1, ^uint64(0), 0) +//go:linkname runtime_debug_freeOSMemory runtime/debug.freeOSMemory +func runtime_debug_freeOSMemory() { + startGC(gcForceBlockMode) + systemstack(func() { mHeap_Scavenge(-1, ^uint64(0), 0) }) } // Initialize a new span with the given start and npages. diff --git a/src/runtime/pprof/trace_parser_test.go b/src/runtime/pprof/trace_parser_test.go deleted file mode 100644 index c1c43245ef..0000000000 --- a/src/runtime/pprof/trace_parser_test.go +++ /dev/null @@ -1,656 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pprof_test - -import ( - "bufio" - "bytes" - "fmt" - "io" - "os/exec" - "sort" - "strconv" - "strings" -) - -// Event describes one event in the trace. -type Event struct { - off int // offset in input file (for debugging and error reporting) - typ byte // one of traceEv* - ts int64 // timestamp in nanoseconds - p int // P on which the event happened (can be one of timerP, netpollP, syscallP) - g uint64 // G on which the event happened - stkID uint64 // unique stack ID - stk []*Frame // stack trace (can be empty) - args [2]uint64 // event-type-specific arguments - // linked event (can be nil), depends on event type: - // for GCStart: the GCStop - // for GCScanStart: the GCScanDone - // for GCSweepStart: the GCSweepDone - // for GoCreate: first GoStart of the created goroutine - // for GoStart: the associated GoEnd, GoBlock or other blocking event - // for GoSched/GoPreempt: the next GoStart - // for GoBlock and other blocking events: the unblock event - // for GoUnblock: the associated GoStart - // for blocking GoSysCall: the associated GoSysExit - // for GoSysExit: the next GoStart - link *Event -} - -// Frame is a frame in stack traces. -type Frame struct { - pc uint64 - fn string - file string - line int -} - -const ( - // Special P identifiers: - timerP = 1000000 + iota // depicts timer unblocks - netpollP // depicts network unblocks - syscallP // depicts returns from syscalls -) - -// parseTrace parses, post-processes and verifies the trace. -func parseTrace(r io.Reader) ([]*Event, error) { - rawEvents, err := readTrace(r) - if err != nil { - return nil, err - } - events, err := parseEvents(rawEvents) - if err != nil { - return nil, err - } - err = postProcessTrace(events) - if err != nil { - return nil, err - } - return events, nil -} - -// RawEvent is a helper type used during parsing. -type RawEvent struct { - off int - typ byte - args []uint64 -} - -// readTrace does wire-format parsing and verification. -// It does not care about specific event types and argument meaning. -func readTrace(r io.Reader) ([]RawEvent, error) { - // Read and validate trace header. - var buf [8]byte - off, err := r.Read(buf[:]) - if off != 8 || err != nil { - return nil, fmt.Errorf("failed to read header: read %v, err %v", off, err) - } - if bytes.Compare(buf[:], []byte("gotrace\x00")) != 0 { - return nil, fmt.Errorf("not a trace file") - } - - // Read events. - var events []RawEvent - for { - // Read event type and number of arguments (1 byte). - off0 := off - n, err := r.Read(buf[:1]) - if err == io.EOF { - break - } - if err != nil || n != 1 { - return nil, fmt.Errorf("failed to read trace at offset 0x%x: n=%v err=%v", off0, n, err) - } - off += n - typ := buf[0] << 2 >> 2 - narg := buf[0]>>6 + 1 - ev := RawEvent{typ: typ, off: off0} - if narg <= 3 { - for i := 0; i < int(narg); i++ { - var v uint64 - v, off, err = readVal(r, off) - if err != nil { - return nil, err - } - ev.args = append(ev.args, v) - } - } else { - // If narg == 4, the first value is length of the event in bytes. - var v uint64 - v, off, err = readVal(r, off) - if err != nil { - return nil, err - } - evLen := v - off1 := off - for evLen > uint64(off-off1) { - v, off, err = readVal(r, off) - if err != nil { - return nil, err - } - ev.args = append(ev.args, v) - } - if evLen != uint64(off-off1) { - return nil, fmt.Errorf("event has wrong length at offset 0x%x: want %v, got %v", off0, evLen, off-off1) - } - } - events = append(events, ev) - } - return events, nil -} - -// Parse events transforms raw events into events. -// It does analyze and verify per-event-type arguments. -func parseEvents(rawEvents []RawEvent) (events []*Event, err error) { - var ticksPerSec, lastTs int64 - var lastG, timerGoid uint64 - var lastP int - lastGs := make(map[int]uint64) // last goroutine running on P - stacks := make(map[uint64][]*Frame) - for _, raw := range rawEvents { - if raw.typ == traceEvNone || raw.typ >= traceEvCount { - err = fmt.Errorf("unknown event type %v at offset 0x%x", raw.typ, raw.off) - return - } - desc := evDescriptions[raw.typ] - if desc.name == "" { - err = fmt.Errorf("missing description for event type %v", raw.typ) - return - } - if raw.typ != traceEvStack { - narg := len(desc.args) - if desc.stack { - narg++ - } - if raw.typ != traceEvBatch && raw.typ != traceEvFrequency && raw.typ != traceEvTimerGoroutine { - narg++ // timestamp - } - if len(raw.args) != narg { - err = fmt.Errorf("%v has wrong number of arguments at offset 0x%x: want %v, got %v", - desc.name, raw.off, narg, len(raw.args)) - return - } - } - switch raw.typ { - case traceEvBatch: - lastGs[lastP] = lastG - lastP = int(raw.args[0]) - lastG = lastGs[lastP] - lastTs = int64(raw.args[1]) - case traceEvFrequency: - ticksPerSec = int64(raw.args[0]) - if ticksPerSec <= 0 { - err = fmt.Errorf("traceEvFrequency contains invalid frequency %v at offset 0x%x", - ticksPerSec, raw.off) - return - } - case traceEvTimerGoroutine: - timerGoid = raw.args[0] - case traceEvStack: - if len(raw.args) < 2 { - err = fmt.Errorf("traceEvStack has wrong number of arguments at offset 0x%x: want at least 2, got %v", - raw.off, len(raw.args)) - return - } - size := raw.args[1] - if size > 1000 { - err = fmt.Errorf("traceEvStack has bad number of frames at offset 0x%x: %v", - raw.off, size) - return - } - id := raw.args[0] - if id != 0 && size > 0 { - stk := make([]*Frame, size) - for i := 0; i < int(size); i++ { - stk[i] = &Frame{pc: raw.args[i+2]} - } - stacks[id] = stk - } - default: - e := &Event{off: raw.off, typ: raw.typ, p: lastP, g: lastG} - e.ts = lastTs + int64(raw.args[0]) - lastTs = e.ts - for i := range desc.args { - e.args[i] = raw.args[i+1] - } - if desc.stack { - e.stkID = raw.args[len(desc.args)+1] - } - switch raw.typ { - case traceEvGoStart: - lastG = e.args[0] - e.g = lastG - case traceEvGCStart, traceEvGCDone, traceEvGCScanStart, traceEvGCScanDone: - e.g = 0 - case traceEvGoEnd, traceEvGoStop, traceEvGoSched, traceEvGoPreempt, - traceEvGoSleep, traceEvGoBlock, traceEvGoBlockSend, traceEvGoBlockRecv, - traceEvGoBlockSelect, traceEvGoBlockSync, traceEvGoBlockCond, traceEvGoBlockNet, - traceEvGoSysBlock: - lastG = 0 - } - events = append(events, e) - } - } - - // Attach stack traces. - for _, ev := range events { - if ev.stkID != 0 { - ev.stk = stacks[ev.stkID] - } - } - - // Sort by time and translate cpu ticks to real time. - sort.Sort(EventList(events)) - if ticksPerSec == 0 { - err = fmt.Errorf("no traceEvFrequency event") - return - } - minTs := events[0].ts - for _, ev := range events { - ev.ts = (ev.ts - minTs) * 1e9 / ticksPerSec - // Move timers and syscalls to separate fake Ps. - if timerGoid != 0 && ev.g == timerGoid && ev.typ == traceEvGoUnblock { - ev.p = timerP - } - if ev.typ == traceEvGoSysExit { - ev.p = syscallP - ev.g = ev.args[0] - } - } - - return -} - -// postProcessTrace does inter-event verification and information restoration. -// The resulting trace is guaranteed to be consistent -// (for example, a P does not run two Gs at the same time, or a G is indeed -// blocked before an unblock event). -func postProcessTrace(events []*Event) error { - const ( - gDead = iota - gRunnable - gRunning - gWaiting - ) - type gdesc struct { - state int - ev *Event - evStart *Event - } - type pdesc struct { - running bool - g uint64 - evGC *Event - evScan *Event - evSweep *Event - } - - gs := make(map[uint64]gdesc) - ps := make(map[int]pdesc) - gs[0] = gdesc{state: gRunning} - - checkRunning := func(p pdesc, g gdesc, ev *Event) error { - name := evDescriptions[ev.typ].name - if g.state != gRunning { - return fmt.Errorf("g %v is not running while %v (offset %v, time %v)", ev.g, name, ev.off, ev.ts) - } - if p.g != ev.g { - return fmt.Errorf("p %v is not running g %v while %v (offset %v, time %v)", ev.p, ev.g, name, ev.off, ev.ts) - } - return nil - } - - for _, ev := range events { - g := gs[ev.g] - p := ps[ev.p] - - switch ev.typ { - case traceEvProcStart: - if p.running { - return fmt.Errorf("p %v is running before start (offset %v, time %v)", ev.p, ev.off, ev.ts) - } - p.running = true - case traceEvProcStop: - if !p.running { - return fmt.Errorf("p %v is not running before stop (offset %v, time %v)", ev.p, ev.off, ev.ts) - } - if p.g != 0 { - return fmt.Errorf("p %v is running a goroutine %v during stop (offset %v, time %v)", ev.p, p.g, ev.off, ev.ts) - } - p.running = false - case traceEvGCStart: - if p.evGC != nil { - return fmt.Errorf("previous GC is not ended before a new one (offset %v, time %v)", ev.off, ev.ts) - } - p.evGC = ev - case traceEvGCDone: - if p.evGC == nil { - return fmt.Errorf("bogus GC end (offset %v, time %v)", ev.off, ev.ts) - } - p.evGC.link = ev - p.evGC = nil - case traceEvGCScanStart: - if p.evScan != nil { - return fmt.Errorf("previous scanning is not ended before a new one (offset %v, time %v)", ev.off, ev.ts) - } - p.evScan = ev - case traceEvGCScanDone: - if p.evScan == nil { - return fmt.Errorf("bogus scanning end (offset %v, time %v)", ev.off, ev.ts) - } - p.evScan.link = ev - p.evScan = nil - case traceEvGCSweepStart: - if p.evSweep != nil { - return fmt.Errorf("previous sweeping is not ended before a new one (offset %v, time %v)", ev.off, ev.ts) - } - p.evSweep = ev - case traceEvGCSweepDone: - if p.evSweep == nil { - return fmt.Errorf("bogus sweeping end (offset %v, time %v)", ev.off, ev.ts) - } - p.evSweep.link = ev - p.evSweep = nil - case traceEvGoWaiting: - g1 := gs[ev.args[0]] - if g1.state != gRunnable { - return fmt.Errorf("g %v is not runnable before traceEvGoWaiting (offset %v, time %v)", ev.args[0], ev.off, ev.ts) - } - g1.state = gWaiting - gs[ev.args[0]] = g1 - case traceEvGoInSyscall: - // this case is intentionally left blank - case traceEvGoCreate: - if err := checkRunning(p, g, ev); err != nil { - return err - } - if _, ok := gs[ev.args[0]]; ok { - return fmt.Errorf("g %v already exists (offset %v, time %v)", ev.args[0], ev.off, ev.ts) - } - gs[ev.args[0]] = gdesc{state: gRunnable, ev: ev} - case traceEvGoStart: - if g.state != gRunnable { - return fmt.Errorf("g %v is not runnable before start (offset %v, time %v)", ev.g, ev.off, ev.ts) - } - if p.g != 0 { - return fmt.Errorf("p %v is already running g %v while start g %v (offset %v, time %v)", ev.p, p.g, ev.g, ev.off, ev.ts) - } - g.state = gRunning - g.evStart = ev - p.g = ev.g - if g.ev != nil { - if g.ev.typ == traceEvGoCreate { - // +1 because symblizer expects return pc. - ev.stk = []*Frame{&Frame{pc: g.ev.args[1] + 1}} - } - g.ev.link = ev - g.ev = nil - } - case traceEvGoEnd, traceEvGoStop: - if err := checkRunning(p, g, ev); err != nil { - return err - } - g.evStart.link = ev - g.evStart = nil - g.state = gDead - p.g = 0 - case traceEvGoSched, traceEvGoPreempt: - if err := checkRunning(p, g, ev); err != nil { - return err - } - g.state = gRunnable - g.evStart.link = ev - g.evStart = nil - p.g = 0 - g.ev = ev - case traceEvGoUnblock: - if g.state != gRunning { - return fmt.Errorf("g %v is not running while unpark (offset %v, time %v)", ev.g, ev.off, ev.ts) - } - if ev.p != timerP && p.g != ev.g { - return fmt.Errorf("p %v is not running g %v while unpark (offset %v, time %v)", ev.p, ev.g, ev.off, ev.ts) - } - g1 := gs[ev.args[0]] - if g1.state != gWaiting { - return fmt.Errorf("g %v is not waiting before unpark (offset %v, time %v)", ev.args[0], ev.off, ev.ts) - } - if g1.ev != nil && g1.ev.typ == traceEvGoBlockNet && ev.p != timerP { - ev.p = netpollP - } - if g1.ev != nil { - g1.ev.link = ev - } - g1.state = gRunnable - g1.ev = ev - gs[ev.args[0]] = g1 - case traceEvGoSysCall: - if err := checkRunning(p, g, ev); err != nil { - return err - } - g.ev = ev - case traceEvGoSysBlock: - if err := checkRunning(p, g, ev); err != nil { - return err - } - g.state = gRunnable - g.evStart.link = ev - g.evStart = nil - p.g = 0 - case traceEvGoSysExit: - if g.state != gRunnable { - return fmt.Errorf("g %v is not runnable during syscall exit (offset %v, time %v)", ev.g, ev.off, ev.ts) - } - if g.ev != nil && g.ev.typ == traceEvGoSysCall { - g.ev.link = ev - } - g.ev = ev - case traceEvGoSleep, traceEvGoBlock, traceEvGoBlockSend, traceEvGoBlockRecv, - traceEvGoBlockSelect, traceEvGoBlockSync, traceEvGoBlockCond, traceEvGoBlockNet: - if err := checkRunning(p, g, ev); err != nil { - return err - } - g.state = gWaiting - g.ev = ev - g.evStart.link = ev - g.evStart = nil - p.g = 0 - } - - gs[ev.g] = g - ps[ev.p] = p - } - - return nil -} - -// symbolizeTrace attaches func/file/line info to stack traces. -func symbolizeTrace(events []*Event, bin string) error { - // First, collect and dedup all pcs. - pcs := make(map[uint64]*Frame) - for _, ev := range events { - for _, f := range ev.stk { - pcs[f.pc] = nil - } - } - - // Start addr2line. - cmd := exec.Command("go", "tool", "addr2line", bin) - in, err := cmd.StdinPipe() - if err != nil { - return fmt.Errorf("failed to pipe addr2line stdin: %v", err) - } - out, err := cmd.StdoutPipe() - if err != nil { - return fmt.Errorf("failed to pipe addr2line stdout: %v", err) - } - err = cmd.Start() - if err != nil { - return fmt.Errorf("failed to start addr2line: %v", err) - } - outb := bufio.NewReader(out) - - // Write all pcs to addr2line. - // Need to copy pcs to an array, because map iteration order is non-deterministic. - var pcArray []uint64 - for pc := range pcs { - pcArray = append(pcArray, pc) - _, err := fmt.Fprintf(in, "0x%x\n", pc-1) - if err != nil { - return fmt.Errorf("failed to write to addr2line: %v", err) - } - } - in.Close() - - // Read in answers. - for _, pc := range pcArray { - fn, err := outb.ReadString('\n') - if err != nil { - return fmt.Errorf("failed to read from addr2line: %v", err) - } - file, err := outb.ReadString('\n') - if err != nil { - return fmt.Errorf("failed to read from addr2line: %v", err) - } - f := &Frame{pc: pc} - f.fn = fn[:len(fn)-1] - f.file = file[:len(file)-1] - if colon := strings.LastIndex(f.file, ":"); colon != -1 { - ln, err := strconv.Atoi(f.file[colon+1:]) - if err == nil { - f.file = f.file[:colon] - f.line = ln - } - } - pcs[pc] = f - } - cmd.Wait() - - // Replace frames in events array. - for _, ev := range events { - for i, f := range ev.stk { - ev.stk[i] = pcs[f.pc] - } - } - - return nil -} - -// readVal reads unsigned base-128 value from r. -func readVal(r io.Reader, off0 int) (v uint64, off int, err error) { - off = off0 - for i := 0; i < 10; i++ { - var buf [1]byte - var n int - n, err = r.Read(buf[:]) - if err != nil || n != 1 { - return 0, 0, fmt.Errorf("failed to read trace at offset: read %v, error %v", off0, n, err) - } - off++ - v |= uint64(buf[0]&0x7f) << (uint(i) * 7) - if buf[0]&0x80 == 0 { - return - } - } - return 0, 0, fmt.Errorf("bad value at offset 0x%x", off0) -} - -type EventList []*Event - -func (l EventList) Len() int { - return len(l) -} - -func (l EventList) Less(i, j int) bool { - return l[i].ts < l[j].ts -} - -func (l EventList) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} - -// Event types in the trace. -// Verbatim copy from src/runtime/trace.go. -const ( - traceEvNone = 0 // unused - traceEvBatch = 1 // start of per-P batch of events [pid, timestamp] - traceEvFrequency = 2 // contains tracer timer frequency [frequency (ticks per second)] - traceEvStack = 3 // stack [stack id, number of PCs, array of PCs] - traceEvGomaxprocs = 4 // current value of GOMAXPROCS [timestamp, GOMAXPROCS, stack id] - traceEvProcStart = 5 // start of P [timestamp] - traceEvProcStop = 6 // stop of P [timestamp] - traceEvGCStart = 7 // GC start [timestamp, stack id] - traceEvGCDone = 8 // GC done [timestamp] - traceEvGCScanStart = 9 // GC scan start [timestamp] - traceEvGCScanDone = 10 // GC scan done [timestamp] - traceEvGCSweepStart = 11 // GC sweep start [timestamp, stack id] - traceEvGCSweepDone = 12 // GC sweep done [timestamp] - traceEvGoCreate = 13 // goroutine creation [timestamp, new goroutine id, start PC, stack id] - traceEvGoStart = 14 // goroutine starts running [timestamp, goroutine id] - traceEvGoEnd = 15 // goroutine ends [timestamp] - traceEvGoStop = 16 // goroutine stops (like in select{}) [timestamp, stack] - traceEvGoSched = 17 // goroutine calls Gosched [timestamp, stack] - traceEvGoPreempt = 18 // goroutine is preempted [timestamp, stack] - traceEvGoSleep = 19 // goroutine calls Sleep [timestamp, stack] - traceEvGoBlock = 20 // goroutine blocks [timestamp, stack] - traceEvGoUnblock = 21 // goroutine is unblocked [timestamp, goroutine id, stack] - traceEvGoBlockSend = 22 // goroutine blocks on chan send [timestamp, stack] - traceEvGoBlockRecv = 23 // goroutine blocks on chan recv [timestamp, stack] - traceEvGoBlockSelect = 24 // goroutine blocks on select [timestamp, stack] - traceEvGoBlockSync = 25 // goroutine blocks on Mutex/RWMutex [timestamp, stack] - traceEvGoBlockCond = 26 // goroutine blocks on Cond [timestamp, stack] - traceEvGoBlockNet = 27 // goroutine blocks on network [timestamp, stack] - traceEvGoSysCall = 28 // syscall enter [timestamp, stack] - traceEvGoSysExit = 29 // syscall exit [timestamp, goroutine id] - traceEvGoSysBlock = 30 // syscall blocks [timestamp, stack] - traceEvGoWaiting = 31 // denotes that goroutine is blocked when tracing starts [goroutine id] - traceEvGoInSyscall = 32 // denotes that goroutine is in syscall when tracing starts [goroutine id] - traceEvHeapAlloc = 33 // memstats.heap_alloc change [timestamp, heap_alloc] - traceEvNextGC = 34 // memstats.next_gc change [timestamp, next_gc] - traceEvTimerGoroutine = 35 // denotes timer goroutine [timer goroutine id] - traceEvCount = 36 -) - -var evDescriptions = [traceEvCount]struct { - name string - stack bool - args []string -}{ - traceEvNone: {"None", false, []string{}}, - traceEvBatch: {"Batch", false, []string{"p", "ticks"}}, - traceEvFrequency: {"Frequency", false, []string{"freq"}}, - traceEvStack: {"Stack", false, []string{"id", "siz"}}, - traceEvGomaxprocs: {"Gomaxprocs", true, []string{"procs"}}, - traceEvProcStart: {"ProcStart", false, []string{}}, - traceEvProcStop: {"ProcStop", false, []string{}}, - traceEvGCStart: {"GCStart", true, []string{}}, - traceEvGCDone: {"GCDone", false, []string{}}, - traceEvGCScanStart: {"GCScanStart", false, []string{}}, - traceEvGCScanDone: {"GCScanDone", false, []string{}}, - traceEvGCSweepStart: {"GCSweepStart", true, []string{}}, - traceEvGCSweepDone: {"GCSweepDone", false, []string{}}, - traceEvGoCreate: {"GoCreate", true, []string{"g", "pc"}}, - traceEvGoStart: {"GoStart", false, []string{"g"}}, - traceEvGoEnd: {"GoEnd", false, []string{}}, - traceEvGoStop: {"GoStop", true, []string{}}, - traceEvGoSched: {"GoSched", true, []string{}}, - traceEvGoPreempt: {"GoPreempt", true, []string{}}, - traceEvGoSleep: {"GoSleep", true, []string{}}, - traceEvGoBlock: {"GoBlock", true, []string{}}, - traceEvGoUnblock: {"GoUnblock", true, []string{"g"}}, - traceEvGoBlockSend: {"GoBlockSend", true, []string{}}, - traceEvGoBlockRecv: {"GoBlockRecv", true, []string{}}, - traceEvGoBlockSelect: {"GoBlockSelect", true, []string{}}, - traceEvGoBlockSync: {"GoBlockSync", true, []string{}}, - traceEvGoBlockCond: {"GoBlockCond", true, []string{}}, - traceEvGoBlockNet: {"GoBlockNet", true, []string{}}, - traceEvGoSysCall: {"GoSysCall", true, []string{}}, - traceEvGoSysExit: {"GoSysExit", false, []string{"g"}}, - traceEvGoSysBlock: {"GoSysBlock", true, []string{}}, - traceEvGoWaiting: {"GoWaiting", false, []string{"g"}}, - traceEvGoInSyscall: {"GoInSyscall", false, []string{"g"}}, - traceEvHeapAlloc: {"HeapAlloc", false, []string{"mem"}}, - traceEvNextGC: {"NextGC", false, []string{"mem"}}, - traceEvTimerGoroutine: {"TimerGoroutine", false, []string{"g"}}, -} diff --git a/src/runtime/pprof/trace_test.go b/src/runtime/pprof/trace_test.go index 1b99830bfa..e19e695e50 100644 --- a/src/runtime/pprof/trace_test.go +++ b/src/runtime/pprof/trace_test.go @@ -6,6 +6,7 @@ package pprof_test import ( "bytes" + "internal/trace" "net" "os" "runtime" @@ -66,7 +67,7 @@ func TestTrace(t *testing.T) { t.Fatalf("failed to start tracing: %v", err) } StopTrace() - _, err := parseTrace(buf) + _, err := trace.Parse(buf) if err != nil { t.Fatalf("failed to parse trace: %v", err) } @@ -198,12 +199,153 @@ func TestTraceStress(t *testing.T) { runtime.GOMAXPROCS(procs) StopTrace() - _, err = parseTrace(buf) + _, err = trace.Parse(buf) if err != nil { t.Fatalf("failed to parse trace: %v", err) } } +// Do a bunch of various stuff (timers, GC, network, etc) in a separate goroutine. +// And concurrently with all that start/stop trace 3 times. +func TestTraceStressStartStop(t *testing.T) { + skipTraceTestsIfNeeded(t) + + defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(8)) + outerDone := make(chan bool) + + go func() { + defer func() { + outerDone <- true + }() + + var wg sync.WaitGroup + done := make(chan bool) + + wg.Add(1) + go func() { + <-done + wg.Done() + }() + + rp, wp, err := os.Pipe() + if err != nil { + t.Fatalf("failed to create pipe: %v", err) + } + defer func() { + rp.Close() + wp.Close() + }() + wg.Add(1) + go func() { + var tmp [1]byte + rp.Read(tmp[:]) + <-done + wg.Done() + }() + time.Sleep(time.Millisecond) + + go func() { + runtime.LockOSThread() + for { + select { + case <-done: + return + default: + runtime.Gosched() + } + } + }() + + runtime.GC() + // Trigger GC from malloc. + for i := 0; i < 1e3; i++ { + _ = make([]byte, 1<<20) + } + + // Create a bunch of busy goroutines to load all Ps. + for p := 0; p < 10; p++ { + wg.Add(1) + go func() { + // Do something useful. + tmp := make([]byte, 1<<16) + for i := range tmp { + tmp[i]++ + } + _ = tmp + <-done + wg.Done() + }() + } + + // Block in syscall. + wg.Add(1) + go func() { + var tmp [1]byte + rp.Read(tmp[:]) + <-done + wg.Done() + }() + + runtime.GOMAXPROCS(runtime.GOMAXPROCS(1)) + + // Test timers. + timerDone := make(chan bool) + go func() { + time.Sleep(time.Millisecond) + timerDone <- true + }() + <-timerDone + + // A bit of network. + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatalf("listen failed: %v", err) + } + defer ln.Close() + go func() { + c, err := ln.Accept() + if err != nil { + return + } + time.Sleep(time.Millisecond) + var buf [1]byte + c.Write(buf[:]) + c.Close() + }() + c, err := net.Dial("tcp", ln.Addr().String()) + if err != nil { + t.Fatalf("dial failed: %v", err) + } + var tmp [1]byte + c.Read(tmp[:]) + c.Close() + + go func() { + runtime.Gosched() + select {} + }() + + // Unblock helper goroutines and wait them to finish. + wp.Write(tmp[:]) + wp.Write(tmp[:]) + close(done) + wg.Wait() + }() + + for i := 0; i < 3; i++ { + buf := new(bytes.Buffer) + if err := StartTrace(buf); err != nil { + t.Fatalf("failed to start tracing: %v", err) + } + time.Sleep(time.Millisecond) + StopTrace() + if _, err := trace.Parse(buf); err != nil { + t.Fatalf("failed to parse trace: %v", err) + } + } + <-outerDone +} + func TestTraceSymbolize(t *testing.T) { skipTraceTestsIfNeeded(t) if runtime.GOOS == "nacl" { @@ -215,24 +357,24 @@ func TestTraceSymbolize(t *testing.T) { } runtime.GC() StopTrace() - events, err := parseTrace(buf) + events, err := trace.Parse(buf) if err != nil { t.Fatalf("failed to parse trace: %v", err) } - err = symbolizeTrace(events, os.Args[0]) + err = trace.Symbolize(events, os.Args[0]) if err != nil { t.Fatalf("failed to symbolize trace: %v", err) } found := false eventLoop: for _, ev := range events { - if ev.typ != traceEvGCStart { + if ev.Type != trace.EvGCStart { continue } - for _, f := range ev.stk { - if strings.HasSuffix(f.file, "trace_test.go") && - strings.HasSuffix(f.fn, "pprof_test.TestTraceSymbolize") && - f.line == 216 { + for _, f := range ev.Stk { + if strings.HasSuffix(f.File, "trace_test.go") && + strings.HasSuffix(f.Fn, "pprof_test.TestTraceSymbolize") && + f.Line == 358 { found = true break eventLoop } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 027416a9ec..d251c314d4 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -123,7 +123,7 @@ func forcegchelper() { if debug.gctrace > 0 { println("GC forced") } - gogc(1) + startGC(gcForceMode) } } diff --git a/src/runtime/race.go b/src/runtime/race.go index e7703ba770..923d6113f6 100644 --- a/src/runtime/race.go +++ b/src/runtime/race.go @@ -23,6 +23,9 @@ func RaceSemrelease(s *uint32) // private interface for the runtime const raceenabled = true +// For all functions accepting callerpc and pc, +// callerpc is a return PC of the function that calls this function, +// pc is start PC of the function that calls this function. func raceReadObjectPC(t *_type, addr unsafe.Pointer, callerpc, pc uintptr) { kind := t.kind & kindMask if kind == kindArray || kind == kindStruct { diff --git a/src/runtime/race/README b/src/runtime/race/README index 7f185359fe..52dd38e580 100644 --- a/src/runtime/race/README +++ b/src/runtime/race/README @@ -9,4 +9,4 @@ $ ./buildgo.sh Tested with gcc 4.6.1 and 4.7.0. On Windows it's built with 64-bit MinGW. -Current runtime is built on rev 215000. +Current runtime is built on rev 229396. diff --git a/src/runtime/race/race_darwin_amd64.syso b/src/runtime/race/race_darwin_amd64.syso Binary files differindex 81b48c6c94..9cf1eccde4 100644 --- a/src/runtime/race/race_darwin_amd64.syso +++ b/src/runtime/race/race_darwin_amd64.syso diff --git a/src/runtime/race/race_freebsd_amd64.syso b/src/runtime/race/race_freebsd_amd64.syso Binary files differindex 5bbe322299..50ae2d342a 100644 --- a/src/runtime/race/race_freebsd_amd64.syso +++ b/src/runtime/race/race_freebsd_amd64.syso diff --git a/src/runtime/race/race_linux_amd64.syso b/src/runtime/race/race_linux_amd64.syso Binary files differindex 49bf08ef38..a141051931 100644 --- a/src/runtime/race/race_linux_amd64.syso +++ b/src/runtime/race/race_linux_amd64.syso diff --git a/src/runtime/race/race_windows_amd64.syso b/src/runtime/race/race_windows_amd64.syso Binary files differindex a4eae9bdd9..125115eaab 100644 --- a/src/runtime/race/race_windows_amd64.syso +++ b/src/runtime/race/race_windows_amd64.syso diff --git a/src/runtime/race1.go b/src/runtime/race1.go index 41f4938e87..4c14d84746 100644 --- a/src/runtime/race1.go +++ b/src/runtime/race1.go @@ -227,26 +227,6 @@ func racereadrangepc(addr unsafe.Pointer, sz, callpc, pc uintptr) { } //go:nosplit -func racewriteobjectpc(addr unsafe.Pointer, t *_type, callpc, pc uintptr) { - kind := t.kind & _KindMask - if kind == _KindArray || kind == _KindStruct { - racewriterangepc(addr, t.size, callpc, pc) - } else { - racewritepc(addr, callpc, pc) - } -} - -//go:nosplit -func racereadobjectpc(addr unsafe.Pointer, t *_type, callpc, pc uintptr) { - kind := t.kind & _KindMask - if kind == _KindArray || kind == _KindStruct { - racereadrangepc(addr, t.size, callpc, pc) - } else { - racereadpc(addr, callpc, pc) - } -} - -//go:nosplit func raceacquire(addr unsafe.Pointer) { raceacquireg(getg(), addr) } diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s index 267cd6cec4..d9e674b61f 100644 --- a/src/runtime/race_amd64.s +++ b/src/runtime/race_amd64.s @@ -58,6 +58,7 @@ TEXT runtime·racereadpc(SB), NOSPLIT, $0-24 MOVQ addr+0(FP), RARG1 MOVQ callpc+8(FP), RARG2 MOVQ pc+16(FP), RARG3 + ADDQ $1, RARG3 // pc is function start, tsan wants return address // void __tsan_read_pc(ThreadState *thr, void *addr, void *callpc, void *pc); MOVQ $__tsan_read_pc(SB), AX JMP racecalladdr<>(SB) @@ -81,6 +82,7 @@ TEXT runtime·racewritepc(SB), NOSPLIT, $0-24 MOVQ addr+0(FP), RARG1 MOVQ callpc+8(FP), RARG2 MOVQ pc+16(FP), RARG3 + ADDQ $1, RARG3 // pc is function start, tsan wants return address // void __tsan_write_pc(ThreadState *thr, void *addr, void *callpc, void *pc); MOVQ $__tsan_write_pc(SB), AX JMP racecalladdr<>(SB) @@ -105,6 +107,7 @@ TEXT runtime·racereadrangepc1(SB), NOSPLIT, $0-24 MOVQ addr+0(FP), RARG1 MOVQ size+8(FP), RARG2 MOVQ pc+16(FP), RARG3 + ADDQ $1, RARG3 // pc is function start, tsan wants return address // void __tsan_read_range(ThreadState *thr, void *addr, uintptr size, void *pc); MOVQ $__tsan_read_range(SB), AX JMP racecalladdr<>(SB) @@ -129,6 +132,7 @@ TEXT runtime·racewriterangepc1(SB), NOSPLIT, $0-24 MOVQ addr+0(FP), RARG1 MOVQ size+8(FP), RARG2 MOVQ pc+16(FP), RARG3 + ADDQ $1, RARG3 // pc is function start, tsan wants return address // void __tsan_write_range(ThreadState *thr, void *addr, uintptr size, void *pc); MOVQ $__tsan_write_range(SB), AX JMP racecalladdr<>(SB) diff --git a/src/runtime/runtime-gdb.py b/src/runtime/runtime-gdb.py index 6076bcb11b..47a28f5ee6 100644 --- a/src/runtime/runtime-gdb.py +++ b/src/runtime/runtime-gdb.py @@ -227,8 +227,6 @@ def lookup_type(name): except gdb.error: pass -_rctp_type = gdb.lookup_type("struct reflect.rtype").pointer() - def iface_commontype(obj): if is_iface(obj): @@ -238,7 +236,7 @@ def iface_commontype(obj): else: return - return go_type_ptr.cast(_rctp_type).dereference() + return go_type_ptr.cast(gdb.lookup_type("struct reflect.rtype").pointer()).dereference() def iface_dtype(obj): diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index c056bfcdbf..f0d26c8edc 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -58,13 +58,6 @@ var ( iswindows int32 ) -// Information about what cpu features are available. -// Set on startup in asm_{x86/amd64}.s. -var ( -//cpuid_ecx uint32 -//cpuid_edx uint32 -) - func goargs() { if GOOS == "windows" { return diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index ca3e7d564e..ea2d55dbb6 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -562,12 +562,16 @@ var ( goos *int8 ncpu int32 iscgo bool - cpuid_ecx uint32 - cpuid_edx uint32 signote note forcegc forcegcstate sched schedt newprocs int32 + + // Information about what cpu features are available. + // Set on startup in asm_{x86,amd64}.s. + cpuid_ecx uint32 + cpuid_edx uint32 + lfenceBeforeRdtsc bool ) /* diff --git a/src/runtime/signal_unix.h b/src/runtime/signal_unix.h deleted file mode 100644 index 2d84a01864..0000000000 --- a/src/runtime/signal_unix.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#define SIG_DFL ((void*)0) -#define SIG_IGN ((void*)1) - -typedef void GoSighandler(int32, Siginfo*, void*, G*); -void runtime·setsig(int32, GoSighandler*, bool); -GoSighandler* runtime·getsig(int32); - -void runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp); -void runtime·raise(int32); - diff --git a/src/runtime/trace.go b/src/runtime/trace.go index e7937b3d17..9804092da3 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -190,7 +190,6 @@ func StopTrace() { } traceGoSched() - traceGoStart() for _, p := range &allp { if p == nil { |