diff --git a/web_widget_bokeh_chart/__manifest__.py b/web_widget_bokeh_chart/__manifest__.py index c84e3a454..ac6fd7670 100644 --- a/web_widget_bokeh_chart/__manifest__.py +++ b/web_widget_bokeh_chart/__manifest__.py @@ -6,13 +6,13 @@ "category": "Hidden", "summary": "This widget allows to display charts using Bokeh library.", "author": "ForgeFlow, " "Odoo Community Association (OCA)", - "version": "14.0.1.0.0", + "version": "14.0.2.3.1", "maintainers": ["LoisRForgeFlow"], "development_status": "Production/Stable", "website": "https://github.com/OCA/web", "depends": ["web"], "data": ["views/web_widget_bokeh_chart.xml"], - "external_dependencies": {"python": ["bokeh==1.1.0"]}, + "external_dependencies": {"python": ["bokeh==2.3.1"]}, "auto_install": False, "license": "LGPL-3", } diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.css b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.css deleted file mode 100644 index 2a2366073..000000000 --- a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.css +++ /dev/null @@ -1,747 +0,0 @@ -.bk-root { - position: relative; - width: auto; - height: auto; - z-index: 0; - box-sizing: border-box; - font-family: Helvetica, Arial, sans-serif; - font-size: 10pt; - /* Same border color used everywhere */ - /* Gray of icons */ -} -.bk-root .bk, -.bk-root .bk:before, -.bk-root .bk:after { - box-sizing: inherit; - margin: 0; - border: 0; - padding: 0; - background-image: none; - font-family: inherit; - font-size: 100%; - line-height: 1.42857143; -} -.bk-root pre.bk { - font-family: Courier, monospace; -} -.bk-root .bk-clearfix:before, -.bk-root .bk-clearfix:after { - content: ""; - display: table; -} -.bk-root .bk-clearfix:after { - clear: both; -} -.bk-root .bk-shading { - position: absolute; - display: block; - border: 1px dashed green; -} -.bk-root .bk-tile-attribution a { - color: black; -} -.bk-root .bk-tool-icon-box-select { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg0kduFrowAAAIdJREFUWMPtVtEKwCAI9KL//4e9DPZ3+wP3KgOjNZouFYI4C8q7s7DtB1lGIeMoRMRinCLXg/ML3EcFqpjjloOyZxRntxpwQ8HsgHYARKFAtSFrCg3TCdMFCE1BuuALEXJLjC4qENsFVXCESZw38/kWLOkC/K4PcOc/Hj03WkoDT3EaWW9egQul6CUbq90JTwAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-box-zoom { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg82t254aQAAAkBJREFUWMPN11+E1FEUB/DPTFn2qaeIpcSwr5NlUyJiKWVXWUqvlUh/iE3RY9mUekkPPURtLKNRrFJEeuphGfUUaVliiX1aVjGs6aG7+XX9ZnZ+d2fTl2vmnHvPPfeee/79Sk+may2/UQq/q7Qu+bAJoxjHIKqB/wlfUMcMVqI9bLZ+DGIKwzlzQ2GcxCx2xwvKOUKlaHTiX8bHNspjDONHkOmJBW5jIof/FvPh/06MZOb6cRc7cGn1AKUE5cdzlM/gAr5F/O24H3xkFRfxAbVygvK+cIsspjGWo1zgjeFpxL+BvnLw7laBA4xjIFJwrgu52DoVjKdY4HBEX8dSF3JLYe1fe6UcYCii3xWQjdfuSTnAtoheKCC7GNED5Zx4L4qt61jbTLHA94geKSC7P7ZeShQ0Inoi1IJuEOeORooFXkV0FZNdZs5qvFfKAeqYy7nZ6yg//HG0MBfffh71lFrQDCW2EvEP4mt4okZUDftz9rmGZkotmMxJRtlisy+MTniAWrty3AlXw0hFM2TD89l+oNsoOJXjbIs4EpqNtTCLXbiZ0g+M4mFObj8U3vsNjoZCVcmk60ZwthpepLZkB/AsivWfOJZxtpUQHfWib7KWDwzjeegBZJSdKFiE2qJTFFTwElsi/unQ/awXrU4WGMD7nOJxBY/1EO2iYConq93CHT1GOwucjdqnRyFz+VcHmMNefMY9nNkA3SWUOoXhQviSWQ4huLIRFlirFixnQq/XaKXUgg2xQNGv4V7x/RcW+AXPB3h7H1PaiQAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-zoom-in { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsUBmL8iQAAA2JJREFUWMO9l12IlFUYx3//MzPrLpSjkm5oN4FFIWVEl66IQlFYwtLOzozsjHdGRSCRF0sfBEXRVV0FQuQiLm5CZNBFgRRaRLVFhbJ2EdiN5gbK7toObTPn6eYdPTvNzPvOBz5Xh/ec5/n/n89zXtEHmZqeSXSuXBz/3zfdKvBWJHQrwZuRcP0El+QkbQXeBX6WZEgm6TtJk5lM5o4Lc+cV6qpf4Ga20Tm338zeATItVK9Ker6yvPzp4NDQ3+XieGsCU9MzTYumGbhz7m4ze9/MHgvBgItACrgfGAj2jgAvAYs3wlEujjc13kii8YyZrXXOfWhmo9GnFUlvOOemarVapVqtkslksmb2KjARqL62ecuWN9NxbRInzrldAXhV0uFSIfdew7G/gNLU9MwS8CwSmE3Oz88fcXG5blfpqVRq0Ix8VIAAX0XgrVL7HDCHGcCaWrV60LUBN8Dae58aQIxEqcA592I9M610JL0cpG/U9TIHJNKY3RV5z0R+7Nd4HZ0P1g/2RMBuegLAsRMnb4vT8d5vqKfMzOgtAlADrkmqGywmiMBTwfr3dC9j1Xv/r6Tvg/5/5ejxE6cO7M9faVbQZrYNOFSPmqQvVo9FKexvi5uWX58943aM7DwAfBDY+FbSCxP5sdkGx55GeguzrUEXPaSo2pFkAbiSZQCAzZJOmdkjwd6SpB/M7KykQTPbA2wDhoIzRzcNDx9MJwGNIXdJ0mEzmwbujL7dbma7gd03A7lKfnTOvf74nl0r6bonTUbujRSUCrm2d4L3/kvn3JPe+8+BDW2i9o+kT7z3kxP5sYsA6W47oE64TsR7P9tQL4vA2mh9WdIscKxUyJ0M7aR7acOGzikD65EQLEjaa2ZXzMwDFeB6qZBbbLTRE4EGeSaozNOZgYFf8qP7lmIvs354n0qlHpB0T7B9Ogl4IgJJrmjv/SiQjbrkD+BMUkfSbYATPdckrTOzkciWAXOlQu5cYgLdPEIapud9wMOR9zVJH3ViKx333mtHMJvNuoWFhZ3A+ojMcja77njXBEKwJJfTcqUyCIQ34Mf7nnh0paMnXacFuGoC1mr3AtuDfLzd8Zuyl+rfuGn4HLAD+Az4qZQf+61TAj0Noj8vX6oC35SL43u7teG6rf5+iXppwW7/JUL5D03qaFRvvUe+AAAAAElFTkSuQmCC"); -} -.bk-root .bk-tool-icon-zoom-out { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsHgty9VwAAA0FJREFUWMO9l09oXFUUxn/fmXlpItppi22k7UJBRSlVkCytSAuKUloIdjKT0El3FXVXdVFKRVAQV7qQohsNwdA0UFvBhYtqUVyIVlRaogtFQVq7qSTVjA3z3nHzBq/jvPmTN/Ss7rv3nvN99/y794kByMzcfE/7picn/jenmwWeRUI3E7wdCRskuCSTdDfwBvCtJEdySV9KOhpF0e0/LF5SqKtBgbv7ZjObcvfXgShD9Zqk5+orKx8Oj4z8NT05kU1gZm6+bdK0Azezu9z9hLs/HoIBvwAF4H5gKFh7B3gBWFY3460kWve4+3oze9fdx9OpVUmvmNlMHMf1RqNBFEUldz8OHAxUX9q6bduryut+Sfvc/Wz62ZD0fK1afjND9y3gGSRwv1GMojstTxUUCoVhdyopEYDzKXjWwZ4FFnEHWBc3Goet00m7lZlZYQixKw0FZnakGZksHUnHgvCN5/KARBH37enpOVg58H13HV0Kxg/kIuD/ngSA2ZMLt3bTSZJkUzNk7k4+D0AM/CGpaXCyBw/sC8Y/qZd2GpZiuL9YLN4Sx/HpoP5/c/exQ1OVq+1yyt13SLoArEsJnMjlgfOffvK3u58Kprab2QezJxfG2iTzUzI70wRPG9jbmpmb95SNB9mpzp7/j2yVdNbdx4K565K+cvfPJQ27+x5gBzAS7Hlvy+jo4WIvoC3kWpcvS3rR3eeAO9K529x9N7C7zX6AC2b28hN7Hl1Vt44niVq13LUjmtlYkiQfA5s6eO+GpDNJkhw9NFX5ueNt2ARodyF1IHIN2JiOl4H16fiKpK+B2Vq1vBAqFAf4IJkGNiIhWJK0192vunsC1IE/a9XycquNXARa5OnApeeioaHvKuP7r3dTGsiLqFAo7JR0T7B8rhfwXARa2us4UEqr5Ffgs151i/08oTNKdIO770ptObBYq5Yv5ibQq/sl3Qc8lJ4+lnSqH1vFfp9koZRKJVtaWnqkWXqSVkqlDe+vmUDWpZMlK/X6MBDegKf3P/nYaj8ErN9fqZBYEsf3Ag8G8Xit33BaniTcvGX0IvAw8BHwTa1y4Md+CeRqRL9fudwAvpienNi7Vhu21uwflOT+L+i1X2TJP57iUvUFtHWsAAAAAElFTkSuQmCC"); -} -.bk-root .bk-tool-icon-help { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABltpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgICAgICAgICAgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6Q29tcHJlc3Npb24+NTwvdGlmZjpDb21wcmVzc2lvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjcyPC90aWZmOllSZXNvbHV0aW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPHhtcE1NOkluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMzIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06SW5zdGFuY2VJRD4KICAgICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDNDIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkRlcml2ZWRGcm9tIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgPHN0UmVmOmluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMTIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6aW5zdGFuY2VJRD4KICAgICAgICAgICAgPHN0UmVmOmRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDMjIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6ZG9jdW1lbnRJRD4KICAgICAgICAgPC94bXBNTTpEZXJpdmVkRnJvbT4KICAgICAgICAgPGRjOnN1YmplY3Q+CiAgICAgICAgICAgIDxyZGY6U2VxLz4KICAgICAgICAgPC9kYzpzdWJqZWN0PgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNjoxMToyOCAxMToxMTo4MjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjY8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cphjt2AAAAT7SURBVFgJxRdbaFxFdGb2bhui227BWrsVKYgf2kJUbP9EUPuzEB803WTXJjH61Q/7Ya1+CMYKEVTsh4J/EpvY7BoabUiNiA8s1p+4KIhpoUUEselHqyS76TbZ3HuP58ydc3d2u4+IkQxczpz3mZkzZ86VYpXjvenpjZsLhUcliE4AuUuASAgptmt1EFdwPiclzIIUUwubNn17OJlcXo1p2UpodHRiux9xB1Eug1+slbzhFxGOKc851tu7/0oznYYBDA8Pt0U2tL8KQryIq2tvZqQhD0QJHRz3yqWhgYGBpXpydQMwqz6NCnurleCSADkJEfgKfOePqL80R/wV1ZaQyr1LenKfkPCkEPKeaj0xg7vxVL3duCmA0Vyuw/fl52hgBxsBED+h4Cv9z3R/zbRm8MTJTx7HQN7GQB6w5C4L4SX7M5lfLBpurjXMyvNIShiyi0l1pL8n9b7EDGPR8fHxzSsQ6XDB3618/xqo6Pk25V5MpVJllgHM1BO58RdQ612kOYZ+GXdij70TYQB05mpj+1kU5G2fB+l3PZtOf8NGx6ambnMXb3yAxg8wjSEG6OKKR9oicBQD+ZvpH2Wzj0lQpxCPG9qMv1x6hHNCsSAlHM7ZOa682vlI9tRDbvHGbD3nZAPpDoD/3JIrLpAs26UFkC3EMUA99hpfGtEBfJjNJnS2Gwnadnvl+Xw+iuc3DAJuNyIaSCHpilVldyDjjUxj3WDZIAhxhHHyRcdNuA7AAfUaXzVKODpzFiZ4/uLvh5G+m2no+C/pyIf7MqlEJB7bpqR6nXkEUfbeawuLaZsW2ISfNQ2vtaktQlGFQyIVGT0o2+2EC4iQNGwjBIN9qdQ5Qg4mk4X4rW3vCClLtowE2FOFUxKDfNmiZci3ovKKRFPh4FK9q4Zbdr+lKKJiA13TcHR2dmLBgdmQ0GAS2MZaEowY+XbAk09IvgtYZGp16SyvFhaHcIUh645t8T9DBCcnz5zZ4hZLu3DzK2QlL1QQa0Y+pHiJKPSuOGj3PmZTheM5w2TwqBxnvBZOTk7G5gvXJ5Aelms8wnJURL+olSWcfEhf6gDoUXPMq6ZlqbzWU2pE+3hi4s6F68tfIj9cBMlikr7Z0/P0b/X0yIcUXsDCF1WhtL4OROHaXk+xlkbV0Cu732Nmhc4peaWSg73pA8dq5RkvO37ldUTfXCKZv2q45MkhvG87WQEzpCCUSvV1d9GONBy3lMvgKSwrZig8gjAietWY0QriylO2jIo4yVbOSb7KB/qmI9BPKjHpSSXYauRyn92Nq9/Kcrj13x3s3v8D481glQ/0raiNYgX9njPSBOImbrHZePl+tfFmc9sH+Xaoh8NjOKSVdDMhjjYzQLy+dFceH5+IJQf9VYXX4tROg4ZFU8m31M3mfPEqUoJqCGJfvWpo2xnNfdrhC28n06SCeSzNZxlvBINGRXCtKS7EY1uV6V7HWAm38y1cXaXsMcOCvr9ySPj+af7A1U2HJXHzVNvUXVLIGyPf+jV0pf8GHoN+TLAyPkidTCi2RpPApmnR0Bd1zGRaB/B8Oj2HSw7LLbVR1MmskW8RdEWVXSJf3JbpAMgRtc4IZoxTh9qotQjCasm46M0YX9pV1VmbpvRH5OwwgdRtSg2vKaAz/1dNKVtb17Y8DCL4HVufHxMOYl1/zTgIgiYvBnFKfaNp3YjTdPz3n9Na8//X7/k/O1tdwopcZlcAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-hover { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4oVHp0SwAAAQJJREFUWMPtlsENgzAMRb8RQ5VJItFDOgaZAMaAA0iZpN3KPZSoEEHSQBCViI/G8pfNt/KAFFcPshPdoAGgZkYVVYjQAFCyFLN8tlAbXRwAxp61nc9XCkGERpZCxRDvBl0zoxp7K98GAACxxH29srNNmPsK2l7zHoHHXZDr+/9vwDfB3kgeSB5IHkgeOH0DmesJjSXi6pUvkYt5u9teVy6aWREDM0D0BRvmGRV5N6DsQkMzI64FidtI5t3AOKWaFhuioY8dlYf9TO1PREUh/9HVeAqzIThHgWZ6MuNmC1jiL1mK4pAzlKUojEmNsxcmL0J60tazWjLZFpClPbd9BMJfL95145YajN5RHQAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-crosshair { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADEUlEQVRYR81XXVIaQRCeHqug8CXmBNETaE4gniDwIgpVspxAbxC9ATkBkCpQ8gKeQDiB5AQxNyAvUlrldr7eHxyGXZi1rMJ5opbp7m++7un+htSGF204vsoMoNXrlzSpfWa1oxQfhAegCZGaEtPorHo8znIoJwCt6+td8uk7ApUQCIHTF4BNAWzImq8ap6cP68CsBdDp9i9ZqXM7ML79g/EnCWD+jgMKENKqWT+tXK0CkQqgNRjs0OxpQIqKhoMxaG6/6JeRnK7T6yO2UvVqhYSlLX+ryORfgKn9ORDFIy7ky41yGcwsr0QAQfDH5zucOswx819fs4egI9OFCcD8DjBF7VNbEX0JzdWEt3NHSSASAcCxBDqMgt/623kvyTgNgNjJIfTjk4D4FqaJR1715MjmYAmA5Bx3AwUXQL+t105KaTlcBSC26XRvhjEIoLiq1yqXpr8FAGG16/ug4IT27fxBWu7EiQuAiImJpEMKE6nYM30uAIDDttSUOPfJP7JzbjPhAiBIh9QE67vIvoOi9WJfCwDavf40ulpjbCqmUf+W753ezURuh7Dg1SqflwAEHU6pgfyBq9Y4qx0LG++2fnZ/eUzcstmdM2AWH+jfc+liWdBJfSENf8Lifi3GVwC9mybOfi5dzatWVrbbLIHNva8p5h/16gkaFiLGGxbufkoE6XguwePiXLF3XmMfCUCUAqtKXU7sumd1CowOuJEi3Pg1FBpjitIGhyvVSfvmjci6ZR+rFQfDiPVE2jFYeICQ+PoewwjC5h7CZld6DBdyu6nDSKgzOyIMhmhK5TTqXYbRorZYM46TmpKAAOrGWwSJJekSB1yqJNOzp1Gs7YJ0EDeySDIMtJbQHh6Kf/uFfNFZkolJICRmz0P8DKWZuIG2g1hpok+Mk0Qphs0h9lzMtWRoNvYLuVImUWrmPJDlBKeRBDfATGOpHkhw670QSHWGLLckmF1PTsMlYqMJpyUbiO0weiMMceqLVTcotnMCYAYJJbcuQrVgZFP0NOOJYpr62pf3AmrHfWUG4O7abefGAfwH7EXSMJafOlYAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-lasso-select { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgwlGP1qdAAABMBJREFUWMO9V1uIVVUY/r61z57ZMx4DnbzgkbQXL5iCJphlWdpIGY4jpFBkEiU9ZNaDRRcITcIwMwgxoQtU2IMXdAZfMjFvpERXYiSbysyBEXFmyuHMnLP32uvrwT2xnY5nxvHQ93Jg7fWv71/r//7L4a59TRgqJk+Z6v3a+sv0OI5nk5wu6VaSVZImAThHsgjgrKTvM5nMUWvtmf5n8HodCIKgOgzDhc65pSTrJQWDsSNpJX1ljHnDOfdT37oZLLHv+8OMMasKhcIJ59xHAJYMlhwAJGUAzJfUTHLFuFzOG5QDU6dNMyQfs9Yedc5tBpAD4IYYNQGoBrDtQnt7/b0LFrJsCHzfn2itfQfAnZLiazytA3AaQAuAiwDaEgeNpGkkswAWSBqRONB38b88z5uTKePt6iiKXkk8jq+iJC5LOmiMaTLGHLPWhmWeHr7vV0dRtATAapAzIVmSo51zyzIlbm2stesFPA6pKk0r6Ryg93y/ek8YFvPOOTg3cDSiKCoC2OP7/rEoirYm4rUkF12lAWNM1lr7lqQn0+QA8gI2jBg5cj6Aj8OwmB+KAKIoukhyp6SRJAUgl0ndPLDWPi9pJQCbuviXvu+/GIZhW1dnJ24UJFuTjCCA2ADA8sYGWmsXS3qmL94kDYAtkh4Nw7ANlQJ5U6INT1KrAYC9zQdykl7nFSj5fXp5Y8NWVBhy7mUAjqShMYdMXV2dJ2klyRwAJ8lIeuGWCRMP7N7frEqSG2OmAFhKshNAp5wrmO7u7jEAngPQm1S2z2pqapr+OPt7XEly0oxwzq2RdFmSD2AMgKKJouhhAL4kA+Cs53l7e3t7uytJHgRBreTWkXwkKVJnJD0B4GAGwIJE9R6AFufc6UqSZ7PZbD6ff5dkA4CQZEHSqwAOISmXtwGIE+F1SeqqIP8d+Xz+C0mLJYWSAODteXffczjdDQNJ0BWMCoLg5gqIbRTJNwHsljQhUb0luWPM2LE7Thw/9m/5NCT/TByxAOYWi8X6/gdWV1dnfN8fNRBxJpMZTXKdc+6IpFVJWAEgkvSJpA0X2tvtVTaSjgOYBCAEEADYSHK87/sfhmEYA9gShuEDkgzJHyWtB/B1irQ2juP7ADxkrX0wOUOpzmdpzEY590HJ7Ni1r2kSyZOSiv2+hSRjSTXp/QAukzySNJOJkmalyNIl10hqMcasdc61XDNcQRD8BnITgNp+36r6kfcNFMMlLQGwTNLMEuQGQBfJl2bdPru+HDkAZAqFQux53jZHEsC6aw0eg2gylNRBcqcx5v04ji999+03AwsWAOI4Lsy9a94WkisAnE5a5WCJYwCfA1g7LJudI2lTHMeXBm1faiQzxkyRtF3S5CTupeAB+KG2tnZFT0/P30NO2VKLzrmfAbwGMipjG5Oc0dPTc0Md05SZ5U4Q2FxChErtEYD7jTGNQ3UgM8Asv90Yc9I5LSKRlXSI5CxJa0jWSALJjKRnAewfkniT+vwf7N7fXHK9rq7O7+jo+BTA/NRrdBpjnnLOnUrvXd7YMPQXSBunneno6IhIHgYwW1JtkgmBpBkATlVMAwOk3nFJ+VSoqgCMr6gIy2FcLtdKspAedyQN/98caDt/3kpyabUmf8WvG/8A1vODTBVE/0MAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-pan { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4lKssI9gAAAOtJREFUWMPVll0KwyAMgNPgoc0JzDX2Mtgp3csKErSamGabIEUo/T6bHz0ezxdsjPJ5kvUDaROem7VJAp3gufkbtwtI+JYEOsHNEugIN0mgM1wtsVoF1MnyKtZHZBW4DVxoMh6jaAW0MTfnBAbALyUwCD6UwEB4VyJN4FXx4aqUAACgFLjzrsRP9AECAP4Cm88QtJeJrGivdeNdPpko+j1H7XzUB+6WYHmo4eDk4wj41XFMEfBZGXpK0F/eB+QhVcXslVo7i6eANjF5NYSojCN7wi05MJNgbfKiMaPZA75TBVKCrWWbnGrb3DPePZ9Bcbe/QecAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-xpan { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4X4hxZdgAAAMpJREFUWMPtlsEKwjAMhr/pwOOedINJe/PobWXCfAIvgo/nA4heOiilZQqN2yE5lpD/I38SWt3uD9aMHSuHAiiAAmwaYCqoM/0KMABtQYDW11wEaHyiEei28bWb8LGOkk5C4iEEgE11YBQWDyHGuAMD0CeS30IQPfACbC3o+Vd2bOIOWMCtoO1mC+ap3CfmoCokFs/SZd6E0ILjnzrhvFbyEJ2FIZzXyB6iZ3AkjITn8WOdSbbAoaD4NSW+tIZdQYBOPyQKoAAKkIsPv0se4A/1UC0AAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-ypan { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4anK0lywAAAMVJREFUWMPtlzEKwzAMRX/S7rlpIMXeOnaLaME36FLo8XqCdNFghGljyc4kgQi2Q/SUj0F/eL7eMMTKz6j9wNlYPGRrFcSoLH4XxQPvdQeYuPOlcLbw2dRTgqvoXEaolWM0aP4LYm0NkHYWzyFSSwlmzjw2sR6OvAXNwgEcwAEcwAEcwAEcoGYk20SiMCHlmVoCzACoojEqjHBmCeJOCOo1lgPA7Q8E8TvdjMmHuzsV3NFD4w+1t+Ai/gTx3qHuOFqdMQB8ASMwJX0IEHOeAAAAAElFTkSuQmCC"); -} -.bk-root .bk-tool-icon-range { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABCJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjMyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zMjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpzdWJqZWN0PgogICAgICAgICAgICA8cmRmOkJhZy8+CiAgICAgICAgIDwvZGM6c3ViamVjdD4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTgtMDQtMjhUMTQ6MDQ6NDk8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPlBpeGVsbWF0b3IgMy43PC94bXA6Q3JlYXRvclRvb2w+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrsrWBhAAAD60lEQVRYCcVWv2scRxSemZ097SHbSeWkcYwwclDhzr1Q5T6QE1LghP6BGNIYJGRWNlaZItiFK1mr+JAu4HQu0kjpU8sgF3ITAsaFg0hOvt2Zyfvmdsa7a610Unx44Zgf773vvfneezPHNzrbhn3CT3xC3wPXYOC8LDzqdi8YY/gwh4BeknS/2th6dr2kf94AOp3OFyWgMyziOPbMDxV9FTtJnl1ut795Xd0/YQ0/vtYQwMT1KXWCfr2IjOWwtNehwN4xL9ykTrm6Pzl58yLn3J+mKh9mXbT3uRjGEDph+O8/TjfP5dBp7Ha7AX7O3o5nZeD/0E/OGyXntDgzA0X6qmCnrVutVlrUWV9f/3xo+pwhGDhvEPHOjoxnZjJggXmMHzBQ7NGNp9vxk61fr0HR7e/u7pZzCGHlc7qwBYYTT7tJYSx1AQzppyFPft5apta9w7SKcn0b7P7+/jCsDQ5mbc0dCmIJGDN0ehdcjsmkm6A6KUeKFOTE11PLxrC7Ukqh3ylL2fT0NAP9q6ur6rRCJJYsbKB0JsbCKMuy+xREePDyxQPCz+Crlw062QcA5wBOOt1l6vIl2WiI9F1fN6Q+BBqit6hEC4Hk08GQJMn4myjSP7RavVxgdaVUh/3U6HCMsPr9pYnJKRziHtWQ+un58+hGs6nsjQSjpuTyKGN3CX+FBwHXSiEVgjP+O8X6N12kIePES+GzTKAkGbNp8yJsGUMVzz8jPKReiyAQRimy5/cjye5RpF8utFp/+nwmT7d/NMzcFkS7yjJNGDaPURQxIQThEQy0SyF4l5WJYYhBa816vZ6dU7A6CAhbZVow/pDe0O9hVOoCi13r4BgBAvJHqMSQL2vE/iH6IAXEwgrRVUmBoRRwnwJQT98xEeVeSUyB4dJ5nwJBKdCFFGRmUCcu7rwIYypCTblaChuNBhWODrman5ub+4v0rMNBt8z6Ezh7GksJQpCbm79cMQE7QBFm/X6f0rjWnv8WRYg/QdbUpwDAEBy8vPyA8rNGzg3a8MiElwiM7dAtRqNoNptjGPM1laVxP9umWEMGLOKhKUOJDtBwDmzsw9fC/CzHr9SGuCTi2LbbKvVtmqXpCjMihBFa79Wrt5fGx9PDzc3fmu32Lf8qFliwU9emKhBSp+kRKn/hu9k1COEDbFdt/BoKWOAkuEbdVYyoIXv8+I/QK9dMHEb1Knb7MHOv8LFFOsjzCVHWOD7Ltn+MXCRF4729vWMDK+p8rLkvwjLg4N4v741m5YuwCI9CvHp1Ha8gFdBoPnQAkGsYYGxxcfEI7QQlFCTGUXwjAz4tWF+EpymOWu7fglE7qsOvrYE6g4+9/x/vhRbMdLOCFgAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-polygon-select { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjc1OfiVKAAAAe1JREFUWMPt1r9rU1EUB/DPK0XbqphFHETo4OCiFhwF0V1KHbRSROLqon+AUMVRRFBwEbRFMBiV+mMW/wIxi5OD1kERRVKRJHUwLvfBTZrU5OWBGXLgQu7Jfe98z/ec7z0vKa88b2q1BDtRHdAPBaylm1NzsxsOjPnPNt6WSWprbft+/c3I3zOAjhT1Y4+fvcjEQJIXnVECSa+AhqIHqlHH5lWCZoe+Gk4GRgDG86j9SAUdlDBSQaZhlOkuHyoVdJmsw98D1S5fM4NYM1LCpqM+Lwa240oLgmZzpVZvzKT75VLZcqksSZKWlQeAy/iORVwIvh31xvotvK7VG3Px4aWHj3Jl4C2uYSvq+Bn8v6LLbaVWb9zsBiKLCvbiNG7gLm7jAYqbPHMJMziZ9lsKoh8GtqCEVVzHftwJn+TFHp4/hg8BSCYVfMOZoPEv2NZGdy9WCGUr9toDR3E2/H4V6nwRe/BmgN65H1ZhvMuB3XiKIyFoGefwO6ysVkUlrNUNsyAK/jli533Q+Y8cJFvAeXyMS1CI/jiMr/gUtD2LQwMGr4R3p7bY3oQHQ5b38CT4D2AXXg6YcQXHpyYnlqKsi5iOAVSwL9zd7zJ09r+Cpwq72omFMazjT9Dnibym0dTkRDUKrrgwH7MwXVyYB38BstaGDfLUTsgAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-redo { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4itK+dVQAAAaFJREFUWMPt1L1rFFEUBfDfJDaBBSslIFjbaSFp1FJQFMVCHkzhKIqdUYOCoBgErVz8rCwiTDMwBCIKipDWyip/gxAIWAmBgBC0eYFh2Gx2l9lFcA5M8e59782Zc84dWrT435Hs1siLchqn43MS0zgW22vYxjesYjVLw3YjBPKinMUTBOwf8J5fKLGYpWFjJAJ5Uc7gIW6jM6Kim3iNZ1katgYmEL/6I+YasvY7Lg6iRpIX5VF8wuEe/XV8wGf8jN6LWTiAc7iEQ7ucPZ+lYW0vAtfwvlbfwCKW9gpXDOv1mJvZHiSO91MiyYsyiQSuxtpXXM7SsDmM5nlRdrCMMz3sOJWl4Xevc/vwBzdwAl+yNNwZxfRI+GxelK9ikHcwh8d4NNR/YFRES1ZwoTYdR7I0rNf3TzVNIGbmSvR/Bx08mIgCFSVu4l2ltIWD9WxNGR+W8KOynqnZ0rwCeVG+wa0hjrxtWoF5dAfc28V8Mib/n+Nev5dnabg/zgw87aNEN/bHOwVRiRe4Wym9zNKwMKkpgIWKEt24njxiJlq0aPFv4i9ZWXMSPPhE/QAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-reset { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4gWqH8eQAABLdJREFUWMPtlktsVGUUx3/nfvfOlLQaY2IiRRMQIRpI0PjamJhoVASDvNpCpYw1vJQYSVwZwIVQF6wwRHmkAUof9ElrI6VqDAXcID4TF0IiYQMkSlTokNCZ+b7jove2t+NMH7rQBWd3v+989/zP+Z8X3Jb/WGQySvUNTQBJESkNguAVYIWqzhaRhwBU9WcR+QXoymazn6jqzUQiMQSQzWZRVdal1vwzAI2tHQBPOuc2AbWTdOyQ53n7nHNfRwee51GzqoIQMCLDpr3x/tLQ0oZzrk5Vj0/BOEBt+KYuOlBVGlrahr0Wob27t3gEjnZ2AyQzmUwHsDgP6J/AYRE553neDwDOuUdU9QngNeCumK4TkRMhZUORcYC1qysLA6iuSQHIwkWLD6lqapQsuSmwTVV3h99I7EcAR462A2xR2Ilq6ehTaejvO1774kuLNALR33eclsaGsQDe3fYegHl43vyNwEeqGl1963mm2jl7YZRTQ82qlWP4HM6ZToC5ztkW4LHQoALru7s6Di5dvlIj/e6ujrEAWoZDn8hmMjXATMACGaAVuBjXTVVXFc/AxhaA+4zvn1DV+eHxVWPMAmvtb5GeMWZyZVhI2rt7qVy2pOh9U1snwIPW2vMi4oWJuBPYHkVAVScPoKmtkzVVK6cEMsyJraHhiCqJqJUwj/JRz7TW1iSSyR2rVyylqa0Ta+24Ic8vXaAEmDFc/l5Z2A/80OibuVyuz/f9ElUdHCmvw82t5HK5h6y1PYhsz2YyGw43t2KtBZHIGwB6+j4rCkBVUdV7gXrggnPuu8h4eP+xMeZS2D0rJYZ6AdAMzAt1b4nI26p6IFZOY8pugijcKSIHVLUK0LyST4vnrVfnWr3mjmP4QTATaERkXkypRFX3isjmuHdRJEK6Ckqquopp06bdKCkp2Sgi7XnGLcg7gzeutwNIiPYc8HixqIrIOlU9ONVIhHPEd851icgSVXUiskVV94gIqoonIt0i8gfQCfwae38e6BWRXuBZz5jZ8VbaOE4EIqlZVUEQBLlkMplS1QER2RwkEnsSyaREDUzyeNsvIhvCMqkH1kdIJ2o+k8iJB1LVVRfjZ6nqqlEAIbdVQGto8Lrv+/dbawcjAL7vc+6bs+zetetfLSHxniIFGofGGsU2oC7eOCbDfZ7nQawBOSAX74SF9oEPImOq+r7nmVmxb5raukZa8UReGmNmhbMkAwwBH467EYVZe49z7kdgenj8k7V2oTHm8kgdWcvrNdVFjR8cHkYzjDH9wLjDaEwEzpwa4MypgWvAjtjxfGNMj4jMiT+M+kFsZI/Q6Pv+HGNMT8w4wI7TAyevxXVPD5z8+zD64tRXAMHVK1eaVLUyVvuDqroV2BOnJF4ZIedviUidqt4Re9s+vbx8zZXLl7PR2+nl5Tz/zNOFp2FzxzGAklw22wUsLLaSKXwf8vhosZUM6PeDYEUum70VHfpBwKsVyyfeikOP6oBNwN1TrLbfgX3A1kKLzKeff8nLLzw38T5wZDgxn1LnNk5lLRfP26/OnR2hwfNYW2Atn9RCsrf+EECyrKysDFimqhXhyjY3VLkAXBKRDqA7nU6nS0tLhyIj6XSaN9bVclv+l/IXAmkwvZc+jNUAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-save { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4UexUIzAAAAIRJREFUWMNjXLhs5X+GAQRMDAMMWJDYjGhyf7CoIQf8x2H+f0KGM9M7BBio5FNcITo408CoA0YdQM1cwEhtB/ylgqMkCJmFLwrOQguj/xTg50hmkeyARAYGhlNUCIXjDAwM0eREwTUGBgbz0Ww46oBRB4w6YNQBow4YdcCIahP+H5EhAAAH2R8hH3Rg0QAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-tap-select { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NzIwRUFGMDYyMjE2ODExOTdBNUNBNjVEQTY5OTRDRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCOTJBQzE0RDQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCOTJBQzE0QzQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OTQ0QzIwMUM1RjIxNjgxMUE3QkFFMzhGRjc2NTI3MjgiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NzcyMEVBRjA2MjIxNjgxMTk3QTVDQTY1REE2OTk0Q0UiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6eYZ88AAADLklEQVR42rSXf2TUYRzHv7tuGcfE6Vwb5zLSSjEj7Y9KWqfEmFZJP+yPMdKKmUrrn0iUfjhWlLFi6YfNrF+StBoTo39iYkTGco4xxxG59P7k/T2PT8/37nu3bx9ezvPj+zyf5/PreS78bGLS8SmrwE6yje3NHJsDBTALpknBz6JhH3NiYAB0gHqPOVv52wJ6QQ48BzdAttTioRJjdeA8mAHHS2xuk3p+M8M16ipVQE49Ds6CiFO9RLjGONf05QLx6wPQaBlbBlPgJVgkP0ETiIJ2sB/E1XfimjfgBOOlKDUqCGOcqBcQnw6BYW5YTo4wbvQhMmCfGRemC2rBiGXzWUb+kM/NRZ6CHWBM9ce5R61NgX6ayhSJ5EPlItlDRNkz4JbFHf06BkSzHjXxM+gDv1S/mPUo2AXWgt9UUHL/IVhS8yUV1/EbV3o4N+NaoE9Fu/i827K5pNYHnqAVJECShWmAaddpscYFFXwR7vnXBRGlnUN/L6kqKJlxnRUuDbaDBiL+vst5d4gpcpBrqk/2jIgCKVUolhntplzivHmwh4stGOPfwBWwl/2dpp8p7xjQZqFLiQJtauKkivYm+kzccpK57yXfOUe+P23JqAnVbhMFmlXntCWnxbT31am9ZJ4BJifsUmNTqt0cYhA5ypympPg7VkEKunPbVb8cIG+0kyHLJZNR7fUMooUKFHAPkfQo58VLK+RzwRDd4FdWG9mjpaAXzqkJa1R7kQttqEABWXMjOOxxVRfnhRm5URX1prk/0pQHwNcKlchZ+jdpC+hFdVqO0my9Hj5dkYgCn1Rfh/KdlNDHrJhPqlDih+IfBd6qwpOgEqYMsorJ2HtWxtagLJDn/W3KRfPOZhoeBJfZPgVeGKeKrkQBh5dLXl25Ny3pc4/1fkTdbvFqFQgbxWeYD0hXulhQ0pYiM1jG547fcbMQpVnHTZEn9W3ljsCzwHxCdVteNHIZvQa7/7cC7nV6zHIfyFP9EXjFa7YxKAVqPP4bxhhoLWW+z9JyCb6M/MREg59/RlmmXbmneIybB+YC/ay+yrffqEddDzwGvKxxDmzhc0tc80XVgblqFfgjwAAPubcGjAOl1wAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-undo { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4em8Dh0gAAAatJREFUWMPt1rFrFFEQBvDfGhACASshkL/ALpWVrSAKEQV5sIULWlgZNSgIFkGIVQ412gkBt1lYLERREFJqJRaW1oHAoZUQsDqwecWy7N3tbe6C4H2wxc682Zn3zTfvLXPM8b8j6RqYF+UCzsfnHBawGt3fMcAX7GEvS8NgKgXkRbmMxwg41TLsN0psZmnodyogL8pFPMIdLHUk7hA7eJKl4U/rAuKu3+HslFr/FZezNPSTFslX8QErDe4DvMVH/Iq9F7VwGpdwZUjsPtaSFjv/1vCBPjaxO0xcNbHejLpZrrlvJCMCT+JzA+2fcC1Lw+GE4l3CG1yIptfjCtiKoqtiJ0vD3aM0Py/K57iIMxgkQxat4EdN7e9xdRzlk+LEEPvDWvIDXJ928sYxjL36icWK+VaWhlezOIqbGFirJd/H7szugrwoX+D2BDEvszSsT5OBdfRaru/F9dPXQF6U27g/KnmWhgctxqyzBrZGMNGL/rHI0nDkKXiKexXTsywNGx0OnFbFNk3BRoWJXnw//j+ivCi32/S8CxPVNiWOAdUiJtXITIqYY45/Cn8B2D97FYW2H+IAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-wheel-pan { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgswOmEYWAAABddJREFUWMO9l09oXNcVxn/n3vc0fzRjj2RHyIZ6ERuy6CarxJtS0pQSCsXNpqGFWK5tTHAwyqIGN7VdEts1LV04BEoxdlJnUbfNogtDCYWQRZOSxtAUCoFiJY0pWJVUjeTKM9LMe+9+Xcyb8ZMychuofeHCffeee7/vnXvOuefYlV/+mv932//tb91z/Y2rvxmMHQ+4FcEfOIGN4A+UwDDwoQScc7vM7AIwB8yZ2QXn3K77Ab6OgJnVgeOSbkqaBiaACUnTkm4Cx3OZzwf+qzcRQup1zNZ9RwDe+0YI4YKZTUn6zCGSMLOfAF/03r+QZdnyfwO+ePEiI6N1nPMgMDMkETLRbd2mXG8gCbd9YiIKIUxLKoLfBN7I+80+CUlTIYTp7RMT0b3Af37p8kh5y9gZcy4Fzt+5szqSaxkzUR7dwtrKMmaGW242d0t6vrD/He/90865o865o977p4F3Ctp4frnZ3L0Z+OryUrVSrZ0z8ZxhHjhcq1XPrS43q/0flDlK9XpPA2ma7gMeyvfPx3H8TJZlH4YQWiGEVpZlH8Zx/Awwn8s8lKbpvmq1ahvB641SXNk6dhLskNA2MIBtwKHK1vGTW8bKMRbAMgyPqWeETxUM8VSSJAv52JmZA0iSZMHMThWwnipXKp8hsLLcSaIR92oU8xjSayCQXotiHotG3Ku3m+0EOQwPQCDggMf7BzQajSs5eAk4B5zLx4O1vD2eJMmAQKliscgASJMw21pansFs1swQ/DNLmUmTMNuXX+taXHTDaj5OW612R1JZ0nFJJ/J+XFJ5aWmpA6S5bHV8fHsPHFU6q3pJCjtFxtrKMuXRLUUXXxdrRLazFOtUolZlsGhmACsgnHPTwJnCnjP5HMBKLotzxsTE9rgDL0t6LoriKsDIaB31ZEK+JxQJRHFUBR2NqLw8OTkZR0OC0ntm9k1JWU7OA4vD/mZ+YfElsANmNEKi75vztzB5M8uAr+bx48me88g757PQ1U5zNg52YH7hX8l6f+4Fi3c3BqHNmkI4YQOV2MGCNu9qHPYCewfzbrC+XSGcWEcgTRKA3wFfyzdDz5d+D3x9CIcfA4eBbQS9LscskgfLnHNPAnslvS/pbZDHLLPADpx9N9fqpSIBH8cxWZY9m6bpb4Ev5fN/iKLo2TRNgdx/eo8Wk5O7Ts/N/SOSdMjHdj4kmgkIEJLJzPZKetvMTkIvFLsR25Ml2gfuF5M7vnA66sdooJYkCSGERe/9VAjhzRxoKk3Tvg3U8nulVqvx8cyNpER2umM+SdOkbc5B8JhpqBdIgTRR24h+lpKen731aRIN7thscH9Zlv0d2F8YD2TIX7F2uw3A7ZWV1a0TYz9ca8cJZHRbuRuaDfUCw9/qJHamPOKToAwHtHN6lMvlSkH2o7wDMDo6WuGuQbbn5+YAKNcb3J5fSvrhtTY+vsOPuD1IOyRhMOkj9kSx29HfXB5RUnS964NT2+3vbGbxG9auO2cDNuV6A8NTb5TitBuOpQkfYD2vwOxgmvBB2g3Hto5X42EJyVsFlztbKpXGNgqVSqUxSWcLU2+tdToa9hasLjfPYlwGa+bTi8Dl1dvNsyvNtQQL9MO2w+HM7BqwlAtPdrvdq9773WAVsIr3fne3270KTOYyS2Z2bbXdHhogKmPj7YWF+VOSXs/v/9KdO+0fVBrjbRkgB/KIDBnYu9f/7D+ZmfmRxPd6qwB8YmZXcq1MAQ/nJhTM+OnDe/a8+PGNG9lm19V/D1Qw7HXZlcRa69+U6w38l5/4ipxzf5X0CPBILjcGPJH34pVcc8692FxcXLlXRnTwwH7+9P4f8aWe3fY59LIqo1NMyQBCCHNmdgx4BegUWefjDvCKmR0LIcz9L8nokSNH+PRvH4HC3YQ098pSbevg24qlmZmNmtmjkg4D3+j/tZldkvQXSa3PW5ptlpL3ZaIN99OS9F7+IgKUgSyEkNyv2nHT7DZX0dr9rpjua2l2r4rogRAYVqZvnPsPqVnpEXjEaB4AAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-wheel-zoom { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgskILvMJQAABTtJREFUWMPdl1+MXVUVxn/fPvf2zrSFmUKnoBCUdjRoVaIxEpO2JhilMYBCtBQS2hejpg1Uo2NUrIFAoyGmtiE+GHwQGtvQJhqDmKYRBv+URFsFDNCSptH60DJTO3dKnX/33rM/H7rvsDu9M20fDMaVnGTvtb69z7fWXmvtc/TEzqd4OyXwNsv/FwFJQVI/sA14SZKRLOlPkr5TrVYXHz70quYkEEK4TtI2YAgYkrQthHDdhV5uuw+43/ZrwCbgRttgY/tjtrc0m83X3/f+D6ydnJhYcB4BSZcBA7aP2d4ELAGW2N5k+xgwkDB0IH19CGGH7R8B1aQeAf4KvAw0ku4K2zu7uru3ApdPEyiKohd4TNKjtjt5h6RHgccSNrddbvuHtm9Jqoak7xVF8WFgdavV+pSk5cCObNmXgK++85prCj3z28HKqZMnH7D9YAY4BvwujT8BvCuL1INX9vVt+dfwcCvNb7f9q2RuSfrGvWu/sL2Nf3LX7pzvj4ENSGBPVarVd4fRkZFltjdmoMGiKO4IIWwIIWwoiuIOYDDzeOPoyMiyFLkum7WJCMDztrcrTTrIRuAQZ6NcK1utL4dWq/VZoC8BhqvV6l1lWb4YYxyLMY6VZflitVq9CxhOmL60hhCKeYiV7WMKIXw9jT1HpXw3c+bOAKzOjJubzebJrKQCQLPZPClpc7bP6rMYKtjXth2OMf7tIkr11Wz8oQDc1Fb09vY+kQw1YAuwJY2nbUluAnCWpKkaFl6IQIzxivaR2SYA89sJVK/Xp2x32R6w/a30DNjuqtfrU0ArYecDCEqgLqm94T0dEm9mBG7PxkdDlkBnkhebgIezNQ8nHcCZPL9ijE1Jf/bZZoPtzbavmqNZLbf9tSxq+yoduuJ+SZ+zXSZyBXCqU+d8fvC5yRUrV+0G2j3g2hDCLyXd/+Su3QdnvP/zCuH72LWsgf2k0oHlH2c2odlkxcpVEdgr6aDtjyb8x20/J+mA7T9I6rL9SWA5dne2/GdXLl58qNJh398An85yTMA+4DOz8Dgu6Zu2dwJXJ91ltm8Gbp7Fgb+EEB4aHhpq5CEtACqVyr3AC0AlPS8k3TSmQ2YPhhBuS/1/LpmS9JTtNTHGfwBU2uUALARotVqniqJYH2Pck85pfavVaufAwnQvnHc0McaDKVptebN94QAnJB0EdtjekydyZXqjs/0ZgLIs/w6sy8bnYGYJ63pgERKC05JutT1kOwITwL9tvzlzUQUYB+Zjs2DBgu6xsbGJZHstByZbezregcBXeCsEz1bnzXt5anLyzLq71zDLxTRdVgemdx0fv2e2w5thO5DbiqL4oKT3ZKpnpyYnz+SY2ZpTAPZmJfdIrVZbNBNUq9UW2X4kU+2dcf53Aj1pj2PA7y/6m1DS00A9za9uNBq7iqJYBuoGdRdFsazRaOzKSqye1rTbaa/tlbYrqXQP2X4FIA9/J1l39xrC0v7+w5IeB8XkwS1lWe6TGJAYKMty31tfO4qSHl/a3384I3CDpI+kzC4lnRfrue6GytEjR8oQwlY73gC0L4qlth/q0M1/LYWtR48cKQF6enrC6dOnVwGLEpnxnp7en4+O1i/tszzGOCTpPmB7ahb57QUwBWyXdF+McWg6MScmuoA8OX8xOlpvXGz422XYTsB/SnpA0h7bX5R0WzI9HUL4qe2XbI+dk3xl+V7gxoztD5jRI+YK/zkEEokx2/uB/RdzIfUtueqVN04cXwF8G3iHY3z9Urw/j8ClyhsnjrcS2Vv/J/8NLxT+/zqBTkcxU/cfEkyEAu3kmjAAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-box-edit { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4QfHjM1QAAAGRJREFUWMNjXLhsJcNAAiaGAQYsDAwM/+lsJ+OgCwGsLqMB+D8o08CoA0YdMOqAUQewDFQdMBoFIyoN/B/U7YFRB7DQIc7xyo9GwbBMA4xDqhxgISH1klXbDYk0QOseEeOgDgEAIS0JQleje6IAAAAASUVORK5CYII="); -} -.bk-root .bk-tool-icon-freehand-draw { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADTElEQVRYCeWWTWwMYRjH/88721X1lZJIGxJxcEE4OOiBgzjXWh8TJKR76kWacOBGxdEJIdk4VChZI/phidRBHMRRIr7DSUiaSCRFRM3u88gz+o7Z6bBTdjmYZPf9eJ55fv/5zzvvDPC/H9QsA66Olo9Ga+/MdR+Ljm2/KQIULsz9FqItGdOfJKLhApLgVkiSCGODjWit7QpKWy+TNrFeXvzKVUT8NiTVaIgDcbiCFJ7GiT8WkARXAdYBK0Lbhi/CenArRNskuM7/tgNp4ArQ42dwjf3WY5gWTqC7O/NbNn2Xkfw/YwdSw/We14HP2IEZwX+y9cZ9SH0LmgFP7UCz4KkENBNeV0Cz4b8U8DfgKiDxMWwUXETqLvJpCQpXZfawbzS7t9v5pL19cHBwfja7YA0y/lyCM0+E5hv5+piZXwKYcF23as+37bTXsQVqgkL0p/34fHR7DcBtbetFsBmGDwMOJCggYG55yw7dMlk6DuC1Bdu2RsCU9TYWQq2IoGbsreZ5NzvEqfSBsIsIy8OTbcdgiRHeh4o8AFAEwDakbY2AaCCpH7V9aGhoUUUy3UyVbkPYFuYLDlUZH8XBpwxkK0Dbgxg5HcVi0ent7a0RULMIozaHBSMfF9b2SzdutFcFB2FkwMIJOG6qfteXOa1nHZ48tyefuwyfT9s6wtzZ3t7eZse2DR2I228TtHXzuWCx9g8MtK5cuHCZTH4tiHEOa4xFngvTyS8f35d6enomiCi4/foEXBkZaQuukChL4FYA2Whd7YcC4gEdW3CpdL3LtGAVCVYJywEyTpAuJKeMOKXZs/Bw947C50KhUFOG4cwz35cjWNBlHGeD53n3xsfHP/T19U1qciggar8Fa4I3PHobIotBWBtc2hSiChyZxVzM53Pv7FVH6Tp3uVy+g0r1ImD2GjIrQGYIxjnfuXTZGICS5k/bBwJoubwEFX4TLah9EXomJGMA3za+f9913Yl4TnzsDQ+vE6YTZOjHh4ngibstt1pzQwd04F0bPStEBpXqRoBeQ/AKghfBnOEKgS+Q7z91Xfdz/HGKg8Ox7z8iYD9z6wqTkZFgnvhMGP9VZ2or1XVkPM9z0mytSfVsHa1RLBZbLoyNzUnK+ydz3wC6I9x+lwbngwAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-poly-draw { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjglo9eZgwAAAc5JREFUWMPt1zFrU1EUB/DfS4OmVTGDIChCP4BgnQXRxVHqIJUupp9AB8VBQcRBQUXIB9DWQoMRiXZzcnQSA34A7aAuHSJKkgo2LvfBrU3aJnlYkBy4vHcP557zP/9z3r33JdXa647N0kHSZd5Nn0rSxc8G3cXp85sMcnZZ8vge3osZ+l3vB8CWFA0iL14t79h210swAjACMAIwAjACkB90D/8/GchI9ve4nPwTBh5E9ws7OepzGWb9EddSn51Op9ZstadSg4VK1UKlKkmSDSMLALewiuNh/hVJq71Wxttmqz0dG88vPc+MgWP4grvYG3SLOBrZFFFrttqPe4HIDxh4GSei+98iSlusuYopXEAjBtEPA3tQwUpwluAbDm4TPJUz+BTW9l2Ce6G7L0X/Bw8D3T/7SKKIDzHg7QCcxjvcQAEtXAnrrg/RP0/DKPbqgcN4iVOR7gcO4dcQgRuoh7HSqwlP4n20m63jJu5n8MkWMYfP3UowhzdR8FU8w9iQwevBdyq3/27CMRzAE5yLuvsRLg+ZcR1nJ8YL81HWJUzGAPaFZwe/Q5MdyYDyNHgjzO90YyGHtVDncuiJchaHw8R4oREFV5qdiVmYLM3OgD9k5209/atmIAAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-point-draw { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEiERGWPELgAAA4RJREFUWMO1lr1uG1cQhb9ztdRSP7AF1QxgwKlcuZSqRC9gWUUUINWqTh5AnaFOnVPEteQmRuhCURqWsSqqc9IolREXdEvQBElxtdw7KURSFEVKu4w8wAKLxdw9Z+bMnRmZGXfZ29//II8th4WwGVNyIoQLYB5vxA9Caq04iUd9A+7ZlsNC2I7TdSd2hZXMJKlnTqp9jtl/GBaqoyQ0noFKpUIzBicYYc+DEFpxkglc4oVJa5gvDn8v1xV2irG3FM4NSVwjUKlUaMcpJhCGmSEJQ6QGD8M5WnHCd8+f3QCXpPLx8WNwv0j6Bm9FMK7FJ3WBE+R/2t7c/GBmFvSBrzRTCsyTDjXrxUgEMtpxynJYmJoBJ4VAybwVARgvL7Oik0okCodnKpVKX7P0leiVMb0VvbJT+upznK4vh0GIeQwwQStJkHQD3MwsCALTJRG7Qrdrj5m/djgYaIa0hlkRdJk26XEgC9txurccBtVW3IudBImmZuACUP+ZlIDBt9FKcubYNTcAH/X0RYM1E7utJPlqe+uZzPxUcEkiSS4sTT95n15Mud0xWC0o2PAWOCdK3KYZlFxfM+tHOcnMzNr1es18ug+cgsVjP4yBU/Ppfrter1m/+l0+zYygML1xRVHU7TSb1cSzBzoBzszsH+AMdJJ49jrNZjWKou6wBnwOzcyndBpNbuueURR1Dw8Pq35p9cc5p/Dy9Dypt7jXrtdGwQECS9NPhr6Gq6txUzNigE6zydLK6lTw12/KT4FGFEUfJX2YJNONq5tVs4ODA7sD/DnwJ/BoADZuE3tHFs12dna6d4C/BI6AlbyzI8ii2TTw12/KK33gb2cdXsNZoAntbZC2SeO4c9592k/5eNQbiwvFd1kJuFGwLJr1wSPg/SwpvyFBHufOeXcFeAlE97U/uCxOY+P3b+Bn4B3Q+L8EdJfD4a+/AbC4UBzPxiPg3wlHZquB28Cn2IuR9x3gr3uV4DbwfvSDOvi4uFA8BDZmIRHkjHpS9Ht9iRqd8+5G3g05mAGcQbsdiX5QJ428G7Kygo8XYdb1/K4NWVmjzkNge2sz84bs+ELmpDDLtqWsNZBXgvmw8CTtpWVMT7x5YWBjLARnwZfKQNYN2U2LPvrh+5nBt7c2M2/It9bArCTKR8eZN+SJ13AScPnoODeRdqNenH+wul5w2gUr2WUjMFAt8bZ/0axX/wNnv4H8vTFb1QAAAABJRU5ErkJggg=="); -} -.bk-root .bk-tool-icon-poly-edit { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gELFi46qJmxxAAABV9JREFUWMOdl19vFFUYxn9n9u9sCyylUIzWUoMQBAWCMdEEIt6xIRQSLIEKtvHe6AcA4yeQb7CAUNJy0daLeomJN8SEULAC2kBBapBKoLvbmdl/c14vdmY7u91tF95kknPOnHmf95znPc97Ro2OTeBbdjFDT3c32ZxVHUOE9kSMB0/m6ExuoJn1H+ur6Y+OTfD50SMN5168OgrAlyf7CfuD+z7+iDs3p8hkLUQ0iFQ/yFl5Nm/qonfHVva+s32Zw9GxCYILsZ08tpNfBhbs+1YN4OH9+7huGdECSBVfqUosbsllfmauBqiR+cCNwOr7AEo8pPHJnymXykhg5fUWjoQpl0vVvhZhbSzGoUOHqgBlt6B6uruj2Zy1E9jo0fhfeyL2x4Mnc8VErK0KUEOB64JSyptfG4RSytsJjUJVxw2lsFy3urL9nx1Qd25ObctkrVMi+jQivd7U2ZyV/3Hzpq7h3h1b/7p9Y0o8v8rwAbTWrGpSocN/FGDlbAI0Rl23PCBan0Ok158H9Ipwzi25A/Mzc9Gl/BYx/E4kYqC1NKRARNAaDCNUM27Z+Zr+ouXs0q4+LSLBHPYCFkTkC6uU39kwCdsS7WRKmaYUiAhdnZ3MPX2K4+QjQI+C94A93rMzm8ltMwyDeDzWjMZeEb2pYQDdW3vITU2jtUZ5QThOPgm8C7wP7J15OPsBsB3oWpGnVWisCeDS1VHj4vBI92+/3tgB7Ab2AruAXiDBK5oIOkhtkEYRNRuJhObrd8Dl9ewf4D5wG7hVLpen29vb5wzD+BrkbBMaL3d1dk5nsrnlFDTTFWAWmAZueWD3gCemGde2k2fw1Al1YXhEvjozoO49eczdqekrWmsc2zlrmvEKOGoW1GUjFLqSk2KpJrCLwyMCPAP+BO54QL8DM6YZX/ClsP9YnwKkXnIBP4jdIpJRpdJTCYdMwwi98KU0Hjc/dDILNyUcwTCWdOSMJ0TRmBktGRhLugu0xyLk7CIqVNm+0bGJptl1YXikD0grpY4Rjc4a8Fbgdab/6OGbAJeCUuyJnnHmZH9pbSyGuBXV8NUwlUpR1EWyixmSyTWEwqGlJ2Swbo2JXbAAfgDGgGQA9I1A9t1tlq0AxrXxn0ilUpw4fhQqYkH/sT41OTnJJwf2s6FjI5mshdYa7bqVR2uezr9MJmJt14FvGrh/O9D+e6UkM/xyCuCqEKCYnJyUTKFQrZDHjxzGshwWLQcRsOz8Hi85P23id0ug/XilAMLBmm4tPGdoaKjSH5+oAGrhwvBI9SjZTn4QSK9yenoD7dlrExPoJlXW8G8ytpNHxRKk02lGxsdRKFwXLNvx5yY94HQLGhGk4LFCYQSqaE0AwWM1eOoEbR0dKBSW7bC4mKuffxs4D/wCLKwQQPAUzIkslfp6cVomROWSolh0GjldAM4nzDi2k9/i5UAzC9aKfwNJ3zgJg9YEvN6+C7SHgKm69+sD7RfNnKTTaZRPQfAut4oFV//IS7gkcB34VlVo8kGzphlfB+DU+TfNGBpZtRastvrvARJmfMF28ge9sc2B9/PNnCilMIDwK6y8/ow/Ai4kvILTljAXvDvEvrqKSUs60KolzPjBxspavQD2tKqCAGF/Ba+xE/Wbilu54wZV8NEKF5fXzQHl/bh4hUsE0WAXSlDMYcQSrQXgCmsTseXHsJkNnjqBFGwKJaHsKlxtUHYVhbLCzr1kaOA4bcn1y1Swmb+iLpJKpVrfgdpfsiVVCYcgluwgnU7jEgJ4s5UkLFtWYyHyEg0/N1q1tmQH+YXnAMFr97Nmv3p+0QsHQRsF8qpBOE5+rb9Nkaj50tVQKjqh4OU3GNL/1/So3vuUgbAAAAAASUVORK5CYII="); -} -.bk-root .bk-logo { - margin: 5px; - position: relative; - display: block; - background-repeat: no-repeat; -} -.bk-root .bk-logo.bk-grey { - filter: url("data:image/svg+xml;utf8,#grayscale"); - /* Firefox 10+, Firefox on Android */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+, Safari 6+, Safari 6+ iOS */ -} -.bk-root .bk-logo-notebook { - display: inline-block; - vertical-align: middle; - margin-right: 5px; -} -.bk-root .bk-logo-small { - width: 20px; - height: 20px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAOkSURBVDiNjZRtaJVlGMd/1/08zzln5zjP1LWcU9N0NkN8m2CYjpgQYQXqSs0I84OLIC0hkEKoPtiH3gmKoiJDU7QpLgoLjLIQCpEsNJ1vqUOdO7ppbuec5+V+rj4ctwzd8IIbbi6u+8f1539dt3A78eXC7QizUF7gyV1fD1Yqg4JWz84yffhm0qkFqBogB9rM8tZdtwVsPUhWhGcFJngGeWrPzHm5oaMmkfEg1usvLFyc8jLRqDOMru7AyC8saQr7GG7f5fvDeH7Ej8CM66nIF+8yngt6HWaKh7k49Soy9nXurCi1o3qUbS3zWfrYeQDTB/Qj6kX6Ybhw4B+bOYoLKCC9H3Nu/leUTZ1JdRWkkn2ldcCamzrcf47KKXdAJllSlxAOkRgyHsGC/zRday5Qld9DyoM4/q/rUoy/CXh3jzOu3bHUVZeU+DEn8FInkPBFlu3+nW3Nw0mk6vCDiWg8CeJaxEwuHS3+z5RgY+YBR6V1Z1nxSOfoaPa4LASWxxdNp+VWTk7+4vzaou8v8PN+xo+KY2xsw6une2frhw05CTYOmQvsEhjhWjn0bmXPjpE1+kplmmkP3suftwTubK9Vq22qKmrBhpY4jvd5afdRA3wGjFAgcnTK2s4hY0/GPNIb0nErGMCRxWOOX64Z8RAC4oCXdklmEvcL8o0BfkNK4lUg9HTl+oPlQxdNo3Mg4Nv175e/1LDGzZen30MEjRUtmXSfiTVu1kK8W4txyV6BMKlbgk3lMwYCiusNy9fVfvvwMxv8Ynl6vxoByANLTWplvuj/nF9m2+PDtt1eiHPBr1oIfhCChQMBw6Aw0UulqTKZdfVvfG7VcfIqLG9bcldL/+pdWTLxLUy8Qq38heUIjh4XlzZxzQm19lLFlr8vdQ97rjZVOLf8nclzckbcD4wxXMidpX30sFd37Fv/GtwwhzhxGVAprjbg0gCAEeIgwCZyTV2Z1REEW8O4py0wsjeloKoMr6iCY6dP92H6Vw/oTyICIthibxjm/DfN9lVz8IqtqKYLUXfoKVMVQVVJOElGjrnnUt9T9wbgp8AyYKaGlqingHZU/uG2NTZSVqwHQTWkx9hxjkpWDaCg6Ckj5qebgBVbT3V3NNXMSiWSDdGV3hrtzla7J+duwPOToIg42ChPQOQjspnSlp1V+Gjdged7+8UN5CRAV7a5EdFNwCjEaBR27b3W890TE7g24NAP/mMDXRWrGoFPQI9ls/MWO2dWFAar/xcOIImbbpA3zgAAAABJRU5ErkJggg==); -} -.bk-root .bk-caret { - display: inline-block; - vertical-align: middle; - width: 0; - height: 0; - margin: 0 5px; -} -.bk-root .bk-caret.bk-down { - border-top: 4px solid; -} -.bk-root .bk-caret.bk-up { - border-bottom: 4px solid; -} -.bk-root .bk-caret.bk-down, -.bk-root .bk-caret.bk-up { - border-right: 4px solid transparent; - border-left: 4px solid transparent; -} -.bk-root .bk-caret.bk-left { - border-right: 4px solid; -} -.bk-root .bk-caret.bk-right { - border-left: 4px solid; -} -.bk-root .bk-caret.bk-left, -.bk-root .bk-caret.bk-right { - border-top: 4px solid transparent; - border-bottom: 4px solid transparent; -} -.bk-root .bk-menu { - position: absolute; - left: 0; - width: 100%; - z-index: 100; - cursor: pointer; - font-size: 12px; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 4px; - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); -} -.bk-root .bk-menu.bk-above { - bottom: 100%; -} -.bk-root .bk-menu.bk-below { - top: 100%; -} -.bk-root .bk-menu > .bk-divider { - height: 1px; - margin: 7.5px 0; - overflow: hidden; - background-color: #e5e5e5; -} -.bk-root .bk-menu > :not(.bk-divider) { - padding: 6px 12px; -} -.bk-root .bk-menu > :not(.bk-divider):hover { - background-color: #e6e6e6; -} -.bk-root .bk-tabs-header { - display: flex; - display: -webkit-flex; - flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; - align-items: center; - -webkit-align-items: center; - overflow: hidden; - user-select: none; - -ms-user-select: none; - -moz-user-select: none; - -webkit-user-select: none; -} -.bk-root .bk-tabs-header .bk-btn-group { - height: auto; - margin-right: 5px; -} -.bk-root .bk-tabs-header .bk-btn-group > .bk-btn { - flex-grow: 0; - -webkit-flex-grow: 0; - height: auto; - padding: 4px 4px; -} -.bk-root .bk-tabs-header .bk-headers-wrapper { - flex-grow: 1; - -webkit-flex-grow: 1; - overflow: hidden; - color: #666666; -} -.bk-root .bk-tabs-header.bk-above .bk-headers-wrapper { - border-bottom: 1px solid #e6e6e6; -} -.bk-root .bk-tabs-header.bk-right .bk-headers-wrapper { - border-left: 1px solid #e6e6e6; -} -.bk-root .bk-tabs-header.bk-below .bk-headers-wrapper { - border-top: 1px solid #e6e6e6; -} -.bk-root .bk-tabs-header.bk-left .bk-headers-wrapper { - border-right: 1px solid #e6e6e6; -} -.bk-root .bk-tabs-header.bk-above, -.bk-root .bk-tabs-header.bk-below { - flex-direction: row; - -webkit-flex-direction: row; -} -.bk-root .bk-tabs-header.bk-above .bk-headers, -.bk-root .bk-tabs-header.bk-below .bk-headers { - flex-direction: row; - -webkit-flex-direction: row; -} -.bk-root .bk-tabs-header.bk-left, -.bk-root .bk-tabs-header.bk-right { - flex-direction: column; - -webkit-flex-direction: column; -} -.bk-root .bk-tabs-header.bk-left .bk-headers, -.bk-root .bk-tabs-header.bk-right .bk-headers { - flex-direction: column; - -webkit-flex-direction: column; -} -.bk-root .bk-tabs-header .bk-headers { - position: relative; - display: flex; - display: -webkit-flex; - flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; - align-items: center; - -webkit-align-items: center; -} -.bk-root .bk-tabs-header .bk-tab { - padding: 4px 8px; - border: solid transparent; - white-space: nowrap; - cursor: pointer; -} -.bk-root .bk-tabs-header .bk-tab:hover { - background-color: #f2f2f2; -} -.bk-root .bk-tabs-header .bk-tab.bk-active { - color: #4d4d4d; - background-color: white; - border-color: #e6e6e6; -} -.bk-root .bk-tabs-header .bk-tab .bk-close { - margin-left: 10px; -} -.bk-root .bk-tabs-header.bk-above .bk-tab { - border-width: 3px 1px 0px 1px; - border-radius: 4px 4px 0 0; -} -.bk-root .bk-tabs-header.bk-right .bk-tab { - border-width: 1px 3px 1px 0px; - border-radius: 0 4px 4px 0; -} -.bk-root .bk-tabs-header.bk-below .bk-tab { - border-width: 0px 1px 3px 1px; - border-radius: 0 0 4px 4px; -} -.bk-root .bk-tabs-header.bk-left .bk-tab { - border-width: 1px 0px 1px 3px; - border-radius: 4px 0 0 4px; -} -.bk-root .bk-close { - display: inline-block; - width: 10px; - height: 10px; - vertical-align: middle; - background-image: url('data:image/svg+xml;utf8,\ - \ - \ - \ - '); -} -.bk-root .bk-close:hover { - background-image: url('data:image/svg+xml;utf8,\ - \ - \ - \ - '); -} -.bk-root .bk-btn { - height: 100%; - display: inline-block; - text-align: center; - vertical-align: middle; - white-space: nowrap; - cursor: pointer; - padding: 6px 12px; - font-size: 12px; - border: 1px solid transparent; - border-radius: 4px; - outline: 0; - user-select: none; - -ms-user-select: none; - -moz-user-select: none; - -webkit-user-select: none; -} -.bk-root .bk-btn:hover, -.bk-root .bk-btn:focus { - text-decoration: none; -} -.bk-root .bk-btn:active, -.bk-root .bk-btn.bk-active { - background-image: none; - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); -} -.bk-root .bk-btn[disabled] { - cursor: not-allowed; - pointer-events: none; - opacity: 0.65; - box-shadow: none; -} -.bk-root .bk-btn-default { - color: #333; - background-color: #fff; - border-color: #ccc; -} -.bk-root .bk-btn-default:hover { - background-color: #f5f5f5; - border-color: #b8b8b8; -} -.bk-root .bk-btn-default.bk-active { - background-color: #ebebeb; - border-color: #adadad; -} -.bk-root .bk-btn-default[disabled], -.bk-root .bk-btn-default[disabled]:hover, -.bk-root .bk-btn-default[disabled]:focus, -.bk-root .bk-btn-default[disabled]:active, -.bk-root .bk-btn-default[disabled].bk-active { - background-color: #e6e6e6; - border-color: #ccc; -} -.bk-root .bk-btn-primary { - color: #fff; - background-color: #428bca; - border-color: #357ebd; -} -.bk-root .bk-btn-primary:hover { - background-color: #3681c1; - border-color: #2c699e; -} -.bk-root .bk-btn-primary.bk-active { - background-color: #3276b1; - border-color: #285e8e; -} -.bk-root .bk-btn-primary[disabled], -.bk-root .bk-btn-primary[disabled]:hover, -.bk-root .bk-btn-primary[disabled]:focus, -.bk-root .bk-btn-primary[disabled]:active, -.bk-root .bk-btn-primary[disabled].bk-active { - background-color: #506f89; - border-color: #357ebd; -} -.bk-root .bk-btn-success { - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; -} -.bk-root .bk-btn-success:hover { - background-color: #4eb24e; - border-color: #409240; -} -.bk-root .bk-btn-success.bk-active { - background-color: #47a447; - border-color: #398439; -} -.bk-root .bk-btn-success[disabled], -.bk-root .bk-btn-success[disabled]:hover, -.bk-root .bk-btn-success[disabled]:focus, -.bk-root .bk-btn-success[disabled]:active, -.bk-root .bk-btn-success[disabled].bk-active { - background-color: #667b66; - border-color: #4cae4c; -} -.bk-root .bk-btn-info { - color: #fff; - background-color: #5bc0de; - border-color: #46b8da; -} -.bk-root .bk-btn-info:hover { - background-color: #4ab9db; - border-color: #29a8cd; -} -.bk-root .bk-btn-info.bk-active { - background-color: #39b3d7; - border-color: #269abc; -} -.bk-root .bk-btn-info[disabled], -.bk-root .bk-btn-info[disabled]:hover, -.bk-root .bk-btn-info[disabled]:focus, -.bk-root .bk-btn-info[disabled]:active, -.bk-root .bk-btn-info[disabled].bk-active { - background-color: #569cb0; - border-color: #46b8da; -} -.bk-root .bk-btn-warning { - color: #fff; - background-color: #f0ad4e; - border-color: #eea236; -} -.bk-root .bk-btn-warning:hover { - background-color: #eea43b; - border-color: #e89014; -} -.bk-root .bk-btn-warning.bk-active { - background-color: #ed9c28; - border-color: #d58512; -} -.bk-root .bk-btn-warning[disabled], -.bk-root .bk-btn-warning[disabled]:hover, -.bk-root .bk-btn-warning[disabled]:focus, -.bk-root .bk-btn-warning[disabled]:active, -.bk-root .bk-btn-warning[disabled].bk-active { - background-color: #c89143; - border-color: #eea236; -} -.bk-root .bk-btn-danger { - color: #fff; - background-color: #d9534f; - border-color: #d43f3a; -} -.bk-root .bk-btn-danger:hover { - background-color: #d5433e; - border-color: #bd2d29; -} -.bk-root .bk-btn-danger.bk-active { - background-color: #d2322d; - border-color: #ac2925; -} -.bk-root .bk-btn-danger[disabled], -.bk-root .bk-btn-danger[disabled]:hover, -.bk-root .bk-btn-danger[disabled]:focus, -.bk-root .bk-btn-danger[disabled]:active, -.bk-root .bk-btn-danger[disabled].bk-active { - background-color: #a55350; - border-color: #d43f3a; -} -.bk-root .bk-btn-group { - height: 100%; - display: flex; - display: -webkit-flex; - flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; - align-items: center; - -webkit-align-items: center; - flex-direction: row; - -webkit-flex-direction: row; -} -.bk-root .bk-btn-group > .bk-btn { - flex-grow: 1; - -webkit-flex-grow: 1; -} -.bk-root .bk-btn-group > .bk-btn + .bk-btn { - margin-left: -1px; -} -.bk-root .bk-btn-group > .bk-btn:first-child:not(:last-child) { - border-bottom-right-radius: 0; - border-top-right-radius: 0; -} -.bk-root .bk-btn-group > .bk-btn:not(:first-child):last-child { - border-bottom-left-radius: 0; - border-top-left-radius: 0; -} -.bk-root .bk-btn-group > .bk-btn:not(:first-child):not(:last-child) { - border-radius: 0; -} -.bk-root .bk-btn-group .bk-dropdown-toggle { - flex: 0 0 0; - -webkit-flex: 0 0 0; - padding: 6px 6px; -} -.bk-root .bk-toolbar-hidden { - visibility: hidden; - opacity: 0; - transition: visibility 0.3s linear, opacity 0.3s linear; -} -.bk-root .bk-toolbar, -.bk-root .bk-button-bar { - display: flex; - display: -webkit-flex; - flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; - align-items: center; - -webkit-align-items: center; - user-select: none; - -ms-user-select: none; - -moz-user-select: none; - -webkit-user-select: none; -} -.bk-root .bk-toolbar .bk-logo { - flex-shrink: 0; - -webkit-flex-shrink: 0; -} -.bk-root .bk-toolbar-above, -.bk-root .bk-toolbar-below { - flex-direction: row; - -webkit-flex-direction: row; - justify-content: flex-end; - -webkit-justify-content: flex-end; -} -.bk-root .bk-toolbar-above .bk-button-bar, -.bk-root .bk-toolbar-below .bk-button-bar { - display: flex; - display: -webkit-flex; - flex-direction: row; - -webkit-flex-direction: row; -} -.bk-root .bk-toolbar-above .bk-logo, -.bk-root .bk-toolbar-below .bk-logo { - order: 1; - -webkit-order: 1; - margin-left: 5px; - margin-right: 0px; -} -.bk-root .bk-toolbar-left, -.bk-root .bk-toolbar-right { - flex-direction: column; - -webkit-flex-direction: column; - justify-content: flex-start; - -webkit-justify-content: flex-start; -} -.bk-root .bk-toolbar-left .bk-button-bar, -.bk-root .bk-toolbar-right .bk-button-bar { - display: flex; - display: -webkit-flex; - flex-direction: column; - -webkit-flex-direction: column; -} -.bk-root .bk-toolbar-left .bk-logo, -.bk-root .bk-toolbar-right .bk-logo { - order: 0; - -webkit-order: 0; - margin-bottom: 5px; - margin-top: 0px; -} -.bk-root .bk-toolbar-button { - width: 30px; - height: 30px; - background-size: 60%; - background-color: transparent; - background-repeat: no-repeat; - background-position: center center; -} -.bk-root .bk-toolbar-button:hover { - background-color: #f9f9f9; -} -.bk-root .bk-toolbar-button:focus { - outline: none; -} -.bk-root .bk-toolbar-button::-moz-focus-inner { - border: 0; -} -.bk-root .bk-toolbar-above .bk-toolbar-button { - border-bottom: 2px solid transparent; -} -.bk-root .bk-toolbar-above .bk-toolbar-button.bk-active { - border-bottom-color: #26aae1; -} -.bk-root .bk-toolbar-below .bk-toolbar-button { - border-top: 2px solid transparent; -} -.bk-root .bk-toolbar-below .bk-toolbar-button.bk-active { - border-top-color: #26aae1; -} -.bk-root .bk-toolbar-right .bk-toolbar-button { - border-left: 2px solid transparent; -} -.bk-root .bk-toolbar-right .bk-toolbar-button.bk-active { - border-left-color: #26aae1; -} -.bk-root .bk-toolbar-left .bk-toolbar-button { - border-right: 2px solid transparent; -} -.bk-root .bk-toolbar-left .bk-toolbar-button.bk-active { - border-right-color: #26aae1; -} -.bk-root .bk-button-bar + .bk-button-bar:before { - content: " "; - display: inline-block; - background-color: lightgray; -} -.bk-root .bk-toolbar-above .bk-button-bar + .bk-button-bar:before, -.bk-root .bk-toolbar-below .bk-button-bar + .bk-button-bar:before { - height: 10px; - width: 1px; -} -.bk-root .bk-toolbar-left .bk-button-bar + .bk-button-bar:before, -.bk-root .bk-toolbar-right .bk-button-bar + .bk-button-bar:before { - height: 1px; - width: 10px; -} -.bk-root .bk-tooltip { - font-weight: 300; - font-size: 12px; - position: absolute; - padding: 5px; - border: 1px solid #e5e5e5; - color: #2f2f2f; - background-color: white; - pointer-events: none; - opacity: 0.95; - z-index: 100; -} -.bk-root .bk-tooltip > div:not(:first-child) { - /* gives space when multiple elements are being hovered over */ - margin-top: 5px; - border-top: #e5e5e5 1px dashed; -} -.bk-root .bk-tooltip.bk-left.bk-tooltip-arrow::before { - position: absolute; - margin: -7px 0 0 0; - top: 50%; - width: 0; - height: 0; - border-style: solid; - border-width: 7px 0 7px 0; - border-color: transparent; - content: " "; - display: block; - left: -10px; - border-right-width: 10px; - border-right-color: #909599; -} -.bk-root .bk-tooltip.bk-left::before { - left: -10px; - border-right-width: 10px; - border-right-color: #909599; -} -.bk-root .bk-tooltip.bk-right.bk-tooltip-arrow::after { - position: absolute; - margin: -7px 0 0 0; - top: 50%; - width: 0; - height: 0; - border-style: solid; - border-width: 7px 0 7px 0; - border-color: transparent; - content: " "; - display: block; - right: -10px; - border-left-width: 10px; - border-left-color: #909599; -} -.bk-root .bk-tooltip.bk-right::after { - right: -10px; - border-left-width: 10px; - border-left-color: #909599; -} -.bk-root .bk-tooltip.bk-above::before { - position: absolute; - margin: 0 0 0 -7px; - left: 50%; - width: 0; - height: 0; - border-style: solid; - border-width: 0 7px 0 7px; - border-color: transparent; - content: " "; - display: block; - top: -10px; - border-bottom-width: 10px; - border-bottom-color: #909599; -} -.bk-root .bk-tooltip.bk-below::after { - position: absolute; - margin: 0 0 0 -7px; - left: 50%; - width: 0; - height: 0; - border-style: solid; - border-width: 0 7px 0 7px; - border-color: transparent; - content: " "; - display: block; - bottom: -10px; - border-top-width: 10px; - border-top-color: #909599; -} -.bk-root .bk-tooltip-row-label { - text-align: right; - color: #26aae1; - /* blue from toolbar highlighting */ -} -.bk-root .bk-tooltip-row-value { - color: default; - /* seems to be necessary for notebook */ -} -.bk-root .bk-tooltip-color-block { - width: 12px; - height: 12px; - margin-left: 5px; - margin-right: 5px; - outline: #dddddd solid 1px; - display: inline-block; -} -/* notebook specific tweaks so no black outline and matching padding -/* can't be wrapped inside bk-root. here are the offending jupyter lines: -/* https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/less/renderedhtml.less#L59-L76 */ -.rendered_html .bk-root .bk-tooltip table, -.rendered_html .bk-root .bk-tooltip tr, -.rendered_html .bk-root .bk-tooltip th, -.rendered_html .bk-root .bk-tooltip td { - border: none; - padding: 1px; -} \ No newline at end of file diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.js b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.js deleted file mode 100644 index 03a056a02..000000000 --- a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-1.1.0.js +++ /dev/null @@ -1,40809 +0,0 @@ -/*! - * Copyright (c) 2012 - 2018, Anaconda, Inc., and Bokeh Contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of Anaconda nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ -(function(root, factory) { -// if(typeof exports === 'object' && typeof module === 'object') -// module.exports = factory(); -// else if(typeof define === 'function' && define.amd) -// define("Bokeh", [], factory); -// else if(typeof exports === 'object') -// exports["Bokeh"] = factory(); -// else - root["Bokeh"] = factory(); -})(this, function() { - var define; - return (function(modules, aliases, entry, parent_require) { - var cache = {}; - - var normalize = function(name) { - if (typeof name === "number") - return name; - - if (name === "bokehjs") - return entry; - - var prefix = "@bokehjs/" - if (name.slice(0, prefix.length) === prefix) - name = name.slice(prefix.length) - - var alias = aliases[name] - if (alias != null) - return alias; - - var trailing = name.length > 0 && name[name.lenght-1] === "/"; - var index = aliases[name + (trailing ? "" : "/") + "index"]; - if (index != null) - return index; - - return name; - } - - var require = function(name) { - var mod = cache[name]; - if (!mod) { - var id = normalize(name); - - mod = cache[id]; - if (!mod) { - if (!modules[id]) { - if (parent_require) - return parent_require(id); - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - mod = {exports: {}}; - cache[id] = mod; - cache[name] = mod; - modules[id].call(mod.exports, require, mod, mod.exports); - } else - cache[name] = mod; - } - - return mod.exports; - } - - var main = require(entry); - main.require = require; - - main.register_plugin = function(plugin_modules, plugin_aliases, plugin_entry) { - for (var name in plugin_modules) { - modules[name] = plugin_modules[name]; - } - - for (var name in plugin_aliases) { - aliases[name] = plugin_aliases[name]; - } - - var plugin = require(plugin_entry); - - for (var name in plugin) { - main[name] = plugin[name]; - } - - return plugin; - } - - return main; - }) -([ -/* base */ function _(require, module, exports) { - var models = require(157) /* ./models/index */; - var object_1 = require(35) /* ./core/util/object */; - exports.overrides = {}; - var _all_models = object_1.clone(models); - exports.Models = (function (name) { - var model = exports.overrides[name] || _all_models[name]; - if (model == null) { - throw new Error("Model '" + name + "' does not exist. This could be due to a widget\n or a custom model not being registered before first usage."); - } - return model; - }); - exports.Models.register = function (name, model) { - exports.overrides[name] = model; - }; - exports.Models.unregister = function (name) { - delete exports.overrides[name]; - }; - exports.Models.register_models = function (models, force, errorFn) { - if (force === void 0) { - force = false; - } - if (models == null) - return; - for (var name_1 in models) { - var model = models[name_1]; - if (force || !_all_models.hasOwnProperty(name_1)) - _all_models[name_1] = model; - else if (errorFn != null) - errorFn(name_1); - else - console.warn("Model '" + name_1 + "' was already registered"); - } - }; - exports.register_models = exports.Models.register_models; - exports.Models.registered_names = function () { return Object.keys(_all_models); }; -} -, -/* client/connection */ function _(require, module, exports) { - var logging_1 = require(17) /* ../core/logging */; - var document_1 = require(54) /* ../document */; - var message_1 = require(292) /* ../protocol/message */; - var receiver_1 = require(293) /* ../protocol/receiver */; - var session_1 = require(2) /* ./session */; - exports.DEFAULT_SERVER_WEBSOCKET_URL = "ws://localhost:5006/ws"; - exports.DEFAULT_SESSION_ID = "default"; - var _connection_count = 0; - var ClientConnection = /** @class */ (function () { - function ClientConnection(url, id, args_string, _on_have_session_hook, _on_closed_permanently_hook) { - if (url === void 0) { - url = exports.DEFAULT_SERVER_WEBSOCKET_URL; - } - if (id === void 0) { - id = exports.DEFAULT_SESSION_ID; - } - if (args_string === void 0) { - args_string = null; - } - if (_on_have_session_hook === void 0) { - _on_have_session_hook = null; - } - if (_on_closed_permanently_hook === void 0) { - _on_closed_permanently_hook = null; - } - this.url = url; - this.id = id; - this.args_string = args_string; - this._on_have_session_hook = _on_have_session_hook; - this._on_closed_permanently_hook = _on_closed_permanently_hook; - this._number = _connection_count++; - this.socket = null; - this.session = null; - this.closed_permanently = false; - this._current_handler = null; - this._pending_ack = null; // null or [resolve,reject] - this._pending_replies = {}; // map reqid to [resolve,reject] - this._receiver = new receiver_1.Receiver(); - logging_1.logger.debug("Creating websocket " + this._number + " to '" + this.url + "' session '" + this.id + "'"); - } - ClientConnection.prototype.connect = function () { - var _this = this; - if (this.closed_permanently) - return Promise.reject(new Error("Cannot connect() a closed ClientConnection")); - if (this.socket != null) - return Promise.reject(new Error("Already connected")); - this._pending_replies = {}; - this._current_handler = null; - try { - var versioned_url = this.url + "?bokeh-protocol-version=1.0&bokeh-session-id=" + this.id; - if (this.args_string != null && this.args_string.length > 0) - versioned_url += "&" + this.args_string; - this.socket = new WebSocket(versioned_url); - return new Promise(function (resolve, reject) { - // "arraybuffer" gives us binary data we can look at; - // if we just needed an opaque blob we could use "blob" - _this.socket.binaryType = "arraybuffer"; - _this.socket.onopen = function () { return _this._on_open(resolve, reject); }; - _this.socket.onmessage = function (event) { return _this._on_message(event); }; - _this.socket.onclose = function (event) { return _this._on_close(event); }; - _this.socket.onerror = function () { return _this._on_error(reject); }; - }); - } - catch (error) { - logging_1.logger.error("websocket creation failed to url: " + this.url); - logging_1.logger.error(" - " + error); - return Promise.reject(error); - } - }; - ClientConnection.prototype.close = function () { - if (!this.closed_permanently) { - logging_1.logger.debug("Permanently closing websocket connection " + this._number); - this.closed_permanently = true; - if (this.socket != null) - this.socket.close(1000, "close method called on ClientConnection " + this._number); - this.session._connection_closed(); - if (this._on_closed_permanently_hook != null) { - this._on_closed_permanently_hook(); - this._on_closed_permanently_hook = null; - } - } - }; - ClientConnection.prototype._schedule_reconnect = function (milliseconds) { - var _this = this; - var retry = function () { - // TODO commented code below until we fix reconnection to repull - // the document when required. Otherwise, we get a lot of - // confusing errors that are causing trouble when debugging. - /* - if (this.closed_permanently) { - */ - if (!_this.closed_permanently) - logging_1.logger.info("Websocket connection " + _this._number + " disconnected, will not attempt to reconnect"); - return; - /* - } else { - logger.debug(`Attempting to reconnect websocket ${this._number}`) - this.connect() - } - */ - }; - setTimeout(retry, milliseconds); - }; - ClientConnection.prototype.send = function (message) { - if (this.socket == null) - throw new Error("not connected so cannot send " + message); - message.send(this.socket); - }; - ClientConnection.prototype.send_with_reply = function (message) { - var _this = this; - var promise = new Promise(function (resolve, reject) { - _this._pending_replies[message.msgid()] = [resolve, reject]; - _this.send(message); - }); - return promise.then(function (message) { - if (message.msgtype() === "ERROR") - throw new Error("Error reply " + message.content.text); - else - return message; - }, function (error) { - throw error; - }); - }; - ClientConnection.prototype._pull_doc_json = function () { - var message = message_1.Message.create("PULL-DOC-REQ", {}); - var promise = this.send_with_reply(message); - return promise.then(function (reply) { - if (!('doc' in reply.content)) - throw new Error("No 'doc' field in PULL-DOC-REPLY"); - return reply.content.doc; - }, function (error) { - throw error; - }); - }; - ClientConnection.prototype._repull_session_doc = function () { - var _this = this; - if (this.session == null) - logging_1.logger.debug("Pulling session for first time"); - else - logging_1.logger.debug("Repulling session"); - this._pull_doc_json().then(function (doc_json) { - if (_this.session == null) { - if (_this.closed_permanently) - logging_1.logger.debug("Got new document after connection was already closed"); - else { - var document_2 = document_1.Document.from_json(doc_json); - // Constructing models changes some of their attributes, we deal with that - // here. This happens when models set attributes during construction - // or initialization. - var patch = document_1.Document._compute_patch_since_json(doc_json, document_2); - if (patch.events.length > 0) { - logging_1.logger.debug("Sending " + patch.events.length + " changes from model construction back to server"); - var patch_message = message_1.Message.create('PATCH-DOC', {}, patch); - _this.send(patch_message); - } - _this.session = new session_1.ClientSession(_this, document_2, _this.id); - logging_1.logger.debug("Created a new session from new pulled doc"); - if (_this._on_have_session_hook != null) { - _this._on_have_session_hook(_this.session); - _this._on_have_session_hook = null; - } - } - } - else { - _this.session.document.replace_with_json(doc_json); - logging_1.logger.debug("Updated existing session with new pulled doc"); - } - }, function (error) { - // handling the error here is useless because we wouldn't - // get errors from the resolve handler above, so see - // the catch below instead - throw error; - }).catch(function (error) { - if (console.trace != null) - console.trace(error); - logging_1.logger.error("Failed to repull session " + error); - }); - }; - ClientConnection.prototype._on_open = function (resolve, reject) { - var _this = this; - logging_1.logger.info("Websocket connection " + this._number + " is now open"); - this._pending_ack = [resolve, reject]; - this._current_handler = function (message) { - _this._awaiting_ack_handler(message); - }; - }; - ClientConnection.prototype._on_message = function (event) { - if (this._current_handler == null) - logging_1.logger.error("Got a message with no current handler set"); - try { - this._receiver.consume(event.data); - } - catch (e) { - this._close_bad_protocol(e.toString()); - } - if (this._receiver.message == null) - return; - var msg = this._receiver.message; - var problem = msg.problem(); - if (problem != null) - this._close_bad_protocol(problem); - this._current_handler(msg); - }; - ClientConnection.prototype._on_close = function (event) { - var _this = this; - logging_1.logger.info("Lost websocket " + this._number + " connection, " + event.code + " (" + event.reason + ")"); - this.socket = null; - if (this._pending_ack != null) { - this._pending_ack[1](new Error("Lost websocket connection, " + event.code + " (" + event.reason + ")")); - this._pending_ack = null; - } - var pop_pending = function () { - for (var reqid in _this._pending_replies) { - var promise_funcs_1 = _this._pending_replies[reqid]; - delete _this._pending_replies[reqid]; - return promise_funcs_1; - } - return null; - }; - var promise_funcs = pop_pending(); - while (promise_funcs != null) { - promise_funcs[1]("Disconnected"); - promise_funcs = pop_pending(); - } - if (!this.closed_permanently) - this._schedule_reconnect(2000); - }; - ClientConnection.prototype._on_error = function (reject) { - logging_1.logger.debug("Websocket error on socket " + this._number); - reject(new Error("Could not open websocket")); - }; - ClientConnection.prototype._close_bad_protocol = function (detail) { - logging_1.logger.error("Closing connection: " + detail); - if (this.socket != null) - this.socket.close(1002, detail); // 1002 = protocol error - }; - ClientConnection.prototype._awaiting_ack_handler = function (message) { - var _this = this; - if (message.msgtype() === "ACK") { - this._current_handler = function (message) { return _this._steady_state_handler(message); }; - // Reload any sessions - // TODO (havocp) there's a race where we might get a PATCH before - // we send and get a reply to our pulls. - this._repull_session_doc(); - if (this._pending_ack != null) { - this._pending_ack[0](this); - this._pending_ack = null; - } - } - else - this._close_bad_protocol("First message was not an ACK"); - }; - ClientConnection.prototype._steady_state_handler = function (message) { - if (message.reqid() in this._pending_replies) { - var promise_funcs = this._pending_replies[message.reqid()]; - delete this._pending_replies[message.reqid()]; - promise_funcs[0](message); - } - else - this.session.handle(message); - }; - return ClientConnection; - }()); - exports.ClientConnection = ClientConnection; - // Returns a promise of a ClientSession - // The returned promise has a close() method in case you want to close before - // getting a session; session.close() works too once you have a session. - function pull_session(url, session_id, args_string) { - var promise = new Promise(function (resolve, reject) { - var connection = new ClientConnection(url, session_id, args_string, function (session) { - try { - resolve(session); - } - catch (error) { - logging_1.logger.error("Promise handler threw an error, closing session " + error); - session.close(); - throw error; - } - }, function () { - // we rely on reject() as a no-op if we already resolved - reject(new Error("Connection was closed before we successfully pulled a session")); - }); - connection.connect().then(function (_) { return undefined; }, function (error) { - logging_1.logger.error("Failed to connect to Bokeh server " + error); - throw error; - }); - }); - return promise; - } - exports.pull_session = pull_session; -} -, -/* client/session */ function _(require, module, exports) { - var document_1 = require(54) /* ../document */; - var message_1 = require(292) /* ../protocol/message */; - var logging_1 = require(17) /* ../core/logging */; - var ClientSession = /** @class */ (function () { - function ClientSession(_connection, document /*Document*/, id) { - var _this = this; - this._connection = _connection; - this.document = document; - this.id = id; - this._document_listener = function (event) { return _this._document_changed(event); }; - this.document.on_change(this._document_listener); - this.event_manager = this.document.event_manager; - this.event_manager.session = this; - } - ClientSession.prototype.handle = function (message) { - var msgtype = message.msgtype(); - if (msgtype === 'PATCH-DOC') - this._handle_patch(message); - else if (msgtype === 'OK') - this._handle_ok(message); - else if (msgtype === 'ERROR') - this._handle_error(message); - else - logging_1.logger.debug("Doing nothing with message " + message.msgtype()); - }; - ClientSession.prototype.close = function () { - this._connection.close(); - }; - ClientSession.prototype.send_event = function (event) { - var message = message_1.Message.create('EVENT', {}, JSON.stringify(event.to_json())); - this._connection.send(message); - }; - /*protected*/ ClientSession.prototype._connection_closed = function () { - this.document.remove_on_change(this._document_listener); - }; - // Sends a request to the server for info about the server, such as its Bokeh - // version. Returns a promise, the value of the promise is a free-form dictionary - // of server details. - ClientSession.prototype.request_server_info = function () { - var message = message_1.Message.create('SERVER-INFO-REQ', {}); - var promise = this._connection.send_with_reply(message); - return promise.then(function (reply) { return reply.content; }); - }; - // Sends some request to the server (no guarantee about which one) and returns - // a promise which is completed when the server replies. The purpose of this - // is that if you wait for the promise to be completed, you know the server - // has processed the request. This is useful when writing tests because once - // the server has processed this request it should also have processed any - // events or requests you sent previously, which means you can check for the - // results of that processing without a race condition. (This assumes the - // server processes events in sequence, which it mostly has to semantically, - // since reordering events might change the final state.) - ClientSession.prototype.force_roundtrip = function () { - return this.request_server_info().then(function (_) { return undefined; }); - }; - ClientSession.prototype._document_changed = function (event) { - // Filter out events that were initiated by the ClientSession itself - if (event.setter_id === this.id) - return; - // Filter out changes to attributes that aren't server-visible - if (event instanceof document_1.ModelChangedEvent && !(event.attr in event.model.serializable_attributes())) - return; - // TODO (havocp) the connection may be closed here, which will - // cause this send to throw an error - need to deal with it more cleanly. - var message = message_1.Message.create('PATCH-DOC', {}, this.document.create_json_patch([event])); - this._connection.send(message); - }; - ClientSession.prototype._handle_patch = function (message) { - this.document.apply_json_patch(message.content, message.buffers, this.id); - }; - ClientSession.prototype._handle_ok = function (message) { - logging_1.logger.trace("Unhandled OK reply to " + message.reqid()); - }; - ClientSession.prototype._handle_error = function (message) { - logging_1.logger.error("Unhandled ERROR reply to " + message.reqid() + ": " + message.content.text); - }; - return ClientSession; - }()); - exports.ClientSession = ClientSession; -} -, -/* core/bokeh_events */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - function event(event_name) { - return function (cls) { - cls.prototype.event_name = event_name; - }; - } - var BokehEvent = /** @class */ (function () { - function BokehEvent() { - } - BokehEvent.prototype.to_json = function () { - var event_name = this.event_name; - return { event_name: event_name, event_values: this._to_json() }; - }; - BokehEvent.prototype._to_json = function () { - var origin = this.origin; - return { model_id: origin != null ? origin.id : null }; - }; - return BokehEvent; - }()); - exports.BokehEvent = BokehEvent; - var ButtonClick = /** @class */ (function (_super) { - tslib_1.__extends(ButtonClick, _super); - function ButtonClick() { - return _super !== null && _super.apply(this, arguments) || this; - } - ButtonClick = tslib_1.__decorate([ - event("button_click") - ], ButtonClick); - return ButtonClick; - }(BokehEvent)); - exports.ButtonClick = ButtonClick; - var MenuItemClick = /** @class */ (function (_super) { - tslib_1.__extends(MenuItemClick, _super); - function MenuItemClick(item) { - var _this = _super.call(this) || this; - _this.item = item; - return _this; - } - MenuItemClick.prototype._to_json = function () { - var item = this.item; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { item: item }); - }; - MenuItemClick = tslib_1.__decorate([ - event("menu_item_click") - ], MenuItemClick); - return MenuItemClick; - }(BokehEvent)); - exports.MenuItemClick = MenuItemClick; - // A UIEvent is an event originating on a canvas this includes. - // DOM events such as keystrokes as well as hammer events and LOD events. - var UIEvent = /** @class */ (function (_super) { - tslib_1.__extends(UIEvent, _super); - function UIEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - return UIEvent; - }(BokehEvent)); - exports.UIEvent = UIEvent; - var LODStart = /** @class */ (function (_super) { - tslib_1.__extends(LODStart, _super); - function LODStart() { - return _super !== null && _super.apply(this, arguments) || this; - } - LODStart = tslib_1.__decorate([ - event("lodstart") - ], LODStart); - return LODStart; - }(UIEvent)); - exports.LODStart = LODStart; - var LODEnd = /** @class */ (function (_super) { - tslib_1.__extends(LODEnd, _super); - function LODEnd() { - return _super !== null && _super.apply(this, arguments) || this; - } - LODEnd = tslib_1.__decorate([ - event("lodend") - ], LODEnd); - return LODEnd; - }(UIEvent)); - exports.LODEnd = LODEnd; - var SelectionGeometry = /** @class */ (function (_super) { - tslib_1.__extends(SelectionGeometry, _super); - function SelectionGeometry(geometry, final) { - var _this = _super.call(this) || this; - _this.geometry = geometry; - _this.final = final; - return _this; - } - SelectionGeometry.prototype._to_json = function () { - var _a = this, geometry = _a.geometry, final = _a.final; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { geometry: geometry, final: final }); - }; - SelectionGeometry = tslib_1.__decorate([ - event("selectiongeometry") - ], SelectionGeometry); - return SelectionGeometry; - }(UIEvent)); - exports.SelectionGeometry = SelectionGeometry; - var Reset = /** @class */ (function (_super) { - tslib_1.__extends(Reset, _super); - function Reset() { - return _super !== null && _super.apply(this, arguments) || this; - } - Reset = tslib_1.__decorate([ - event("reset") - ], Reset); - return Reset; - }(UIEvent)); - exports.Reset = Reset; - var PointEvent = /** @class */ (function (_super) { - tslib_1.__extends(PointEvent, _super); - function PointEvent(sx, sy, x, y) { - var _this = _super.call(this) || this; - _this.sx = sx; - _this.sy = sy; - _this.x = x; - _this.y = y; - return _this; - } - PointEvent.prototype._to_json = function () { - var _a = this, sx = _a.sx, sy = _a.sy, x = _a.x, y = _a.y; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { sx: sx, sy: sy, x: x, y: y }); - }; - return PointEvent; - }(UIEvent)); - exports.PointEvent = PointEvent; - var Pan = /** @class */ (function (_super) { - tslib_1.__extends(Pan, _super); - function Pan(sx, sy, x, y, delta_x, delta_y) { - var _this = _super.call(this, sx, sy, x, y) || this; - _this.sx = sx; - _this.sy = sy; - _this.x = x; - _this.y = y; - _this.delta_x = delta_x; - _this.delta_y = delta_y; - return _this; - } - Pan.prototype._to_json = function () { - var _a = this, delta_x = _a.delta_x, delta_y = _a.delta_y /*, direction*/; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { delta_x: delta_x, delta_y: delta_y /*, direction*/ }); - }; - Pan = tslib_1.__decorate([ - event("pan") - ], Pan); - return Pan; - }(PointEvent)); - exports.Pan = Pan; - var Pinch = /** @class */ (function (_super) { - tslib_1.__extends(Pinch, _super); - function Pinch(sx, sy, x, y, scale) { - var _this = _super.call(this, sx, sy, x, y) || this; - _this.sx = sx; - _this.sy = sy; - _this.x = x; - _this.y = y; - _this.scale = scale; - return _this; - } - Pinch.prototype._to_json = function () { - var scale = this.scale; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { scale: scale }); - }; - Pinch = tslib_1.__decorate([ - event("pinch") - ], Pinch); - return Pinch; - }(PointEvent)); - exports.Pinch = Pinch; - var MouseWheel = /** @class */ (function (_super) { - tslib_1.__extends(MouseWheel, _super); - function MouseWheel(sx, sy, x, y, delta) { - var _this = _super.call(this, sx, sy, x, y) || this; - _this.sx = sx; - _this.sy = sy; - _this.x = x; - _this.y = y; - _this.delta = delta; - return _this; - } - MouseWheel.prototype._to_json = function () { - var delta = this.delta; - return tslib_1.__assign({}, _super.prototype._to_json.call(this), { delta: delta }); - }; - MouseWheel = tslib_1.__decorate([ - event("wheel") - ], MouseWheel); - return MouseWheel; - }(PointEvent)); - exports.MouseWheel = MouseWheel; - var MouseMove = /** @class */ (function (_super) { - tslib_1.__extends(MouseMove, _super); - function MouseMove() { - return _super !== null && _super.apply(this, arguments) || this; - } - MouseMove = tslib_1.__decorate([ - event("mousemove") - ], MouseMove); - return MouseMove; - }(PointEvent)); - exports.MouseMove = MouseMove; - var MouseEnter = /** @class */ (function (_super) { - tslib_1.__extends(MouseEnter, _super); - function MouseEnter() { - return _super !== null && _super.apply(this, arguments) || this; - } - MouseEnter = tslib_1.__decorate([ - event("mouseenter") - ], MouseEnter); - return MouseEnter; - }(PointEvent)); - exports.MouseEnter = MouseEnter; - var MouseLeave = /** @class */ (function (_super) { - tslib_1.__extends(MouseLeave, _super); - function MouseLeave() { - return _super !== null && _super.apply(this, arguments) || this; - } - MouseLeave = tslib_1.__decorate([ - event("mouseleave") - ], MouseLeave); - return MouseLeave; - }(PointEvent)); - exports.MouseLeave = MouseLeave; - var Tap = /** @class */ (function (_super) { - tslib_1.__extends(Tap, _super); - function Tap() { - return _super !== null && _super.apply(this, arguments) || this; - } - Tap = tslib_1.__decorate([ - event("tap") - ], Tap); - return Tap; - }(PointEvent)); - exports.Tap = Tap; - var DoubleTap = /** @class */ (function (_super) { - tslib_1.__extends(DoubleTap, _super); - function DoubleTap() { - return _super !== null && _super.apply(this, arguments) || this; - } - DoubleTap = tslib_1.__decorate([ - event("doubletap") - ], DoubleTap); - return DoubleTap; - }(PointEvent)); - exports.DoubleTap = DoubleTap; - var Press = /** @class */ (function (_super) { - tslib_1.__extends(Press, _super); - function Press() { - return _super !== null && _super.apply(this, arguments) || this; - } - Press = tslib_1.__decorate([ - event("press") - ], Press); - return Press; - }(PointEvent)); - exports.Press = Press; - var PanStart = /** @class */ (function (_super) { - tslib_1.__extends(PanStart, _super); - function PanStart() { - return _super !== null && _super.apply(this, arguments) || this; - } - PanStart = tslib_1.__decorate([ - event("panstart") - ], PanStart); - return PanStart; - }(PointEvent)); - exports.PanStart = PanStart; - var PanEnd = /** @class */ (function (_super) { - tslib_1.__extends(PanEnd, _super); - function PanEnd() { - return _super !== null && _super.apply(this, arguments) || this; - } - PanEnd = tslib_1.__decorate([ - event("panend") - ], PanEnd); - return PanEnd; - }(PointEvent)); - exports.PanEnd = PanEnd; - var PinchStart = /** @class */ (function (_super) { - tslib_1.__extends(PinchStart, _super); - function PinchStart() { - return _super !== null && _super.apply(this, arguments) || this; - } - PinchStart = tslib_1.__decorate([ - event("pinchstart") - ], PinchStart); - return PinchStart; - }(PointEvent)); - exports.PinchStart = PinchStart; - var PinchEnd = /** @class */ (function (_super) { - tslib_1.__extends(PinchEnd, _super); - function PinchEnd() { - return _super !== null && _super.apply(this, arguments) || this; - } - PinchEnd = tslib_1.__decorate([ - event("pinchend") - ], PinchEnd); - return PinchEnd; - }(PointEvent)); - exports.PinchEnd = PinchEnd; -} -, -/* core/build_views */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var array_1 = require(24) /* ./util/array */; - function build_views(view_storage, models, options, cls) { - if (cls === void 0) { - cls = function (model) { return model.default_view; }; - } - var to_remove = array_1.difference(Object.keys(view_storage), models.map(function (model) { return model.id; })); - for (var _i = 0, to_remove_1 = to_remove; _i < to_remove_1.length; _i++) { - var model_id = to_remove_1[_i]; - view_storage[model_id].remove(); - delete view_storage[model_id]; - } - var created_views = []; - var new_models = models.filter(function (model) { return view_storage[model.id] == null; }); - for (var _a = 0, new_models_1 = new_models; _a < new_models_1.length; _a++) { - var model = new_models_1[_a]; - var view_cls = cls(model); - var view_options = tslib_1.__assign({}, options, { model: model, connect_signals: false }); - var view = new view_cls(view_options); - view_storage[model.id] = view; - created_views.push(view); - } - for (var _b = 0, created_views_1 = created_views; _b < created_views_1.length; _b++) { - var view = created_views_1[_b]; - view.connect_signals(); - } - return created_views; - } - exports.build_views = build_views; - function remove_views(view_storage) { - for (var id in view_storage) { - view_storage[id].remove(); - delete view_storage[id]; - } - } - exports.remove_views = remove_views; -} -, -/* core/dom */ function _(require, module, exports) { - var types_1 = require(46) /* ./util/types */; - var _createElement = function (tag) { - return function (attrs) { - if (attrs === void 0) { - attrs = {}; - } - var children = []; - for (var _i = 1; _i < arguments.length; _i++) { - children[_i - 1] = arguments[_i]; - } - var element = document.createElement(tag); - element.classList.add("bk"); - for (var attr in attrs) { - var value = attrs[attr]; - if (value == null || types_1.isBoolean(value) && !value) - continue; - if (attr === "class") { - if (types_1.isString(value)) - value = value.split(/\s+/); - if (types_1.isArray(value)) { - for (var _a = 0, _b = value; _a < _b.length; _a++) { - var cls = _b[_a]; - if (cls != null) - element.classList.add(cls); - } - continue; - } - } - if (attr === "style" && types_1.isPlainObject(value)) { - for (var prop in value) { - element.style[prop] = value[prop]; - } - continue; - } - if (attr === "data" && types_1.isPlainObject(value)) { - for (var key in value) { - element.dataset[key] = value[key]; // XXX: attrs needs a better type - } - continue; - } - element.setAttribute(attr, value); - } - function append(child) { - if (child instanceof HTMLElement) - element.appendChild(child); - else if (types_1.isString(child)) - element.appendChild(document.createTextNode(child)); - else if (child != null && child !== false) - throw new Error("expected an HTMLElement, string, false or null, got " + JSON.stringify(child)); - } - for (var _c = 0, children_1 = children; _c < children_1.length; _c++) { - var child = children_1[_c]; - if (types_1.isArray(child)) { - for (var _d = 0, child_1 = child; _d < child_1.length; _d++) { - var _child = child_1[_d]; - append(_child); - } - } - else - append(child); - } - return element; - }; - }; - function createElement(tag, attrs) { - var children = []; - for (var _i = 2; _i < arguments.length; _i++) { - children[_i - 2] = arguments[_i]; - } - return _createElement(tag).apply(void 0, [attrs].concat(children)); - } - exports.createElement = createElement; - exports.div = _createElement("div"), exports.span = _createElement("span"), exports.canvas = _createElement("canvas"), exports.link = _createElement("link"), exports.style = _createElement("style"), exports.a = _createElement("a"), exports.p = _createElement("p"), exports.i = _createElement("i"), exports.pre = _createElement("pre"), exports.button = _createElement("button"), exports.label = _createElement("label"), exports.input = _createElement("input"), exports.select = _createElement("select"), exports.option = _createElement("option"), exports.optgroup = _createElement("optgroup"), exports.textarea = _createElement("textarea"); - function nbsp() { - return document.createTextNode("\u00a0"); - } - exports.nbsp = nbsp; - function removeElement(element) { - var parent = element.parentNode; - if (parent != null) { - parent.removeChild(element); - } - } - exports.removeElement = removeElement; - function replaceWith(element, replacement) { - var parent = element.parentNode; - if (parent != null) { - parent.replaceChild(replacement, element); - } - } - exports.replaceWith = replaceWith; - function prepend(element) { - var nodes = []; - for (var _i = 1; _i < arguments.length; _i++) { - nodes[_i - 1] = arguments[_i]; - } - var first = element.firstChild; - for (var _a = 0, nodes_1 = nodes; _a < nodes_1.length; _a++) { - var node = nodes_1[_a]; - element.insertBefore(node, first); - } - } - exports.prepend = prepend; - function empty(element) { - var child; - while (child = element.firstChild) { - element.removeChild(child); - } - } - exports.empty = empty; - function display(element) { - element.style.display = ""; - } - exports.display = display; - function undisplay(element) { - element.style.display = "none"; - } - exports.undisplay = undisplay; - function show(element) { - element.style.visibility = ""; - } - exports.show = show; - function hide(element) { - element.style.visibility = "hidden"; - } - exports.hide = hide; - function offset(element) { - var rect = element.getBoundingClientRect(); - return { - top: rect.top + window.pageYOffset - document.documentElement.clientTop, - left: rect.left + window.pageXOffset - document.documentElement.clientLeft, - }; - } - exports.offset = offset; - function matches(el, selector) { - var p = Element.prototype; - var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector; - return f.call(el, selector); - } - exports.matches = matches; - function parent(el, selector) { - var node = el; - while (node = node.parentElement) { - if (matches(node, selector)) - return node; - } - return null; - } - exports.parent = parent; - function num(value) { - return parseFloat(value) || 0; - } - function extents(el) { - var style = getComputedStyle(el); - return { - border: { - top: num(style.borderTopWidth), - bottom: num(style.borderBottomWidth), - left: num(style.borderLeftWidth), - right: num(style.borderRightWidth), - }, - margin: { - top: num(style.marginTop), - bottom: num(style.marginBottom), - left: num(style.marginLeft), - right: num(style.marginRight), - }, - padding: { - top: num(style.paddingTop), - bottom: num(style.paddingBottom), - left: num(style.paddingLeft), - right: num(style.paddingRight), - }, - }; - } - exports.extents = extents; - function size(el) { - var rect = el.getBoundingClientRect(); - return { - width: Math.ceil(rect.width), - height: Math.ceil(rect.height), - }; - } - exports.size = size; - function scroll_size(el) { - return { - width: Math.ceil(el.scrollWidth), - height: Math.ceil(el.scrollHeight), - }; - } - exports.scroll_size = scroll_size; - function outer_size(el) { - var _a = extents(el).margin, left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom; - var _b = size(el), width = _b.width, height = _b.height; - return { - width: Math.ceil(width + left + right), - height: Math.ceil(height + top + bottom), - }; - } - exports.outer_size = outer_size; - function content_size(el) { - var _a = el.getBoundingClientRect(), left = _a.left, top = _a.top; - var padding = extents(el).padding; - var width = 0; - var height = 0; - for (var _i = 0, _b = children(el); _i < _b.length; _i++) { - var child = _b[_i]; - var rect = child.getBoundingClientRect(); - width = Math.max(width, Math.ceil(rect.left - left - padding.left + rect.width)); - height = Math.max(height, Math.ceil(rect.top - top - padding.top + rect.height)); - } - return { width: width, height: height }; - } - exports.content_size = content_size; - function position(el, box, margin) { - var style = el.style; - style.left = box.left + "px"; - style.top = box.top + "px"; - style.width = box.width + "px"; - style.height = box.height + "px"; - if (margin == null) - style.margin = ""; - else { - var top_1 = margin.top, right = margin.right, bottom = margin.bottom, left = margin.left; - style.margin = top_1 + "px " + right + "px " + bottom + "px " + left + "px"; - } - } - exports.position = position; - function children(el) { - return Array.from(el.children); - } - exports.children = children; - var ClassList = /** @class */ (function () { - function ClassList(el) { - this.el = el; - this.classList = el.classList; - } - Object.defineProperty(ClassList.prototype, "values", { - get: function () { - var values = []; - for (var i_1 = 0; i_1 < this.classList.length; i_1++) { - var item = this.classList.item(i_1); - if (item != null) - values.push(item); - } - return values; - }, - enumerable: true, - configurable: true - }); - ClassList.prototype.has = function (cls) { - return this.classList.contains(cls); - }; - ClassList.prototype.add = function () { - var classes = []; - for (var _i = 0; _i < arguments.length; _i++) { - classes[_i] = arguments[_i]; - } - for (var _a = 0, classes_1 = classes; _a < classes_1.length; _a++) { - var cls = classes_1[_a]; - this.classList.add(cls); - } - return this; - }; - ClassList.prototype.remove = function () { - var classes = []; - for (var _i = 0; _i < arguments.length; _i++) { - classes[_i] = arguments[_i]; - } - for (var _a = 0, classes_2 = classes; _a < classes_2.length; _a++) { - var cls = classes_2[_a]; - this.classList.remove(cls); - } - return this; - }; - ClassList.prototype.clear = function () { - for (var _i = 0, _a = this.values; _i < _a.length; _i++) { - var cls = _a[_i]; - if (cls != "bk") - this.classList.remove(cls); - } - return this; - }; - ClassList.prototype.toggle = function (cls, activate) { - var add = activate != null ? activate : !this.has(cls); - if (add) - this.add(cls); - else - this.remove(cls); - return this; - }; - return ClassList; - }()); - exports.ClassList = ClassList; - function classes(el) { - return new ClassList(el); - } - exports.classes = classes; - var Keys; - (function (Keys) { - Keys[Keys["Backspace"] = 8] = "Backspace"; - Keys[Keys["Tab"] = 9] = "Tab"; - Keys[Keys["Enter"] = 13] = "Enter"; - Keys[Keys["Esc"] = 27] = "Esc"; - Keys[Keys["PageUp"] = 33] = "PageUp"; - Keys[Keys["PageDown"] = 34] = "PageDown"; - Keys[Keys["Left"] = 37] = "Left"; - Keys[Keys["Up"] = 38] = "Up"; - Keys[Keys["Right"] = 39] = "Right"; - Keys[Keys["Down"] = 40] = "Down"; - Keys[Keys["Delete"] = 46] = "Delete"; - })(Keys = exports.Keys || (exports.Keys = {})); - function undisplayed(el, fn) { - var display = el.style.display; - el.style.display = "none"; - try { - return fn(); - } - finally { - el.style.display = display; - } - } - exports.undisplayed = undisplayed; - function unsized(el, fn) { - return sized(el, {}, fn); - } - exports.unsized = unsized; - function sized(el, size, fn) { - var _a = el.style, width = _a.width, height = _a.height, position = _a.position, display = _a.display; - el.style.position = "absolute"; - el.style.display = ""; - el.style.width = size.width != null && size.width != Infinity ? size.width + "px" : "auto"; - el.style.height = size.height != null && size.height != Infinity ? size.height + "px" : "auto"; - try { - return fn(); - } - finally { - el.style.position = position; - el.style.display = display; - el.style.width = width; - el.style.height = height; - } - } - exports.sized = sized; -} -, -/* core/dom_view */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var view_1 = require(50) /* ./view */; - var DOM = require(5) /* ./dom */; - var DOMView = /** @class */ (function (_super) { - tslib_1.__extends(DOMView, _super); - function DOMView() { - return _super !== null && _super.apply(this, arguments) || this; - } - DOMView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._has_finished = false; - this.el = this._createElement(); - }; - DOMView.prototype.remove = function () { - DOM.removeElement(this.el); - _super.prototype.remove.call(this); - }; - DOMView.prototype.css_classes = function () { - return []; - }; - DOMView.prototype.cursor = function (_sx, _sy) { - return null; - }; - DOMView.prototype.render = function () { }; - DOMView.prototype.renderTo = function (element) { - element.appendChild(this.el); - this.render(); - }; - DOMView.prototype.has_finished = function () { - return this._has_finished; - }; - Object.defineProperty(DOMView.prototype, "_root_element", { - get: function () { - return DOM.parent(this.el, ".bk-root") || document.body; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMView.prototype, "is_idle", { - get: function () { - return this.has_finished(); - }, - enumerable: true, - configurable: true - }); - DOMView.prototype._createElement = function () { - return DOM.createElement(this.tagName, { class: this.css_classes() }); - }; - return DOMView; - }(view_1.View)); - exports.DOMView = DOMView; - DOMView.prototype.tagName = "div"; -} -, -/* core/enums */ function _(require, module, exports) { - exports.Align = ["start", "center", "end"]; - exports.Anchor = [ - "top_left", "top_center", "top_right", - "center_left", "center", "center_right", - "bottom_left", "bottom_center", "bottom_right", - ]; - exports.AngleUnits = ["deg", "rad"]; - exports.BoxOrigin = ["corner", "center"]; - exports.ButtonType = ["default", "primary", "success", "warning", "danger"]; - exports.Dimension = ["width", "height"]; - exports.Dimensions = ["width", "height", "both"]; - exports.Direction = ["clock", "anticlock"]; - exports.Distribution = ["uniform", "normal"]; - exports.FontStyle = ["normal", "italic", "bold", "bold italic"]; - exports.HTTPMethod = ["POST", "GET"]; - exports.HexTileOrientation = ["pointytop", "flattop"]; - exports.HoverMode = ["mouse", "hline", "vline"]; - exports.LatLon = ["lat", "lon"]; - exports.LegendClickPolicy = ["none", "hide", "mute"]; - exports.LegendLocation = exports.Anchor; - exports.LineCap = ["butt", "round", "square"]; - exports.LineJoin = ["miter", "round", "bevel"]; - exports.LinePolicy = ["prev", "next", "nearest", "interp", "none"]; - exports.Location = ["above", "below", "left", "right"]; - exports.Logo = ["normal", "grey"]; - exports.MarkerType = [ - "asterisk", "circle", "circle_cross", "circle_x", "cross", - "dash", "diamond", "diamond_cross", "hex", "inverted_triangle", - "square", "square_cross", "square_x", "triangle", "x", - ]; - exports.Orientation = ["vertical", "horizontal"]; - exports.OutputBackend = ["canvas", "svg", "webgl"]; - exports.PaddingUnits = ["percent", "absolute"]; - exports.Place = ["above", "below", "left", "right", "center"]; - exports.PointPolicy = ["snap_to_data", "follow_mouse", "none"]; - exports.RadiusDimension = ["x", "y", "max", "min"]; - exports.RenderLevel = ["image", "underlay", "glyph", "annotation", "overlay"]; - exports.RenderMode = ["canvas", "css"]; - exports.RoundingFunction = ["round", "nearest", "floor", "rounddown", "ceil", "roundup"]; - exports.Side = ["above", "below", "left", "right"]; - exports.SizingMode = ["stretch_width", "stretch_height", "stretch_both", "scale_width", "scale_height", "scale_both", "fixed"]; - exports.SliderCallbackPolicy = ["continuous", "throttle", "mouseup"]; - exports.Sort = ["ascending", "descending"]; - exports.SpatialUnits = ["screen", "data"]; - exports.StartEnd = ["start", "end"]; - exports.StepMode = ["after", "before", "center"]; - exports.TapBehavior = ["select", "inspect"]; - exports.TextAlign = ["left", "right", "center"]; - exports.TextBaseline = ["top", "middle", "bottom", "alphabetic", "hanging", "ideographic"]; - exports.TickLabelOrientation = ["vertical", "horizontal", "parallel", "normal"]; - exports.TooltipAttachment = ["horizontal", "vertical", "left", "right", "above", "below"]; - exports.UpdateMode = ["replace", "append"]; - exports.VerticalAlign = ["top", "middle", "bottom"]; -} -, -/* core/has_props */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var signaling_1 = require(22) /* ./signaling */; - var property_mixins = require(19) /* ./property_mixins */; - var refs_1 = require(37) /* ./util/refs */; - var p = require(18) /* ./properties */; - var string_1 = require(40) /* ./util/string */; - var array_1 = require(24) /* ./util/array */; - var object_1 = require(35) /* ./util/object */; - var types_1 = require(46) /* ./util/types */; - var eq_1 = require(33) /* ./util/eq */; - var HasProps = /** @class */ (function (_super) { - tslib_1.__extends(HasProps, _super); - function HasProps(attrs) { - if (attrs === void 0) { - attrs = {}; - } - var _this = _super.call(this) || this; - _this._subtype = undefined; - _this.document = null; - _this.destroyed = new signaling_1.Signal0(_this, "destroyed"); - _this.change = new signaling_1.Signal0(_this, "change"); - _this.transformchange = new signaling_1.Signal0(_this, "transformchange"); - _this.attributes = {}; - _this.properties = {}; - _this._set_after_defaults = {}; - _this._pending = false; - _this._changing = false; - for (var name_1 in _this.props) { - var _a = _this.props[name_1], type = _a.type, default_value = _a.default_value; - if (type != null) - _this.properties[name_1] = new type(_this, name_1, default_value); - else - throw new Error("undefined property type for " + _this.type + "." + name_1); - } - // auto generating ID - if (attrs.id == null) - _this.setv({ id: string_1.uniqueId() }, { silent: true }); - var deferred = attrs.__deferred__ || false; - if (deferred) { - attrs = object_1.clone(attrs); - delete attrs.__deferred__; - } - _this.setv(attrs, { silent: true }); - // allowing us to defer initialization when loading many models - // when loading a bunch of models, we want to do initialization as a second pass - // because other objects that this one depends on might not be loaded yet - if (!deferred) - _this.finalize(); - return _this; - } - HasProps.initClass = function () { - this.prototype.type = "HasProps"; - this.prototype.props = {}; - this.prototype.mixins = []; - this.define({ - id: [p.Any], - }); - }; - // }}} - HasProps._fix_default = function (default_value, _attr) { - if (default_value === undefined) - return undefined; - else if (types_1.isFunction(default_value)) - return default_value; - else if (!types_1.isObject(default_value)) - return function () { return default_value; }; - else { - //logger.warn(`${this.prototype.type}.${attr} uses unwrapped non-primitive default value`) - if (types_1.isArray(default_value)) - return function () { return array_1.copy(default_value); }; - else - return function () { return object_1.clone(default_value); }; - } - }; - // TODO: don't use Partial<>, but exclude inherited properties - HasProps.define = function (obj) { - var _loop_1 = function (name_2) { - var prop = obj[name_2]; - if (this_1.prototype.props[name_2] != null) - throw new Error("attempted to redefine property '" + this_1.prototype.type + "." + name_2 + "'"); - if (this_1.prototype[name_2] != null) - throw new Error("attempted to redefine attribute '" + this_1.prototype.type + "." + name_2 + "'"); - Object.defineProperty(this_1.prototype, name_2, { - // XXX: don't use tail calls in getters/setters due to https://bugs.webkit.org/show_bug.cgi?id=164306 - get: function () { - var value = this.getv(name_2); - return value; - }, - set: function (value) { - var _a; - this.setv((_a = {}, _a[name_2] = value, _a)); - return this; - }, - configurable: false, - enumerable: true, - }); - var _a = prop, type = _a[0], default_value = _a[1], internal = _a[2]; - var refined_prop = { - type: type, - default_value: this_1._fix_default(default_value, name_2), - internal: internal || false, - }; - var props = object_1.clone(this_1.prototype.props); - props[name_2] = refined_prop; - this_1.prototype.props = props; - }; - var this_1 = this; - for (var name_2 in obj) { - _loop_1(name_2); - } - }; - HasProps.internal = function (obj) { - var _object = {}; - for (var name_3 in obj) { - var prop = obj[name_3]; - var type = prop[0], default_value = prop[1]; - _object[name_3] = [type, default_value, true]; - } - this.define(_object); - }; - HasProps.mixin = function () { - var names = []; - for (var _i = 0; _i < arguments.length; _i++) { - names[_i] = arguments[_i]; - } - this.define(property_mixins.create(names)); - var mixins = this.prototype.mixins.concat(names); - this.prototype.mixins = mixins; - }; - HasProps.mixins = function (names) { - this.mixin.apply(this, names); - }; - HasProps.override = function (obj) { - for (var name_4 in obj) { - var default_value = this._fix_default(obj[name_4], name_4); - var value = this.prototype.props[name_4]; - if (value == null) - throw new Error("attempted to override nonexistent '" + this.prototype.type + "." + name_4 + "'"); - var props = object_1.clone(this.prototype.props); - props[name_4] = tslib_1.__assign({}, value, { default_value: default_value }); - this.prototype.props = props; - } - }; - HasProps.prototype.toString = function () { - return this.type + "(" + this.id + ")"; - }; - HasProps.prototype.finalize = function () { - var _this = this; - // This is necessary because the initial creation of properties relies on - // model.get which is not usable at that point yet in the constructor. This - // initializer is called when deferred initialization happens for all models - // and insures that the Bokeh properties are initialized from Backbone - // attributes in a consistent way. - // - // TODO (bev) split property creation up into two parts so that only the - // portion of init that can be done happens in HasProps constructor and so - // that subsequent updates do not duplicate that setup work. - for (var name_5 in this.properties) { - var prop = this.properties[name_5]; - prop.update(); - if (prop.spec.transform != null) - this.connect(prop.spec.transform.change, function () { return _this.transformchange.emit(); }); - } - this.initialize(); - this.connect_signals(); - }; - HasProps.prototype.initialize = function () { }; - HasProps.prototype.connect_signals = function () { }; - HasProps.prototype.disconnect_signals = function () { - signaling_1.Signal.disconnectReceiver(this); - }; - HasProps.prototype.destroy = function () { - this.disconnect_signals(); - this.destroyed.emit(); - }; - // Create a new model with identical attributes to this one. - HasProps.prototype.clone = function () { - return new this.constructor(this.attributes); - }; - // Set a hash of model attributes on the object, firing `"change"`. This is - // the core primitive operation of a model, updating the data and notifying - // anyone who needs to know about the change in state. The heart of the beast. - HasProps.prototype._setv = function (attrs, options) { - // Extract attributes and options. - var check_eq = options.check_eq; - var silent = options.silent; - var changes = []; - var changing = this._changing; - this._changing = true; - var current = this.attributes; - // For each `set` attribute, update or delete the current value. - for (var attr in attrs) { - var val = attrs[attr]; - if (check_eq !== false) { - if (!eq_1.isEqual(current[attr], val)) - changes.push(attr); - } - else - changes.push(attr); - current[attr] = val; - } - // Trigger all relevant attribute changes. - if (!silent) { - if (changes.length > 0) - this._pending = true; - for (var i = 0; i < changes.length; i++) - this.properties[changes[i]].change.emit(); - } - // You might be wondering why there's a `while` loop here. Changes can - // be recursively nested within `"change"` events. - if (changing) - return; - if (!silent && !options.no_change) { - while (this._pending) { - this._pending = false; - this.change.emit(); - } - } - this._pending = false; - this._changing = false; - }; - HasProps.prototype.setv = function (attrs, options) { - if (options === void 0) { - options = {}; - } - for (var key in attrs) { - if (!attrs.hasOwnProperty(key)) - continue; - var prop_name = key; - if (this.props[prop_name] == null) - throw new Error("property " + this.type + "." + prop_name + " wasn't declared"); - if (!(options != null && options.defaults)) - this._set_after_defaults[key] = true; - } - if (!object_1.isEmpty(attrs)) { - var old = {}; - for (var key in attrs) - old[key] = this.getv(key); - this._setv(attrs, options); - var silent = options.silent; - if (silent == null || !silent) { - for (var key in attrs) - this._tell_document_about_change(key, old[key], this.getv(key), options); - } - } - }; - HasProps.prototype.getv = function (prop_name) { - if (this.props[prop_name] == null) - throw new Error("property " + this.type + "." + prop_name + " wasn't declared"); - else - return this.attributes[prop_name]; - }; - HasProps.prototype.ref = function () { - return refs_1.create_ref(this); - }; - // we only keep the subtype so we match Python; - // only Python cares about this - HasProps.prototype.set_subtype = function (subtype) { - this._subtype = subtype; - }; - HasProps.prototype.attribute_is_serializable = function (attr) { - var prop = this.props[attr]; - if (prop == null) - throw new Error(this.type + ".attribute_is_serializable('" + attr + "'): " + attr + " wasn't declared"); - else - return !prop.internal; - }; - // dict of attributes that should be serialized to the server. We - // sometimes stick things in attributes that aren't part of the - // Document's models, subtypes that do that have to remove their - // extra attributes here. - HasProps.prototype.serializable_attributes = function () { - var attrs = {}; - for (var name_6 in this.attributes) { - var value = this.attributes[name_6]; - if (this.attribute_is_serializable(name_6)) - attrs[name_6] = value; - } - return attrs; - }; - HasProps._value_to_json = function (_key, value, _optional_parent_object) { - if (value instanceof HasProps) - return value.ref(); - else if (types_1.isArray(value)) { - var ref_array = []; - for (var i = 0; i < value.length; i++) { - var v = value[i]; - ref_array.push(HasProps._value_to_json(i.toString(), v, value)); - } - return ref_array; - } - else if (types_1.isPlainObject(value)) { - var ref_obj = {}; - for (var subkey in value) { - if (value.hasOwnProperty(subkey)) - ref_obj[subkey] = HasProps._value_to_json(subkey, value[subkey], value); - } - return ref_obj; - } - else - return value; - }; - // Convert attributes to "shallow" JSON (values which are themselves models - // are included as just references) - HasProps.prototype.attributes_as_json = function (include_defaults, value_to_json) { - if (include_defaults === void 0) { - include_defaults = true; - } - if (value_to_json === void 0) { - value_to_json = HasProps._value_to_json; - } - var serializable = this.serializable_attributes(); - var attrs = {}; - for (var key in serializable) { - if (serializable.hasOwnProperty(key)) { - var value = serializable[key]; - if (include_defaults) - attrs[key] = value; - else if (key in this._set_after_defaults) - attrs[key] = value; - } - } - return value_to_json("attributes", attrs, this); - }; - // this is like _value_record_references but expects to find refs - // instead of models, and takes a doc to look up the refs in - HasProps._json_record_references = function (doc, v, result, recurse) { - if (v == null) { - } - else if (refs_1.is_ref(v)) { - if (!(v.id in result)) { - var model = doc.get_model_by_id(v.id); - HasProps._value_record_references(model, result, recurse); - } - } - else if (types_1.isArray(v)) { - for (var _i = 0, v_1 = v; _i < v_1.length; _i++) { - var elem = v_1[_i]; - HasProps._json_record_references(doc, elem, result, recurse); - } - } - else if (types_1.isPlainObject(v)) { - for (var k in v) { - if (v.hasOwnProperty(k)) { - var elem = v[k]; - HasProps._json_record_references(doc, elem, result, recurse); - } - } - } - }; - // add all references from 'v' to 'result', if recurse - // is true then descend into refs, if false only - // descend into non-refs - HasProps._value_record_references = function (v, result, recurse) { - if (v == null) { - } - else if (v instanceof HasProps) { - if (!(v.id in result)) { - result[v.id] = v; - if (recurse) { - var immediate = v._immediate_references(); - for (var _i = 0, immediate_1 = immediate; _i < immediate_1.length; _i++) { - var obj = immediate_1[_i]; - HasProps._value_record_references(obj, result, true); - } // true=recurse - } - } - } - else if (v.buffer instanceof ArrayBuffer) { - } - else if (types_1.isArray(v)) { - for (var _a = 0, v_2 = v; _a < v_2.length; _a++) { - var elem = v_2[_a]; - HasProps._value_record_references(elem, result, recurse); - } - } - else if (types_1.isPlainObject(v)) { - for (var k in v) { - if (v.hasOwnProperty(k)) { - var elem = v[k]; - HasProps._value_record_references(elem, result, recurse); - } - } - } - }; - // Get models that are immediately referenced by our properties - // (do not recurse, do not include ourselves) - HasProps.prototype._immediate_references = function () { - var result = {}; - var attrs = this.serializable_attributes(); - for (var key in attrs) { - var value = attrs[key]; - HasProps._value_record_references(value, result, false); // false = no recurse - } - return object_1.values(result); - }; - HasProps.prototype.references = function () { - var references = {}; - HasProps._value_record_references(this, references, true); - return object_1.values(references); - }; - HasProps.prototype._doc_attached = function () { }; - HasProps.prototype.attach_document = function (doc) { - // This should only be called by the Document implementation to set the document field - if (this.document != null && this.document != doc) - throw new Error("models must be owned by only a single document"); - this.document = doc; - this._doc_attached(); - }; - HasProps.prototype.detach_document = function () { - // This should only be called by the Document implementation to unset the document field - this.document = null; - }; - HasProps.prototype._tell_document_about_change = function (attr, old, new_, options) { - if (!this.attribute_is_serializable(attr)) - return; - if (this.document != null) { - var new_refs = {}; - HasProps._value_record_references(new_, new_refs, false); - var old_refs = {}; - HasProps._value_record_references(old, old_refs, false); - var need_invalidate = false; - for (var new_id in new_refs) { - if (!(new_id in old_refs)) { - need_invalidate = true; - break; - } - } - if (!need_invalidate) { - for (var old_id in old_refs) { - if (!(old_id in new_refs)) { - need_invalidate = true; - break; - } - } - } - if (need_invalidate) - this.document._invalidate_all_models(); - this.document._notify_change(this, attr, old, new_, options); - } - }; - HasProps.prototype.materialize_dataspecs = function (source) { - // Note: this should be moved to a function separate from HasProps - var data = {}; - for (var name_7 in this.properties) { - var prop = this.properties[name_7]; - if (!(prop instanceof p.VectorSpec)) - continue; - // this skips optional properties like radius for circles - if (prop.optional && prop.spec.value == null && !(name_7 in this._set_after_defaults)) - continue; - var array = prop.array(source); - data["_" + name_7] = array; - // the shapes are indexed by the column name, but when we materialize the dataspec, we should - // store under the canonical field name, e.g. _image_shape, even if the column name is "foo" - if (prop.spec.field != null && prop.spec.field in source._shapes) - data["_" + name_7 + "_shape"] = source._shapes[prop.spec.field]; - if (prop instanceof p.DistanceSpec) - data["max_" + name_7] = array_1.max(array); - } - return data; - }; - return HasProps; - }(signaling_1.Signalable())); - exports.HasProps = HasProps; - HasProps.initClass(); -} -, -/* core/hittest */ function _(require, module, exports) { - var array_1 = require(24) /* ./util/array */; - var selection_1 = require(205) /* ../models/selections/selection */; - function point_in_poly(x, y, px, py) { - var inside = false; - var x1 = px[px.length - 1]; - var y1 = py[py.length - 1]; - for (var i = 0; i < px.length; i++) { - var x2 = px[i]; - var y2 = py[i]; - if ((y1 < y) != (y2 < y)) { - if (x1 + (y - y1) / (y2 - y1) * (x2 - x1) < x) - inside = !inside; - } - x1 = x2; - y1 = y2; - } - return inside; - } - exports.point_in_poly = point_in_poly; - function point_in_ellipse(x, y, angle, b, a, x0, y0) { - var A = (Math.pow((Math.cos(angle) / a), 2) + Math.pow((Math.sin(angle) / b), 2)); - var B = 2 * Math.cos(angle) * Math.sin(angle) * (Math.pow((1 / a), 2) - Math.pow((1 / b), 2)); - var C = (Math.pow((Math.cos(angle) / b), 2) + Math.pow((Math.sin(angle) / a), 2)); - var eqn = A * Math.pow((x - x0), 2) + B * (x - x0) * (y - y0) + C * Math.pow((y - y0), 2); - var inside = eqn <= 1; - return inside; - } - exports.point_in_ellipse = point_in_ellipse; - function create_empty_hit_test_result() { - return new selection_1.Selection(); - } - exports.create_empty_hit_test_result = create_empty_hit_test_result; - function create_hit_test_result_from_hits(hits) { - var result = new selection_1.Selection(); - result.indices = array_1.sort_by(hits, function (_a) { - var _i = _a[0], dist = _a[1]; - return dist; - }).map(function (_a) { - var i = _a[0], _dist = _a[1]; - return i; - }); - return result; - } - exports.create_hit_test_result_from_hits = create_hit_test_result_from_hits; - function validate_bbox_coords(_a, _b) { - var _c, _d; - var x0 = _a[0], x1 = _a[1]; - var y0 = _b[0], y1 = _b[1]; - // spatial index (flatbush) expects x0, y0 to be min, x1, y1 max - if (x0 > x1) - _c = [x1, x0], x0 = _c[0], x1 = _c[1]; - if (y0 > y1) - _d = [y1, y0], y0 = _d[0], y1 = _d[1]; - return { minX: x0, minY: y0, maxX: x1, maxY: y1 }; - } - exports.validate_bbox_coords = validate_bbox_coords; - function sqr(x) { - return x * x; - } - function dist_2_pts(p0, p1) { - return sqr(p0.x - p1.x) + sqr(p0.y - p1.y); - } - exports.dist_2_pts = dist_2_pts; - function dist_to_segment_squared(p, v, w) { - var l2 = dist_2_pts(v, w); - if (l2 == 0) - return dist_2_pts(p, v); - var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2; - if (t < 0) - return dist_2_pts(p, v); - if (t > 1) - return dist_2_pts(p, w); - var q = { x: v.x + t * (w.x - v.x), y: v.y + t * (w.y - v.y) }; - return dist_2_pts(p, q); - } - exports.dist_to_segment_squared = dist_to_segment_squared; - function dist_to_segment(p, v, w) { - return Math.sqrt(dist_to_segment_squared(p, v, w)); - } - exports.dist_to_segment = dist_to_segment; - function check_2_segments_intersect(l0_x0, l0_y0, l0_x1, l0_y1, l1_x0, l1_y0, l1_x1, l1_y1) { - /* - * Check if 2 segments (l0 and l1) intersect. Returns a structure with - * the following attributes: - * * hit (boolean): whether the 2 segments intersect - * * x (float): x coordinate of the intersection point - * * y (float): y coordinate of the intersection point - */ - var den = ((l1_y1 - l1_y0) * (l0_x1 - l0_x0)) - ((l1_x1 - l1_x0) * (l0_y1 - l0_y0)); - if (den == 0) { - return { hit: false, x: null, y: null }; - } - else { - var a = l0_y0 - l1_y0; - var b = l0_x0 - l1_x0; - var num1 = ((l1_x1 - l1_x0) * a) - ((l1_y1 - l1_y0) * b); - var num2 = ((l0_x1 - l0_x0) * a) - ((l0_y1 - l0_y0) * b); - a = num1 / den; - b = num2 / den; - var x = l0_x0 + (a * (l0_x1 - l0_x0)); - var y = l0_y0 + (a * (l0_y1 - l0_y0)); - return { hit: (a > 0 && a < 1) && (b > 0 && b < 1), x: x, y: y }; - } - } - exports.check_2_segments_intersect = check_2_segments_intersect; -} -, -/* core/layout/alignments */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layoutable_1 = require(14) /* ./layoutable */; - var bbox_1 = require(27) /* ../util/bbox */; - var Stack = /** @class */ (function (_super) { - tslib_1.__extends(Stack, _super); - function Stack() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.children = []; - return _this; - } - return Stack; - }(layoutable_1.Layoutable)); - exports.Stack = Stack; - var HStack = /** @class */ (function (_super) { - tslib_1.__extends(HStack, _super); - function HStack() { - return _super !== null && _super.apply(this, arguments) || this; - } - HStack.prototype._measure = function (_viewport) { - var width = 0; - var height = 0; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - var size_hint = child.measure({ width: 0, height: 0 }); - width += size_hint.width; - height = Math.max(height, size_hint.height); - } - return { width: width, height: height }; - }; - HStack.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - var top = outer.top, bottom = outer.bottom; - var left = outer.left; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - var width = child.measure({ width: 0, height: 0 }).width; - child.set_geometry(new bbox_1.BBox({ left: left, width: width, top: top, bottom: bottom })); - left += width; - } - }; - return HStack; - }(Stack)); - exports.HStack = HStack; - var VStack = /** @class */ (function (_super) { - tslib_1.__extends(VStack, _super); - function VStack() { - return _super !== null && _super.apply(this, arguments) || this; - } - VStack.prototype._measure = function (_viewport) { - var width = 0; - var height = 0; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - var size_hint = child.measure({ width: 0, height: 0 }); - width = Math.max(width, size_hint.width); - height += size_hint.height; - } - return { width: width, height: height }; - }; - VStack.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - var left = outer.left, right = outer.right; - var top = outer.top; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - var height = child.measure({ width: 0, height: 0 }).height; - child.set_geometry(new bbox_1.BBox({ top: top, height: height, left: left, right: right })); - top += height; - } - }; - return VStack; - }(Stack)); - exports.VStack = VStack; - var AnchorLayout = /** @class */ (function (_super) { - tslib_1.__extends(AnchorLayout, _super); - function AnchorLayout() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.children = []; - return _this; - } - AnchorLayout.prototype._measure = function (viewport) { - var width = 0; - var height = 0; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var layout = _a[_i].layout; - var size_hint = layout.measure(viewport); - width = Math.max(width, size_hint.width); - height = Math.max(height, size_hint.height); - } - return { width: width, height: height }; - }; - AnchorLayout.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var _b = _a[_i], layout = _b.layout, anchor = _b.anchor, margin = _b.margin; - var left = outer.left, right = outer.right, top_1 = outer.top, bottom = outer.bottom, hcenter = outer.hcenter, vcenter = outer.vcenter; - var _c = layout.measure(outer), width = _c.width, height = _c.height; - var bbox = void 0; - switch (anchor) { - case 'top_left': - bbox = new bbox_1.BBox({ left: left + margin, top: top_1 + margin, width: width, height: height }); - break; - case 'top_center': - bbox = new bbox_1.BBox({ hcenter: hcenter, top: top_1 + margin, width: width, height: height }); - break; - case 'top_right': - bbox = new bbox_1.BBox({ right: right - margin, top: top_1 + margin, width: width, height: height }); - break; - case 'bottom_right': - bbox = new bbox_1.BBox({ right: right - margin, bottom: bottom - margin, width: width, height: height }); - break; - case 'bottom_center': - bbox = new bbox_1.BBox({ hcenter: hcenter, bottom: bottom - margin, width: width, height: height }); - break; - case 'bottom_left': - bbox = new bbox_1.BBox({ left: left + margin, bottom: bottom - margin, width: width, height: height }); - break; - case 'center_left': - bbox = new bbox_1.BBox({ left: left + margin, vcenter: vcenter, width: width, height: height }); - break; - case 'center': - bbox = new bbox_1.BBox({ hcenter: hcenter, vcenter: vcenter, width: width, height: height }); - break; - case 'center_right': - bbox = new bbox_1.BBox({ right: right - margin, vcenter: vcenter, width: width, height: height }); - break; - default: - throw new Error("unreachable"); - } - layout.set_geometry(bbox); - } - }; - return AnchorLayout; - }(layoutable_1.Layoutable)); - exports.AnchorLayout = AnchorLayout; -} -, -/* core/layout/grid */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var types_1 = require(16) /* ./types */; - var layoutable_1 = require(14) /* ./layoutable */; - var types_2 = require(46) /* ../util/types */; - var bbox_1 = require(27) /* ../util/bbox */; - var array_1 = require(24) /* ../util/array */; - var max = Math.max, round = Math.round; - var DefaultMap = /** @class */ (function () { - function DefaultMap(def) { - this.def = def; - this._map = new Map(); - } - DefaultMap.prototype.get = function (key) { - var value = this._map.get(key); - if (value === undefined) { - value = this.def(); - this._map.set(key, value); - } - return value; - }; - DefaultMap.prototype.apply = function (key, fn) { - var value = this.get(key); - this._map.set(key, fn(value)); - }; - return DefaultMap; - }()); - var Container = /** @class */ (function () { - function Container() { - this._items = []; - this._nrows = 0; - this._ncols = 0; - } - Object.defineProperty(Container.prototype, "nrows", { - get: function () { - return this._nrows; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Container.prototype, "ncols", { - get: function () { - return this._ncols; - }, - enumerable: true, - configurable: true - }); - Container.prototype.add = function (span, data) { - var r1 = span.r1, c1 = span.c1; - this._nrows = max(this._nrows, r1 + 1); - this._ncols = max(this._ncols, c1 + 1); - this._items.push({ span: span, data: data }); - }; - Container.prototype.at = function (r, c) { - var selected = this._items.filter(function (_a) { - var span = _a.span; - return span.r0 <= r && r <= span.r1 && - span.c0 <= c && c <= span.c1; - }); - return selected.map(function (_a) { - var data = _a.data; - return data; - }); - }; - Container.prototype.row = function (r) { - var selected = this._items.filter(function (_a) { - var span = _a.span; - return span.r0 <= r && r <= span.r1; - }); - return selected.map(function (_a) { - var data = _a.data; - return data; - }); - }; - Container.prototype.col = function (c) { - var selected = this._items.filter(function (_a) { - var span = _a.span; - return span.c0 <= c && c <= span.c1; - }); - return selected.map(function (_a) { - var data = _a.data; - return data; - }); - }; - Container.prototype.foreach = function (fn) { - for (var _i = 0, _a = this._items; _i < _a.length; _i++) { - var _b = _a[_i], span = _b.span, data = _b.data; - fn(span, data); - } - }; - Container.prototype.map = function (fn) { - var result = new Container(); - for (var _i = 0, _a = this._items; _i < _a.length; _i++) { - var _b = _a[_i], span = _b.span, data = _b.data; - result.add(span, fn(span, data)); - } - return result; - }; - return Container; - }()); - var Grid = /** @class */ (function (_super) { - tslib_1.__extends(Grid, _super); - function Grid(items) { - if (items === void 0) { - items = []; - } - var _this = _super.call(this) || this; - _this.items = items; - _this.rows = "auto"; - _this.cols = "auto"; - _this.spacing = 0; - _this.absolute = false; - return _this; - } - Grid.prototype.is_width_expanding = function () { - if (_super.prototype.is_width_expanding.call(this)) - return true; - if (this.sizing.width_policy == "fixed") - return false; - var cols = this._state.cols; - return array_1.some(cols, function (col) { return col.policy == "max"; }); - }; - Grid.prototype.is_height_expanding = function () { - if (_super.prototype.is_height_expanding.call(this)) - return true; - if (this.sizing.height_policy == "fixed") - return false; - var rows = this._state.rows; - return array_1.some(rows, function (row) { return row.policy == "max"; }); - }; - Grid.prototype._init = function () { - var _this = this; - _super.prototype._init.call(this); - var items = new Container(); - for (var _i = 0, _a = this.items; _i < _a.length; _i++) { - var _b = _a[_i], layout = _b.layout, row = _b.row, col = _b.col, row_span = _b.row_span, col_span = _b.col_span; - if (layout.sizing.visible) { - var r0 = row; - var c0 = col; - var r1 = row + (row_span != null ? row_span : 1) - 1; - var c1 = col + (col_span != null ? col_span : 1) - 1; - items.add({ r0: r0, c0: c0, r1: r1, c1: c1 }, layout); - } - } - var nrows = items.nrows, ncols = items.ncols; - var rows = new Array(nrows); - var _loop_1 = function (y) { - var row = (function () { - var sizing = types_2.isPlainObject(_this.rows) ? _this.rows[y] || _this.rows["*"] : _this.rows; - if (sizing == null) - return { policy: "auto" }; - else if (types_2.isNumber(sizing)) - return { policy: "fixed", height: sizing }; - else if (types_2.isString(sizing)) - return { policy: sizing }; - else - return sizing; - })(); - var align = row.align || "auto"; - if (row.policy == "fixed") - rows[y] = { policy: "fixed", height: row.height, align: align }; - else if (row.policy == "min") - rows[y] = { policy: "min", align: align }; - else if (row.policy == "fit" || row.policy == "max") - rows[y] = { policy: row.policy, flex: row.flex || 1, align: align }; - else if (row.policy == "auto") { - if (array_1.some(items.row(y), function (layout) { return layout.is_height_expanding(); })) - rows[y] = { policy: "max", flex: 1, align: align }; - else - rows[y] = { policy: "min", align: align }; - } - else - throw new Error("unrechable"); - }; - for (var y = 0; y < nrows; y++) { - _loop_1(y); - } - var cols = new Array(ncols); - var _loop_2 = function (x) { - var col = (function () { - var sizing = types_2.isPlainObject(_this.cols) ? _this.cols[x] || _this.cols["*"] : _this.cols; - if (sizing == null) - return { policy: "auto" }; - else if (types_2.isNumber(sizing)) - return { policy: "fixed", width: sizing }; - else if (types_2.isString(sizing)) - return { policy: sizing }; - else - return sizing; - })(); - var align = col.align || "auto"; - if (col.policy == "fixed") - cols[x] = { policy: "fixed", width: col.width, align: align }; - else if (col.policy == "min") - cols[x] = { policy: "min", align: align }; - else if (col.policy == "fit" || col.policy == "max") - cols[x] = { policy: col.policy, flex: col.flex || 1, align: align }; - else if (col.policy == "auto") { - if (array_1.some(items.col(x), function (layout) { return layout.is_width_expanding(); })) - cols[x] = { policy: "max", flex: 1, align: align }; - else - cols[x] = { policy: "min", align: align }; - } - else - throw new Error("unrechable"); - }; - for (var x = 0; x < ncols; x++) { - _loop_2(x); - } - var _c = types_2.isNumber(this.spacing) ? [this.spacing, this.spacing] : this.spacing, rspacing = _c[0], cspacing = _c[1]; - this._state = { items: items, nrows: nrows, ncols: ncols, rows: rows, cols: cols, rspacing: rspacing, cspacing: cspacing }; - }; - Grid.prototype._measure_totals = function (row_heights, col_widths) { - var _a = this._state, nrows = _a.nrows, ncols = _a.ncols, rspacing = _a.rspacing, cspacing = _a.cspacing; - return { - height: array_1.sum(row_heights) + (nrows - 1) * rspacing, - width: array_1.sum(col_widths) + (ncols - 1) * cspacing, - }; - }; - Grid.prototype._measure_cells = function (cell_viewport) { - var _a = this._state, items = _a.items, nrows = _a.nrows, ncols = _a.ncols, rows = _a.rows, cols = _a.cols, rspacing = _a.rspacing, cspacing = _a.cspacing; - var row_heights = new Array(nrows); - for (var r = 0; r < nrows; r++) { - var row = rows[r]; - row_heights[r] = row.policy == "fixed" ? row.height : 0; - } - var col_widths = new Array(ncols); - for (var c = 0; c < ncols; c++) { - var col = cols[c]; - col_widths[c] = col.policy == "fixed" ? col.width : 0; - } - var size_hints = new Container(); - items.foreach(function (span, layout) { - var r0 = span.r0, c0 = span.c0, r1 = span.r1, c1 = span.c1; - var rspace = (r1 - r0) * rspacing; - var cspace = (c1 - c0) * cspacing; - var height = 0; - for (var r = r0; r <= r1; r++) { - height += cell_viewport(r, c0).height; - } - height += rspace; - var width = 0; - for (var c = c0; c <= c1; c++) { - width += cell_viewport(r0, c).width; - } - width += cspace; - var size_hint = layout.measure({ width: width, height: height }); - size_hints.add(span, { layout: layout, size_hint: size_hint }); - var size = new types_1.Sizeable(size_hint).grow_by(layout.sizing.margin); - size.height -= rspace; - size.width -= cspace; - var radjustable = []; - for (var r = r0; r <= r1; r++) { - var row = rows[r]; - if (row.policy == "fixed") - size.height -= row.height; - else - radjustable.push(r); - } - if (size.height > 0) { - var rheight = round(size.height / radjustable.length); - for (var _i = 0, radjustable_1 = radjustable; _i < radjustable_1.length; _i++) { - var r = radjustable_1[_i]; - row_heights[r] = max(row_heights[r], rheight); - } - } - var cadjustable = []; - for (var c = c0; c <= c1; c++) { - var col = cols[c]; - if (col.policy == "fixed") - size.width -= col.width; - else - cadjustable.push(c); - } - if (size.width > 0) { - var cwidth = round(size.width / cadjustable.length); - for (var _a = 0, cadjustable_1 = cadjustable; _a < cadjustable_1.length; _a++) { - var c = cadjustable_1[_a]; - col_widths[c] = max(col_widths[c], cwidth); - } - } - }); - var size = this._measure_totals(row_heights, col_widths); - return { size: size, row_heights: row_heights, col_widths: col_widths, size_hints: size_hints }; - }; - Grid.prototype._measure_grid = function (viewport) { - var _a = this._state, nrows = _a.nrows, ncols = _a.ncols, rows = _a.rows, cols = _a.cols, rspacing = _a.rspacing, cspacing = _a.cspacing; - var preferred = this._measure_cells(function (y, x) { - var row = rows[y]; - var col = cols[x]; - return { - width: col.policy == "fixed" ? col.width : Infinity, - height: row.policy == "fixed" ? row.height : Infinity, - }; - }); - var available_height; - if (this.sizing.height_policy == "fixed" && this.sizing.height != null) - available_height = this.sizing.height; - else if (viewport.height != Infinity && this.is_height_expanding()) - available_height = viewport.height; - else - available_height = preferred.size.height; - var height_flex = 0; - for (var y = 0; y < nrows; y++) { - var row = rows[y]; - if (row.policy == "fit" || row.policy == "max") - height_flex += row.flex; - else - available_height -= preferred.row_heights[y]; - } - available_height -= (nrows - 1) * rspacing; - if (height_flex != 0 && available_height > 0) { - for (var y = 0; y < nrows; y++) { - var row = rows[y]; - if (row.policy == "fit" || row.policy == "max") { - var height = round(available_height * (row.flex / height_flex)); - available_height -= height; - preferred.row_heights[y] = height; - height_flex -= row.flex; - } - } - } - else if (available_height < 0) { - var nadjustable = 0; - for (var y = 0; y < nrows; y++) { - var row = rows[y]; - if (row.policy != "fixed") - nadjustable++; - } - var overflow_height = -available_height; - for (var y = 0; y < nrows; y++) { - var row = rows[y]; - if (row.policy != "fixed") { - var height = preferred.row_heights[y]; - var cutoff = round(overflow_height / nadjustable); - preferred.row_heights[y] = max(height - cutoff, 0); - overflow_height -= cutoff > height ? height : cutoff; - nadjustable--; - } - } - } - var available_width; - if (this.sizing.width_policy == "fixed" && this.sizing.width != null) - available_width = this.sizing.width; - else if (viewport.width != Infinity && this.is_width_expanding()) - available_width = viewport.width; - else - available_width = preferred.size.width; - var width_flex = 0; - for (var x = 0; x < ncols; x++) { - var col = cols[x]; - if (col.policy == "fit" || col.policy == "max") - width_flex += col.flex; - else - available_width -= preferred.col_widths[x]; - } - available_width -= (ncols - 1) * cspacing; - if (width_flex != 0 && available_width > 0) { - for (var x = 0; x < ncols; x++) { - var col = cols[x]; - if (col.policy == "fit" || col.policy == "max") { - var width = round(available_width * (col.flex / width_flex)); - available_width -= width; - preferred.col_widths[x] = width; - width_flex -= col.flex; - } - } - } - else if (available_width < 0) { - var nadjustable = 0; - for (var x = 0; x < ncols; x++) { - var col = cols[x]; - if (col.policy != "fixed") - nadjustable++; - } - var overflow_width = -available_width; - for (var x = 0; x < ncols; x++) { - var col = cols[x]; - if (col.policy != "fixed") { - var width = preferred.col_widths[x]; - var cutoff = round(overflow_width / nadjustable); - preferred.col_widths[x] = max(width - cutoff, 0); - overflow_width -= cutoff > width ? width : cutoff; - nadjustable--; - } - } - } - var _b = this._measure_cells(function (y, x) { - return { - width: preferred.col_widths[x], - height: preferred.row_heights[y], - }; - }), row_heights = _b.row_heights, col_widths = _b.col_widths, size_hints = _b.size_hints; - var size = this._measure_totals(row_heights, col_widths); - return { size: size, row_heights: row_heights, col_widths: col_widths, size_hints: size_hints }; - }; - Grid.prototype._measure = function (viewport) { - var size = this._measure_grid(viewport).size; - return size; - }; - Grid.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - var _a = this._state, nrows = _a.nrows, ncols = _a.ncols, rspacing = _a.rspacing, cspacing = _a.cspacing; - var _b = this._measure_grid(outer), row_heights = _b.row_heights, col_widths = _b.col_widths, size_hints = _b.size_hints; - var rows = this._state.rows.map(function (row, r) { - return tslib_1.__assign({}, row, { top: 0, height: row_heights[r], get bottom() { return this.top + this.height; } }); - }); - var cols = this._state.cols.map(function (col, c) { - return tslib_1.__assign({}, col, { left: 0, width: col_widths[c], get right() { return this.left + this.width; } }); - }); - var items = size_hints.map(function (_, item) { - return tslib_1.__assign({}, item, { outer: new bbox_1.BBox(), inner: new bbox_1.BBox() }); - }); - for (var r = 0, top_1 = !this.absolute ? 0 : outer.top; r < nrows; r++) { - var row = rows[r]; - row.top = top_1; - top_1 += row.height + rspacing; - } - for (var c = 0, left = !this.absolute ? 0 : outer.left; c < ncols; c++) { - var col = cols[c]; - col.left = left; - left += col.width + cspacing; - } - function span_width(c0, c1) { - var width = (c1 - c0) * cspacing; - for (var c = c0; c <= c1; c++) { - width += cols[c].width; - } - return width; - } - function span_height(r0, r1) { - var height = (r1 - r0) * rspacing; - for (var r = r0; r <= r1; r++) { - height += rows[r].height; - } - return height; - } - items.foreach(function (_a, item) { - var r0 = _a.r0, c0 = _a.c0, r1 = _a.r1, c1 = _a.c1; - var layout = item.layout, size_hint = item.size_hint; - var sizing = layout.sizing; - var width = size_hint.width, height = size_hint.height; - var span = { - width: span_width(c0, c1), - height: span_height(r0, r1), - }; - var halign = c0 == c1 && cols[c0].align != "auto" ? cols[c0].align : sizing.halign; - var valign = r0 == r1 && rows[r0].align != "auto" ? rows[r0].align : sizing.valign; - var left = cols[c0].left; - if (halign == "start") - left += sizing.margin.left; - else if (halign == "center") - left += round((span.width - width) / 2); - else if (halign == "end") - left += span.width - sizing.margin.right - width; - var top = rows[r0].top; - if (valign == "start") - top += sizing.margin.top; - else if (valign == "center") - top += round((span.height - height) / 2); - else if (valign == "end") - top += span.height - sizing.margin.bottom - height; - item.outer = new bbox_1.BBox({ left: left, top: top, width: width, height: height }); - }); - var row_aligns = rows.map(function () { - return { - start: new DefaultMap(function () { return 0; }), - end: new DefaultMap(function () { return 0; }), - }; - }); - var col_aligns = cols.map(function () { - return { - start: new DefaultMap(function () { return 0; }), - end: new DefaultMap(function () { return 0; }), - }; - }); - items.foreach(function (_a, _b) { - var r0 = _a.r0, c0 = _a.c0, r1 = _a.r1, c1 = _a.c1; - var size_hint = _b.size_hint, outer = _b.outer; - var inner = size_hint.inner; - if (inner != null) { - row_aligns[r0].start.apply(outer.top, function (v) { return max(v, inner.top); }); - row_aligns[r1].end.apply(rows[r1].bottom - outer.bottom, function (v) { return max(v, inner.bottom); }); - col_aligns[c0].start.apply(outer.left, function (v) { return max(v, inner.left); }); - col_aligns[c1].end.apply(cols[c1].right - outer.right, function (v) { return max(v, inner.right); }); - } - }); - items.foreach(function (_a, item) { - var r0 = _a.r0, c0 = _a.c0, r1 = _a.r1, c1 = _a.c1; - var size_hint = item.size_hint, outer = item.outer; - function inner_bbox(_a) { - var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom; - var width = outer.width - left - right; - var height = outer.height - top - bottom; - return new bbox_1.BBox({ left: left, top: top, width: width, height: height }); - } - if (size_hint.inner != null) { - var inner_1 = inner_bbox(size_hint.inner); - if (size_hint.align !== false) { - var top_2 = row_aligns[r0].start.get(outer.top); - var bottom = row_aligns[r1].end.get(rows[r1].bottom - outer.bottom); - var left = col_aligns[c0].start.get(outer.left); - var right = col_aligns[c1].end.get(cols[c1].right - outer.right); - try { - inner_1 = inner_bbox({ top: top_2, bottom: bottom, left: left, right: right }); - } - catch (_b) { } - } - item.inner = inner_1; - } - else - item.inner = outer; - }); - items.foreach(function (_, _a) { - var layout = _a.layout, outer = _a.outer, inner = _a.inner; - layout.set_geometry(outer, inner); - }); - }; - return Grid; - }(layoutable_1.Layoutable)); - exports.Grid = Grid; - var Row = /** @class */ (function (_super) { - tslib_1.__extends(Row, _super); - function Row(items) { - var _this = _super.call(this) || this; - _this.items = items.map(function (item, i) { return ({ layout: item, row: 0, col: i }); }); - _this.rows = "fit"; - return _this; - } - return Row; - }(Grid)); - exports.Row = Row; - var Column = /** @class */ (function (_super) { - tslib_1.__extends(Column, _super); - function Column(items) { - var _this = _super.call(this) || this; - _this.items = items.map(function (item, i) { return ({ layout: item, row: i, col: 0 }); }); - _this.cols = "fit"; - return _this; - } - return Column; - }(Grid)); - exports.Column = Column; -} -, -/* core/layout/html */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layoutable_1 = require(14) /* ./layoutable */; - var types_1 = require(16) /* ./types */; - var dom_1 = require(5) /* ../dom */; - var ContentBox = /** @class */ (function (_super) { - tslib_1.__extends(ContentBox, _super); - function ContentBox(el) { - var _this = _super.call(this) || this; - _this.content_size = dom_1.unsized(el, function () { return new types_1.Sizeable(dom_1.size(el)); }); - return _this; - } - ContentBox.prototype._content_size = function () { - return this.content_size; - }; - return ContentBox; - }(layoutable_1.ContentLayoutable)); - exports.ContentBox = ContentBox; - var VariadicBox = /** @class */ (function (_super) { - tslib_1.__extends(VariadicBox, _super); - function VariadicBox(el) { - var _this = _super.call(this) || this; - _this.el = el; - return _this; - } - VariadicBox.prototype._measure = function (viewport) { - var _this = this; - var bounded = new types_1.Sizeable(viewport).bounded_to(this.sizing.size); - return dom_1.sized(this.el, bounded, function () { - var content = new types_1.Sizeable(dom_1.content_size(_this.el)); - var _a = dom_1.extents(_this.el), border = _a.border, padding = _a.padding; - return content.grow_by(border).grow_by(padding).map(Math.ceil); - }); - }; - return VariadicBox; - }(layoutable_1.Layoutable)); - exports.VariadicBox = VariadicBox; -} -, -/* core/layout/index */ function _(require, module, exports) { - var types_1 = require(16) /* ./types */; - exports.Sizeable = types_1.Sizeable; - var layoutable_1 = require(14) /* ./layoutable */; - exports.Layoutable = layoutable_1.Layoutable; - exports.LayoutItem = layoutable_1.LayoutItem; - var alignments_1 = require(10) /* ./alignments */; - exports.HStack = alignments_1.HStack; - exports.VStack = alignments_1.VStack; - exports.AnchorLayout = alignments_1.AnchorLayout; - var grid_1 = require(11) /* ./grid */; - exports.Grid = grid_1.Grid; - exports.Row = grid_1.Row; - exports.Column = grid_1.Column; - var html_1 = require(12) /* ./html */; - exports.ContentBox = html_1.ContentBox; - exports.VariadicBox = html_1.VariadicBox; -} -, -/* core/layout/layoutable */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var types_1 = require(16) /* ./types */; - var bbox_1 = require(27) /* ../util/bbox */; - var min = Math.min, max = Math.max, round = Math.round; - var Layoutable = /** @class */ (function () { - function Layoutable() { - this._bbox = new bbox_1.BBox(); - this._inner_bbox = new bbox_1.BBox(); - var layout = this; - this._top = { get value() { return layout.bbox.top; } }; - this._left = { get value() { return layout.bbox.left; } }; - this._width = { get value() { return layout.bbox.width; } }; - this._height = { get value() { return layout.bbox.height; } }; - this._right = { get value() { return layout.bbox.right; } }; - this._bottom = { get value() { return layout.bbox.bottom; } }; - this._hcenter = { get value() { return layout.bbox.hcenter; } }; - this._vcenter = { get value() { return layout.bbox.vcenter; } }; - } - Object.defineProperty(Layoutable.prototype, "bbox", { - get: function () { - return this._bbox; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Layoutable.prototype, "inner_bbox", { - get: function () { - return this._inner_bbox; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Layoutable.prototype, "sizing", { - get: function () { - return this._sizing; - }, - enumerable: true, - configurable: true - }); - Layoutable.prototype.set_sizing = function (sizing) { - var width_policy = sizing.width_policy || "fit"; - var width = sizing.width; - var min_width = sizing.min_width != null ? sizing.min_width : 0; - var max_width = sizing.max_width != null ? sizing.max_width : Infinity; - var height_policy = sizing.height_policy || "fit"; - var height = sizing.height; - var min_height = sizing.min_height != null ? sizing.min_height : 0; - var max_height = sizing.max_height != null ? sizing.max_height : Infinity; - var aspect = sizing.aspect; - var margin = sizing.margin || { top: 0, right: 0, bottom: 0, left: 0 }; - var visible = sizing.visible !== false; - var halign = sizing.halign || "start"; - var valign = sizing.valign || "start"; - this._sizing = { - width_policy: width_policy, min_width: min_width, width: width, max_width: max_width, - height_policy: height_policy, min_height: min_height, height: height, max_height: max_height, - aspect: aspect, - margin: margin, - visible: visible, - halign: halign, - valign: valign, - size: { width: width, height: height }, - min_size: { width: min_width, height: min_height }, - max_size: { width: max_width, height: max_height }, - }; - this._init(); - }; - Layoutable.prototype._init = function () { }; - Layoutable.prototype._set_geometry = function (outer, inner) { - this._bbox = outer; - this._inner_bbox = inner; - }; - Layoutable.prototype.set_geometry = function (outer, inner) { - this._set_geometry(outer, inner || outer); - }; - Layoutable.prototype.is_width_expanding = function () { - return this.sizing.width_policy == "max"; - }; - Layoutable.prototype.is_height_expanding = function () { - return this.sizing.height_policy == "max"; - }; - Layoutable.prototype.apply_aspect = function (viewport, _a) { - var width = _a.width, height = _a.height; - var aspect = this.sizing.aspect; - if (aspect != null) { - var _b = this.sizing, width_policy = _b.width_policy, height_policy = _b.height_policy; - var gt = function (width, height) { - var policies = { max: 4, fit: 3, min: 2, fixed: 1 }; - return policies[width] > policies[height]; - }; - if (width_policy != "fixed" && height_policy != "fixed") { - if (width_policy == height_policy) { - var w_width = width; - var w_height = round(width / aspect); - var h_width = round(height * aspect); - var h_height = height; - var w_diff = Math.abs(viewport.width - w_width) + Math.abs(viewport.height - w_height); - var h_diff = Math.abs(viewport.width - h_width) + Math.abs(viewport.height - h_height); - if (w_diff <= h_diff) { - width = w_width; - height = w_height; - } - else { - width = h_width; - height = h_height; - } - } - else if (gt(width_policy, height_policy)) { - height = round(width / aspect); - } - else { - width = round(height * aspect); - } - } - else if (width_policy == "fixed") { - height = round(width / aspect); - } - else if (height_policy == "fixed") { - width = round(height * aspect); - } - } - return { width: width, height: height }; - }; - Layoutable.prototype.measure = function (viewport_size) { - var _this = this; - if (!this.sizing.visible) - return { width: 0, height: 0 }; - var exact_width = function (width) { - return _this.sizing.width_policy == "fixed" && _this.sizing.width != null ? _this.sizing.width : width; - }; - var exact_height = function (height) { - return _this.sizing.height_policy == "fixed" && _this.sizing.height != null ? _this.sizing.height : height; - }; - var viewport = new types_1.Sizeable(viewport_size) - .shrink_by(this.sizing.margin) - .map(exact_width, exact_height); - var computed = this._measure(viewport); - var clipped = this.clip_size(computed); - var width = exact_width(clipped.width); - var height = exact_height(clipped.height); - var size = this.apply_aspect(viewport, { width: width, height: height }); - return tslib_1.__assign({}, computed, size); - }; - Layoutable.prototype.compute = function (viewport) { - if (viewport === void 0) { - viewport = {}; - } - var size_hint = this.measure({ - width: viewport.width != null && this.is_width_expanding() ? viewport.width : Infinity, - height: viewport.height != null && this.is_height_expanding() ? viewport.height : Infinity, - }); - var width = size_hint.width, height = size_hint.height; - var outer = new bbox_1.BBox({ left: 0, top: 0, width: width, height: height }); - var inner = undefined; - if (size_hint.inner != null) { - var _a = size_hint.inner, left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom; - inner = new bbox_1.BBox({ left: left, top: top_1, right: width - right, bottom: height - bottom }); - } - this.set_geometry(outer, inner); - }; - Object.defineProperty(Layoutable.prototype, "xview", { - get: function () { - return this.bbox.xview; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Layoutable.prototype, "yview", { - get: function () { - return this.bbox.yview; - }, - enumerable: true, - configurable: true - }); - Layoutable.prototype.clip_width = function (width) { - return max(this.sizing.min_width, min(width, this.sizing.max_width)); - }; - Layoutable.prototype.clip_height = function (height) { - return max(this.sizing.min_height, min(height, this.sizing.max_height)); - }; - Layoutable.prototype.clip_size = function (_a) { - var width = _a.width, height = _a.height; - return { - width: this.clip_width(width), - height: this.clip_height(height), - }; - }; - return Layoutable; - }()); - exports.Layoutable = Layoutable; - var LayoutItem = /** @class */ (function (_super) { - tslib_1.__extends(LayoutItem, _super); - function LayoutItem() { - return _super !== null && _super.apply(this, arguments) || this; - } - /* - constructor(readonly measure_fn: (viewport: Size) => Size) { - super() - } - protected _measure(viewport: Size): SizeHint { - return this.measure_fn(viewport) - } - protected _measure(viewport: Size): SizeHint { - return { - width: viewport.width != Infinity ? viewport.width : this.sizing.min_width, - height: viewport.height != Infinity ? viewport.height : this.sizing.min_width, - } - } - */ - LayoutItem.prototype._measure = function (viewport) { - var _a = this.sizing, width_policy = _a.width_policy, height_policy = _a.height_policy; - var width; - if (viewport.width == Infinity) { - width = this.sizing.width != null ? this.sizing.width : 0; - } - else { - if (width_policy == "fixed") - width = this.sizing.width != null ? this.sizing.width : 0; - else if (width_policy == "min") - width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : 0; - else if (width_policy == "fit") - width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : viewport.width; - else if (width_policy == "max") - width = this.sizing.width != null ? max(viewport.width, this.sizing.width) : viewport.width; - else - throw new Error("unrechable"); - } - var height; - if (viewport.height == Infinity) { - height = this.sizing.height != null ? this.sizing.height : 0; - } - else { - if (height_policy == "fixed") - height = this.sizing.height != null ? this.sizing.height : 0; - else if (height_policy == "min") - height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : 0; - else if (height_policy == "fit") - height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : viewport.height; - else if (height_policy == "max") - height = this.sizing.height != null ? max(viewport.height, this.sizing.height) : viewport.height; - else - throw new Error("unrechable"); - } - return { width: width, height: height }; - }; - return LayoutItem; - }(Layoutable)); - exports.LayoutItem = LayoutItem; - var ContentLayoutable = /** @class */ (function (_super) { - tslib_1.__extends(ContentLayoutable, _super); - function ContentLayoutable() { - return _super !== null && _super.apply(this, arguments) || this; - } - ContentLayoutable.prototype._measure = function (viewport) { - var _this = this; - var content_size = this._content_size(); - var bounds = viewport.bounded_to(this.sizing.size) - .bounded_to(content_size); - var width = (function () { - switch (_this.sizing.width_policy) { - case "fixed": - return _this.sizing.width != null ? _this.sizing.width : content_size.width; - case "min": - return content_size.width; - case "fit": - return bounds.width; - case "max": - return Math.max(content_size.width, bounds.width); - default: - throw new Error("unexpected"); - } - })(); - var height = (function () { - switch (_this.sizing.height_policy) { - case "fixed": - return _this.sizing.height != null ? _this.sizing.height : content_size.height; - case "min": - return content_size.height; - case "fit": - return bounds.height; - case "max": - return Math.max(content_size.height, bounds.height); - default: - throw new Error("unexpected"); - } - })(); - return { width: width, height: height }; - }; - return ContentLayoutable; - }(Layoutable)); - exports.ContentLayoutable = ContentLayoutable; -} -, -/* core/layout/side_panel */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var types_1 = require(16) /* ./types */; - var layoutable_1 = require(14) /* ./layoutable */; - var types_2 = require(46) /* ../util/types */; - // This table lays out the rules for configuring the baseline, alignment, etc. of - // title text, based on it's location and orientation - // - // side orient baseline align angle normal-dist - // ------------------------------------------------------------------------------ - // above parallel bottom center 0 height - // normal middle left -90 width - // horizontal bottom center 0 height - // [angle > 0] middle left width * sin + height * cos - // [angle < 0] middle right width * sin + height * cos - // - // below parallel top center 0 height - // normal middle right 90 width - // horizontal top center 0 height - // [angle > 0] middle right width * sin + height * cos - // [angle < 0] middle left width * sin + height * cos - // - // left parallel bottom center 90 height - // normal middle right 0 width - // horizontal middle right 0 width - // [angle > 0] middle right width * cos + height * sin - // [angle < 0] middle right width * cos + height + sin - // - // right parallel bottom center -90 height - // normal middle left 0 width - // horizontal middle left 0 width - // [angle > 0] middle left width * cos + height * sin - // [angle < 0] middle left width * cos + height + sin - var pi2 = Math.PI / 2; - var ALPHABETIC = 'alphabetic'; - var TOP = 'top'; - var BOTTOM = 'bottom'; - var MIDDLE = 'middle'; - var HANGING = 'hanging'; - var LEFT = 'left'; - var RIGHT = 'right'; - var CENTER = 'center'; - var _angle_lookup = { - above: { - parallel: 0, - normal: -pi2, - horizontal: 0, - vertical: -pi2, - }, - below: { - parallel: 0, - normal: pi2, - horizontal: 0, - vertical: pi2, - }, - left: { - parallel: -pi2, - normal: 0, - horizontal: 0, - vertical: -pi2, - }, - right: { - parallel: pi2, - normal: 0, - horizontal: 0, - vertical: pi2, - }, - }; - var _baseline_lookup = { - above: { - justified: TOP, - parallel: ALPHABETIC, - normal: MIDDLE, - horizontal: ALPHABETIC, - vertical: MIDDLE, - }, - below: { - justified: BOTTOM, - parallel: HANGING, - normal: MIDDLE, - horizontal: HANGING, - vertical: MIDDLE, - }, - left: { - justified: TOP, - parallel: ALPHABETIC, - normal: MIDDLE, - horizontal: MIDDLE, - vertical: ALPHABETIC, - }, - right: { - justified: TOP, - parallel: ALPHABETIC, - normal: MIDDLE, - horizontal: MIDDLE, - vertical: ALPHABETIC, - }, - }; - var _align_lookup = { - above: { - justified: CENTER, - parallel: CENTER, - normal: LEFT, - horizontal: CENTER, - vertical: LEFT, - }, - below: { - justified: CENTER, - parallel: CENTER, - normal: LEFT, - horizontal: CENTER, - vertical: LEFT, - }, - left: { - justified: CENTER, - parallel: CENTER, - normal: RIGHT, - horizontal: RIGHT, - vertical: CENTER, - }, - right: { - justified: CENTER, - parallel: CENTER, - normal: LEFT, - horizontal: LEFT, - vertical: CENTER, - }, - }; - var _align_lookup_negative = { - above: RIGHT, - below: LEFT, - left: RIGHT, - right: LEFT, - }; - var _align_lookup_positive = { - above: LEFT, - below: RIGHT, - left: RIGHT, - right: LEFT, - }; - var SidePanel = /** @class */ (function (_super) { - tslib_1.__extends(SidePanel, _super); - function SidePanel(side, obj) { - var _this = _super.call(this) || this; - _this.side = side; - _this.obj = obj; - switch (_this.side) { - case "above": - _this._dim = 0; - _this._normals = [0, -1]; - break; - case "below": - _this._dim = 0; - _this._normals = [0, 1]; - break; - case "left": - _this._dim = 1; - _this._normals = [-1, 0]; - break; - case "right": - _this._dim = 1; - _this._normals = [1, 0]; - break; - default: - throw new Error("unreachable"); - } - if (_this.is_horizontal) - _this.set_sizing({ width_policy: "max", height_policy: "fixed" }); - else - _this.set_sizing({ width_policy: "fixed", height_policy: "max" }); - return _this; - } - SidePanel.prototype._content_size = function () { - return new types_1.Sizeable(this.get_oriented_size()); - }; - SidePanel.prototype.get_oriented_size = function () { - var _a = this.obj.get_size(), width = _a.width, height = _a.height; - if (!this.obj.rotate || this.is_horizontal) - return { width: width, height: height }; - else - return { width: height, height: width }; - }; - SidePanel.prototype.has_size_changed = function () { - var _a = this.get_oriented_size(), width = _a.width, height = _a.height; - if (this.is_horizontal) - return this.bbox.height != height; - else - return this.bbox.width != width; - }; - Object.defineProperty(SidePanel.prototype, "dimension", { - get: function () { - return this._dim; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SidePanel.prototype, "normals", { - get: function () { - return this._normals; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SidePanel.prototype, "is_horizontal", { - get: function () { - return this._dim == 0; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SidePanel.prototype, "is_vertical", { - get: function () { - return this._dim == 1; - }, - enumerable: true, - configurable: true - }); - SidePanel.prototype.apply_label_text_heuristics = function (ctx, orient) { - var side = this.side; - var baseline; - var align; - if (types_2.isString(orient)) { - baseline = _baseline_lookup[side][orient]; - align = _align_lookup[side][orient]; - } - else { - if (orient === 0) { - baseline = "whatever"; // XXX: _baseline_lookup[side][orient] - align = "whatever"; // XXX: _align_lookup[side][orient] - } - else if (orient < 0) { - baseline = 'middle'; - align = _align_lookup_negative[side]; - } - else { - baseline = 'middle'; - align = _align_lookup_positive[side]; - } - } - ctx.textBaseline = baseline; - ctx.textAlign = align; - }; - SidePanel.prototype.get_label_angle_heuristic = function (orient) { - return _angle_lookup[this.side][orient]; - }; - return SidePanel; - }(layoutable_1.ContentLayoutable)); - exports.SidePanel = SidePanel; -} -, -/* core/layout/types */ function _(require, module, exports) { - var min = Math.min, max = Math.max; - var Sizeable = /** @class */ (function () { - function Sizeable(size) { - if (size === void 0) { - size = {}; - } - this.width = size.width != null ? size.width : 0; - this.height = size.height != null ? size.height : 0; - } - Sizeable.prototype.bounded_to = function (_a) { - var width = _a.width, height = _a.height; - return new Sizeable({ - width: this.width == Infinity && width != null ? width : this.width, - height: this.height == Infinity && height != null ? height : this.height, - }); - }; - Sizeable.prototype.expanded_to = function (_a) { - var width = _a.width, height = _a.height; - return new Sizeable({ - width: width != Infinity ? max(this.width, width) : this.width, - height: height != Infinity ? max(this.height, height) : this.height, - }); - }; - Sizeable.prototype.expand_to = function (_a) { - var width = _a.width, height = _a.height; - this.width = max(this.width, width); - this.height = max(this.height, height); - }; - Sizeable.prototype.narrowed_to = function (_a) { - var width = _a.width, height = _a.height; - return new Sizeable({ - width: min(this.width, width), - height: min(this.height, height), - }); - }; - Sizeable.prototype.narrow_to = function (_a) { - var width = _a.width, height = _a.height; - this.width = min(this.width, width); - this.height = min(this.height, height); - }; - Sizeable.prototype.grow_by = function (_a) { - var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom; - var width = this.width + left + right; - var height = this.height + top + bottom; - return new Sizeable({ width: width, height: height }); - }; - Sizeable.prototype.shrink_by = function (_a) { - var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom; - var width = max(this.width - left - right, 0); - var height = max(this.height - top - bottom, 0); - return new Sizeable({ width: width, height: height }); - }; - Sizeable.prototype.map = function (w_fn, h_fn) { - return new Sizeable({ - width: w_fn(this.width), - height: (h_fn != null ? h_fn : w_fn)(this.height), - }); - }; - return Sizeable; - }()); - exports.Sizeable = Sizeable; -} -, -/* core/logging */ function _(require, module, exports) { - var types_1 = require(46) /* ./util/types */; - var _loggers = {}; - var LogLevel = /** @class */ (function () { - function LogLevel(name, level) { - this.name = name; - this.level = level; - } - return LogLevel; - }()); - exports.LogLevel = LogLevel; - var Logger = /** @class */ (function () { - function Logger(name, level) { - if (level === void 0) { - level = Logger.INFO; - } - this._name = name; - this.set_level(level); - } - Object.defineProperty(Logger, "levels", { - get: function () { - return Object.keys(Logger.log_levels); - }, - enumerable: true, - configurable: true - }); - Logger.get = function (name, level) { - if (level === void 0) { - level = Logger.INFO; - } - if (name.length > 0) { - var logger_1 = _loggers[name]; - if (logger_1 == null) - _loggers[name] = logger_1 = new Logger(name, level); - return logger_1; - } - else - throw new TypeError("Logger.get() expects a non-empty string name and an optional log-level"); - }; - Object.defineProperty(Logger.prototype, "level", { - get: function () { - return this.get_level(); - }, - enumerable: true, - configurable: true - }); - Logger.prototype.get_level = function () { - return this._log_level; - }; - Logger.prototype.set_level = function (log_level) { - if (log_level instanceof LogLevel) - this._log_level = log_level; - else if (types_1.isString(log_level) && Logger.log_levels[log_level] != null) - this._log_level = Logger.log_levels[log_level]; - else - throw new Error("Logger.set_level() expects a log-level object or a string name of a log-level"); - var logger_name = "[" + this._name + "]"; - for (var name_1 in Logger.log_levels) { - var log_level_1 = Logger.log_levels[name_1]; - if (log_level_1.level < this._log_level.level || this._log_level.level === Logger.OFF.level) - this[name_1] = function () { }; - else - this[name_1] = _method_factory(name_1, logger_name); - } - }; - Logger.prototype.trace = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - }; - Logger.prototype.debug = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - }; - Logger.prototype.info = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - }; - Logger.prototype.warn = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - }; - Logger.prototype.error = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - }; - Logger.TRACE = new LogLevel("trace", 0); - Logger.DEBUG = new LogLevel("debug", 1); - Logger.INFO = new LogLevel("info", 2); - Logger.WARN = new LogLevel("warn", 6); - Logger.ERROR = new LogLevel("error", 7); - Logger.FATAL = new LogLevel("fatal", 8); - Logger.OFF = new LogLevel("off", 9); - Logger.log_levels = { - trace: Logger.TRACE, - debug: Logger.DEBUG, - info: Logger.INFO, - warn: Logger.WARN, - error: Logger.ERROR, - fatal: Logger.FATAL, - off: Logger.OFF, - }; - return Logger; - }()); - exports.Logger = Logger; - function _method_factory(method_name, logger_name) { - if (console[method_name] != null) - return console[method_name].bind(console, logger_name); - else if (console.log != null) - return console.log.bind(console, logger_name); - else - return function () { }; - } - exports.logger = Logger.get("bokeh"); - function set_log_level(level) { - if (Logger.log_levels[level] == null) { - console.log("[bokeh] unrecognized logging level '" + level + "' passed to Bokeh.set_log_level(), ignoring"); - console.log("[bokeh] valid log levels are: " + Logger.levels.join(', ')); - } - else { - console.log("[bokeh] setting log level to: '" + level + "'"); - exports.logger.set_level(level); - } - } - exports.set_log_level = set_log_level; -} -, -/* core/properties */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var signaling_1 = require(22) /* ./signaling */; - var enums = require(7) /* ./enums */; - var array_1 = require(24) /* ./util/array */; - var arrayable_1 = require(25) /* ./util/arrayable */; - var color_1 = require(30) /* ./util/color */; - var types_1 = require(46) /* ./util/types */; - signaling_1.Signal; // XXX: silence TS, because `Signal` appears in declarations due to Signalable - function valueToString(value) { - try { - return JSON.stringify(value); - } - catch (_a) { - return value.toString(); - } - } - function isSpec(obj) { - return types_1.isPlainObject(obj) && - ((obj.value === undefined ? 0 : 1) + - (obj.field === undefined ? 0 : 1) + - (obj.expr === undefined ? 0 : 1) == 1); // garbage JS XOR - } - exports.isSpec = isSpec; - var Property = /** @class */ (function (_super) { - tslib_1.__extends(Property, _super); - function Property(obj, attr, default_value) { - var _this = _super.call(this) || this; - _this.obj = obj; - _this.attr = attr; - _this.default_value = default_value; - _this.optional = false; - _this.change = new signaling_1.Signal0(_this.obj, "change"); - _this._init(); - _this.connect(_this.change, function () { return _this._init(); }); - return _this; - } - Property.prototype.update = function () { - this._init(); - }; - // ----- customizable policies - Property.prototype.init = function () { }; - Property.prototype.transform = function (values) { - return values; - }; - Property.prototype.validate = function (value) { - if (!this.valid(value)) - throw new Error(this.obj.type + "." + this.attr + " given invalid value: " + valueToString(value)); - }; - Property.prototype.valid = function (_value) { - return true; - }; - // ----- property accessors - Property.prototype.value = function (do_spec_transform) { - if (do_spec_transform === void 0) { - do_spec_transform = true; - } - if (this.spec.value === undefined) - throw new Error("attempted to retrieve property value for property without value specification"); - var ret = this.transform([this.spec.value])[0]; - if (this.spec.transform != null && do_spec_transform) - ret = this.spec.transform.compute(ret); - return ret; - }; - // ----- private methods - /*protected*/ Property.prototype._init = function () { - var _a; - var obj = this.obj; - var attr = this.attr; - var attr_value = obj.getv(attr); - if (attr_value === undefined) { - var default_value = this.default_value; - if (default_value !== undefined) - attr_value = default_value(obj); - else - attr_value = null; - obj.setv((_a = {}, _a[attr] = attr_value, _a), { silent: true, defaults: true }); - } - if (types_1.isArray(attr_value)) - this.spec = { value: attr_value }; - else if (isSpec(attr_value)) - this.spec = attr_value; - else - this.spec = { value: attr_value }; - //if (this.dataspec && this.spec.field != null && !isString(this.spec.field)) - // throw new Error(`field value for property '${attr}' is not a string`) - if (this.spec.value != null) - this.validate(this.spec.value); - this.init(); - }; - Property.prototype.toString = function () { - /*${this.name}*/ - return "Prop(" + this.obj + "." + this.attr + ", spec: " + valueToString(this.spec) + ")"; - }; - return Property; - }(signaling_1.Signalable())); - exports.Property = Property; - // - // Primitive Properties - // - var Any = /** @class */ (function (_super) { - tslib_1.__extends(Any, _super); - function Any() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Any; - }(Property)); - exports.Any = Any; - var Array = /** @class */ (function (_super) { - tslib_1.__extends(Array, _super); - function Array() { - return _super !== null && _super.apply(this, arguments) || this; - } - Array.prototype.valid = function (value) { - return types_1.isArray(value) || value instanceof Float64Array; - }; - return Array; - }(Property)); - exports.Array = Array; - var Boolean = /** @class */ (function (_super) { - tslib_1.__extends(Boolean, _super); - function Boolean() { - return _super !== null && _super.apply(this, arguments) || this; - } - Boolean.prototype.valid = function (value) { - return types_1.isBoolean(value); - }; - return Boolean; - }(Property)); - exports.Boolean = Boolean; - var Color = /** @class */ (function (_super) { - tslib_1.__extends(Color, _super); - function Color() { - return _super !== null && _super.apply(this, arguments) || this; - } - Color.prototype.valid = function (value) { - return types_1.isString(value) && color_1.is_color(value); - }; - return Color; - }(Property)); - exports.Color = Color; - var Instance = /** @class */ (function (_super) { - tslib_1.__extends(Instance, _super); - function Instance() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Instance; - }(Property)); - exports.Instance = Instance; - var Number = /** @class */ (function (_super) { - tslib_1.__extends(Number, _super); - function Number() { - return _super !== null && _super.apply(this, arguments) || this; - } - Number.prototype.valid = function (value) { - return types_1.isNumber(value); - }; - return Number; - }(Property)); - exports.Number = Number; - var Int = /** @class */ (function (_super) { - tslib_1.__extends(Int, _super); - function Int() { - return _super !== null && _super.apply(this, arguments) || this; - } - Int.prototype.valid = function (value) { - return types_1.isNumber(value) && (value | 0) == value; - }; - return Int; - }(Number)); - exports.Int = Int; - var Angle = /** @class */ (function (_super) { - tslib_1.__extends(Angle, _super); - function Angle() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Angle; - }(Number)); - exports.Angle = Angle; - var Percent = /** @class */ (function (_super) { - tslib_1.__extends(Percent, _super); - function Percent() { - return _super !== null && _super.apply(this, arguments) || this; - } - Percent.prototype.valid = function (value) { - return types_1.isNumber(value) && 0 <= value && value <= 1.0; - }; - return Percent; - }(Number)); - exports.Percent = Percent; - var String = /** @class */ (function (_super) { - tslib_1.__extends(String, _super); - function String() { - return _super !== null && _super.apply(this, arguments) || this; - } - String.prototype.valid = function (value) { - return types_1.isString(value); - }; - return String; - }(Property)); - exports.String = String; - var FontSize = /** @class */ (function (_super) { - tslib_1.__extends(FontSize, _super); - function FontSize() { - return _super !== null && _super.apply(this, arguments) || this; - } - return FontSize; - }(String)); - exports.FontSize = FontSize; - var Font = /** @class */ (function (_super) { - tslib_1.__extends(Font, _super); - function Font() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Font; - }(String)); // TODO (bev) don't think this exists python side - exports.Font = Font; - // - // Enum properties - // - var EnumProperty = /** @class */ (function (_super) { - tslib_1.__extends(EnumProperty, _super); - function EnumProperty() { - return _super !== null && _super.apply(this, arguments) || this; - } - EnumProperty.prototype.valid = function (value) { - return types_1.isString(value) && array_1.includes(this.enum_values, value); - }; - return EnumProperty; - }(Property)); - exports.EnumProperty = EnumProperty; - function Enum(values) { - return /** @class */ (function (_super) { - tslib_1.__extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(class_1.prototype, "enum_values", { - get: function () { - return values; - }, - enumerable: true, - configurable: true - }); - return class_1; - }(EnumProperty)); - } - exports.Enum = Enum; - var Direction = /** @class */ (function (_super) { - tslib_1.__extends(Direction, _super); - function Direction() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Direction.prototype, "enum_values", { - get: function () { - return enums.Direction; - }, - enumerable: true, - configurable: true - }); - Direction.prototype.transform = function (values) { - var result = new Uint8Array(values.length); - for (var i = 0; i < values.length; i++) { - switch (values[i]) { - case "clock": - result[i] = 0; - break; - case "anticlock": - result[i] = 1; - break; - } - } - return result; - }; - return Direction; - }(EnumProperty)); - exports.Direction = Direction; - exports.Anchor = Enum(enums.Anchor); - exports.AngleUnits = Enum(enums.AngleUnits); - exports.BoxOrigin = Enum(enums.BoxOrigin); - exports.ButtonType = Enum(enums.ButtonType); - exports.Dimension = Enum(enums.Dimension); - exports.Dimensions = Enum(enums.Dimensions); - exports.Distribution = Enum(enums.Distribution); - exports.FontStyle = Enum(enums.FontStyle); - exports.HTTPMethod = Enum(enums.HTTPMethod); - exports.HexTileOrientation = Enum(enums.HexTileOrientation); - exports.HoverMode = Enum(enums.HoverMode); - exports.LatLon = Enum(enums.LatLon); - exports.LegendClickPolicy = Enum(enums.LegendClickPolicy); - exports.LegendLocation = Enum(enums.LegendLocation); - exports.LineCap = Enum(enums.LineCap); - exports.LineJoin = Enum(enums.LineJoin); - exports.LinePolicy = Enum(enums.LinePolicy); - exports.Location = Enum(enums.Location); - exports.Logo = Enum(enums.Logo); - exports.MarkerType = Enum(enums.MarkerType); - exports.Orientation = Enum(enums.Orientation); - exports.OutputBackend = Enum(enums.OutputBackend); - exports.PaddingUnits = Enum(enums.PaddingUnits); - exports.Place = Enum(enums.Place); - exports.PointPolicy = Enum(enums.PointPolicy); - exports.RadiusDimension = Enum(enums.RadiusDimension); - exports.RenderLevel = Enum(enums.RenderLevel); - exports.RenderMode = Enum(enums.RenderMode); - exports.RoundingFunction = Enum(enums.RoundingFunction); - exports.Side = Enum(enums.Side); - exports.SizingMode = Enum(enums.SizingMode); - exports.SliderCallbackPolicy = Enum(enums.SliderCallbackPolicy); - exports.Sort = Enum(enums.Sort); - exports.SpatialUnits = Enum(enums.SpatialUnits); - exports.StartEnd = Enum(enums.StartEnd); - exports.StepMode = Enum(enums.StepMode); - exports.TapBehavior = Enum(enums.TapBehavior); - exports.TextAlign = Enum(enums.TextAlign); - exports.TextBaseline = Enum(enums.TextBaseline); - exports.TickLabelOrientation = Enum(enums.TickLabelOrientation); - exports.TooltipAttachment = Enum(enums.TooltipAttachment); - exports.UpdateMode = Enum(enums.UpdateMode); - exports.VerticalAlign = Enum(enums.VerticalAlign); - // - // DataSpec properties - // - var ScalarSpec = /** @class */ (function (_super) { - tslib_1.__extends(ScalarSpec, _super); - function ScalarSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ScalarSpec; - }(Property)); - exports.ScalarSpec = ScalarSpec; - var VectorSpec = /** @class */ (function (_super) { - tslib_1.__extends(VectorSpec, _super); - function VectorSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - VectorSpec.prototype.array = function (source) { - var ret; - if (this.spec.field != null) { - ret = this.transform(source.get_column(this.spec.field)); - if (ret == null) - throw new Error("attempted to retrieve property array for nonexistent field '" + this.spec.field + "'"); - } - else if (this.spec.expr != null) { - ret = this.transform(this.spec.expr.v_compute(source)); - } - else { - var length_1 = source.get_length(); - if (length_1 == null) - length_1 = 1; - var value = this.value(false); // don't apply any spec transform - ret = array_1.repeat(value, length_1); - } - if (this.spec.transform != null) - ret = this.spec.transform.v_compute(ret); - return ret; - }; - return VectorSpec; - }(Property)); - exports.VectorSpec = VectorSpec; - var DataSpec = /** @class */ (function (_super) { - tslib_1.__extends(DataSpec, _super); - function DataSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return DataSpec; - }(VectorSpec)); - exports.DataSpec = DataSpec; - var UnitsSpec = /** @class */ (function (_super) { - tslib_1.__extends(UnitsSpec, _super); - function UnitsSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - UnitsSpec.prototype.init = function () { - if (this.spec.units == null) - this.spec.units = this.default_units; - var units = this.spec.units; - if (!array_1.includes(this.valid_units, units)) - throw new Error("units must be one of " + this.valid_units.join(", ") + "; got: " + units); - }; - Object.defineProperty(UnitsSpec.prototype, "units", { - get: function () { - return this.spec.units; - }, - set: function (units) { - this.spec.units = units; - }, - enumerable: true, - configurable: true - }); - return UnitsSpec; - }(VectorSpec)); - exports.UnitsSpec = UnitsSpec; - var AngleSpec = /** @class */ (function (_super) { - tslib_1.__extends(AngleSpec, _super); - function AngleSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(AngleSpec.prototype, "default_units", { - get: function () { return "rad"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AngleSpec.prototype, "valid_units", { - get: function () { return enums.AngleUnits; }, - enumerable: true, - configurable: true - }); - AngleSpec.prototype.transform = function (values) { - if (this.spec.units == "deg") - values = arrayable_1.map(values, function (x) { return x * Math.PI / 180.0; }); - values = arrayable_1.map(values, function (x) { return -x; }); - return _super.prototype.transform.call(this, values); - }; - return AngleSpec; - }(UnitsSpec)); - exports.AngleSpec = AngleSpec; - var BooleanSpec = /** @class */ (function (_super) { - tslib_1.__extends(BooleanSpec, _super); - function BooleanSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return BooleanSpec; - }(DataSpec)); - exports.BooleanSpec = BooleanSpec; - var ColorSpec = /** @class */ (function (_super) { - tslib_1.__extends(ColorSpec, _super); - function ColorSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ColorSpec; - }(DataSpec)); - exports.ColorSpec = ColorSpec; - var CoordinateSpec = /** @class */ (function (_super) { - tslib_1.__extends(CoordinateSpec, _super); - function CoordinateSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CoordinateSpec; - }(DataSpec)); - exports.CoordinateSpec = CoordinateSpec; - var CoordinateSeqSpec = /** @class */ (function (_super) { - tslib_1.__extends(CoordinateSeqSpec, _super); - function CoordinateSeqSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CoordinateSeqSpec; - }(DataSpec)); - exports.CoordinateSeqSpec = CoordinateSeqSpec; - var DistanceSpec = /** @class */ (function (_super) { - tslib_1.__extends(DistanceSpec, _super); - function DistanceSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DistanceSpec.prototype, "default_units", { - get: function () { return "data"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DistanceSpec.prototype, "valid_units", { - get: function () { return enums.SpatialUnits; }, - enumerable: true, - configurable: true - }); - return DistanceSpec; - }(UnitsSpec)); - exports.DistanceSpec = DistanceSpec; - var FontSizeSpec = /** @class */ (function (_super) { - tslib_1.__extends(FontSizeSpec, _super); - function FontSizeSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return FontSizeSpec; - }(DataSpec)); - exports.FontSizeSpec = FontSizeSpec; - var MarkerSpec = /** @class */ (function (_super) { - tslib_1.__extends(MarkerSpec, _super); - function MarkerSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return MarkerSpec; - }(DataSpec)); - exports.MarkerSpec = MarkerSpec; - var NumberSpec = /** @class */ (function (_super) { - tslib_1.__extends(NumberSpec, _super); - function NumberSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return NumberSpec; - }(DataSpec)); - exports.NumberSpec = NumberSpec; - var StringSpec = /** @class */ (function (_super) { - tslib_1.__extends(StringSpec, _super); - function StringSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return StringSpec; - }(DataSpec)); - exports.StringSpec = StringSpec; - var NullStringSpec = /** @class */ (function (_super) { - tslib_1.__extends(NullStringSpec, _super); - function NullStringSpec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return NullStringSpec; - }(DataSpec)); - exports.NullStringSpec = NullStringSpec; -} -, -/* core/property_mixins */ function _(require, module, exports) { - var p = require(18) /* ./properties */; - var object_1 = require(35) /* ./util/object */; - function _gen_mixin(mixin, prefix) { - var result = {}; - for (var name_1 in mixin) { - var prop = mixin[name_1]; - result[prefix + name_1] = prop; - } - return result; - } - var _line_mixin = { - line_color: [p.ColorSpec, 'black'], - line_width: [p.NumberSpec, 1], - line_alpha: [p.NumberSpec, 1.0], - line_join: [p.LineJoin, 'bevel'], - line_cap: [p.LineCap, 'butt'], - line_dash: [p.Array, []], - line_dash_offset: [p.Number, 0], - }; - exports.line = function (prefix) { - if (prefix === void 0) { - prefix = ""; - } - return _gen_mixin(_line_mixin, prefix); - }; - var _fill_mixin = { - fill_color: [p.ColorSpec, 'gray'], - fill_alpha: [p.NumberSpec, 1.0], - }; - exports.fill = function (prefix) { - if (prefix === void 0) { - prefix = ""; - } - return _gen_mixin(_fill_mixin, prefix); - }; - var _text_mixin = { - text_font: [p.Font, 'helvetica'], - text_font_size: [p.FontSizeSpec, '12pt'], - text_font_style: [p.FontStyle, 'normal'], - text_color: [p.ColorSpec, '#444444'], - text_alpha: [p.NumberSpec, 1.0], - text_align: [p.TextAlign, 'left'], - text_baseline: [p.TextBaseline, 'bottom'], - text_line_height: [p.Number, 1.2], - }; - exports.text = function (prefix) { - if (prefix === void 0) { - prefix = ""; - } - return _gen_mixin(_text_mixin, prefix); - }; - function create(configs) { - var result = {}; - for (var _i = 0, configs_1 = configs; _i < configs_1.length; _i++) { - var config = configs_1[_i]; - var _a = config.split(":"), kind = _a[0], prefix = _a[1]; - var mixin = void 0; - switch (kind) { - case "line": - mixin = exports.line; - break; - case "fill": - mixin = exports.fill; - break; - case "text": - mixin = exports.text; - break; - default: - throw new Error("Unknown property mixin kind '" + kind + "'"); - } - object_1.extend(result, mixin(prefix)); - } - return result; - } - exports.create = create; -} -, -/* core/selection_manager */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var has_props_1 = require(8) /* ./has_props */; - var selection_1 = require(205) /* ../models/selections/selection */; - var glyph_renderer_1 = require(193) /* ../models/renderers/glyph_renderer */; - var graph_renderer_1 = require(194) /* ../models/renderers/graph_renderer */; - var p = require(18) /* ./properties */; - var SelectionManager = /** @class */ (function (_super) { - tslib_1.__extends(SelectionManager, _super); - function SelectionManager(attrs) { - var _this = _super.call(this, attrs) || this; - _this.inspectors = {}; - return _this; - } - SelectionManager.initClass = function () { - this.prototype.type = "SelectionManager"; - this.internal({ - source: [p.Any], - }); - }; - SelectionManager.prototype.select = function (renderer_views, geometry, final, append) { - if (append === void 0) { - append = false; - } - // divide renderers into glyph_renderers or graph_renderers - var glyph_renderer_views = []; - var graph_renderer_views = []; - for (var _i = 0, renderer_views_1 = renderer_views; _i < renderer_views_1.length; _i++) { - var r = renderer_views_1[_i]; - if (r instanceof glyph_renderer_1.GlyphRendererView) - glyph_renderer_views.push(r); - else if (r instanceof graph_renderer_1.GraphRendererView) - graph_renderer_views.push(r); - } - var did_hit = false; - // graph renderer case - for (var _a = 0, graph_renderer_views_1 = graph_renderer_views; _a < graph_renderer_views_1.length; _a++) { - var r = graph_renderer_views_1[_a]; - var hit_test_result = r.model.selection_policy.hit_test(geometry, r); - did_hit = did_hit || r.model.selection_policy.do_selection(hit_test_result, r.model, final, append); - } - // glyph renderers - if (glyph_renderer_views.length > 0) { - var hit_test_result = this.source.selection_policy.hit_test(geometry, glyph_renderer_views); - did_hit = did_hit || this.source.selection_policy.do_selection(hit_test_result, this.source, final, append); - } - return did_hit; - }; - SelectionManager.prototype.inspect = function (renderer_view, geometry) { - var did_hit = false; - if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) { - var hit_test_result = renderer_view.hit_test(geometry); - if (hit_test_result != null) { - did_hit = !hit_test_result.is_empty(); - var inspection = this.get_or_create_inspector(renderer_view.model); - inspection.update(hit_test_result, true, false); - this.source.setv({ inspected: inspection }, { silent: true }); - this.source.inspect.emit([renderer_view, { geometry: geometry }]); - } - } - else if (renderer_view instanceof graph_renderer_1.GraphRendererView) { - var hit_test_result = renderer_view.model.inspection_policy.hit_test(geometry, renderer_view); - did_hit = did_hit || renderer_view.model.inspection_policy.do_inspection(hit_test_result, geometry, renderer_view, false, false); - } - return did_hit; - }; - SelectionManager.prototype.clear = function (rview) { - this.source.selected.clear(); - if (rview != null) - this.get_or_create_inspector(rview.model).clear(); - }; - SelectionManager.prototype.get_or_create_inspector = function (rmodel) { - if (this.inspectors[rmodel.id] == null) - this.inspectors[rmodel.id] = new selection_1.Selection(); - return this.inspectors[rmodel.id]; - }; - return SelectionManager; - }(has_props_1.HasProps)); - exports.SelectionManager = SelectionManager; - SelectionManager.initClass(); -} -, -/* core/settings */ function _(require, module, exports) { - var Settings = /** @class */ (function () { - function Settings() { - this._dev = false; - } - Object.defineProperty(Settings.prototype, "dev", { - get: function () { - return this._dev; - }, - set: function (dev) { - this._dev = dev; - }, - enumerable: true, - configurable: true - }); - return Settings; - }()); - exports.Settings = Settings; - exports.settings = new Settings(); -} -, -/* core/signaling */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var data_structures_1 = require(32) /* ./util/data_structures */; - var callback_1 = require(28) /* ./util/callback */; - var array_1 = require(24) /* ./util/array */; - var Signal = /** @class */ (function () { - function Signal(sender, name) { - this.sender = sender; - this.name = name; - } - Signal.prototype.connect = function (slot, context) { - if (context === void 0) { - context = null; - } - if (!receiversForSender.has(this.sender)) { - receiversForSender.set(this.sender, []); - } - var receivers = receiversForSender.get(this.sender); - if (findConnection(receivers, this, slot, context) != null) { - return false; - } - var receiver = context || slot; - if (!sendersForReceiver.has(receiver)) { - sendersForReceiver.set(receiver, []); - } - var senders = sendersForReceiver.get(receiver); - var connection = { signal: this, slot: slot, context: context }; - receivers.push(connection); - senders.push(connection); - return true; - }; - Signal.prototype.disconnect = function (slot, context) { - if (context === void 0) { - context = null; - } - var receivers = receiversForSender.get(this.sender); - if (receivers == null || receivers.length === 0) { - return false; - } - var connection = findConnection(receivers, this, slot, context); - if (connection == null) { - return false; - } - var receiver = context || slot; - var senders = sendersForReceiver.get(receiver); - connection.signal = null; - scheduleCleanup(receivers); - scheduleCleanup(senders); - return true; - }; - Signal.prototype.emit = function (args) { - var receivers = receiversForSender.get(this.sender) || []; - for (var _i = 0, receivers_1 = receivers; _i < receivers_1.length; _i++) { - var _a = receivers_1[_i], signal = _a.signal, slot = _a.slot, context = _a.context; - if (signal === this) { - slot.call(context, args, this.sender); - } - } - }; - return Signal; - }()); - exports.Signal = Signal; - var Signal0 = /** @class */ (function (_super) { - tslib_1.__extends(Signal0, _super); - function Signal0() { - return _super !== null && _super.apply(this, arguments) || this; - } - Signal0.prototype.emit = function () { - _super.prototype.emit.call(this, undefined); - }; - return Signal0; - }(Signal)); - exports.Signal0 = Signal0; - (function (Signal) { - function disconnectBetween(sender, receiver) { - var receivers = receiversForSender.get(sender); - if (receivers == null || receivers.length === 0) - return; - var senders = sendersForReceiver.get(receiver); - if (senders == null || senders.length === 0) - return; - for (var _i = 0, senders_1 = senders; _i < senders_1.length; _i++) { - var connection = senders_1[_i]; - if (connection.signal == null) - return; - if (connection.signal.sender === sender) - connection.signal = null; - } - scheduleCleanup(receivers); - scheduleCleanup(senders); - } - Signal.disconnectBetween = disconnectBetween; - function disconnectSender(sender) { - var receivers = receiversForSender.get(sender); - if (receivers == null || receivers.length === 0) - return; - for (var _i = 0, receivers_2 = receivers; _i < receivers_2.length; _i++) { - var connection = receivers_2[_i]; - if (connection.signal == null) - return; - var receiver = connection.context || connection.slot; - connection.signal = null; - scheduleCleanup(sendersForReceiver.get(receiver)); - } - scheduleCleanup(receivers); - } - Signal.disconnectSender = disconnectSender; - function disconnectReceiver(receiver) { - var senders = sendersForReceiver.get(receiver); - if (senders == null || senders.length === 0) - return; - for (var _i = 0, senders_2 = senders; _i < senders_2.length; _i++) { - var connection = senders_2[_i]; - if (connection.signal == null) - return; - var sender = connection.signal.sender; - connection.signal = null; - scheduleCleanup(receiversForSender.get(sender)); - } - scheduleCleanup(senders); - } - Signal.disconnectReceiver = disconnectReceiver; - function disconnectAll(obj) { - var receivers = receiversForSender.get(obj); - if (receivers != null && receivers.length !== 0) { - for (var _i = 0, receivers_3 = receivers; _i < receivers_3.length; _i++) { - var connection = receivers_3[_i]; - connection.signal = null; - } - scheduleCleanup(receivers); - } - var senders = sendersForReceiver.get(obj); - if (senders != null && senders.length !== 0) { - for (var _a = 0, senders_3 = senders; _a < senders_3.length; _a++) { - var connection = senders_3[_a]; - connection.signal = null; - } - scheduleCleanup(senders); - } - } - Signal.disconnectAll = disconnectAll; - })(Signal = exports.Signal || (exports.Signal = {})); - exports.Signal = Signal; - function Signalable(Base) { - // XXX: `class Foo extends Signalable(Object)` doesn't work (compiles, but fails at runtime), so - // we have to do this to allow signalable classes without an explict base class. - if (Base != null) { - return /** @class */ (function (_super) { - tslib_1.__extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - class_1.prototype.connect = function (signal, slot) { - return signal.connect(slot, this); - }; - return class_1; - }(Base)); - } - else { - return /** @class */ (function () { - function class_2() { - } - class_2.prototype.connect = function (signal, slot) { - return signal.connect(slot, this); - }; - return class_2; - }()); - } - } - exports.Signalable = Signalable; - var _Signalable; - (function (_Signalable) { - function connect(signal, slot) { - return signal.connect(slot, this); - } - _Signalable.connect = connect; - })(_Signalable = exports._Signalable || (exports._Signalable = {})); - var receiversForSender = new WeakMap(); - var sendersForReceiver = new WeakMap(); - function findConnection(conns, signal, slot, context) { - return array_1.find(conns, function (conn) { return conn.signal === signal && conn.slot === slot && conn.context === context; }); - } - var dirtySet = new data_structures_1.Set(); - function scheduleCleanup(connections) { - if (dirtySet.size === 0) { - callback_1.defer(cleanupDirtySet); - } - dirtySet.add(connections); - } - function cleanupDirtySet() { - dirtySet.forEach(function (connections) { - array_1.remove_by(connections, function (connection) { return connection.signal == null; }); - }); - dirtySet.clear(); - } -} -, -/* core/ui_events */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var Hammer = require(369) /* hammerjs */; - var signaling_1 = require(22) /* ./signaling */; - var logging_1 = require(17) /* ./logging */; - var dom_1 = require(5) /* ./dom */; - var wheel_1 = require(47) /* ./util/wheel */; - var array_1 = require(24) /* ./util/array */; - var object_1 = require(35) /* ./util/object */; - var types_1 = require(46) /* ./util/types */; - var compat_1 = require(31) /* ./util/compat */; - var events = require(3) /* ./bokeh_events */; - var UIEvents = /** @class */ (function () { - function UIEvents(plot_view, toolbar, hit_area) { - var _this = this; - this.plot_view = plot_view; - this.toolbar = toolbar; - this.hit_area = hit_area; - this.pan_start = new signaling_1.Signal(this, 'pan:start'); - this.pan = new signaling_1.Signal(this, 'pan'); - this.pan_end = new signaling_1.Signal(this, 'pan:end'); - this.pinch_start = new signaling_1.Signal(this, 'pinch:start'); - this.pinch = new signaling_1.Signal(this, 'pinch'); - this.pinch_end = new signaling_1.Signal(this, 'pinch:end'); - this.rotate_start = new signaling_1.Signal(this, 'rotate:start'); - this.rotate = new signaling_1.Signal(this, 'rotate'); - this.rotate_end = new signaling_1.Signal(this, 'rotate:end'); - this.tap = new signaling_1.Signal(this, 'tap'); - this.doubletap = new signaling_1.Signal(this, 'doubletap'); - this.press = new signaling_1.Signal(this, 'press'); - this.move_enter = new signaling_1.Signal(this, 'move:enter'); - this.move = new signaling_1.Signal(this, 'move'); - this.move_exit = new signaling_1.Signal(this, 'move:exit'); - this.scroll = new signaling_1.Signal(this, 'scroll'); - this.keydown = new signaling_1.Signal(this, 'keydown'); - this.keyup = new signaling_1.Signal(this, 'keyup'); - this.hammer = new Hammer(this.hit_area); - this._configure_hammerjs(); - // Mouse & keyboard events not handled through hammerjs - // We can 'add and forget' these event listeners because this.hit_area is a DOM element - // that will be thrown away when the view is removed - this.hit_area.addEventListener("mousemove", function (e) { return _this._mouse_move(e); }); - this.hit_area.addEventListener("mouseenter", function (e) { return _this._mouse_enter(e); }); - this.hit_area.addEventListener("mouseleave", function (e) { return _this._mouse_exit(e); }); - this.hit_area.addEventListener("wheel", function (e) { return _this._mouse_wheel(e); }); - // But we MUST remove listeners registered on document or we'll leak memory: register - // 'this' as the listener (it implements the event listener interface, i.e. handleEvent) - // instead of an anonymous function so we can easily refer back to it for removing - document.addEventListener("keydown", this); - document.addEventListener("keyup", this); - } - UIEvents.prototype.destroy = function () { - this.hammer.destroy(); - document.removeEventListener("keydown", this); - document.removeEventListener("keyup", this); - }; - UIEvents.prototype.handleEvent = function (e) { - if (e.type == "keydown") - this._key_down(e); - else if (e.type == "keyup") - this._key_up(e); - }; - UIEvents.prototype._configure_hammerjs = function () { - var _this = this; - // This is to be able to distinguish double taps from single taps - this.hammer.get('doubletap').recognizeWith('tap'); - this.hammer.get('tap').requireFailure('doubletap'); - this.hammer.get('doubletap').dropRequireFailure('tap'); - this.hammer.on('doubletap', function (e) { return _this._doubletap(e); }); - this.hammer.on('tap', function (e) { return _this._tap(e); }); - this.hammer.on('press', function (e) { return _this._press(e); }); - this.hammer.get('pan').set({ direction: Hammer.DIRECTION_ALL }); - this.hammer.on('panstart', function (e) { return _this._pan_start(e); }); - this.hammer.on('pan', function (e) { return _this._pan(e); }); - this.hammer.on('panend', function (e) { return _this._pan_end(e); }); - this.hammer.get('pinch').set({ enable: true }); - this.hammer.on('pinchstart', function (e) { return _this._pinch_start(e); }); - this.hammer.on('pinch', function (e) { return _this._pinch(e); }); - this.hammer.on('pinchend', function (e) { return _this._pinch_end(e); }); - this.hammer.get('rotate').set({ enable: true }); - this.hammer.on('rotatestart', function (e) { return _this._rotate_start(e); }); - this.hammer.on('rotate', function (e) { return _this._rotate(e); }); - this.hammer.on('rotateend', function (e) { return _this._rotate_end(e); }); - }; - UIEvents.prototype.register_tool = function (tool_view) { - var _this = this; - var et = tool_view.model.event_type; - if (et != null) { - if (types_1.isString(et)) - this._register_tool(tool_view, et); - else { - // Multi-tools should only registered shared events once - et.forEach(function (e, index) { return _this._register_tool(tool_view, e, index < 1); }); - } - } - }; - UIEvents.prototype._register_tool = function (tool_view, et, shared) { - if (shared === void 0) { - shared = true; - } - var v = tool_view; - var id = v.model.id; - var conditionally = function (fn) { - return function (arg) { - if (arg.id == id) - fn(arg.e); - }; - }; - var unconditionally = function (fn) { - return function (arg) { - fn(arg.e); - }; - }; - switch (et) { - case "pan": { - if (v._pan_start != null) - v.connect(this.pan_start, conditionally(v._pan_start.bind(v))); - if (v._pan != null) - v.connect(this.pan, conditionally(v._pan.bind(v))); - if (v._pan_end != null) - v.connect(this.pan_end, conditionally(v._pan_end.bind(v))); - break; - } - case "pinch": { - if (v._pinch_start != null) - v.connect(this.pinch_start, conditionally(v._pinch_start.bind(v))); - if (v._pinch != null) - v.connect(this.pinch, conditionally(v._pinch.bind(v))); - if (v._pinch_end != null) - v.connect(this.pinch_end, conditionally(v._pinch_end.bind(v))); - break; - } - case "rotate": { - if (v._rotate_start != null) - v.connect(this.rotate_start, conditionally(v._rotate_start.bind(v))); - if (v._rotate != null) - v.connect(this.rotate, conditionally(v._rotate.bind(v))); - if (v._rotate_end != null) - v.connect(this.rotate_end, conditionally(v._rotate_end.bind(v))); - break; - } - case "move": { - if (v._move_enter != null) - v.connect(this.move_enter, conditionally(v._move_enter.bind(v))); - if (v._move != null) - v.connect(this.move, conditionally(v._move.bind(v))); - if (v._move_exit != null) - v.connect(this.move_exit, conditionally(v._move_exit.bind(v))); - break; - } - case "tap": { - if (v._tap != null) - v.connect(this.tap, conditionally(v._tap.bind(v))); - break; - } - case "press": { - if (v._press != null) - v.connect(this.press, conditionally(v._press.bind(v))); - break; - } - case "scroll": { - if (v._scroll != null) - v.connect(this.scroll, conditionally(v._scroll.bind(v))); - break; - } - default: - throw new Error("unsupported event_type: " + et); - } - // Skip shared events if registering multi-tool - if (!shared) - return; - if (v._doubletap != null) - v.connect(this.doubletap, unconditionally(v._doubletap.bind(v))); - if (v._keydown != null) - v.connect(this.keydown, unconditionally(v._keydown.bind(v))); - if (v._keyup != null) - v.connect(this.keyup, unconditionally(v._keyup.bind(v))); - // Dual touch hack part 1/2 - // This is a hack for laptops with touch screen who may be pinching or scrolling - // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event - // will be linked to pinch. But we also want to trigger in the case of a scroll. - if (compat_1.is_mobile && v._scroll != null && et == 'pinch') { - logging_1.logger.debug("Registering scroll on touch screen"); - v.connect(this.scroll, conditionally(v._scroll.bind(v))); - } - }; - UIEvents.prototype._hit_test_renderers = function (sx, sy) { - var views = this.plot_view.get_renderer_views(); - for (var _i = 0, _a = array_1.reversed(views); _i < _a.length; _i++) { - var view = _a[_i]; - var level = view.model.level; - if ((level == 'annotation' || level == 'overlay') && view.interactive_hit != null) { - if (view.interactive_hit(sx, sy)) - return view; - } - } - return null; - }; - UIEvents.prototype._hit_test_frame = function (sx, sy) { - return this.plot_view.frame.bbox.contains(sx, sy); - }; - UIEvents.prototype._hit_test_canvas = function (sx, sy) { - return this.plot_view.layout.bbox.contains(sx, sy); - }; - UIEvents.prototype._trigger = function (signal, e, srcEvent) { - var _this = this; - var gestures = this.toolbar.gestures; - var event_type = signal.name; - var base_type = event_type.split(":")[0]; - var view = this._hit_test_renderers(e.sx, e.sy); - var on_canvas = this._hit_test_canvas(e.sx, e.sy); - switch (base_type) { - case "move": { - var active_gesture = gestures[base_type].active; - if (active_gesture != null) - this.trigger(signal, e, active_gesture.id); - var active_inspectors = this.toolbar.inspectors.filter(function (t) { return t.active; }); - var cursor = "default"; - // the event happened on a renderer - if (view != null) { - cursor = view.cursor(e.sx, e.sy) || cursor; - if (!object_1.isEmpty(active_inspectors)) { - // override event_type to cause inspectors to clear overlays - signal = this.move_exit; // XXX - event_type = signal.name; - } - // the event happened on the plot frame but off a renderer - } - else if (this._hit_test_frame(e.sx, e.sy)) { - if (!object_1.isEmpty(active_inspectors)) { - cursor = "crosshair"; - } - } - this.plot_view.set_cursor(cursor); - this.plot_view.set_toolbar_visibility(on_canvas); - active_inspectors.map(function (inspector) { return _this.trigger(signal, e, inspector.id); }); - break; - } - case "tap": { - var target = srcEvent.target; - if (target != null && target != this.hit_area) - return; // don't trigger bokeh events - if (view != null && view.on_hit != null) - view.on_hit(e.sx, e.sy); - var active_gesture = gestures[base_type].active; - if (active_gesture != null) - this.trigger(signal, e, active_gesture.id); - break; - } - case "scroll": { - // Dual touch hack part 2/2 - // This is a hack for laptops with touch screen who may be pinching or scrolling - // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event - // will be linked to pinch. But we also want to trigger in the case of a scroll. - var base = compat_1.is_mobile ? "pinch" : "scroll"; - var active_gesture = gestures[base].active; - if (active_gesture != null) { - srcEvent.preventDefault(); - srcEvent.stopPropagation(); - this.trigger(signal, e, active_gesture.id); - } - break; - } - default: { - var active_gesture = gestures[base_type].active; - if (active_gesture != null) - this.trigger(signal, e, active_gesture.id); - } - } - this._trigger_bokeh_event(e); - }; - UIEvents.prototype.trigger = function (signal, e, id) { - if (id === void 0) { - id = null; - } - signal.emit({ id: id, e: e }); - }; - UIEvents.prototype._trigger_bokeh_event = function (e) { - var _this = this; - var ev = (function () { - var xscale = _this.plot_view.frame.xscales.default; - var yscale = _this.plot_view.frame.yscales.default; - var sx = e.sx, sy = e.sy; - var x = xscale.invert(sx); - var y = yscale.invert(sy); - switch (e.type) { - case "wheel": - return new events.MouseWheel(sx, sy, x, y, e.delta); - case "mousemove": - return new events.MouseMove(sx, sy, x, y); - case "mouseenter": - return new events.MouseEnter(sx, sy, x, y); - case "mouseleave": - return new events.MouseLeave(sx, sy, x, y); - case "tap": - return new events.Tap(sx, sy, x, y); - case "doubletap": - return new events.DoubleTap(sx, sy, x, y); - case "press": - return new events.Press(sx, sy, x, y); - case "pan": - return new events.Pan(sx, sy, x, y, e.deltaX, e.deltaY); - case "panstart": - return new events.PanStart(sx, sy, x, y); - case "panend": - return new events.PanEnd(sx, sy, x, y); - case "pinch": - return new events.Pinch(sx, sy, x, y, e.scale); - case "pinchstart": - return new events.PinchStart(sx, sy, x, y); - case "pinchend": - return new events.PinchEnd(sx, sy, x, y); - default: - throw new Error("unreachable"); - } - })(); - this.plot_view.model.trigger_event(ev); - }; - UIEvents.prototype._get_sxy = function (event) { - // XXX: jsdom doesn't support TouchEvent constructor - function is_touch(event) { - return typeof TouchEvent !== "undefined" && event instanceof TouchEvent; - } - var _a = is_touch(event) ? (event.touches.length != 0 ? event.touches : event.changedTouches)[0] : event, pageX = _a.pageX, pageY = _a.pageY; - var _b = dom_1.offset(this.hit_area), left = _b.left, top = _b.top; - return { - sx: pageX - left, - sy: pageY - top, - }; - }; - UIEvents.prototype._gesture_event = function (e) { - return tslib_1.__assign({ type: e.type }, this._get_sxy(e.srcEvent), { deltaX: e.deltaX, deltaY: e.deltaY, scale: e.scale, shiftKey: e.srcEvent.shiftKey }); - }; - UIEvents.prototype._tap_event = function (e) { - return tslib_1.__assign({ type: e.type }, this._get_sxy(e.srcEvent), { shiftKey: e.srcEvent.shiftKey }); - }; - UIEvents.prototype._move_event = function (e) { - return tslib_1.__assign({ type: e.type }, this._get_sxy(e)); - }; - UIEvents.prototype._scroll_event = function (e) { - return tslib_1.__assign({ type: e.type }, this._get_sxy(e), { delta: wheel_1.getDeltaY(e) }); - }; - UIEvents.prototype._key_event = function (e) { - return { - type: e.type, - keyCode: e.keyCode, - }; - }; - UIEvents.prototype._pan_start = function (e) { - var ev = this._gesture_event(e); - // back out delta to get original center point - ev.sx -= e.deltaX; - ev.sy -= e.deltaY; - this._trigger(this.pan_start, ev, e.srcEvent); - }; - UIEvents.prototype._pan = function (e) { - this._trigger(this.pan, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._pan_end = function (e) { - this._trigger(this.pan_end, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._pinch_start = function (e) { - this._trigger(this.pinch_start, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._pinch = function (e) { - this._trigger(this.pinch, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._pinch_end = function (e) { - this._trigger(this.pinch_end, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._rotate_start = function (e) { - this._trigger(this.rotate_start, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._rotate = function (e) { - this._trigger(this.rotate, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._rotate_end = function (e) { - this._trigger(this.rotate_end, this._gesture_event(e), e.srcEvent); - }; - UIEvents.prototype._tap = function (e) { - this._trigger(this.tap, this._tap_event(e), e.srcEvent); - }; - UIEvents.prototype._doubletap = function (e) { - // NOTE: doubletap event triggered unconditionally - var ev = this._tap_event(e); - this._trigger_bokeh_event(ev); - this.trigger(this.doubletap, ev); - }; - UIEvents.prototype._press = function (e) { - this._trigger(this.press, this._tap_event(e), e.srcEvent); - }; - UIEvents.prototype._mouse_enter = function (e) { - this._trigger(this.move_enter, this._move_event(e), e); - }; - UIEvents.prototype._mouse_move = function (e) { - this._trigger(this.move, this._move_event(e), e); - }; - UIEvents.prototype._mouse_exit = function (e) { - this._trigger(this.move_exit, this._move_event(e), e); - }; - UIEvents.prototype._mouse_wheel = function (e) { - this._trigger(this.scroll, this._scroll_event(e), e); - }; - UIEvents.prototype._key_down = function (e) { - // NOTE: keyup event triggered unconditionally - this.trigger(this.keydown, this._key_event(e)); - }; - UIEvents.prototype._key_up = function (e) { - // NOTE: keyup event triggered unconditionally - this.trigger(this.keyup, this._key_event(e)); - }; - return UIEvents; - }()); - exports.UIEvents = UIEvents; -} -, -/* core/util/array */ function _(require, module, exports) { - var math_1 = require(34) /* ./math */; - var assert_1 = require(26) /* ./assert */; - var arrayable_1 = require(25) /* ./arrayable */; - exports.min = arrayable_1.min; - exports.min_by = arrayable_1.min_by; - exports.max = arrayable_1.max; - exports.max_by = arrayable_1.max_by; - exports.sum = arrayable_1.sum; - exports.every = arrayable_1.every; - exports.some = arrayable_1.some; - exports.find = arrayable_1.find; - exports.find_last = arrayable_1.find_last; - exports.find_index = arrayable_1.find_index; - exports.find_last_index = arrayable_1.find_last_index; - exports.sorted_index = arrayable_1.sorted_index; - var slice = Array.prototype.slice; - function head(array) { - return array[0]; - } - exports.head = head; - function tail(array) { - return array[array.length - 1]; - } - exports.tail = tail; - function last(array) { - return array[array.length - 1]; - } - exports.last = last; - function copy(array) { - return slice.call(array); - } - exports.copy = copy; - function concat(arrays) { - var _a; - return (_a = []).concat.apply(_a, arrays); - } - exports.concat = concat; - function includes(array, value) { - return array.indexOf(value) !== -1; - } - exports.includes = includes; - exports.contains = includes; - function nth(array, index) { - return array[index >= 0 ? index : array.length + index]; - } - exports.nth = nth; - function zip() { - var arrays = []; - for (var _i = 0; _i < arguments.length; _i++) { - arrays[_i] = arguments[_i]; - } - if (arrays.length == 0) - return []; - var n = arrayable_1.min(arrays.map(function (a) { return a.length; })); - var k = arrays.length; - var result = new Array(n); - for (var i = 0; i < n; i++) { - result[i] = new Array(k); - for (var j = 0; j < k; j++) - result[i][j] = arrays[j][i]; - } - return result; - } - exports.zip = zip; - function unzip(array) { - var n = array.length; - var k = arrayable_1.min(array.map(function (a) { return a.length; })); - var results = Array(k); - for (var j = 0; j < k; j++) - results[j] = new Array(n); - for (var i = 0; i < n; i++) { - for (var j = 0; j < k; j++) - results[j][i] = array[i][j]; - } - return results; - } - exports.unzip = unzip; - function range(start, stop, step) { - if (step === void 0) { - step = 1; - } - assert_1.assert(step > 0, "'step' must be a positive number"); - if (stop == null) { - stop = start; - start = 0; - } - var max = Math.max, ceil = Math.ceil, abs = Math.abs; - var delta = start <= stop ? step : -step; - var length = max(ceil(abs(stop - start) / step), 0); - var range = Array(length); - for (var i = 0; i < length; i++, start += delta) { - range[i] = start; - } - return range; - } - exports.range = range; - function linspace(start, stop, num) { - if (num === void 0) { - num = 100; - } - var step = (stop - start) / (num - 1); - var array = new Array(num); - for (var i = 0; i < num; i++) { - array[i] = start + step * i; - } - return array; - } - exports.linspace = linspace; - function transpose(array) { - var rows = array.length; - var cols = array[0].length; - var transposed = []; - for (var j = 0; j < cols; j++) { - transposed[j] = []; - for (var i = 0; i < rows; i++) { - transposed[j][i] = array[i][j]; - } - } - return transposed; - } - exports.transpose = transpose; - function cumsum(array) { - var result = []; - array.reduce(function (a, b, i) { return result[i] = a + b; }, 0); - return result; - } - exports.cumsum = cumsum; - function argmin(array) { - return arrayable_1.min_by(range(array.length), function (i) { return array[i]; }); - } - exports.argmin = argmin; - function argmax(array) { - return arrayable_1.max_by(range(array.length), function (i) { return array[i]; }); - } - exports.argmax = argmax; - function sort_by(array, key) { - var tmp = array.map(function (value, index) { - return { value: value, index: index, key: key(value) }; - }); - tmp.sort(function (left, right) { - var a = left.key; - var b = right.key; - if (a !== b) { - if (a > b || a === undefined) - return 1; - if (a < b || b === undefined) - return -1; - } - return left.index - right.index; - }); - return tmp.map(function (item) { return item.value; }); - } - exports.sort_by = sort_by; - function uniq(array) { - var result = []; - for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { - var value = array_1[_i]; - if (!includes(result, value)) { - result.push(value); - } - } - return result; - } - exports.uniq = uniq; - function uniq_by(array, key) { - var result = []; - var seen = []; - for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { - var value = array_2[_i]; - var computed = key(value); - if (!includes(seen, computed)) { - seen.push(computed); - result.push(value); - } - } - return result; - } - exports.uniq_by = uniq_by; - function union() { - var arrays = []; - for (var _i = 0; _i < arguments.length; _i++) { - arrays[_i] = arguments[_i]; - } - return uniq(concat(arrays)); - } - exports.union = union; - function intersection(array) { - var arrays = []; - for (var _i = 1; _i < arguments.length; _i++) { - arrays[_i - 1] = arguments[_i]; - } - var result = []; - top: for (var _a = 0, array_3 = array; _a < array_3.length; _a++) { - var item = array_3[_a]; - if (includes(result, item)) - continue; - for (var _b = 0, arrays_1 = arrays; _b < arrays_1.length; _b++) { - var other = arrays_1[_b]; - if (!includes(other, item)) - continue top; - } - result.push(item); - } - return result; - } - exports.intersection = intersection; - function difference(array) { - var arrays = []; - for (var _i = 1; _i < arguments.length; _i++) { - arrays[_i - 1] = arguments[_i]; - } - var rest = concat(arrays); - return array.filter(function (value) { return !includes(rest, value); }); - } - exports.difference = difference; - function remove_at(array, i) { - var result = copy(array); - result.splice(i, 1); - return result; - } - exports.remove_at = remove_at; - function remove_by(array, key) { - for (var i = 0; i < array.length;) { - if (key(array[i])) - array.splice(i, 1); - else - i++; - } - } - exports.remove_by = remove_by; - // Shuffle a collection, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). - function shuffle(array) { - var length = array.length; - var shuffled = new Array(length); - for (var i = 0; i < length; i++) { - var rand = math_1.randomIn(0, i); - if (rand !== i) - shuffled[i] = shuffled[rand]; - shuffled[rand] = array[i]; - } - return shuffled; - } - exports.shuffle = shuffle; - function pairwise(array, fn) { - var n = array.length; - var result = new Array(n - 1); - for (var i = 0; i < n - 1; i++) { - result[i] = fn(array[i], array[i + 1]); - } - return result; - } - exports.pairwise = pairwise; - function reversed(array) { - var n = array.length; - var result = new Array(n); - for (var i = 0; i < n; i++) { - result[n - i - 1] = array[i]; - } - return result; - } - exports.reversed = reversed; - function repeat(value, n) { - var result = new Array(n); - for (var i = 0; i < n; i++) { - result[i] = value; - } - return result; - } - exports.repeat = repeat; -} -, -/* core/util/arrayable */ function _(require, module, exports) { - function splice(array, start, k) { - var items = []; - for (var _i = 3; _i < arguments.length; _i++) { - items[_i - 3] = arguments[_i]; - } - var len = array.length; - if (start < 0) - start += len; - if (start < 0) - start = 0; - else if (start > len) - start = len; - if (k == null || k > len - start) - k = len - start; - else if (k < 0) - k = 0; - var n = len - k + items.length; - var result = new array.constructor(n); - var i = 0; - for (; i < start; i++) { - result[i] = array[i]; - } - for (var _a = 0, items_1 = items; _a < items_1.length; _a++) { - var item = items_1[_a]; - result[i++] = item; - } - for (var j = start + k; j < len; j++) { - result[i++] = array[j]; - } - return result; - } - exports.splice = splice; - function insert(array, item, i) { - return splice(array, i, 0, item); - } - exports.insert = insert; - function append(array, item) { - return splice(array, array.length, 0, item); - } - exports.append = append; - function prepend(array, item) { - return splice(array, 0, 0, item); - } - exports.prepend = prepend; - function indexOf(array, item) { - for (var i = 0, n = array.length; i < n; i++) { - if (array[i] === item) - return i; - } - return -1; - } - exports.indexOf = indexOf; - function map(array, fn) { - var n = array.length; - var result = new array.constructor(n); - for (var i = 0; i < n; i++) { - result[i] = fn(array[i], i, array); - } - return result; - } - exports.map = map; - function min(array) { - var value; - var result = Infinity; - for (var i = 0, length_1 = array.length; i < length_1; i++) { - value = array[i]; - if (value < result) { - result = value; - } - } - return result; - } - exports.min = min; - function min_by(array, key) { - if (array.length == 0) - throw new Error("min_by() called with an empty array"); - var result = array[0]; - var resultComputed = key(result); - for (var i = 1, length_2 = array.length; i < length_2; i++) { - var value = array[i]; - var computed = key(value); - if (computed < resultComputed) { - result = value; - resultComputed = computed; - } - } - return result; - } - exports.min_by = min_by; - function max(array) { - var value; - var result = -Infinity; - for (var i = 0, length_3 = array.length; i < length_3; i++) { - value = array[i]; - if (value > result) { - result = value; - } - } - return result; - } - exports.max = max; - function max_by(array, key) { - if (array.length == 0) - throw new Error("max_by() called with an empty array"); - var result = array[0]; - var resultComputed = key(result); - for (var i = 1, length_4 = array.length; i < length_4; i++) { - var value = array[i]; - var computed = key(value); - if (computed > resultComputed) { - result = value; - resultComputed = computed; - } - } - return result; - } - exports.max_by = max_by; - function sum(array) { - var result = 0; - for (var i = 0, n = array.length; i < n; i++) { - result += array[i]; - } - return result; - } - exports.sum = sum; - function every(array, predicate) { - for (var i = 0, length_5 = array.length; i < length_5; i++) { - if (!predicate(array[i])) - return false; - } - return true; - } - exports.every = every; - function some(array, predicate) { - for (var i = 0, length_6 = array.length; i < length_6; i++) { - if (predicate(array[i])) - return true; - } - return false; - } - exports.some = some; - function index_of(array, value) { - for (var i = 0, length_7 = array.length; i < length_7; i++) { - if (array[i] === value) - return i; - } - return -1; - } - exports.index_of = index_of; - function _find_index(dir) { - return function (array, predicate) { - var length = array.length; - var index = dir > 0 ? 0 : length - 1; - for (; index >= 0 && index < length; index += dir) { - if (predicate(array[index])) - return index; - } - return -1; - }; - } - exports.find_index = _find_index(1); - exports.find_last_index = _find_index(-1); - function find(array, predicate) { - var index = exports.find_index(array, predicate); - return index == -1 ? undefined : array[index]; - } - exports.find = find; - function find_last(array, predicate) { - var index = exports.find_last_index(array, predicate); - return index == -1 ? undefined : array[index]; - } - exports.find_last = find_last; - function sorted_index(array, value) { - var low = 0; - var high = array.length; - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (array[mid] < value) - low = mid + 1; - else - high = mid; - } - return low; - } - exports.sorted_index = sorted_index; -} -, -/* core/util/assert */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var AssertionError = /** @class */ (function (_super) { - tslib_1.__extends(AssertionError, _super); - function AssertionError() { - return _super !== null && _super.apply(this, arguments) || this; - } - return AssertionError; - }(Error)); - exports.AssertionError = AssertionError; - function assert(condition, message) { - if (condition === true || (condition !== false && condition())) - return; - throw new AssertionError(message || "Assertion failed"); - } - exports.assert = assert; -} -, -/* core/util/bbox */ function _(require, module, exports) { - var min = Math.min, max = Math.max; - function empty() { - return { - minX: Infinity, - minY: Infinity, - maxX: -Infinity, - maxY: -Infinity, - }; - } - exports.empty = empty; - function positive_x() { - return { - minX: Number.MIN_VALUE, - minY: -Infinity, - maxX: Infinity, - maxY: Infinity, - }; - } - exports.positive_x = positive_x; - function positive_y() { - return { - minX: -Infinity, - minY: Number.MIN_VALUE, - maxX: Infinity, - maxY: Infinity, - }; - } - exports.positive_y = positive_y; - function union(a, b) { - return { - minX: min(a.minX, b.minX), - maxX: max(a.maxX, b.maxX), - minY: min(a.minY, b.minY), - maxY: max(a.maxY, b.maxY), - }; - } - exports.union = union; - var BBox = /** @class */ (function () { - function BBox(box) { - if (box == null) { - this.x0 = 0; - this.y0 = 0; - this.x1 = 0; - this.y1 = 0; - } - else if ('x0' in box) { - var _a = box, x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1; - if (!(x0 <= x1 && y0 <= y1)) - throw new Error("invalid bbox {x0: " + x0 + ", y0: " + y0 + ", x1: " + x1 + ", y1: " + y1 + "}"); - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - else if ("x" in box) { - var _b = box, left = _b.left, top_1 = _b.top, width = _b.width, height = _b.height; - if (!(width >= 0 && height >= 0)) - throw new Error("invalid bbox {left: " + left + ", top: " + top_1 + ", width: " + width + ", height: " + height + "}"); - this.x0 = left; - this.y0 = top_1; - this.x1 = left + width; - this.y1 = top_1 + height; - } - else { - var left = void 0, right = void 0; - var top_2, bottom = void 0; - if ("width" in box) { - if ("left" in box) { - left = box.left; - right = left + box.width; - } - else if ("right" in box) { - right = box.right; - left = right - box.width; - } - else { - var w2 = box.width / 2; - left = box.hcenter - w2; - right = box.hcenter + w2; - } - } - else { - left = box.left; - right = box.right; - } - if ("height" in box) { - if ("top" in box) { - top_2 = box.top; - bottom = top_2 + box.height; - } - else if ("bottom" in box) { - bottom = box.bottom; - top_2 = bottom - box.height; - } - else { - var h2 = box.height / 2; - top_2 = box.vcenter - h2; - bottom = box.vcenter + h2; - } - } - else { - top_2 = box.top; - bottom = box.bottom; - } - if (!(left <= right && top_2 <= bottom)) - throw new Error("invalid bbox {left: " + left + ", top: " + top_2 + ", right: " + right + ", bottom: " + bottom + "}"); - this.x0 = left; - this.y0 = top_2; - this.x1 = right; - this.y1 = bottom; - } - } - BBox.prototype.toString = function () { - return "BBox({left: " + this.left + ", top: " + this.top + ", width: " + this.width + ", height: " + this.height + "})"; - }; - Object.defineProperty(BBox.prototype, "minX", { - get: function () { return this.x0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "minY", { - get: function () { return this.y0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "maxX", { - get: function () { return this.x1; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "maxY", { - get: function () { return this.y1; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "left", { - get: function () { return this.x0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "top", { - get: function () { return this.y0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "right", { - get: function () { return this.x1; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "bottom", { - get: function () { return this.y1; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "p0", { - get: function () { return [this.x0, this.y0]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "p1", { - get: function () { return [this.x1, this.y1]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "x", { - get: function () { return this.x0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "y", { - get: function () { return this.y0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "width", { - get: function () { return this.x1 - this.x0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "height", { - get: function () { return this.y1 - this.y0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "rect", { - get: function () { return { left: this.left, top: this.top, width: this.width, height: this.height }; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "h_range", { - get: function () { return { start: this.x0, end: this.x1 }; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "v_range", { - get: function () { return { start: this.y0, end: this.y1 }; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "ranges", { - get: function () { return [this.h_range, this.v_range]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "aspect", { - get: function () { return this.width / this.height; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "hcenter", { - get: function () { return (this.left + this.right) / 2; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "vcenter", { - get: function () { return (this.top + this.bottom) / 2; }, - enumerable: true, - configurable: true - }); - BBox.prototype.contains = function (x, y) { - return x >= this.x0 && x <= this.x1 && y >= this.y0 && y <= this.y1; - }; - BBox.prototype.clip = function (x, y) { - if (x < this.x0) - x = this.x0; - else if (x > this.x1) - x = this.x1; - if (y < this.y0) - y = this.y0; - else if (y > this.y1) - y = this.y1; - return [x, y]; - }; - BBox.prototype.union = function (that) { - return new BBox({ - x0: min(this.x0, that.x0), - y0: min(this.y0, that.y0), - x1: max(this.x1, that.x1), - y1: max(this.y1, that.y1), - }); - }; - BBox.prototype.equals = function (that) { - return this.x0 == that.x0 && this.y0 == that.y0 && this.x1 == that.x1 && this.y1 == that.y1; - }; - Object.defineProperty(BBox.prototype, "xview", { - get: function () { - var _this = this; - return { - compute: function (x) { - return _this.left + x; - }, - v_compute: function (xx) { - var _xx = new Float64Array(xx.length); - var left = _this.left; - for (var i = 0; i < xx.length; i++) { - _xx[i] = left + xx[i]; - } - return _xx; - }, - }; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BBox.prototype, "yview", { - get: function () { - var _this = this; - return { - compute: function (y) { - return _this.bottom - y; - }, - v_compute: function (yy) { - var _yy = new Float64Array(yy.length); - var bottom = _this.bottom; - for (var i = 0; i < yy.length; i++) { - _yy[i] = bottom - yy[i]; - } - return _yy; - }, - }; - }, - enumerable: true, - configurable: true - }); - return BBox; - }()); - exports.BBox = BBox; -} -, -/* core/util/callback */ function _(require, module, exports) { - function delay(func, wait) { - return setTimeout(func, wait); - } - exports.delay = delay; - var _defer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setImmediate; - function defer(func) { - return _defer(func); - } - exports.defer = defer; - function throttle(func, wait, options) { - if (options === void 0) { - options = {}; - } - var context, args, result; - var timeout = null; - var previous = 0; - var later = function () { - previous = options.leading === false ? 0 : Date.now(); - timeout = null; - result = func.apply(context, args); - if (!timeout) - context = args = null; - }; - return function () { - var now = Date.now(); - if (!previous && options.leading === false) - previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - previous = now; - result = func.apply(context, args); - if (!timeout) - context = args = null; - } - else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - } - exports.throttle = throttle; - function once(func) { - var done = false; - var memo; - return function () { - if (!done) { - done = true; - memo = func(); - } - return memo; - }; - } - exports.once = once; -} -, -/* core/util/canvas */ function _(require, module, exports) { - function fixup_line_dash(ctx) { - if (!ctx.setLineDash) { - ctx.setLineDash = function (dash) { - ctx.mozDash = dash; - ctx.webkitLineDash = dash; - }; - } - if (!ctx.getLineDash) { - ctx.getLineDash = function () { - return ctx.mozDash; - }; - } - } - function fixup_line_dash_offset(ctx) { - ctx.setLineDashOffset = function (offset) { - ctx.lineDashOffset = offset; - ctx.mozDashOffset = offset; - ctx.webkitLineDashOffset = offset; - }; - ctx.getLineDashOffset = function () { - return ctx.mozDashOffset; - }; - } - function fixup_image_smoothing(ctx) { - ctx.setImageSmoothingEnabled = function (value) { - ctx.imageSmoothingEnabled = value; - ctx.mozImageSmoothingEnabled = value; - ctx.oImageSmoothingEnabled = value; - ctx.webkitImageSmoothingEnabled = value; - ctx.msImageSmoothingEnabled = value; - }; - ctx.getImageSmoothingEnabled = function () { - var val = ctx.imageSmoothingEnabled; - return val != null ? val : true; - }; - } - function fixup_measure_text(ctx) { - if (ctx.measureText && ctx.html5MeasureText == null) { - ctx.html5MeasureText = ctx.measureText; - ctx.measureText = function (text) { - var textMetrics = ctx.html5MeasureText(text); - // fake it til you make it - textMetrics.ascent = ctx.html5MeasureText("m").width * 1.6; - return textMetrics; - }; - } - } - function fixup_ellipse(ctx) { - // implementing the ctx.ellipse function with bezier curves - // we don't implement the startAngle, endAngle and anticlockwise arguments. - function ellipse_bezier(x, y, radiusX, radiusY, rotation, _startAngle, _endAngle, anticlockwise) { - if (anticlockwise === void 0) { - anticlockwise = false; - } - var c = 0.551784; // see http://www.tinaja.com/glib/ellipse4.pdf - ctx.translate(x, y); - ctx.rotate(rotation); - var rx = radiusX; - var ry = radiusY; - if (anticlockwise) { - rx = -radiusX; - ry = -radiusY; - } - ctx.moveTo(-rx, 0); // start point of first curve - ctx.bezierCurveTo(-rx, ry * c, -rx * c, ry, 0, ry); - ctx.bezierCurveTo(rx * c, ry, rx, ry * c, rx, 0); - ctx.bezierCurveTo(rx, -ry * c, rx * c, -ry, 0, -ry); - ctx.bezierCurveTo(-rx * c, -ry, -rx, -ry * c, -rx, 0); - ctx.rotate(-rotation); - ctx.translate(-x, -y); - } - if (!ctx.ellipse) - ctx.ellipse = ellipse_bezier; - } - function fixup_ctx(ctx) { - fixup_line_dash(ctx); - fixup_line_dash_offset(ctx); - fixup_image_smoothing(ctx); - fixup_measure_text(ctx); - fixup_ellipse(ctx); - } - exports.fixup_ctx = fixup_ctx; - function get_scale_ratio(ctx, hidpi, backend) { - if (backend == "svg") - return 1; - else if (hidpi) { - var devicePixelRatio_1 = window.devicePixelRatio || 1; - var backingStoreRatio = ctx.webkitBackingStorePixelRatio || - ctx.mozBackingStorePixelRatio || - ctx.msBackingStorePixelRatio || - ctx.oBackingStorePixelRatio || - ctx.backingStorePixelRatio || 1; - return devicePixelRatio_1 / backingStoreRatio; - } - else - return 1; - } - exports.get_scale_ratio = get_scale_ratio; -} -, -/* core/util/color */ function _(require, module, exports) { - var svg_colors_1 = require(41) /* ./svg_colors */; - var array_1 = require(24) /* ./array */; - function is_color(value) { - return svg_colors_1.is_svg_color(value.toLowerCase()) || value.substring(0, 1) == "#" || valid_rgb(value); - } - exports.is_color = is_color; - function _component2hex(v) { - var h = Number(v).toString(16); - return h.length == 1 ? "0" + h : h; - } - function rgb2hex(r, g, b) { - var R = _component2hex(r & 0xFF); - var G = _component2hex(g & 0xFF); - var B = _component2hex(b & 0xFF); - return "#" + R + G + B; - } - exports.rgb2hex = rgb2hex; - function color2hex(color) { - color = color + ''; - if (color.indexOf('#') == 0) - return color; - else if (svg_colors_1.is_svg_color(color)) - return svg_colors_1.svg_colors[color]; - else if (color.indexOf('rgb') == 0) { - var rgb = color.replace(/^rgba?\(|\s+|\)$/g, '').split(','); - var hex = rgb.slice(0, 3).map(_component2hex).join(''); - if (rgb.length == 4) - hex += _component2hex(Math.floor(parseFloat(rgb[3]) * 255)); - return "#" + hex.slice(0, 8); // can also be rgba - } - else - return color; - } - exports.color2hex = color2hex; - function color2rgba(color, alpha) { - if (alpha === void 0) { - alpha = 1.0; - } - if (!color) // NaN, null, '', etc. - return [0, 0, 0, 0]; // transparent - // Convert to hex and then to clean version of 6 or 8 chars - var hex = color2hex(color); - hex = hex.replace(/ |#/g, ''); - if (hex.length <= 4) { - hex = hex.replace(/(.)/g, '$1$1'); - } - // Convert pairs to numbers - var rgba = hex.match(/../g).map(function (i) { return parseInt(i, 16) / 255; }); - // Ensure correct length, add alpha if necessary - while (rgba.length < 3) - rgba.push(0); - if (rgba.length < 4) - rgba.push(alpha); - return rgba.slice(0, 4); - } - exports.color2rgba = color2rgba; - function valid_rgb(value) { - var params; - switch (value.substring(0, 4)) { - case "rgba": { - params = { start: "rgba(", len: 4, alpha: true }; - break; - } - case "rgb(": { - params = { start: "rgb(", len: 3, alpha: false }; - break; - } - default: - return false; - } - // if '.' and then ',' found, we know decimals are used on rgb - if (new RegExp(".*?(\\.).*(,)").test(value)) - throw new Error("color expects integers for rgb in rgb/rgba tuple, received " + value); - // extract the numerical values from inside parens - var contents = value.replace(params.start, "").replace(")", "").split(',').map(parseFloat); - // check length of array based on rgb/rgba - if (contents.length != params.len) - throw new Error("color expects rgba " + params.len + "-tuple, received " + value); - // check for valid numerical values for rgba - if (params.alpha && !(0 <= contents[3] && contents[3] <= 1)) - throw new Error("color expects rgba 4-tuple to have alpha value between 0 and 1"); - if (array_1.includes(contents.slice(0, 3).map(function (rgb) { return 0 <= rgb && rgb <= 255; }), false)) - throw new Error("color expects rgb to have value between 0 and 255"); - return true; - } - exports.valid_rgb = valid_rgb; -} -, -/* core/util/compat */ function _(require, module, exports) { - exports.is_ie = (function () { - var ua = typeof navigator !== "undefined" ? navigator.userAgent : ""; - return ua.indexOf('MSIE') >= 0 || ua.indexOf('Trident') > 0 || ua.indexOf('Edge') > 0; - })(); - exports.is_mobile = (function () { - return typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0); - })(); - exports.is_little_endian = (function () { - var buf = new ArrayBuffer(4); - var buf8 = new Uint8Array(buf); - var buf32 = new Uint32Array(buf); - buf32[1] = 0x0a0b0c0d; - var little_endian = true; - if (buf8[4] == 0x0a && buf8[5] == 0x0b && buf8[6] == 0x0c && buf8[7] == 0x0d) { - little_endian = false; - } - return little_endian; - })(); -} -, -/* core/util/data_structures */ function _(require, module, exports) { - var array_1 = require(24) /* ./array */; - var eq_1 = require(33) /* ./eq */; - var types_1 = require(46) /* ./types */; - var MultiDict = /** @class */ (function () { - function MultiDict() { - this._dict = {}; - } - MultiDict.prototype._existing = function (key) { - if (key in this._dict) - return this._dict[key]; - else - return null; - }; - MultiDict.prototype.add_value = function (key, value) { - /* - if value == null - throw new Error("Can't put null in this dict") - if isArray(value) - throw new Error("Can't put arrays in this dict") - */ - var existing = this._existing(key); - if (existing == null) { - this._dict[key] = value; - } - else if (types_1.isArray(existing)) { - existing.push(value); - } - else { - this._dict[key] = [existing, value]; - } - }; - MultiDict.prototype.remove_value = function (key, value) { - var existing = this._existing(key); - if (types_1.isArray(existing)) { - var new_array = array_1.difference(existing, [value]); - if (new_array.length > 0) - this._dict[key] = new_array; - else - delete this._dict[key]; - } - else if (eq_1.isEqual(existing, value)) { - delete this._dict[key]; - } - }; - MultiDict.prototype.get_one = function (key, duplicate_error) { - var existing = this._existing(key); - if (types_1.isArray(existing)) { - if (existing.length === 1) - return existing[0]; - else - throw new Error(duplicate_error); - } - else - return existing; - }; - return MultiDict; - }()); - exports.MultiDict = MultiDict; - var Set = /** @class */ (function () { - function Set(obj) { - if (obj == null) - this._values = []; - else if (obj instanceof Set) - this._values = array_1.copy(obj._values); - else { - this._values = []; - for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) { - var item = obj_1[_i]; - this.add(item); - } - } - } - Object.defineProperty(Set.prototype, "values", { - get: function () { - return array_1.copy(this._values).sort(); - }, - enumerable: true, - configurable: true - }); - Set.prototype.toString = function () { - return "Set([" + this.values.join(",") + "])"; - }; - Object.defineProperty(Set.prototype, "size", { - get: function () { - return this._values.length; - }, - enumerable: true, - configurable: true - }); - Set.prototype.has = function (item) { - return this._values.indexOf(item) !== -1; - }; - Set.prototype.add = function (item) { - if (!this.has(item)) - this._values.push(item); - }; - Set.prototype.remove = function (item) { - var i = this._values.indexOf(item); - if (i !== -1) - this._values.splice(i, 1); - }; - Set.prototype.toggle = function (item) { - var i = this._values.indexOf(item); - if (i === -1) - this._values.push(item); - else - this._values.splice(i, 1); - }; - Set.prototype.clear = function () { - this._values = []; - }; - Set.prototype.union = function (input) { - input = new Set(input); - return new Set(this._values.concat(input._values)); - }; - Set.prototype.intersect = function (input) { - input = new Set(input); - var output = new Set(); - for (var _i = 0, _a = input._values; _i < _a.length; _i++) { - var item = _a[_i]; - if (this.has(item) && input.has(item)) - output.add(item); - } - return output; - }; - Set.prototype.diff = function (input) { - input = new Set(input); - var output = new Set(); - for (var _i = 0, _a = this._values; _i < _a.length; _i++) { - var item = _a[_i]; - if (!input.has(item)) - output.add(item); - } - return output; - }; - Set.prototype.forEach = function (fn, thisArg) { - for (var _i = 0, _a = this._values; _i < _a.length; _i++) { - var value = _a[_i]; - fn.call(thisArg || this, value, value, this); - } - }; - return Set; - }()); - exports.Set = Set; - var Matrix = /** @class */ (function () { - function Matrix(nrows, ncols, init) { - this.nrows = nrows; - this.ncols = ncols; - this._matrix = new Array(nrows); - for (var y = 0; y < nrows; y++) { - this._matrix[y] = new Array(ncols); - for (var x = 0; x < ncols; x++) { - this._matrix[y][x] = init(y, x); - } - } - } - Matrix.prototype.at = function (row, col) { - return this._matrix[row][col]; - }; - Matrix.prototype.map = function (fn) { - var _this = this; - return new Matrix(this.nrows, this.ncols, function (row, col) { return fn(_this.at(row, col), row, col); }); - }; - Matrix.prototype.apply = function (obj) { - var _this = this; - var fn = Matrix.from(obj); - var _a = this, nrows = _a.nrows, ncols = _a.ncols; - if (nrows == fn.nrows && ncols == fn.ncols) - return new Matrix(nrows, ncols, function (row, col) { return fn.at(row, col)(_this.at(row, col), row, col); }); - else - throw new Error("dimensions don't match"); - }; - Matrix.prototype.to_sparse = function () { - var items = []; - for (var y = 0; y < this.nrows; y++) { - for (var x = 0; x < this.ncols; x++) { - var value = this._matrix[y][x]; - items.push([value, y, x]); - } - } - return items; - }; - Matrix.from = function (obj) { - if (obj instanceof Matrix) - return obj; - else { - var nrows = obj.length; - var ncols = array_1.min(obj.map(function (row) { return row.length; })); - return new Matrix(nrows, ncols, function (row, col) { return obj[row][col]; }); - } - }; - return Matrix; - }()); - exports.Matrix = Matrix; -} -, -/* core/util/eq */ function _(require, module, exports) { - var types_1 = require(46) /* ./types */; - var toString = Object.prototype.toString; - // Internal recursive comparison function for `isEqual`. - function eq(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) - return a !== 0 || 1 / a === 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) - return a === b; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className !== toString.call(b)) - return false; - switch (className) { - // Strings, numbers, regular expressions, dates, and booleans are compared by value. - case '[object RegExp]': - // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return '' + a === '' + b; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. - // Object(NaN) is equivalent to NaN - if (+a !== +a) - return +b !== +b; - // An `egal` comparison is performed for other numeric values. - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a === +b; - } - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (typeof a != 'object' || typeof b != 'object') - return false; - // Objects with different constructors are not equivalent, but `Object`s or `Array`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(types_1.isFunction(aCtor) && aCtor instanceof aCtor && - types_1.isFunction(bCtor) && bCtor instanceof bCtor) - && ('constructor' in a && 'constructor' in b)) { - return false; - } - } - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - // Initializing stack of traversed objects. - // It's done here since we only need them for objects and arrays comparison. - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] === a) - return bStack[length] === b; - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - // Recursively compare objects and arrays. - if (areArrays) { - // Compare array lengths to determine if a deep comparison is necessary. - length = a.length; - if (length !== b.length) - return false; - // Deep compare the contents, ignoring non-numeric properties. - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) - return false; - } - } - else { - // Deep compare objects. - var keys = Object.keys(a); - var key = void 0; - length = keys.length; - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (Object.keys(b).length !== length) - return false; - while (length--) { - // Deep compare each member - key = keys[length]; - if (!(b.hasOwnProperty(key) && eq(a[key], b[key], aStack, bStack))) - return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return true; - } - // Perform a deep comparison to check if two objects are equal. - function isEqual(a, b) { - return eq(a, b); - } - exports.isEqual = isEqual; -} -, -/* core/util/math */ function _(require, module, exports) { - function angle_norm(angle) { - while (angle < 0) { - angle += 2 * Math.PI; - } - while (angle > 2 * Math.PI) { - angle -= 2 * Math.PI; - } - return angle; - } - exports.angle_norm = angle_norm; - function angle_dist(lhs, rhs) { - return Math.abs(angle_norm(lhs - rhs)); - } - exports.angle_dist = angle_dist; - function angle_between(mid, lhs, rhs, direction) { - var d = angle_dist(lhs, rhs); - if (d == 0) - return false; - var norm_mid = angle_norm(mid); - var cond = angle_dist(lhs, norm_mid) <= d && angle_dist(norm_mid, rhs) <= d; - return (direction == 0 /* clock */) ? cond : !cond; - } - exports.angle_between = angle_between; - function random() { - return Math.random(); - } - exports.random = random; - function randomIn(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - } - exports.randomIn = randomIn; - function atan2(start, end) { - /* - * Calculate the angle between a line containing start and end points (composed - * of [x, y] arrays) and the positive x-axis. - */ - return Math.atan2(end[1] - start[1], end[0] - start[0]); - } - exports.atan2 = atan2; - // http://www2.econ.osaka-u.ac.jp/~tanizaki/class/2013/econome3/13.pdf (Page 432) - function rnorm(mu, sigma) { - // Generate a random normal with a mean of 0 and a sigma of 1 - var r1; - var r2; - while (true) { - r1 = random(); - r2 = random(); - r2 = (2 * r2 - 1) * Math.sqrt(2 * (1 / Math.E)); - if (-4 * r1 * r1 * Math.log(r1) >= r2 * r2) - break; - } - var rn = r2 / r1; - // Transform the standard normal to meet the characteristics that we want (mu, sigma) - rn = mu + sigma * rn; - return rn; - } - exports.rnorm = rnorm; - function clamp(val, min, max) { - if (val > max) - return max; - if (val < min) - return min; - return val; - } - exports.clamp = clamp; -} -, -/* core/util/object */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var array_1 = require(24) /* ./array */; - exports.keys = Object.keys; - function values(object) { - var keys = Object.keys(object); - var length = keys.length; - var values = new Array(length); - for (var i = 0; i < length; i++) { - values[i] = object[keys[i]]; - } - return values; - } - exports.values = values; - function extend(dest, src) { - return tslib_1.__assign(dest, src); - } - exports.extend = extend; - function clone(obj) { - return extend({}, obj); // XXX: can't use {...obj} due to https://github.com/Microsoft/TypeScript/issues/14409 - } - exports.clone = clone; - function merge(obj1, obj2) { - /* - * Returns an object with the array values for obj1 and obj2 unioned by key. - */ - var result = Object.create(Object.prototype); - var keys = array_1.concat([Object.keys(obj1), Object.keys(obj2)]); - for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var key = keys_1[_i]; - var arr1 = obj1.hasOwnProperty(key) ? obj1[key] : []; - var arr2 = obj2.hasOwnProperty(key) ? obj2[key] : []; - result[key] = array_1.union(arr1, arr2); - } - return result; - } - exports.merge = merge; - function size(obj) { - return Object.keys(obj).length; - } - exports.size = size; - function isEmpty(obj) { - return size(obj) === 0; - } - exports.isEmpty = isEmpty; -} -, -/* core/util/projections */ function _(require, module, exports) { - var proj4 = require(383) /* proj4/lib/core */; - var Projection = require(371) /* proj4/lib/Proj */; - var mercator = new Projection('GOOGLE'); - var wgs84 = new Projection('WGS84'); - exports.wgs84_mercator = proj4(wgs84, mercator); - var mercator_bounds = { - lon: [-20026376.39, 20026376.39], - lat: [-20048966.10, 20048966.10], - }; - var latlon_bounds = { - lon: [-180, 180], - lat: [-85.06, 85.06], - }; - function clip_mercator(low, high, dimension) { - var _a = mercator_bounds[dimension], min = _a[0], max = _a[1]; - return [Math.max(low, min), Math.min(high, max)]; - } - exports.clip_mercator = clip_mercator; - function in_bounds(value, dimension) { - return value > latlon_bounds[dimension][0] && value < latlon_bounds[dimension][1]; - } - exports.in_bounds = in_bounds; - function project_xy(x, y) { - var n = Math.min(x.length, y.length); - var merc_x_s = new Array(n); - var merc_y_s = new Array(n); - for (var i = 0; i < n; i++) { - var _a = exports.wgs84_mercator.forward([x[i], y[i]]), merc_x = _a[0], merc_y = _a[1]; - merc_x_s[i] = merc_x; - merc_y_s[i] = merc_y; - } - return [merc_x_s, merc_y_s]; - } - exports.project_xy = project_xy; - function project_xsys(xs, ys) { - var n = Math.min(xs.length, ys.length); - var merc_xs_s = new Array(n); - var merc_ys_s = new Array(n); - for (var i = 0; i < n; i++) { - var _a = project_xy(xs[i], ys[i]), merc_x_s = _a[0], merc_y_s = _a[1]; - merc_xs_s[i] = merc_x_s; - merc_ys_s[i] = merc_y_s; - } - return [merc_xs_s, merc_ys_s]; - } - exports.project_xsys = project_xsys; -} -, -/* core/util/refs */ function _(require, module, exports) { - var types_1 = require(46) /* ./types */; - // Create a Bokeh reference from a HasProps subclass - // - // @param obj [HasProps] the object to create a reference for - // @return [Object] a Bokeh reference for `obj` - // @throw Error if `obj` is not a HasProps - // - function create_ref(obj) { - var ref = { - type: obj.type, - id: obj.id, - }; - if (obj._subtype != null) { - ref.subtype = obj._subtype; - } - return ref; - } - exports.create_ref = create_ref; - // Determine whether an object has the proper format of a Bokeh reference - // - // @param arg [Object] the object to test - // @return [bool] whether the object is a refererence - // - // @note this function does not check that the id and types are valid, - // only that the format is correct (all required keys are present) - // - function is_ref(arg) { - if (types_1.isObject(arg)) { - var keys = Object.keys(arg).sort(); - if (keys.length == 2) - return keys[0] == 'id' && keys[1] == 'type'; - if (keys.length == 3) - return keys[0] == 'id' && keys[1] == 'subtype' && keys[2] == 'type'; - } - return false; - } - exports.is_ref = is_ref; -} -, -/* core/util/serialization */ function _(require, module, exports) { - var types_1 = require(46) /* ./types */; - var compat_1 = require(31) /* ./compat */; - exports.ARRAY_TYPES = { - uint8: Uint8Array, - int8: Int8Array, - uint16: Uint16Array, - int16: Int16Array, - uint32: Uint32Array, - int32: Int32Array, - float32: Float32Array, - float64: Float64Array, - }; - exports.DTYPES = { - Uint8Array: "uint8", - Int8Array: "int8", - Uint16Array: "uint16", - Int16Array: "int16", - Uint32Array: "uint32", - Int32Array: "int32", - Float32Array: "float32", - Float64Array: "float64", - }; - function arrayName(array) { - if ("name" in array.constructor) - return array.constructor.name; - else { - switch (true) { - case array instanceof Uint8Array: return "Uint8Array"; - case array instanceof Int8Array: return "Int8Array"; - case array instanceof Uint16Array: return "Uint16Array"; - case array instanceof Int16Array: return "Int16Array"; - case array instanceof Uint32Array: return "Uint32Array"; - case array instanceof Int32Array: return "Int32Array"; - case array instanceof Float32Array: return "Float32Array"; - case array instanceof Float64Array: return "Float64Array"; - default: - throw new Error("unsupported typed array"); - } - } - } - exports.BYTE_ORDER = compat_1.is_little_endian ? "little" : "big"; - function swap16(a) { - var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 2); - for (var i = 0, end = x.length; i < end; i += 2) { - var t = x[i]; - x[i] = x[i + 1]; - x[i + 1] = t; - } - } - exports.swap16 = swap16; - function swap32(a) { - var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 4); - for (var i = 0, end = x.length; i < end; i += 4) { - var t = x[i]; - x[i] = x[i + 3]; - x[i + 3] = t; - t = x[i + 1]; - x[i + 1] = x[i + 2]; - x[i + 2] = t; - } - } - exports.swap32 = swap32; - function swap64(a) { - var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 8); - for (var i = 0, end = x.length; i < end; i += 8) { - var t = x[i]; - x[i] = x[i + 7]; - x[i + 7] = t; - t = x[i + 1]; - x[i + 1] = x[i + 6]; - x[i + 6] = t; - t = x[i + 2]; - x[i + 2] = x[i + 5]; - x[i + 5] = t; - t = x[i + 3]; - x[i + 3] = x[i + 4]; - x[i + 4] = t; - } - } - exports.swap64 = swap64; - function process_buffer(specification, buffers) { - var need_swap = specification.order !== exports.BYTE_ORDER; - var shape = specification.shape; - var bytes = null; - for (var _i = 0, buffers_1 = buffers; _i < buffers_1.length; _i++) { - var buf = buffers_1[_i]; - var header = JSON.parse(buf[0]); - if (header.id === specification.__buffer__) { - bytes = buf[1]; - break; - } - } - var arr = new (exports.ARRAY_TYPES[specification.dtype])(bytes); - if (need_swap) { - if (arr.BYTES_PER_ELEMENT === 2) { - swap16(arr); - } - else if (arr.BYTES_PER_ELEMENT === 4) { - swap32(arr); - } - else if (arr.BYTES_PER_ELEMENT === 8) { - swap64(arr); - } - } - return [arr, shape]; - } - exports.process_buffer = process_buffer; - function process_array(obj, buffers) { - if (types_1.isObject(obj) && '__ndarray__' in obj) - return decode_base64(obj); - else if (types_1.isObject(obj) && '__buffer__' in obj) - return process_buffer(obj, buffers); - else if (types_1.isArray(obj) || types_1.isTypedArray(obj)) - return [obj, []]; - else - return undefined; - } - exports.process_array = process_array; - function arrayBufferToBase64(buffer) { - var bytes = new Uint8Array(buffer); - var chars = Array.from(bytes).map(function (b) { return String.fromCharCode(b); }); - return btoa(chars.join("")); - } - exports.arrayBufferToBase64 = arrayBufferToBase64; - function base64ToArrayBuffer(base64) { - var binary_string = atob(base64); - var len = binary_string.length; - var bytes = new Uint8Array(len); - for (var i = 0, end = len; i < end; i++) { - bytes[i] = binary_string.charCodeAt(i); - } - return bytes.buffer; - } - exports.base64ToArrayBuffer = base64ToArrayBuffer; - function decode_base64(input) { - var bytes = base64ToArrayBuffer(input.__ndarray__); - var dtype = input.dtype; - var shape = input.shape; - var array; - if (dtype in exports.ARRAY_TYPES) - array = new (exports.ARRAY_TYPES[dtype])(bytes); - else - throw new Error("unknown dtype: " + dtype); - return [array, shape]; - } - exports.decode_base64 = decode_base64; - function encode_base64(array, shape) { - var b64 = arrayBufferToBase64(array.buffer); - var name = arrayName(array); - var dtype; - if (name in exports.DTYPES) - dtype = exports.DTYPES[name]; - else - throw new Error("unknown array type: " + name); - var data = { - __ndarray__: b64, - shape: shape, - dtype: dtype, - }; - return data; - } - exports.encode_base64 = encode_base64; - function decode_traverse_data(v, buffers) { - // v is just a regular array of scalars - if (v.length == 0 || !(types_1.isObject(v[0]) || types_1.isArray(v[0]))) { - return [v, []]; - } - var arrays = []; - var shapes = []; - for (var _i = 0, v_1 = v; _i < v_1.length; _i++) { - var obj = v_1[_i]; - var _a = types_1.isArray(obj) ? decode_traverse_data(obj, buffers) : - process_array(obj, buffers), arr = _a[0], shape = _a[1]; - arrays.push(arr); - shapes.push(shape); - } - // If there is a list of empty lists, reduce that to just a list - var filtered_shapes = shapes.map(function (shape) { return shape.filter(function (v) { return v.length != 0; }); }); - return [arrays, filtered_shapes]; - } - function decode_column_data(data, buffers) { - if (buffers === void 0) { - buffers = []; - } - var new_data = {}; - var new_shapes = {}; - for (var k in data) { - // might be array of scalars, or might be ragged array or arrays - var v = data[k]; - if (types_1.isArray(v)) { - // v is just a regular array of scalars - if (v.length == 0 || !(types_1.isObject(v[0]) || types_1.isArray(v[0]))) { - new_data[k] = v; - continue; - } - // v is a ragged array of arrays - var _a = decode_traverse_data(v, buffers), arrays = _a[0], shapes = _a[1]; - new_data[k] = arrays; - new_shapes[k] = shapes; - // must be object or array (single array case) - } - else { - var _b = process_array(v, buffers), arr = _b[0], shape = _b[1]; - new_data[k] = arr; - new_shapes[k] = shape; - } - } - return [new_data, new_shapes]; - } - exports.decode_column_data = decode_column_data; - function encode_traverse_data(v, shapes) { - var new_array = []; - for (var i = 0, end = v.length; i < end; i++) { - var item = v[i]; - if (types_1.isTypedArray(item)) { - var shape = shapes[i] ? shapes[i] : undefined; - new_array.push(encode_base64(item, shape)); - } - else if (types_1.isArray(item)) { - new_array.push(encode_traverse_data(item, shapes ? shapes[i] : [])); - } - else - new_array.push(item); - } - return new_array; - } - function encode_column_data(data, shapes) { - var new_data = {}; - for (var k in data) { - var v = data[k]; - var shapes_k = shapes != null ? shapes[k] : undefined; - var new_v = void 0; - if (types_1.isTypedArray(v)) { - new_v = encode_base64(v, shapes_k); - } - else if (types_1.isArray(v)) { - new_v = encode_traverse_data(v, shapes_k || []); - } - else - new_v = v; - new_data[k] = new_v; - } - return new_data; - } - exports.encode_column_data = encode_column_data; -} -, -/* core/util/spatial */ function _(require, module, exports) { - var FlatBush = require(368) /* flatbush */; - var bbox_1 = require(27) /* ./bbox */; - var SpatialIndex = /** @class */ (function () { - function SpatialIndex(points) { - this.points = points; - this.index = null; - if (points.length > 0) { - this.index = new FlatBush(points.length); - for (var _i = 0, points_1 = points; _i < points_1.length; _i++) { - var p = points_1[_i]; - var minX = p.minX, minY = p.minY, maxX = p.maxX, maxY = p.maxY; - this.index.add(minX, minY, maxX, maxY); - } - this.index.finish(); - } - } - SpatialIndex.prototype._normalize = function (rect) { - var _a, _b; - var minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY; - if (minX > maxX) - _a = [maxX, minX], minX = _a[0], maxX = _a[1]; - if (minY > maxY) - _b = [maxY, minY], minY = _b[0], maxY = _b[1]; - return { minX: minX, minY: minY, maxX: maxX, maxY: maxY }; - }; - Object.defineProperty(SpatialIndex.prototype, "bbox", { - get: function () { - if (this.index == null) - return bbox_1.empty(); - else { - var _a = this.index, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; - return { minX: minX, minY: minY, maxX: maxX, maxY: maxY }; - } - }, - enumerable: true, - configurable: true - }); - SpatialIndex.prototype.search = function (rect) { - var _this = this; - if (this.index == null) - return []; - else { - var _a = this._normalize(rect), minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; - var indices = this.index.search(minX, minY, maxX, maxY); - return indices.map(function (j) { return _this.points[j]; }); - } - }; - SpatialIndex.prototype.indices = function (rect) { - return this.search(rect).map(function (_a) { - var i = _a.i; - return i; - }); - }; - return SpatialIndex; - }()); - exports.SpatialIndex = SpatialIndex; -} -, -/* core/util/string */ function _(require, module, exports) { - var settings_1 = require(21) /* ../settings */; - function startsWith(str, searchString, position) { - if (position === void 0) { - position = 0; - } - return str.substr(position, searchString.length) == searchString; - } - exports.startsWith = startsWith; - function uuid4() { - // from ipython project - // http://www.ietf.org/rfc/rfc4122.txt - var s = new Array(32); - var hexDigits = "0123456789ABCDEF"; - for (var i = 0; i < 32; i++) { - s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); - } - s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 - s[16] = hexDigits.substr((s[16].charCodeAt(0) & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 - return s.join(""); - } - exports.uuid4 = uuid4; - var counter = 1000; - function uniqueId(prefix) { - var id = settings_1.settings.dev ? "j" + counter++ : uuid4(); - if (prefix != null) - return prefix + "-" + id; - else - return id; - } - exports.uniqueId = uniqueId; - function escape(s) { - return s.replace(/(?:[&<>"'`])/g, function (ch) { - switch (ch) { - case '&': return '&'; - case '<': return '<'; - case '>': return '>'; - case '"': return '"'; - case "'": return '''; - case '`': return '`'; - default: return ch; - } - }); - } - exports.escape = escape; - function unescape(s) { - return s.replace(/&(amp|lt|gt|quot|#x27|#x60);/g, function (_, entity) { - switch (entity) { - case 'amp': return '&'; - case 'lt': return '<'; - case 'gt': return '>'; - case 'quot': return '"'; - case '#x27': return "'"; - case '#x60': return '`'; - default: return entity; - } - }); - } - exports.unescape = unescape; - function use_strict(code) { - return "'use strict';\n" + code; - } - exports.use_strict = use_strict; -} -, -/* core/util/svg_colors */ function _(require, module, exports) { - exports.svg_colors = { - indianred: "#CD5C5C", - lightcoral: "#F08080", - salmon: "#FA8072", - darksalmon: "#E9967A", - lightsalmon: "#FFA07A", - crimson: "#DC143C", - red: "#FF0000", - firebrick: "#B22222", - darkred: "#8B0000", - pink: "#FFC0CB", - lightpink: "#FFB6C1", - hotpink: "#FF69B4", - deeppink: "#FF1493", - mediumvioletred: "#C71585", - palevioletred: "#DB7093", - coral: "#FF7F50", - tomato: "#FF6347", - orangered: "#FF4500", - darkorange: "#FF8C00", - orange: "#FFA500", - gold: "#FFD700", - yellow: "#FFFF00", - lightyellow: "#FFFFE0", - lemonchiffon: "#FFFACD", - lightgoldenrodyellow: "#FAFAD2", - papayawhip: "#FFEFD5", - moccasin: "#FFE4B5", - peachpuff: "#FFDAB9", - palegoldenrod: "#EEE8AA", - khaki: "#F0E68C", - darkkhaki: "#BDB76B", - lavender: "#E6E6FA", - thistle: "#D8BFD8", - plum: "#DDA0DD", - violet: "#EE82EE", - orchid: "#DA70D6", - fuchsia: "#FF00FF", - magenta: "#FF00FF", - mediumorchid: "#BA55D3", - mediumpurple: "#9370DB", - blueviolet: "#8A2BE2", - darkviolet: "#9400D3", - darkorchid: "#9932CC", - darkmagenta: "#8B008B", - purple: "#800080", - indigo: "#4B0082", - slateblue: "#6A5ACD", - darkslateblue: "#483D8B", - mediumslateblue: "#7B68EE", - greenyellow: "#ADFF2F", - chartreuse: "#7FFF00", - lawngreen: "#7CFC00", - lime: "#00FF00", - limegreen: "#32CD32", - palegreen: "#98FB98", - lightgreen: "#90EE90", - mediumspringgreen: "#00FA9A", - springgreen: "#00FF7F", - mediumseagreen: "#3CB371", - seagreen: "#2E8B57", - forestgreen: "#228B22", - green: "#008000", - darkgreen: "#006400", - yellowgreen: "#9ACD32", - olivedrab: "#6B8E23", - olive: "#808000", - darkolivegreen: "#556B2F", - mediumaquamarine: "#66CDAA", - darkseagreen: "#8FBC8F", - lightseagreen: "#20B2AA", - darkcyan: "#008B8B", - teal: "#008080", - aqua: "#00FFFF", - cyan: "#00FFFF", - lightcyan: "#E0FFFF", - paleturquoise: "#AFEEEE", - aquamarine: "#7FFFD4", - turquoise: "#40E0D0", - mediumturquoise: "#48D1CC", - darkturquoise: "#00CED1", - cadetblue: "#5F9EA0", - steelblue: "#4682B4", - lightsteelblue: "#B0C4DE", - powderblue: "#B0E0E6", - lightblue: "#ADD8E6", - skyblue: "#87CEEB", - lightskyblue: "#87CEFA", - deepskyblue: "#00BFFF", - dodgerblue: "#1E90FF", - cornflowerblue: "#6495ED", - royalblue: "#4169E1", - blue: "#0000FF", - mediumblue: "#0000CD", - darkblue: "#00008B", - navy: "#000080", - midnightblue: "#191970", - cornsilk: "#FFF8DC", - blanchedalmond: "#FFEBCD", - bisque: "#FFE4C4", - navajowhite: "#FFDEAD", - wheat: "#F5DEB3", - burlywood: "#DEB887", - tan: "#D2B48C", - rosybrown: "#BC8F8F", - sandybrown: "#F4A460", - goldenrod: "#DAA520", - darkgoldenrod: "#B8860B", - peru: "#CD853F", - chocolate: "#D2691E", - saddlebrown: "#8B4513", - sienna: "#A0522D", - brown: "#A52A2A", - maroon: "#800000", - white: "#FFFFFF", - snow: "#FFFAFA", - honeydew: "#F0FFF0", - mintcream: "#F5FFFA", - azure: "#F0FFFF", - aliceblue: "#F0F8FF", - ghostwhite: "#F8F8FF", - whitesmoke: "#F5F5F5", - seashell: "#FFF5EE", - beige: "#F5F5DC", - oldlace: "#FDF5E6", - floralwhite: "#FFFAF0", - ivory: "#FFFFF0", - antiquewhite: "#FAEBD7", - linen: "#FAF0E6", - lavenderblush: "#FFF0F5", - mistyrose: "#FFE4E1", - gainsboro: "#DCDCDC", - lightgray: "#D3D3D3", - lightgrey: "#D3D3D3", - silver: "#C0C0C0", - darkgray: "#A9A9A9", - darkgrey: "#A9A9A9", - gray: "#808080", - grey: "#808080", - dimgray: "#696969", - dimgrey: "#696969", - lightslategray: "#778899", - lightslategrey: "#778899", - slategray: "#708090", - slategrey: "#708090", - darkslategray: "#2F4F4F", - darkslategrey: "#2F4F4F", - black: "#000000", - }; - function is_svg_color(color) { - return color in exports.svg_colors; - } - exports.is_svg_color = is_svg_color; -} -, -/* core/util/templating */ function _(require, module, exports) { - var sprintf_js_1 = require(398) /* sprintf-js */; - var Numbro = require(370) /* numbro */; - var tz = require(399) /* timezone */; - var string_1 = require(40) /* ./string */; - var types_1 = require(46) /* ./types */; - function sprintf(format) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - return sprintf_js_1.sprintf.apply(void 0, [format].concat(args)); - } - exports.sprintf = sprintf; - exports.DEFAULT_FORMATTERS = { - numeral: function (value, format, _special_vars) { return Numbro.format(value, format); }, - datetime: function (value, format, _special_vars) { return tz(value, format); }, - printf: function (value, format, _special_vars) { return sprintf(format, value); }, - }; - function basic_formatter(value, _format, _special_vars) { - if (types_1.isNumber(value)) { - var format = (function () { - switch (false) { - case Math.floor(value) != value: - return "%d"; - case !(Math.abs(value) > 0.1) || !(Math.abs(value) < 1000): - return "%0.3f"; - default: - return "%0.3e"; - } - })(); - return sprintf(format, value); - } - else - return "" + value; // get strings for categorical types - } - exports.basic_formatter = basic_formatter; - function get_formatter(name, raw_spec, format, formatters) { - // no format, use default built in formatter - if (format == null) - return basic_formatter; - // format spec in the formatters dict, use that - if (formatters != null && (name in formatters || raw_spec in formatters)) { - // some day (Bokeh 2.0) we can get rid of the check for name, and just check the raw spec - // keep it now for compatibility but do not demonstrate it anywhere - var key = raw_spec in formatters ? raw_spec : name; - var formatter_1 = formatters[key]; - if (types_1.isString(formatter_1)) { - if (formatter_1 in exports.DEFAULT_FORMATTERS) - return exports.DEFAULT_FORMATTERS[formatter_1]; - else - throw new Error("Unknown tooltip field formatter type '" + formatter_1 + "'"); - } - return function (value, format, special_vars) { - return formatter_1.format(value, format, special_vars); - }; - } - // otherwise use "numeral" as default - return exports.DEFAULT_FORMATTERS.numeral; - } - exports.get_formatter = get_formatter; - function get_value(name, data_source, i, special_vars) { - if (name[0] == "$") { - if (name.substring(1) in special_vars) - return special_vars[name.substring(1)]; - else - throw new Error("Unknown special variable '" + name + "'"); - } - var column = data_source.get_column(name); - // missing column - if (column == null) - return null; - // typical (non-image) index - if (types_1.isNumber(i)) - return column[i]; - // image index - var data = column[i.index]; - if (types_1.isTypedArray(data) || types_1.isArray(data)) { - // inspect array of arrays - if (types_1.isArray(data[0])) { - var row = data[i.dim2]; - return row[i.dim1]; - } - else - return data[i.flat_index]; // inspect flat array - } - else - return data; // inspect per-image scalar data - } - exports.get_value = get_value; - function replace_placeholders(str, data_source, i, formatters, special_vars) { - if (special_vars === void 0) { - special_vars = {}; - } - // this extracts the $x, @x, @{x} without any trailing {format} - var raw_spec = str.replace(/(?:^|[^@])([@|\$](?:\w+|{[^{}]+}))(?:{[^{}]+})?/g, function (_match, raw_spec, _format) { return "" + raw_spec; }); - // this handles the special case @$name, replacing it with an @var corresponding to special_vars.name - str = str.replace(/@\$name/g, function (_match) { return "@{" + special_vars.name + "}"; }); - // this prepends special vars with "@", e.g "$x" becomes "@$x", so subsequent processing is simpler - str = str.replace(/(^|[^\$])\$(\w+)/g, function (_match, prefix, name) { return prefix + "@$" + name; }); - str = str.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g, function (_match, prefix, name, long_name, format) { - name = long_name != null ? long_name : name; - var value = get_value(name, data_source, i, special_vars); - // missing value, return ??? - if (value == null) - return "" + prefix + string_1.escape("???"); - // 'safe' format, return the value as-is - if (format == 'safe') - return "" + prefix + value; - // format and escape everything else - var formatter = get_formatter(name, raw_spec, format, formatters); - return "" + prefix + string_1.escape(formatter(value, format, special_vars)); - }); - return str; - } - exports.replace_placeholders = replace_placeholders; -} -, -/* core/util/text */ function _(require, module, exports) { - var dom_1 = require(5) /* ../dom */; - var cache = {}; - function measure_font(font) { - if (cache[font] != null) - return cache[font]; - var text = dom_1.span({ style: { font: font } }, "Hg"); - var block = dom_1.div({ style: { display: "inline-block", width: "1px", height: "0px" } }); - var elem = dom_1.div({}, text, block); - document.body.appendChild(elem); - try { - block.style.verticalAlign = "baseline"; - var ascent = dom_1.offset(block).top - dom_1.offset(text).top; - block.style.verticalAlign = "bottom"; - var height = dom_1.offset(block).top - dom_1.offset(text).top; - var result = { height: height, ascent: ascent, descent: height - ascent }; - cache[font] = result; - return result; - } - finally { - document.body.removeChild(elem); - } - } - exports.measure_font = measure_font; - var _cache = {}; - function measure_text(text, font) { - var text_cache = _cache[font]; - if (text_cache != null) { - var size = text_cache[text]; - if (size != null) - return size; - } - else - _cache[font] = {}; - var el = dom_1.div({ style: { display: "inline-block", "white-space": "nowrap", font: font } }, text); - document.body.appendChild(el); - try { - var _a = el.getBoundingClientRect(), width = _a.width, height = _a.height; - _cache[font][text] = { width: width, height: height }; - return { width: width, height: height }; - } - finally { - document.body.removeChild(el); - } - } - exports.measure_text = measure_text; -} -, -/* core/util/throttle */ function _(require, module, exports) { - function _delay_animation(callback) { - callback(Date.now()); // XXX: performance.now() - return -1; - } - var delay_animation = (typeof window !== 'undefined' ? window.requestAnimationFrame : undefined) || - (typeof window !== 'undefined' ? window.webkitRequestAnimationFrame : undefined) || - (typeof window !== 'undefined' ? window.mozRequestAnimationFrame : undefined) || - (typeof window !== 'undefined' ? window.msRequestAnimationFrame : undefined) || _delay_animation; - // Returns a function, that, when invoked, will only be triggered at - // most once during a given window of time. - // - // In addition, if the browser supports requestAnimationFrame, the - // throttled function will be run no more frequently than request - // animation frame allows. - // - // @param func [function] the function to throttle - // @param wait [number] time in milliseconds to use for window - // @return [function] throttled function - // - function throttle(func, wait) { - var timeout = null; - var previous = 0; - var pending = false; - var later = function () { - previous = Date.now(); - timeout = null; - pending = false; - func(); - }; - return function () { - var now = Date.now(); - var remaining = wait - (now - previous); - if (remaining <= 0 && !pending) { - if (timeout != null) - clearTimeout(timeout); - pending = true; - delay_animation(later); - } - else if (!timeout && !pending) - timeout = setTimeout(function () { return delay_animation(later); }, remaining); - }; - } - exports.throttle = throttle; -} -, -/* core/util/typed_array */ function _(require, module, exports) { - function concat(array0) { - var arrays = []; - for (var _i = 1; _i < arguments.length; _i++) { - arrays[_i - 1] = arguments[_i]; - } - var n = array0.length; - for (var _a = 0, arrays_1 = arrays; _a < arrays_1.length; _a++) { - var array = arrays_1[_a]; - n += array.length; - } - var result = new array0.constructor(n); - result.set(array0, 0); - var i = array0.length; - for (var _b = 0, arrays_2 = arrays; _b < arrays_2.length; _b++) { - var array = arrays_2[_b]; - result.set(array, i); - i += array.length; - } - return result; - } - exports.concat = concat; -} -, -/* core/util/types */ function _(require, module, exports) { - var array_1 = require(24) /* ./array */; - var toString = Object.prototype.toString; - function isBoolean(obj) { - return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; - } - exports.isBoolean = isBoolean; - function isNumber(obj) { - return toString.call(obj) === "[object Number]"; - } - exports.isNumber = isNumber; - function isInteger(obj) { - return isNumber(obj) && isFinite(obj) && Math.floor(obj) === obj; - } - exports.isInteger = isInteger; - function isString(obj) { - return toString.call(obj) === "[object String]"; - } - exports.isString = isString; - function isStrictNaN(obj) { - return isNumber(obj) && obj !== +obj; - } - exports.isStrictNaN = isStrictNaN; - function isFunction(obj) { - return toString.call(obj) === "[object Function]"; - } - exports.isFunction = isFunction; - function isArray(obj) { - return Array.isArray(obj); - } - exports.isArray = isArray; - function isArrayOf(arr, predicate) { - return array_1.every(arr, predicate); - } - exports.isArrayOf = isArrayOf; - function isArrayableOf(arr, predicate) { - for (var i = 0, end = arr.length; i < end; i++) { - if (!predicate(arr[i])) - return false; - } - return true; - } - exports.isArrayableOf = isArrayableOf; - function isTypedArray(obj) { - return obj != null && obj.buffer != null && obj.buffer instanceof ArrayBuffer; - } - exports.isTypedArray = isTypedArray; - function isObject(obj) { - var tp = typeof obj; - return tp === 'function' || tp === 'object' && !!obj; - } - exports.isObject = isObject; - function isPlainObject(obj) { - return isObject(obj) && (obj.constructor == null || obj.constructor === Object); - } - exports.isPlainObject = isPlainObject; -} -, -/* core/util/wheel */ function _(require, module, exports) { - function fontSize(element) { - var value = getComputedStyle(element).fontSize; - if (value != null) - return parseInt(value, 10); - return null; - } - function lineHeight(element) { - var parent = element.offsetParent || document.body; - return fontSize(parent) || fontSize(element) || 16; - } - function pageHeight(element) { - return element.clientHeight; // XXX: should be content height? - } - function getDeltaY(event) { - var deltaY = -event.deltaY; - if (event.target instanceof HTMLElement) { - switch (event.deltaMode) { - case event.DOM_DELTA_LINE: - deltaY *= lineHeight(event.target); - break; - case event.DOM_DELTA_PAGE: - deltaY *= pageHeight(event.target); - break; - } - } - return deltaY; - } - exports.getDeltaY = getDeltaY; -} -, -/* core/util/zoom */ function _(require, module, exports) { - var math_1 = require(34) /* ./math */; - // Module for zoom-related functions - function scale_highlow(range, factor, center) { - var _a = [range.start, range.end], low = _a[0], high = _a[1]; - var x = center != null ? center : (high + low) / 2.0; - var x0 = low - (low - x) * factor; - var x1 = high - (high - x) * factor; - return [x0, x1]; - } - exports.scale_highlow = scale_highlow; - function get_info(scales, _a) { - var sxy0 = _a[0], sxy1 = _a[1]; - var info = {}; - for (var name_1 in scales) { - var scale = scales[name_1]; - var _b = scale.r_invert(sxy0, sxy1), start = _b[0], end = _b[1]; - info[name_1] = { start: start, end: end }; - } - return info; - } - exports.get_info = get_info; - function scale_range(frame, factor, h_axis, v_axis, center) { - /* - * Utility function for zoom tools to calculate/create the zoom_info object - * of the form required by ``PlotView.update_range`` - * - * Parameters: - * frame : CartesianFrame - * factor : Number - * h_axis : Boolean, optional - * whether to zoom the horizontal axis (default = true) - * v_axis : Boolean, optional - * whether to zoom the horizontal axis (default = true) - * center : object, optional - * of form {'x': Number, 'y', Number} - * - * Returns: - * object: - */ - if (h_axis === void 0) { - h_axis = true; - } - if (v_axis === void 0) { - v_axis = true; - } - // clamp the magnitude of factor, if it is > 1 bad things happen - factor = math_1.clamp(factor, -0.9, 0.9); - var hfactor = h_axis ? factor : 0; - var _a = scale_highlow(frame.bbox.h_range, hfactor, center != null ? center.x : undefined), sx0 = _a[0], sx1 = _a[1]; - var xrs = get_info(frame.xscales, [sx0, sx1]); - var vfactor = v_axis ? factor : 0; - var _b = scale_highlow(frame.bbox.v_range, vfactor, center != null ? center.y : undefined), sy0 = _b[0], sy1 = _b[1]; - var yrs = get_info(frame.yscales, [sy0, sy1]); - // OK this sucks we can't set factor independently in each direction. It is used - // for GMap plots, and GMap plots always preserve aspect, so effective the value - // of 'dimensions' is ignored. - return { xrs: xrs, yrs: yrs, factor: factor }; - } - exports.scale_range = scale_range; -} -, -/* core/vectorization */ function _(require, module, exports) { - var types_1 = require(46) /* ./util/types */; - function isValue(obj) { - return types_1.isPlainObject(obj) && "value" in obj; - } - exports.isValue = isValue; - function isField(obj) { - return types_1.isPlainObject(obj) && "field" in obj; - } - exports.isField = isField; -} -, -/* core/view */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var signaling_1 = require(22) /* ./signaling */; - var types_1 = require(46) /* ./util/types */; - var string_1 = require(40) /* ./util/string */; - var View = /** @class */ (function (_super) { - tslib_1.__extends(View, _super); - function View(options) { - var _this = _super.call(this) || this; - _this.removed = new signaling_1.Signal0(_this, "removed"); - if (options.model != null) - _this.model = options.model; - else - throw new Error("model of a view wasn't configured"); - _this._parent = options.parent; - _this.id = options.id || string_1.uniqueId(); - _this.initialize(); - if (options.connect_signals !== false) - _this.connect_signals(); - return _this; - } - View.prototype.initialize = function () { }; - View.prototype.remove = function () { - this._parent = undefined; - this.disconnect_signals(); - this.removed.emit(); - }; - View.prototype.toString = function () { - return this.model.type + "View(" + this.id + ")"; - }; - View.prototype.serializable_state = function () { - return { type: this.model.type }; - }; - Object.defineProperty(View.prototype, "parent", { - get: function () { - if (this._parent !== undefined) - return this._parent; - else - throw new Error("parent of a view wasn't configured"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(View.prototype, "is_root", { - get: function () { - return this.parent === null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(View.prototype, "root", { - get: function () { - return this.is_root ? this : this.parent.root; - }, - enumerable: true, - configurable: true - }); - View.prototype.assert_root = function () { - if (!this.is_root) - throw new Error(this.toString() + " is not a root layout"); - }; - View.prototype.connect_signals = function () { }; - View.prototype.disconnect_signals = function () { - signaling_1.Signal.disconnectReceiver(this); - }; - View.prototype.on_change = function (properties, fn) { - for (var _i = 0, _a = types_1.isArray(properties) ? properties : [properties]; _i < _a.length; _i++) { - var property = _a[_i]; - this.connect(property.change, fn); - } - }; - return View; - }(signaling_1.Signalable())); - exports.View = View; -} -, -/* core/visuals */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mixins = require(19) /* ./property_mixins */; - var color_1 = require(30) /* ./util/color */; - var ContextProperties = /** @class */ (function () { - function ContextProperties(obj, prefix) { - if (prefix === void 0) { - prefix = ""; - } - this.obj = obj; - this.prefix = prefix; - // } - this.cache = {}; - for (var _i = 0, _a = this.attrs; _i < _a.length; _i++) { - var attr = _a[_i]; - this[attr] = obj.properties[prefix + attr]; - } - } - ContextProperties.prototype.warm_cache = function (source) { - for (var _i = 0, _a = this.attrs; _i < _a.length; _i++) { - var attr = _a[_i]; - var prop = this.obj.properties[this.prefix + attr]; - if (prop.spec.value !== undefined) // TODO (bev) better test? - this.cache[attr] = prop.spec.value; - else if (source != null) - this.cache[attr + "_array"] = prop.array(source); - else - throw new Error("source is required with a vectorized visual property"); - } - }; - ContextProperties.prototype.cache_select = function (attr, i) { - var prop = this.obj.properties[this.prefix + attr]; - var value; - if (prop.spec.value !== undefined) // TODO (bev) better test? - this.cache[attr] = value = prop.spec.value; - else - this.cache[attr] = value = this.cache[attr + "_array"][i]; - return value; - }; - ContextProperties.prototype.set_vectorize = function (ctx, i) { - if (this.all_indices != null) // all_indices is set by a Visuals instance associated with a CDSView - this._set_vectorize(ctx, this.all_indices[i]); - else // all_indices is not set for annotations which may have vectorized visual props - this._set_vectorize(ctx, i); - }; - return ContextProperties; - }()); - exports.ContextProperties = ContextProperties; - var Line = /** @class */ (function (_super) { - tslib_1.__extends(Line, _super); - function Line() { - return _super !== null && _super.apply(this, arguments) || this; - } - Line.prototype.set_value = function (ctx) { - ctx.strokeStyle = this.line_color.value(); - ctx.globalAlpha = this.line_alpha.value(); - ctx.lineWidth = this.line_width.value(); - ctx.lineJoin = this.line_join.value(); - ctx.lineCap = this.line_cap.value(); - ctx.setLineDash(this.line_dash.value()); - ctx.setLineDashOffset(this.line_dash_offset.value()); - }; - Object.defineProperty(Line.prototype, "doit", { - get: function () { - return !(this.line_color.spec.value === null || - this.line_alpha.spec.value == 0 || - this.line_width.spec.value == 0); - }, - enumerable: true, - configurable: true - }); - Line.prototype._set_vectorize = function (ctx, i) { - this.cache_select("line_color", i); - if (ctx.strokeStyle !== this.cache.line_color) - ctx.strokeStyle = this.cache.line_color; - this.cache_select("line_alpha", i); - if (ctx.globalAlpha !== this.cache.line_alpha) - ctx.globalAlpha = this.cache.line_alpha; - this.cache_select("line_width", i); - if (ctx.lineWidth !== this.cache.line_width) - ctx.lineWidth = this.cache.line_width; - this.cache_select("line_join", i); - if (ctx.lineJoin !== this.cache.line_join) - ctx.lineJoin = this.cache.line_join; - this.cache_select("line_cap", i); - if (ctx.lineCap !== this.cache.line_cap) - ctx.lineCap = this.cache.line_cap; - this.cache_select("line_dash", i); - if (ctx.getLineDash() !== this.cache.line_dash) - ctx.setLineDash(this.cache.line_dash); - this.cache_select("line_dash_offset", i); - if (ctx.getLineDashOffset() !== this.cache.line_dash_offset) - ctx.setLineDashOffset(this.cache.line_dash_offset); - }; - Line.prototype.color_value = function () { - var _a = color_1.color2rgba(this.line_color.value(), this.line_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3]; - return "rgba(" + r * 255 + "," + g * 255 + "," + b * 255 + "," + a + ")"; - }; - return Line; - }(ContextProperties)); - exports.Line = Line; - Line.prototype.attrs = Object.keys(mixins.line()); - var Fill = /** @class */ (function (_super) { - tslib_1.__extends(Fill, _super); - function Fill() { - return _super !== null && _super.apply(this, arguments) || this; - } - Fill.prototype.set_value = function (ctx) { - ctx.fillStyle = this.fill_color.value(); - ctx.globalAlpha = this.fill_alpha.value(); - }; - Object.defineProperty(Fill.prototype, "doit", { - get: function () { - return !(this.fill_color.spec.value === null || - this.fill_alpha.spec.value == 0); - }, - enumerable: true, - configurable: true - }); - Fill.prototype._set_vectorize = function (ctx, i) { - this.cache_select("fill_color", i); - if (ctx.fillStyle !== this.cache.fill_color) - ctx.fillStyle = this.cache.fill_color; - this.cache_select("fill_alpha", i); - if (ctx.globalAlpha !== this.cache.fill_alpha) - ctx.globalAlpha = this.cache.fill_alpha; - }; - Fill.prototype.color_value = function () { - var _a = color_1.color2rgba(this.fill_color.value(), this.fill_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3]; - return "rgba(" + r * 255 + "," + g * 255 + "," + b * 255 + "," + a + ")"; - }; - return Fill; - }(ContextProperties)); - exports.Fill = Fill; - Fill.prototype.attrs = Object.keys(mixins.fill()); - var Text = /** @class */ (function (_super) { - tslib_1.__extends(Text, _super); - function Text() { - return _super !== null && _super.apply(this, arguments) || this; - } - Text.prototype.cache_select = function (name, i) { - var value; - if (name == "font") { - _super.prototype.cache_select.call(this, "text_font_style", i); - _super.prototype.cache_select.call(this, "text_font_size", i); - _super.prototype.cache_select.call(this, "text_font", i); - var _a = this.cache, text_font_style = _a.text_font_style, text_font_size = _a.text_font_size, text_font = _a.text_font; - this.cache.font = value = text_font_style + " " + text_font_size + " " + text_font; - } - else - value = _super.prototype.cache_select.call(this, name, i); - return value; - }; - Text.prototype.font_value = function () { - var font = this.text_font.value(); - var font_size = this.text_font_size.value(); - var font_style = this.text_font_style.value(); - return font_style + " " + font_size + " " + font; - }; - Text.prototype.color_value = function () { - var _a = color_1.color2rgba(this.text_color.value(), this.text_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3]; - return "rgba(" + r * 255 + "," + g * 255 + "," + b * 255 + "," + a + ")"; - }; - Text.prototype.set_value = function (ctx) { - ctx.font = this.font_value(); - ctx.fillStyle = this.text_color.value(); - ctx.globalAlpha = this.text_alpha.value(); - ctx.textAlign = this.text_align.value(); - ctx.textBaseline = this.text_baseline.value(); - }; - Object.defineProperty(Text.prototype, "doit", { - get: function () { - return !(this.text_color.spec.value === null || - this.text_alpha.spec.value == 0); - }, - enumerable: true, - configurable: true - }); - Text.prototype._set_vectorize = function (ctx, i) { - this.cache_select("font", i); - if (ctx.font !== this.cache.font) - ctx.font = this.cache.font; - this.cache_select("text_color", i); - if (ctx.fillStyle !== this.cache.text_color) - ctx.fillStyle = this.cache.text_color; - this.cache_select("text_alpha", i); - if (ctx.globalAlpha !== this.cache.text_alpha) - ctx.globalAlpha = this.cache.text_alpha; - this.cache_select("text_align", i); - if (ctx.textAlign !== this.cache.text_align) - ctx.textAlign = this.cache.text_align; - this.cache_select("text_baseline", i); - if (ctx.textBaseline !== this.cache.text_baseline) - ctx.textBaseline = this.cache.text_baseline; - }; - return Text; - }(ContextProperties)); - exports.Text = Text; - Text.prototype.attrs = Object.keys(mixins.text()); - var Visuals = /** @class */ (function () { - function Visuals(model) { - for (var _i = 0, _a = model.mixins; _i < _a.length; _i++) { - var mixin = _a[_i]; - var _b = mixin.split(":"), name_1 = _b[0], _c = _b[1], prefix = _c === void 0 ? "" : _c; - var cls = void 0; - switch (name_1) { - case "line": - cls = Line; - break; - case "fill": - cls = Fill; - break; - case "text": - cls = Text; - break; - default: - throw new Error("unknown visual: " + name_1); - } - this[prefix + name_1] = new cls(model, prefix); - } - } - Visuals.prototype.warm_cache = function (source) { - for (var name_2 in this) { - if (this.hasOwnProperty(name_2)) { - var prop = this[name_2]; - if (prop instanceof ContextProperties) - prop.warm_cache(source); - } - } - }; - Visuals.prototype.set_all_indices = function (all_indices) { - for (var name_3 in this) { - if (this.hasOwnProperty(name_3)) { - var prop = this[name_3]; - if (prop instanceof ContextProperties) - prop.all_indices = all_indices; - } - } - }; - return Visuals; - }()); - exports.Visuals = Visuals; -} -, -/* document/document */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var base_1 = require(0) /* ../base */; - var version_1 = require(296) /* ../version */; - var logging_1 = require(17) /* ../core/logging */; - var bokeh_events_1 = require(3) /* ../core/bokeh_events */; - var has_props_1 = require(8) /* ../core/has_props */; - var signaling_1 = require(22) /* ../core/signaling */; - var refs_1 = require(37) /* ../core/util/refs */; - var serialization_1 = require(38) /* ../core/util/serialization */; - var data_structures_1 = require(32) /* ../core/util/data_structures */; - var array_1 = require(24) /* ../core/util/array */; - var object_1 = require(35) /* ../core/util/object */; - var eq_1 = require(33) /* ../core/util/eq */; - var types_1 = require(46) /* ../core/util/types */; - var layout_dom_1 = require(163) /* ../models/layouts/layout_dom */; - var column_data_source_1 = require(208) /* ../models/sources/column_data_source */; - var model_1 = require(62) /* ../model */; - var events_1 = require(53) /* ./events */; - var EventManager = /** @class */ (function () { - function EventManager(document) { - this.document = document; - // Dispatches events to the subscribed models - this.session = null; - this.subscribed_models = new data_structures_1.Set(); - } - EventManager.prototype.send_event = function (event) { - if (this.session != null) - this.session.send_event(event); - }; - EventManager.prototype.trigger = function (event) { - for (var _i = 0, _a = this.subscribed_models.values; _i < _a.length; _i++) { - var id = _a[_i]; - if (event.origin != null && event.origin.id !== id) - continue; - var model = this.document._all_models[id]; - if (model != null && model instanceof model_1.Model) - model._process_event(event); - } - }; - return EventManager; - }()); - exports.EventManager = EventManager; - exports.documents = []; - exports.DEFAULT_TITLE = "Bokeh Application"; - // This class should match the API of the Python Document class - // as much as possible. - var Document = /** @class */ (function () { - function Document() { - exports.documents.push(this); - this._init_timestamp = Date.now(); - this._title = exports.DEFAULT_TITLE; - this._roots = []; - this._all_models = {}; - this._all_models_by_name = new data_structures_1.MultiDict(); - this._all_models_freeze_count = 0; - this._callbacks = []; - this.event_manager = new EventManager(this); - this.idle = new signaling_1.Signal0(this, "idle"); - this._idle_roots = new WeakMap(); // TODO: WeakSet would be better - this._interactive_timestamp = null; - this._interactive_plot = null; - } - Object.defineProperty(Document.prototype, "layoutables", { - get: function () { - return this._roots.filter(function (root) { return root instanceof layout_dom_1.LayoutDOM; }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Document.prototype, "is_idle", { - get: function () { - for (var _i = 0, _a = this.layoutables; _i < _a.length; _i++) { - var root = _a[_i]; - if (!this._idle_roots.has(root)) - return false; - } - return true; - }, - enumerable: true, - configurable: true - }); - Document.prototype.notify_idle = function (model) { - this._idle_roots.set(model, true); - if (this.is_idle) { - logging_1.logger.info("document idle at " + (Date.now() - this._init_timestamp) + " ms"); - this.idle.emit(); - } - }; - Document.prototype.clear = function () { - this._push_all_models_freeze(); - try { - while (this._roots.length > 0) { - this.remove_root(this._roots[0]); - } - } - finally { - this._pop_all_models_freeze(); - } - }; - Document.prototype.interactive_start = function (plot) { - if (this._interactive_plot == null) { - this._interactive_plot = plot; - this._interactive_plot.trigger_event(new bokeh_events_1.LODStart()); - } - this._interactive_timestamp = Date.now(); - }; - Document.prototype.interactive_stop = function (plot) { - if (this._interactive_plot != null && this._interactive_plot.id === plot.id) { - this._interactive_plot.trigger_event(new bokeh_events_1.LODEnd()); - } - this._interactive_plot = null; - this._interactive_timestamp = null; - }; - Document.prototype.interactive_duration = function () { - if (this._interactive_timestamp == null) - return -1; - else - return Date.now() - this._interactive_timestamp; - }; - Document.prototype.destructively_move = function (dest_doc) { - if (dest_doc === this) { - throw new Error("Attempted to overwrite a document with itself"); - } - dest_doc.clear(); - // we have to remove ALL roots before adding any - // to the new doc or else models referenced from multiple - // roots could be in both docs at once, which isn't allowed. - var roots = array_1.copy(this._roots); - this.clear(); - for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) { - var root = roots_1[_i]; - if (root.document != null) - throw new Error("Somehow we didn't detach " + root); - } - if (Object.keys(this._all_models).length !== 0) { - throw new Error("this._all_models still had stuff in it: " + this._all_models); - } - for (var _a = 0, roots_2 = roots; _a < roots_2.length; _a++) { - var root = roots_2[_a]; - dest_doc.add_root(root); - } - dest_doc.set_title(this._title); - }; - // TODO other fields of doc - Document.prototype._push_all_models_freeze = function () { - this._all_models_freeze_count += 1; - }; - Document.prototype._pop_all_models_freeze = function () { - this._all_models_freeze_count -= 1; - if (this._all_models_freeze_count === 0) { - this._recompute_all_models(); - } - }; - /*protected*/ Document.prototype._invalidate_all_models = function () { - logging_1.logger.debug("invalidating document models"); - // if freeze count is > 0, we'll recompute on unfreeze - if (this._all_models_freeze_count === 0) { - this._recompute_all_models(); - } - }; - Document.prototype._recompute_all_models = function () { - var new_all_models_set = new data_structures_1.Set(); - for (var _i = 0, _a = this._roots; _i < _a.length; _i++) { - var r = _a[_i]; - new_all_models_set = new_all_models_set.union(r.references()); - } - var old_all_models_set = new data_structures_1.Set(object_1.values(this._all_models)); - var to_detach = old_all_models_set.diff(new_all_models_set); - var to_attach = new_all_models_set.diff(old_all_models_set); - var recomputed = {}; - for (var _b = 0, _c = new_all_models_set.values; _b < _c.length; _b++) { - var m = _c[_b]; - recomputed[m.id] = m; - } - for (var _d = 0, _e = to_detach.values; _d < _e.length; _d++) { - var d = _e[_d]; - d.detach_document(); - if (d instanceof model_1.Model && d.name != null) - this._all_models_by_name.remove_value(d.name, d); - } - for (var _f = 0, _g = to_attach.values; _f < _g.length; _f++) { - var a = _g[_f]; - a.attach_document(this); - if (a instanceof model_1.Model && a.name != null) - this._all_models_by_name.add_value(a.name, a); - } - this._all_models = recomputed; - }; - Document.prototype.roots = function () { - return this._roots; - }; - Document.prototype.add_root = function (model, setter_id) { - logging_1.logger.debug("Adding root: " + model); - if (array_1.includes(this._roots, model)) - return; - this._push_all_models_freeze(); - try { - this._roots.push(model); - } - finally { - this._pop_all_models_freeze(); - } - this._trigger_on_change(new events_1.RootAddedEvent(this, model, setter_id)); - }; - Document.prototype.remove_root = function (model, setter_id) { - var i = this._roots.indexOf(model); - if (i < 0) - return; - this._push_all_models_freeze(); - try { - this._roots.splice(i, 1); - } - finally { - this._pop_all_models_freeze(); - } - this._trigger_on_change(new events_1.RootRemovedEvent(this, model, setter_id)); - }; - Document.prototype.title = function () { - return this._title; - }; - Document.prototype.set_title = function (title, setter_id) { - if (title !== this._title) { - this._title = title; - this._trigger_on_change(new events_1.TitleChangedEvent(this, title, setter_id)); - } - }; - Document.prototype.get_model_by_id = function (model_id) { - if (model_id in this._all_models) { - return this._all_models[model_id]; - } - else { - return null; - } - }; - Document.prototype.get_model_by_name = function (name) { - return this._all_models_by_name.get_one(name, "Multiple models are named '" + name + "'"); - }; - Document.prototype.on_change = function (callback) { - if (!array_1.includes(this._callbacks, callback)) - this._callbacks.push(callback); - }; - Document.prototype.remove_on_change = function (callback) { - var i = this._callbacks.indexOf(callback); - if (i >= 0) - this._callbacks.splice(i, 1); - }; - Document.prototype._trigger_on_change = function (event) { - for (var _i = 0, _a = this._callbacks; _i < _a.length; _i++) { - var cb = _a[_i]; - cb(event); - } - }; - // called by the model - Document.prototype._notify_change = function (model, attr, old, new_, options) { - if (attr === 'name') { - this._all_models_by_name.remove_value(old, model); - if (new_ != null) - this._all_models_by_name.add_value(new_, model); - } - var setter_id = options != null ? options.setter_id : void 0; - var hint = options != null ? options.hint : void 0; - this._trigger_on_change(new events_1.ModelChangedEvent(this, model, attr, old, new_, setter_id, hint)); - }; - Document._references_json = function (references, include_defaults) { - if (include_defaults === void 0) { - include_defaults = true; - } - var references_json = []; - for (var _i = 0, references_1 = references; _i < references_1.length; _i++) { - var r = references_1[_i]; - var ref = r.ref(); - ref.attributes = r.attributes_as_json(include_defaults); - // server doesn't want id in here since it's already in ref above - delete ref.attributes.id; - references_json.push(ref); - } - return references_json; - }; - Document._instantiate_object = function (obj_id, obj_type, obj_attrs) { - var full_attrs = tslib_1.__assign({}, obj_attrs, { id: obj_id, __deferred__: true }); - var model = base_1.Models(obj_type); - return new model(full_attrs); - }; - // given a JSON representation of all models in a graph, return a - // dict of new model objects - Document._instantiate_references_json = function (references_json, existing_models) { - // Create all instances, but without setting their props - var references = {}; - for (var _i = 0, references_json_1 = references_json; _i < references_json_1.length; _i++) { - var obj = references_json_1[_i]; - var obj_id = obj.id; - var obj_type = obj.type; - var obj_attrs = obj.attributes || {}; - var instance = void 0; - if (obj_id in existing_models) - instance = existing_models[obj_id]; - else { - instance = Document._instantiate_object(obj_id, obj_type, obj_attrs); - if (obj.subtype != null) - instance.set_subtype(obj.subtype); - } - references[instance.id] = instance; - } - return references; - }; - // if v looks like a ref, or a collection, resolve it, otherwise return it unchanged - // recurse into collections but not into HasProps - Document._resolve_refs = function (value, old_references, new_references) { - function resolve_ref(v) { - if (refs_1.is_ref(v)) { - if (v.id in old_references) - return old_references[v.id]; - else if (v.id in new_references) - return new_references[v.id]; - else - throw new Error("reference " + JSON.stringify(v) + " isn't known (not in Document?)"); - } - else if (types_1.isArray(v)) - return resolve_array(v); - else if (types_1.isPlainObject(v)) - return resolve_dict(v); - else - return v; - } - function resolve_array(array) { - var results = []; - for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { - var v = array_2[_i]; - results.push(resolve_ref(v)); - } - return results; - } - function resolve_dict(dict) { - var resolved = {}; - for (var k in dict) { - var v = dict[k]; - resolved[k] = resolve_ref(v); - } - return resolved; - } - return resolve_ref(value); - }; - // given a JSON representation of all models in a graph and new - // model instances, set the properties on the models from the - // JSON - Document._initialize_references_json = function (references_json, old_references, new_references) { - var to_update = {}; - for (var _i = 0, references_json_2 = references_json; _i < references_json_2.length; _i++) { - var obj = references_json_2[_i]; - var obj_id = obj.id; - var obj_attrs = obj.attributes; - var was_new = !(obj_id in old_references); - var instance = !was_new ? old_references[obj_id] : new_references[obj_id]; - // replace references with actual instances in obj_attrs - var resolved_attrs = Document._resolve_refs(obj_attrs, old_references, new_references); - to_update[instance.id] = [instance, resolved_attrs, was_new]; - } - function foreach_depth_first(items, f) { - var already_started = {}; - function foreach_value(v) { - if (v instanceof has_props_1.HasProps) { - // note that we ignore instances that aren't updated (not in to_update) - if (!(v.id in already_started) && v.id in items) { - already_started[v.id] = true; - var _a = items[v.id], attrs = _a[1], was_new = _a[2]; - for (var a in attrs) { - var e = attrs[a]; - foreach_value(e); - } - f(v, attrs, was_new); - } - } - else if (types_1.isArray(v)) { - for (var _i = 0, v_1 = v; _i < v_1.length; _i++) { - var e = v_1[_i]; - foreach_value(e); - } - } - else if (types_1.isPlainObject(v)) { - for (var k in v) { - var e = v[k]; - foreach_value(e); - } - } - } - for (var k in items) { - var _a = items[k], instance = _a[0]; - foreach_value(instance); - } - } - // this first pass removes all 'refs' replacing them with real instances - foreach_depth_first(to_update, function (instance, attrs, was_new) { - if (was_new) - instance.setv(attrs, { silent: true }); - }); - // after removing all the refs, we can run the initialize code safely - foreach_depth_first(to_update, function (instance, _attrs, was_new) { - if (was_new) - instance.finalize(); - }); - }; - Document._event_for_attribute_change = function (changed_obj, key, new_value, doc, value_refs) { - var changed_model = doc.get_model_by_id(changed_obj.id); // XXX! - if (!changed_model.attribute_is_serializable(key)) - return null; - else { - var event_1 = { - kind: "ModelChanged", - model: { - id: changed_obj.id, - type: changed_obj.type, - }, - attr: key, - new: new_value, - }; - has_props_1.HasProps._json_record_references(doc, new_value, value_refs, true); // true = recurse - return event_1; - } - }; - Document._events_to_sync_objects = function (from_obj, to_obj, to_doc, value_refs) { - var from_keys = Object.keys(from_obj.attributes); //XXX! - var to_keys = Object.keys(to_obj.attributes); //XXX! - var removed = array_1.difference(from_keys, to_keys); - var added = array_1.difference(to_keys, from_keys); - var shared = array_1.intersection(from_keys, to_keys); - var events = []; - for (var _i = 0, removed_1 = removed; _i < removed_1.length; _i++) { - var key = removed_1[_i]; - // we don't really have a "remove" event - not sure this ever - // happens even. One way this could happen is if the server - // does include_defaults=True and we do - // include_defaults=false ... in that case it'd be best to - // just ignore this probably. Warn about it, could mean - // there's a bug if we don't have a key that the server sent. - logging_1.logger.warn("Server sent key " + key + " but we don't seem to have it in our JSON"); - } - for (var _a = 0, added_1 = added; _a < added_1.length; _a++) { - var key = added_1[_a]; - var new_value = to_obj.attributes[key]; // XXX! - events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs)); - } - for (var _b = 0, shared_1 = shared; _b < shared_1.length; _b++) { - var key = shared_1[_b]; - var old_value = from_obj.attributes[key]; // XXX! - var new_value = to_obj.attributes[key]; // XXX! - if (old_value == null && new_value == null) { - } - else if (old_value == null || new_value == null) { - events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs)); - } - else { - if (!eq_1.isEqual(old_value, new_value)) - events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs)); - } - } - return events.filter(function (e) { return e != null; }); - }; - // we use this to detect changes during document deserialization - // (in model constructors and initializers) - Document._compute_patch_since_json = function (from_json, to_doc) { - var to_json = to_doc.to_json(false); // include_defaults=false - function refs(json) { - var result = {}; - for (var _i = 0, _a = json.roots.references; _i < _a.length; _i++) { - var obj = _a[_i]; - result[obj.id] = obj; - } - return result; - } - var from_references = refs(from_json); - var from_roots = {}; - var from_root_ids = []; - for (var _i = 0, _a = from_json.roots.root_ids; _i < _a.length; _i++) { - var r = _a[_i]; - from_roots[r] = from_references[r]; - from_root_ids.push(r); - } - var to_references = refs(to_json); - var to_roots = {}; - var to_root_ids = []; - for (var _b = 0, _c = to_json.roots.root_ids; _b < _c.length; _b++) { - var r = _c[_b]; - to_roots[r] = to_references[r]; - to_root_ids.push(r); - } - from_root_ids.sort(); - to_root_ids.sort(); - if (array_1.difference(from_root_ids, to_root_ids).length > 0 || - array_1.difference(to_root_ids, from_root_ids).length > 0) { - // this would arise if someone does add_root/remove_root during - // document deserialization, hopefully they won't ever do so. - throw new Error("Not implemented: computing add/remove of document roots"); - } - var value_refs = {}; - var events = []; - for (var id in to_doc._all_models) { - if (id in from_references) { - var update_model_events = Document._events_to_sync_objects(from_references[id], to_references[id], to_doc, value_refs); - events = events.concat(update_model_events); - } - } - return { - references: Document._references_json(object_1.values(value_refs), false), - events: events, - }; - }; - Document.prototype.to_json_string = function (include_defaults) { - if (include_defaults === void 0) { - include_defaults = true; - } - return JSON.stringify(this.to_json(include_defaults)); - }; - Document.prototype.to_json = function (include_defaults) { - if (include_defaults === void 0) { - include_defaults = true; - } - var root_ids = this._roots.map(function (r) { return r.id; }); - var root_references = object_1.values(this._all_models); - return { - version: version_1.version, - title: this._title, - roots: { - root_ids: root_ids, - references: Document._references_json(root_references, include_defaults), - }, - }; - }; - Document.from_json_string = function (s) { - var json = JSON.parse(s); - return Document.from_json(json); - }; - Document.from_json = function (json) { - logging_1.logger.debug("Creating Document from JSON"); - var py_version = json.version; // XXX! - var is_dev = py_version.indexOf('+') !== -1 || py_version.indexOf('-') !== -1; - var versions_string = "Library versions: JS (" + version_1.version + ") / Python (" + py_version + ")"; - if (!is_dev && version_1.version !== py_version) { - logging_1.logger.warn("JS/Python version mismatch"); - logging_1.logger.warn(versions_string); - } - else - logging_1.logger.debug(versions_string); - var roots_json = json.roots; - var root_ids = roots_json.root_ids; - var references_json = roots_json.references; - var references = Document._instantiate_references_json(references_json, {}); - Document._initialize_references_json(references_json, {}, references); - var doc = new Document(); - for (var _i = 0, root_ids_1 = root_ids; _i < root_ids_1.length; _i++) { - var r = root_ids_1[_i]; - doc.add_root(references[r]); - } // XXX: HasProps - doc.set_title(json.title); // XXX! - return doc; - }; - Document.prototype.replace_with_json = function (json) { - var replacement = Document.from_json(json); - replacement.destructively_move(this); - }; - Document.prototype.create_json_patch_string = function (events) { - return JSON.stringify(this.create_json_patch(events)); - }; - Document.prototype.create_json_patch = function (events) { - var references = {}; - var json_events = []; - for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { - var event_2 = events_2[_i]; - if (event_2.document !== this) { - logging_1.logger.warn("Cannot create a patch using events from a different document, event had ", event_2.document, " we are ", this); - throw new Error("Cannot create a patch using events from a different document"); - } - json_events.push(event_2.json(references)); - } - return { - events: json_events, - references: Document._references_json(object_1.values(references)), - }; - }; - Document.prototype.apply_json_patch = function (patch, buffers, setter_id) { - var _a; - if (buffers === void 0) { - buffers = []; - } - var references_json = patch.references; - var events_json = patch.events; - var references = Document._instantiate_references_json(references_json, this._all_models); - // The model being changed isn't always in references so add it in - for (var _i = 0, events_json_1 = events_json; _i < events_json_1.length; _i++) { - var event_json = events_json_1[_i]; - switch (event_json.kind) { - case "RootAdded": - case "RootRemoved": - case "ModelChanged": { - var model_id = event_json.model.id; - if (model_id in this._all_models) { - references[model_id] = this._all_models[model_id]; - } - else { - if (!(model_id in references)) { - logging_1.logger.warn("Got an event for unknown model ", event_json.model); - throw new Error("event model wasn't known"); - } - } - break; - } - } - } - // split references into old and new so we know whether to initialize or update - var old_references = {}; - var new_references = {}; - for (var id in references) { - var value = references[id]; - if (id in this._all_models) - old_references[id] = value; - else - new_references[id] = value; - } - Document._initialize_references_json(references_json, old_references, new_references); - for (var _b = 0, events_json_2 = events_json; _b < events_json_2.length; _b++) { - var event_json = events_json_2[_b]; - switch (event_json.kind) { - case 'ModelChanged': { - var patched_id = event_json.model.id; - if (!(patched_id in this._all_models)) { - throw new Error("Cannot apply patch to " + patched_id + " which is not in the document"); - } - var patched_obj = this._all_models[patched_id]; - var attr = event_json.attr; - var model_type = event_json.model.type; - // XXXX currently still need this first branch, some updates (initial?) go through here - if (attr === 'data' && model_type === 'ColumnDataSource') { - var _c = serialization_1.decode_column_data(event_json.new, buffers), data = _c[0], shapes = _c[1]; - patched_obj.setv({ _shapes: shapes, data: data }, { setter_id: setter_id }); - } - else { - var value = Document._resolve_refs(event_json.new, old_references, new_references); - patched_obj.setv((_a = {}, _a[attr] = value, _a), { setter_id: setter_id }); - } - break; - } - case 'ColumnDataChanged': { - var column_source_id = event_json.column_source.id; - if (!(column_source_id in this._all_models)) { - throw new Error("Cannot stream to " + column_source_id + " which is not in the document"); - } - var column_source = this._all_models[column_source_id]; - var _d = serialization_1.decode_column_data(event_json.new, buffers), data = _d[0], shapes = _d[1]; - if (event_json.cols != null) { - for (var k in column_source.data) { - if (!(k in data)) { - data[k] = column_source.data[k]; - } - } - for (var k in column_source._shapes) { - if (!(k in shapes)) { - shapes[k] = column_source._shapes[k]; - } - } - } - column_source.setv({ - _shapes: shapes, - data: data, - }, { - setter_id: setter_id, - check_eq: false, - }); - break; - } - case 'ColumnsStreamed': { - var column_source_id = event_json.column_source.id; - if (!(column_source_id in this._all_models)) { - throw new Error("Cannot stream to " + column_source_id + " which is not in the document"); - } - var column_source = this._all_models[column_source_id]; - if (!(column_source instanceof column_data_source_1.ColumnDataSource)) { - throw new Error("Cannot stream to non-ColumnDataSource"); - } - var data = event_json.data; - var rollover = event_json.rollover; - column_source.stream(data, rollover, setter_id); - break; - } - case 'ColumnsPatched': { - var column_source_id = event_json.column_source.id; - if (!(column_source_id in this._all_models)) { - throw new Error("Cannot patch " + column_source_id + " which is not in the document"); - } - var column_source = this._all_models[column_source_id]; - if (!(column_source instanceof column_data_source_1.ColumnDataSource)) { - throw new Error("Cannot patch non-ColumnDataSource"); - } - var patches = event_json.patches; - column_source.patch(patches, setter_id); - break; - } - case 'RootAdded': { - var root_id = event_json.model.id; - var root_obj = references[root_id]; - this.add_root(root_obj, setter_id); // XXX: HasProps - break; - } - case 'RootRemoved': { - var root_id = event_json.model.id; - var root_obj = references[root_id]; - this.remove_root(root_obj, setter_id); // XXX: HasProps - break; - } - case 'TitleChanged': { - this.set_title(event_json.title, setter_id); - break; - } - default: - throw new Error("Unknown patch event " + JSON.stringify(event_json)); - } - } - }; - return Document; - }()); - exports.Document = Document; -} -, -/* document/events */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var has_props_1 = require(8) /* ../core/has_props */; - var DocumentChangedEvent = /** @class */ (function () { - function DocumentChangedEvent(document) { - this.document = document; - } - return DocumentChangedEvent; - }()); - exports.DocumentChangedEvent = DocumentChangedEvent; - var ModelChangedEvent = /** @class */ (function (_super) { - tslib_1.__extends(ModelChangedEvent, _super); - function ModelChangedEvent(document, model, attr, old, new_, setter_id, hint) { - var _this = _super.call(this, document) || this; - _this.model = model; - _this.attr = attr; - _this.old = old; - _this.new_ = new_; - _this.setter_id = setter_id; - _this.hint = hint; - return _this; - } - ModelChangedEvent.prototype.json = function (references) { - if (this.attr === "id") { - throw new Error("'id' field should never change, whatever code just set it is wrong"); - } - if (this.hint != null) - return this.hint.json(references); - var value = this.new_; - var value_json = has_props_1.HasProps._value_to_json(this.attr, value, this.model); - var value_refs = {}; - has_props_1.HasProps._value_record_references(value, value_refs, true); // true = recurse - if (this.model.id in value_refs && this.model !== value) { - // we know we don't want a whole new copy of the obj we're - // patching unless it's also the value itself - delete value_refs[this.model.id]; - } - for (var id in value_refs) { - references[id] = value_refs[id]; - } - return { - kind: "ModelChanged", - model: this.model.ref(), - attr: this.attr, - new: value_json, - }; - }; - return ModelChangedEvent; - }(DocumentChangedEvent)); - exports.ModelChangedEvent = ModelChangedEvent; - var ColumnsPatchedEvent = /** @class */ (function (_super) { - tslib_1.__extends(ColumnsPatchedEvent, _super); - function ColumnsPatchedEvent(document, column_source, patches) { - var _this = _super.call(this, document) || this; - _this.column_source = column_source; - _this.patches = patches; - return _this; - } - ColumnsPatchedEvent.prototype.json = function (_references) { - return { - kind: "ColumnsPatched", - column_source: this.column_source, - patches: this.patches, - }; - }; - return ColumnsPatchedEvent; - }(DocumentChangedEvent)); - exports.ColumnsPatchedEvent = ColumnsPatchedEvent; - var ColumnsStreamedEvent = /** @class */ (function (_super) { - tslib_1.__extends(ColumnsStreamedEvent, _super); - function ColumnsStreamedEvent(document, column_source, data, rollover) { - var _this = _super.call(this, document) || this; - _this.column_source = column_source; - _this.data = data; - _this.rollover = rollover; - return _this; - } - ColumnsStreamedEvent.prototype.json = function (_references) { - return { - kind: "ColumnsStreamed", - column_source: this.column_source, - data: this.data, - rollover: this.rollover, - }; - }; - return ColumnsStreamedEvent; - }(DocumentChangedEvent)); - exports.ColumnsStreamedEvent = ColumnsStreamedEvent; - var TitleChangedEvent = /** @class */ (function (_super) { - tslib_1.__extends(TitleChangedEvent, _super); - function TitleChangedEvent(document, title, setter_id) { - var _this = _super.call(this, document) || this; - _this.title = title; - _this.setter_id = setter_id; - return _this; - } - TitleChangedEvent.prototype.json = function (_references) { - return { - kind: "TitleChanged", - title: this.title, - }; - }; - return TitleChangedEvent; - }(DocumentChangedEvent)); - exports.TitleChangedEvent = TitleChangedEvent; - var RootAddedEvent = /** @class */ (function (_super) { - tslib_1.__extends(RootAddedEvent, _super); - function RootAddedEvent(document, model, setter_id) { - var _this = _super.call(this, document) || this; - _this.model = model; - _this.setter_id = setter_id; - return _this; - } - RootAddedEvent.prototype.json = function (references) { - has_props_1.HasProps._value_record_references(this.model, references, true); - return { - kind: "RootAdded", - model: this.model.ref(), - }; - }; - return RootAddedEvent; - }(DocumentChangedEvent)); - exports.RootAddedEvent = RootAddedEvent; - var RootRemovedEvent = /** @class */ (function (_super) { - tslib_1.__extends(RootRemovedEvent, _super); - function RootRemovedEvent(document, model, setter_id) { - var _this = _super.call(this, document) || this; - _this.model = model; - _this.setter_id = setter_id; - return _this; - } - RootRemovedEvent.prototype.json = function (_references) { - return { - kind: "RootRemoved", - model: this.model.ref(), - }; - }; - return RootRemovedEvent; - }(DocumentChangedEvent)); - exports.RootRemovedEvent = RootRemovedEvent; -} -, -/* document/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(52) /* ./document */, exports); - tslib_1.__exportStar(require(53) /* ./events */, exports); -} -, -/* embed/dom */ function _(require, module, exports) { - var dom_1 = require(5) /* ../core/dom */; - // Matches Bokeh CSS class selector. Setting all Bokeh parent element class names - // with this var prevents user configurations where css styling is unset. - exports.BOKEH_ROOT = "bk-root"; - function _get_element(elementid) { - var element = document.getElementById(elementid); - if (element == null) - throw new Error("Error rendering Bokeh model: could not find #" + elementid + " HTML tag"); - if (!document.body.contains(element)) - throw new Error("Error rendering Bokeh model: element #" + elementid + " must be under "); - // If autoload script, replace script tag with div for embedding. - if (element.tagName == "SCRIPT") { - var root_el = dom_1.div({ class: exports.BOKEH_ROOT }); - dom_1.replaceWith(element, root_el); - element = root_el; - } - return element; - } - function _resolve_element(item) { - var elementid = item.elementid; - if (elementid != null) - return _get_element(elementid); - else - return document.body; - } - exports._resolve_element = _resolve_element; - function _resolve_root_elements(item) { - var roots = {}; - if (item.roots != null) { - for (var root_id in item.roots) - roots[root_id] = _get_element(item.roots[root_id]); - } - return roots; - } - exports._resolve_root_elements = _resolve_root_elements; -} -, -/* embed/index */ function _(require, module, exports) { - var document_1 = require(54) /* ../document */; - var logging_1 = require(17) /* ../core/logging */; - var callback_1 = require(28) /* ../core/util/callback */; - var string_1 = require(40) /* ../core/util/string */; - var types_1 = require(46) /* ../core/util/types */; - var standalone_1 = require(59) /* ./standalone */; - var server_1 = require(58) /* ./server */; - var dom_1 = require(55) /* ./dom */; - var standalone_2 = require(59) /* ./standalone */; - exports.add_document_standalone = standalone_2.add_document_standalone; - exports.index = standalone_2.index; - var server_2 = require(58) /* ./server */; - exports.add_document_from_session = server_2.add_document_from_session; - var notebook_1 = require(57) /* ./notebook */; - exports.embed_items_notebook = notebook_1.embed_items_notebook; - exports.kernels = notebook_1.kernels; - var dom_2 = require(55) /* ./dom */; - exports.BOKEH_ROOT = dom_2.BOKEH_ROOT; - function embed_item(item, target_id) { - var _a; - var docs_json = {}; - var doc_id = string_1.uuid4(); - docs_json[doc_id] = item.doc; - if (target_id == null) - target_id = item.target_id; - var element = document.getElementById(target_id); - if (element != null) - element.classList.add(dom_1.BOKEH_ROOT); - var roots = (_a = {}, _a[item.root_id] = target_id, _a); - var render_item = { roots: roots, docid: doc_id }; - callback_1.defer(function () { return _embed_items(docs_json, [render_item]); }); - } - exports.embed_item = embed_item; - // TODO (bev) this is currently clunky. Standalone embeds only provide - // the first two args, whereas server provide the app_app, and *may* prove and - // absolute_url as well if non-relative links are needed for resources. This function - // should probably be split in to two pieces to reflect the different usage patterns - function embed_items(docs_json, render_items, app_path, absolute_url) { - callback_1.defer(function () { return _embed_items(docs_json, render_items, app_path, absolute_url); }); - } - exports.embed_items = embed_items; - function _embed_items(docs_json, render_items, app_path, absolute_url) { - if (types_1.isString(docs_json)) - docs_json = JSON.parse(string_1.unescape(docs_json)); - var docs = {}; - for (var docid in docs_json) { - var doc_json = docs_json[docid]; - docs[docid] = document_1.Document.from_json(doc_json); - } - for (var _i = 0, render_items_1 = render_items; _i < render_items_1.length; _i++) { - var item = render_items_1[_i]; - var element = dom_1._resolve_element(item); - var roots = dom_1._resolve_root_elements(item); - if (item.docid != null) { - standalone_1.add_document_standalone(docs[item.docid], element, roots, item.use_for_title); - } - else if (item.sessionid != null) { - var websocket_url = server_1._get_ws_url(app_path, absolute_url); - logging_1.logger.debug("embed: computed ws url: " + websocket_url); - var promise = server_1.add_document_from_session(websocket_url, item.sessionid, element, roots, item.use_for_title); - promise.then(function () { - console.log("Bokeh items were rendered successfully"); - }, function (error) { - console.log("Error rendering Bokeh items:", error); - }); - } - else - throw new Error("Error rendering Bokeh items: either 'docid' or 'sessionid' was expected."); - } - } -} -, -/* embed/notebook */ function _(require, module, exports) { - var document_1 = require(54) /* ../document */; - var receiver_1 = require(293) /* ../protocol/receiver */; - var logging_1 = require(17) /* ../core/logging */; - var object_1 = require(35) /* ../core/util/object */; - var standalone_1 = require(59) /* ./standalone */; - var dom_1 = require(55) /* ./dom */; - // This exists to allow the jupyterlab_bokeh extension to store the - // notebook kernel so that _init_comms can register the comms target. - // This has to be available at window.Bokeh.embed.kernels in JupyterLab. - exports.kernels = {}; - function _handle_notebook_comms(receiver, comm_msg) { - if (comm_msg.buffers.length > 0) - receiver.consume(comm_msg.buffers[0].buffer); - else - receiver.consume(comm_msg.content.data); - var msg = receiver.message; - if (msg != null) - this.apply_json_patch(msg.content, msg.buffers); - } - function _init_comms(target, doc) { - if (typeof Jupyter !== 'undefined' && Jupyter.notebook.kernel != null) { - logging_1.logger.info("Registering Jupyter comms for target " + target); - var comm_manager = Jupyter.notebook.kernel.comm_manager; - try { - comm_manager.register_target(target, function (comm) { - logging_1.logger.info("Registering Jupyter comms for target " + target); - var r = new receiver_1.Receiver(); - comm.on_msg(_handle_notebook_comms.bind(doc, r)); - }); - } - catch (e) { - logging_1.logger.warn("Jupyter comms failed to register. push_notebook() will not function. (exception reported: " + e + ")"); - } - } - else if (doc.roots()[0].id in exports.kernels) { - logging_1.logger.info("Registering JupyterLab comms for target " + target); - var kernel = exports.kernels[doc.roots()[0].id]; - try { - kernel.registerCommTarget(target, function (comm) { - logging_1.logger.info("Registering JupyterLab comms for target " + target); - var r = new receiver_1.Receiver(); - comm.onMsg = _handle_notebook_comms.bind(doc, r); - }); - } - catch (e) { - logging_1.logger.warn("Jupyter comms failed to register. push_notebook() will not function. (exception reported: " + e + ")"); - } - } - else { - console.warn("Jupyter notebooks comms not available. push_notebook() will not function. If running JupyterLab ensure the latest jupyterlab_bokeh extension is installed. In an exported notebook this warning is expected."); - } - } - function embed_items_notebook(docs_json, render_items) { - if (object_1.size(docs_json) != 1) - throw new Error("embed_items_notebook expects exactly one document in docs_json"); - var document = document_1.Document.from_json(object_1.values(docs_json)[0]); - for (var _i = 0, render_items_1 = render_items; _i < render_items_1.length; _i++) { - var item = render_items_1[_i]; - if (item.notebook_comms_target != null) - _init_comms(item.notebook_comms_target, document); - var element = dom_1._resolve_element(item); - var roots = dom_1._resolve_root_elements(item); - standalone_1.add_document_standalone(document, element, roots); - } - } - exports.embed_items_notebook = embed_items_notebook; -} -, -/* embed/server */ function _(require, module, exports) { - var connection_1 = require(1) /* ../client/connection */; - var logging_1 = require(17) /* ../core/logging */; - var standalone_1 = require(59) /* ./standalone */; - // @internal - function _get_ws_url(app_path, absolute_url) { - var protocol = 'ws:'; - if (window.location.protocol == 'https:') - protocol = 'wss:'; - var loc; - if (absolute_url != null) { - loc = document.createElement('a'); - loc.href = absolute_url; - } - else - loc = window.location; - if (app_path != null) { - if (app_path == "/") - app_path = ""; - } - else - app_path = loc.pathname.replace(/\/+$/, ''); - return protocol + '//' + loc.host + app_path + '/ws'; - } - exports._get_ws_url = _get_ws_url; - // map { websocket url to map { session id to promise of ClientSession } } - var _sessions = {}; - function _get_session(websocket_url, session_id, args_string) { - if (!(websocket_url in _sessions)) - _sessions[websocket_url] = {}; - var subsessions = _sessions[websocket_url]; - if (!(session_id in subsessions)) - subsessions[session_id] = connection_1.pull_session(websocket_url, session_id, args_string); - return subsessions[session_id]; - } - // Fill element with the roots from session_id - function add_document_from_session(websocket_url, session_id, element, roots, use_for_title) { - if (roots === void 0) { - roots = {}; - } - if (use_for_title === void 0) { - use_for_title = false; - } - var args_string = window.location.search.substr(1); - var promise = _get_session(websocket_url, session_id, args_string); - return promise.then(function (session) { - return standalone_1.add_document_standalone(session.document, element, roots, use_for_title); - }, function (error) { - logging_1.logger.error("Failed to load Bokeh session " + session_id + ": " + error); - throw error; - }); - } - exports.add_document_from_session = add_document_from_session; -} -, -/* embed/standalone */ function _(require, module, exports) { - var document_1 = require(54) /* ../document */; - var dom_1 = require(5) /* ../core/dom */; - var dom_2 = require(55) /* ./dom */; - // A map from the root model IDs to their views. - exports.index = {}; - function _create_view(model) { - var view = new model.default_view({ model: model, parent: null }); - exports.index[model.id] = view; - return view; - } - function add_document_standalone(document, element, roots, use_for_title) { - if (roots === void 0) { - roots = {}; - } - if (use_for_title === void 0) { - use_for_title = false; - } - // this is a LOCAL index of views used only by this particular rendering - // call, so we can remove the views we create. - var views = {}; - function render_model(model) { - var root_el; - if (model.id in roots) - root_el = roots[model.id]; - else if (element.classList.contains(dom_2.BOKEH_ROOT)) - root_el = element; - else { - root_el = dom_1.div({ class: dom_2.BOKEH_ROOT }); - element.appendChild(root_el); - } - var view = _create_view(model); - view.renderTo(root_el); - views[model.id] = view; - } - function unrender_model(model) { - var id = model.id; - if (id in views) { - var view = views[id]; - view.remove(); - delete views[id]; - delete exports.index[id]; - } - } - for (var _i = 0, _a = document.roots(); _i < _a.length; _i++) { - var model = _a[_i]; - render_model(model); - } - if (use_for_title) - window.document.title = document.title(); - document.on_change(function (event) { - if (event instanceof document_1.RootAddedEvent) - render_model(event.model); - else if (event instanceof document_1.RootRemovedEvent) - unrender_model(event.model); - else if (use_for_title && event instanceof document_1.TitleChangedEvent) - window.document.title = event.title; - }); - return views; - } - exports.add_document_standalone = add_document_standalone; -} -, -/* index */ function _(require, module, exports) { - require(290) /* ./polyfill */; - var version_1 = require(296) /* ./version */; - exports.version = version_1.version; - var embed = require(56) /* ./embed */; - exports.embed = embed; - var embed_1 = require(56) /* ./embed */; - exports.index = embed_1.index; - var protocol = require(291) /* ./protocol */; - exports.protocol = protocol; - var _testing = require(295) /* ./testing */; - exports._testing = _testing; - var logging_1 = require(17) /* ./core/logging */; - exports.logger = logging_1.logger; - exports.set_log_level = logging_1.set_log_level; - var settings_1 = require(21) /* ./core/settings */; - exports.settings = settings_1.settings; - var base_1 = require(0) /* ./base */; - exports.Models = base_1.Models; - var document_1 = require(54) /* ./document */; - exports.documents = document_1.documents; - var safely_1 = require(294) /* ./safely */; - exports.safely = safely_1.safely; -} -, -/* main */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(60) /* ./index */, exports); -} -, -/* model */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var has_props_1 = require(8) /* ./core/has_props */; - var p = require(18) /* ./core/properties */; - var types_1 = require(46) /* ./core/util/types */; - var object_1 = require(35) /* ./core/util/object */; - var logging_1 = require(17) /* ./core/logging */; - var Model = /** @class */ (function (_super) { - tslib_1.__extends(Model, _super); - function Model(attrs) { - return _super.call(this, attrs) || this; - } - Model.initClass = function () { - this.prototype.type = "Model"; - this.define({ - tags: [p.Array, []], - name: [p.String], - js_property_callbacks: [p.Any, {}], - js_event_callbacks: [p.Any, {}], - subscribed_events: [p.Array, []], - }); - }; - Model.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - for (var base_evt in this.js_property_callbacks) { - var callbacks = this.js_property_callbacks[base_evt]; - var _a = base_evt.split(':'), evt = _a[0], _b = _a[1], attr = _b === void 0 ? null : _b; - var _loop_1 = function (cb) { - var signal = attr != null ? this_1.properties[attr][evt] : this_1[evt]; - this_1.connect(signal, function () { return cb.execute(_this); }); - }; - var this_1 = this; - for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { - var cb = callbacks_1[_i]; - _loop_1(cb); - } - } - this.connect(this.properties.js_event_callbacks.change, function () { return _this._update_event_callbacks(); }); - this.connect(this.properties.subscribed_events.change, function () { return _this._update_event_callbacks(); }); - }; - /*protected*/ Model.prototype._process_event = function (event) { - for (var _i = 0, _a = this.js_event_callbacks[event.event_name] || []; _i < _a.length; _i++) { - var callback = _a[_i]; - callback.execute(event); - } - if (this.document != null && this.subscribed_events.some(function (m) { return m == event.event_name; })) - this.document.event_manager.send_event(event); - }; - Model.prototype.trigger_event = function (event) { - if (this.document != null) { - event.origin = this; - this.document.event_manager.trigger(event); - } - }; - Model.prototype._update_event_callbacks = function () { - if (this.document == null) { - // File an issue: SidePanel in particular seems to have this issue - logging_1.logger.warn('WARNING: Document not defined for updating event callbacks'); - return; - } - this.document.event_manager.subscribed_models.add(this.id); - }; - Model.prototype._doc_attached = function () { - if (!object_1.isEmpty(this.js_event_callbacks) || !object_1.isEmpty(this.subscribed_events)) - this._update_event_callbacks(); - }; - Model.prototype.select = function (selector) { - if (types_1.isString(selector)) - return this.references().filter(function (ref) { return ref instanceof Model && ref.name === selector; }); - else if (selector.prototype instanceof has_props_1.HasProps) - return this.references().filter(function (ref) { return ref instanceof selector; }); - else - throw new Error("invalid selector"); - }; - Model.prototype.select_one = function (selector) { - var result = this.select(selector); - switch (result.length) { - case 0: - return null; - case 1: - return result[0]; - default: - throw new Error("found more than one object matching given selector"); - } - }; - return Model; - }(has_props_1.HasProps)); - exports.Model = Model; - Model.initClass(); -} -, -/* models/annotations/annotation */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var proj = require(36) /* ../../core/util/projections */; - var object_1 = require(35) /* ../../core/util/object */; - var renderer_1 = require(197) /* ../renderers/renderer */; - var AnnotationView = /** @class */ (function (_super) { - tslib_1.__extends(AnnotationView, _super); - function AnnotationView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(AnnotationView.prototype, "panel", { - get: function () { - return this.layout; - }, - enumerable: true, - configurable: true - }); - AnnotationView.prototype.get_size = function () { - if (this.model.visible) { - var _a = this._get_size(), width = _a.width, height = _a.height; - return { width: Math.round(width), height: Math.round(height) }; - } - else - return { width: 0, height: 0 }; - }; - AnnotationView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - var p = this.model.properties; - this.on_change(p.visible, function () { return _this.plot_view.request_layout(); }); - }; - AnnotationView.prototype._get_size = function () { - throw new Error("not implemented"); - }; - Object.defineProperty(AnnotationView.prototype, "ctx", { - get: function () { - return this.plot_view.canvas_view.ctx; - }, - enumerable: true, - configurable: true - }); - AnnotationView.prototype.set_data = function (source) { - var _a, _b; - var data = this.model.materialize_dataspecs(source); - object_1.extend(this, data); - if (this.plot_model.use_map) { - var self_1 = this; - if (self_1._x != null) - _a = proj.project_xy(self_1._x, self_1._y), self_1._x = _a[0], self_1._y = _a[1]; - if (self_1._xs != null) - _b = proj.project_xsys(self_1._xs, self_1._ys), self_1._xs = _b[0], self_1._ys = _b[1]; - } - }; - Object.defineProperty(AnnotationView.prototype, "needs_clip", { - get: function () { - return this.layout == null; // TODO: change this, when center layout is fully implemented - }, - enumerable: true, - configurable: true - }); - AnnotationView.prototype.serializable_state = function () { - var state = _super.prototype.serializable_state.call(this); - return this.layout == null ? state : tslib_1.__assign({}, state, { bbox: this.layout.bbox.rect }); - }; - return AnnotationView; - }(renderer_1.RendererView)); - exports.AnnotationView = AnnotationView; - var Annotation = /** @class */ (function (_super) { - tslib_1.__extends(Annotation, _super); - function Annotation(attrs) { - return _super.call(this, attrs) || this; - } - Annotation.initClass = function () { - this.prototype.type = 'Annotation'; - this.override({ - level: 'annotation', - }); - }; - return Annotation; - }(renderer_1.Renderer)); - exports.Annotation = Annotation; - Annotation.initClass(); -} -, -/* models/annotations/arrow */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var arrow_head_1 = require(65) /* ./arrow_head */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var p = require(18) /* ../../core/properties */; - var math_1 = require(34) /* ../../core/util/math */; - var ArrowView = /** @class */ (function (_super) { - tslib_1.__extends(ArrowView, _super); - function ArrowView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ArrowView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - if (this.model.source == null) - this.model.source = new column_data_source_1.ColumnDataSource(); - this.set_data(this.model.source); - }; - ArrowView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); }); - }; - ArrowView.prototype.set_data = function (source) { - _super.prototype.set_data.call(this, source); - this.visuals.warm_cache(source); - this.plot_view.request_render(); - }; - ArrowView.prototype._map_data = function () { - var frame = this.plot_view.frame; - var sx_start, sy_start; - if (this.model.start_units == 'data') { - sx_start = frame.xscales[this.model.x_range_name].v_compute(this._x_start); - sy_start = frame.yscales[this.model.y_range_name].v_compute(this._y_start); - } - else { - sx_start = frame.xview.v_compute(this._x_start); - sy_start = frame.yview.v_compute(this._y_start); - } - var sx_end, sy_end; - if (this.model.end_units == 'data') { - sx_end = frame.xscales[this.model.x_range_name].v_compute(this._x_end); - sy_end = frame.yscales[this.model.y_range_name].v_compute(this._y_end); - } - else { - sx_end = frame.xview.v_compute(this._x_end); - sy_end = frame.yview.v_compute(this._y_end); - } - return [[sx_start, sy_start], [sx_end, sy_end]]; - }; - ArrowView.prototype.render = function () { - if (!this.model.visible) - return; - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - // Order in this function is important. First we draw all the arrow heads. - var _a = this._map_data(), start = _a[0], end = _a[1]; - if (this.model.end != null) - this._arrow_head(ctx, "render", this.model.end, start, end); - if (this.model.start != null) - this._arrow_head(ctx, "render", this.model.start, end, start); - // Next we call .clip on all the arrow heads, inside an initial canvas sized - // rect, to create an "inverted" clip region for the arrow heads - ctx.beginPath(); - var _b = this.plot_view.layout.bbox.rect, x = _b.left, y = _b.top, width = _b.width, height = _b.height; - ctx.rect(x, y, width, height); - if (this.model.end != null) - this._arrow_head(ctx, "clip", this.model.end, start, end); - if (this.model.start != null) - this._arrow_head(ctx, "clip", this.model.start, end, start); - ctx.closePath(); - ctx.clip(); - // Finally we draw the arrow body, with the clipping regions set up. This prevents - // "fat" arrows from overlapping the arrow head in a bad way. - this._arrow_body(ctx, start, end); - ctx.restore(); - }; - ArrowView.prototype._arrow_head = function (ctx, action, head, start, end) { - for (var i = 0, _end = this._x_start.length; i < _end; i++) { - // arrow head runs orthogonal to arrow body - var angle = Math.PI / 2 + math_1.atan2([start[0][i], start[1][i]], [end[0][i], end[1][i]]); - ctx.save(); - ctx.translate(end[0][i], end[1][i]); - ctx.rotate(angle); - if (action == "render") - head.render(ctx, i); - else if (action == "clip") - head.clip(ctx, i); - ctx.restore(); - } - }; - ArrowView.prototype._arrow_body = function (ctx, start, end) { - if (!this.visuals.line.doit) - return; - for (var i = 0, n = this._x_start.length; i < n; i++) { - this.visuals.line.set_vectorize(ctx, i); - ctx.beginPath(); - ctx.moveTo(start[0][i], start[1][i]); - ctx.lineTo(end[0][i], end[1][i]); - ctx.stroke(); - } - }; - return ArrowView; - }(annotation_1.AnnotationView)); - exports.ArrowView = ArrowView; - var Arrow = /** @class */ (function (_super) { - tslib_1.__extends(Arrow, _super); - function Arrow(attrs) { - return _super.call(this, attrs) || this; - } - Arrow.initClass = function () { - this.prototype.type = 'Arrow'; - this.prototype.default_view = ArrowView; - this.mixins(['line']); - this.define({ - x_start: [p.NumberSpec,], - y_start: [p.NumberSpec,], - start_units: [p.SpatialUnits, 'data'], - start: [p.Instance, null], - x_end: [p.NumberSpec,], - y_end: [p.NumberSpec,], - end_units: [p.SpatialUnits, 'data'], - end: [p.Instance, function () { return new arrow_head_1.OpenHead({}); }], - source: [p.Instance], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - }; - return Arrow; - }(annotation_1.Annotation)); - exports.Arrow = Arrow; - Arrow.initClass(); -} -, -/* models/annotations/arrow_head */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var visuals_1 = require(51) /* ../../core/visuals */; - var p = require(18) /* ../../core/properties */; - var ArrowHead = /** @class */ (function (_super) { - tslib_1.__extends(ArrowHead, _super); - function ArrowHead(attrs) { - return _super.call(this, attrs) || this; - } - ArrowHead.initClass = function () { - this.prototype.type = 'ArrowHead'; - this.define({ - size: [p.Number, 25], - }); - }; - ArrowHead.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.visuals = new visuals_1.Visuals(this); - }; - return ArrowHead; - }(annotation_1.Annotation)); - exports.ArrowHead = ArrowHead; - ArrowHead.initClass(); - var OpenHead = /** @class */ (function (_super) { - tslib_1.__extends(OpenHead, _super); - function OpenHead(attrs) { - return _super.call(this, attrs) || this; - } - OpenHead.initClass = function () { - this.prototype.type = 'OpenHead'; - this.mixins(['line']); - }; - OpenHead.prototype.clip = function (ctx, i) { - // This method should not begin or close a path - this.visuals.line.set_vectorize(ctx, i); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.lineTo(0, 0); - ctx.lineTo(0.5 * this.size, this.size); - }; - OpenHead.prototype.render = function (ctx, i) { - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.beginPath(); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0, 0); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.stroke(); - } - }; - return OpenHead; - }(ArrowHead)); - exports.OpenHead = OpenHead; - OpenHead.initClass(); - var NormalHead = /** @class */ (function (_super) { - tslib_1.__extends(NormalHead, _super); - function NormalHead(attrs) { - return _super.call(this, attrs) || this; - } - NormalHead.initClass = function () { - this.prototype.type = 'NormalHead'; - this.mixins(['line', 'fill']); - this.override({ - fill_color: 'black', - }); - }; - NormalHead.prototype.clip = function (ctx, i) { - // This method should not begin or close a path - this.visuals.line.set_vectorize(ctx, i); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.lineTo(0.5 * this.size, this.size); - }; - NormalHead.prototype.render = function (ctx, i) { - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - this._normal(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - this._normal(ctx, i); - ctx.stroke(); - } - }; - NormalHead.prototype._normal = function (ctx, _i) { - ctx.beginPath(); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0, 0); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.closePath(); - }; - return NormalHead; - }(ArrowHead)); - exports.NormalHead = NormalHead; - NormalHead.initClass(); - var VeeHead = /** @class */ (function (_super) { - tslib_1.__extends(VeeHead, _super); - function VeeHead(attrs) { - return _super.call(this, attrs) || this; - } - VeeHead.initClass = function () { - this.prototype.type = 'VeeHead'; - this.mixins(['line', 'fill']); - this.override({ - fill_color: 'black', - }); - }; - VeeHead.prototype.clip = function (ctx, i) { - // This method should not begin or close a path - this.visuals.line.set_vectorize(ctx, i); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, -2); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.lineTo(0, 0.5 * this.size); - ctx.lineTo(0.5 * this.size, this.size); - }; - VeeHead.prototype.render = function (ctx, i) { - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - this._vee(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - this._vee(ctx, i); - ctx.stroke(); - } - }; - VeeHead.prototype._vee = function (ctx, _i) { - ctx.beginPath(); - ctx.moveTo(0.5 * this.size, this.size); - ctx.lineTo(0, 0); - ctx.lineTo(-0.5 * this.size, this.size); - ctx.lineTo(0, 0.5 * this.size); - ctx.closePath(); - }; - return VeeHead; - }(ArrowHead)); - exports.VeeHead = VeeHead; - VeeHead.initClass(); - var TeeHead = /** @class */ (function (_super) { - tslib_1.__extends(TeeHead, _super); - function TeeHead(attrs) { - return _super.call(this, attrs) || this; - } - TeeHead.initClass = function () { - this.prototype.type = 'TeeHead'; - this.mixins(['line']); - }; - TeeHead.prototype.render = function (ctx, i) { - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.beginPath(); - ctx.moveTo(0.5 * this.size, 0); - ctx.lineTo(-0.5 * this.size, 0); - ctx.stroke(); - } - }; - TeeHead.prototype.clip = function (_ctx, _i) { }; - return TeeHead; - }(ArrowHead)); - exports.TeeHead = TeeHead; - TeeHead.initClass(); -} -, -/* models/annotations/band */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var p = require(18) /* ../../core/properties */; - var BandView = /** @class */ (function (_super) { - tslib_1.__extends(BandView, _super); - function BandView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BandView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.set_data(this.model.source); - }; - BandView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.change, function () { return _this.set_data(_this.model.source); }); - }; - BandView.prototype.set_data = function (source) { - _super.prototype.set_data.call(this, source); - this.visuals.warm_cache(source); - this.plot_view.request_render(); - }; - BandView.prototype._map_data = function () { - var frame = this.plot_view.frame; - var dim = this.model.dimension; - var xscale = frame.xscales[this.model.x_range_name]; - var yscale = frame.yscales[this.model.y_range_name]; - var limit_scale = dim == "height" ? yscale : xscale; - var base_scale = dim == "height" ? xscale : yscale; - var limit_view = dim == "height" ? frame.yview : frame.xview; - var base_view = dim == "height" ? frame.xview : frame.yview; - var _lower_sx; - if (this.model.properties.lower.units == "data") - _lower_sx = limit_scale.v_compute(this._lower); - else - _lower_sx = limit_view.v_compute(this._lower); - var _upper_sx; - if (this.model.properties.upper.units == "data") - _upper_sx = limit_scale.v_compute(this._upper); - else - _upper_sx = limit_view.v_compute(this._upper); - var _base_sx; - if (this.model.properties.base.units == "data") - _base_sx = base_scale.v_compute(this._base); - else - _base_sx = base_view.v_compute(this._base); - var _a = dim == 'height' ? [1, 0] : [0, 1], i = _a[0], j = _a[1]; - var _lower = [_lower_sx, _base_sx]; - var _upper = [_upper_sx, _base_sx]; - this._lower_sx = _lower[i]; - this._lower_sy = _lower[j]; - this._upper_sx = _upper[i]; - this._upper_sy = _upper[j]; - }; - BandView.prototype.render = function () { - if (!this.model.visible) - return; - this._map_data(); - var ctx = this.plot_view.canvas_view.ctx; - // Draw the band body - ctx.beginPath(); - ctx.moveTo(this._lower_sx[0], this._lower_sy[0]); - for (var i = 0, end = this._lower_sx.length; i < end; i++) { - ctx.lineTo(this._lower_sx[i], this._lower_sy[i]); - } - // iterate backwards so that the upper end is below the lower start - for (var start = this._upper_sx.length - 1, i = start; i >= 0; i--) { - ctx.lineTo(this._upper_sx[i], this._upper_sy[i]); - } - ctx.closePath(); - if (this.visuals.fill.doit) { - this.visuals.fill.set_value(ctx); - ctx.fill(); - } - // Draw the lower band edge - ctx.beginPath(); - ctx.moveTo(this._lower_sx[0], this._lower_sy[0]); - for (var i = 0, end = this._lower_sx.length; i < end; i++) { - ctx.lineTo(this._lower_sx[i], this._lower_sy[i]); - } - if (this.visuals.line.doit) { - this.visuals.line.set_value(ctx); - ctx.stroke(); - } - // Draw the upper band edge - ctx.beginPath(); - ctx.moveTo(this._upper_sx[0], this._upper_sy[0]); - for (var i = 0, end = this._upper_sx.length; i < end; i++) { - ctx.lineTo(this._upper_sx[i], this._upper_sy[i]); - } - if (this.visuals.line.doit) { - this.visuals.line.set_value(ctx); - ctx.stroke(); - } - }; - return BandView; - }(annotation_1.AnnotationView)); - exports.BandView = BandView; - var Band = /** @class */ (function (_super) { - tslib_1.__extends(Band, _super); - function Band(attrs) { - return _super.call(this, attrs) || this; - } - Band.initClass = function () { - this.prototype.type = 'Band'; - this.prototype.default_view = BandView; - this.mixins(['line', 'fill']); - this.define({ - lower: [p.DistanceSpec], - upper: [p.DistanceSpec], - base: [p.DistanceSpec], - dimension: [p.Dimension, 'height'], - source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - fill_color: "#fff9ba", - fill_alpha: 0.4, - line_color: "#cccccc", - line_alpha: 0.3, - }); - }; - return Band; - }(annotation_1.Annotation)); - exports.Band = Band; - Band.initClass(); -} -, -/* models/annotations/box_annotation */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var signaling_1 = require(22) /* ../../core/signaling */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var bbox_1 = require(27) /* ../../core/util/bbox */; - exports.EDGE_TOLERANCE = 2.5; - var BoxAnnotationView = /** @class */ (function (_super) { - tslib_1.__extends(BoxAnnotationView, _super); - function BoxAnnotationView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxAnnotationView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.plot_view.canvas_overlays.appendChild(this.el); - this.el.classList.add("bk-shading"); - dom_1.undisplay(this.el); - }; - BoxAnnotationView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - // need to respond to either normal BB change events or silent - // "data only updates" that tools might want to use - if (this.model.render_mode == 'css') { - // dispatch CSS update immediately - this.connect(this.model.change, function () { return _this.render(); }); - this.connect(this.model.data_update, function () { return _this.render(); }); - } - else { - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.data_update, function () { return _this.plot_view.request_render(); }); - } - }; - BoxAnnotationView.prototype.render = function () { - var _this = this; - if (!this.model.visible && this.model.render_mode == 'css') - dom_1.undisplay(this.el); - if (!this.model.visible) - return; - // don't render if *all* position are null - if (this.model.left == null && this.model.right == null && this.model.top == null && this.model.bottom == null) { - dom_1.undisplay(this.el); - return; - } - var frame = this.plot_view.frame; - var xscale = frame.xscales[this.model.x_range_name]; - var yscale = frame.yscales[this.model.y_range_name]; - var _calc_dim = function (dim, dim_units, scale, view, frame_extrema) { - var sdim; - if (dim != null) { - if (_this.model.screen) - sdim = dim; - else { - if (dim_units == 'data') - sdim = scale.compute(dim); - else - sdim = view.compute(dim); - } - } - else - sdim = frame_extrema; - return sdim; - }; - this.sleft = _calc_dim(this.model.left, this.model.left_units, xscale, frame.xview, frame._left.value); - this.sright = _calc_dim(this.model.right, this.model.right_units, xscale, frame.xview, frame._right.value); - this.stop = _calc_dim(this.model.top, this.model.top_units, yscale, frame.yview, frame._top.value); - this.sbottom = _calc_dim(this.model.bottom, this.model.bottom_units, yscale, frame.yview, frame._bottom.value); - var draw = this.model.render_mode == 'css' ? this._css_box.bind(this) : this._canvas_box.bind(this); - draw(this.sleft, this.sright, this.sbottom, this.stop); - }; - BoxAnnotationView.prototype._css_box = function (sleft, sright, sbottom, stop) { - var line_width = this.model.properties.line_width.value(); - var sw = Math.floor(sright - sleft) - line_width; - var sh = Math.floor(sbottom - stop) - line_width; - this.el.style.left = sleft + "px"; - this.el.style.width = sw + "px"; - this.el.style.top = stop + "px"; - this.el.style.height = sh + "px"; - this.el.style.borderWidth = line_width + "px"; - this.el.style.borderColor = this.model.properties.line_color.value(); - this.el.style.backgroundColor = this.model.properties.fill_color.value(); - this.el.style.opacity = this.model.properties.fill_alpha.value(); - // try our best to honor line dashing in some way, if we can - var ld = this.model.properties.line_dash.value().length < 2 ? "solid" : "dashed"; - this.el.style.borderStyle = ld; - dom_1.display(this.el); - }; - BoxAnnotationView.prototype._canvas_box = function (sleft, sright, sbottom, stop) { - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - ctx.beginPath(); - ctx.rect(sleft, stop, sright - sleft, sbottom - stop); - this.visuals.fill.set_value(ctx); - ctx.fill(); - this.visuals.line.set_value(ctx); - ctx.stroke(); - ctx.restore(); - }; - BoxAnnotationView.prototype.interactive_bbox = function () { - var tol = this.model.properties.line_width.value() + exports.EDGE_TOLERANCE; - return new bbox_1.BBox({ - x0: this.sleft - tol, - y0: this.stop - tol, - x1: this.sright + tol, - y1: this.sbottom + tol, - }); - }; - BoxAnnotationView.prototype.interactive_hit = function (sx, sy) { - if (this.model.in_cursor == null) - return false; - var bbox = this.interactive_bbox(); - return bbox.contains(sx, sy); - }; - BoxAnnotationView.prototype.cursor = function (sx, sy) { - var tol = 3; - if (Math.abs(sx - this.sleft) < tol || Math.abs(sx - this.sright) < tol) - return this.model.ew_cursor; - else if (Math.abs(sy - this.sbottom) < tol || Math.abs(sy - this.stop) < tol) - return this.model.ns_cursor; - else if (sx > this.sleft && sx < this.sright && sy > this.stop && sy < this.sbottom) - return this.model.in_cursor; - else - return null; - }; - return BoxAnnotationView; - }(annotation_1.AnnotationView)); - exports.BoxAnnotationView = BoxAnnotationView; - var BoxAnnotation = /** @class */ (function (_super) { - tslib_1.__extends(BoxAnnotation, _super); - function BoxAnnotation(attrs) { - return _super.call(this, attrs) || this; - } - BoxAnnotation.initClass = function () { - this.prototype.type = 'BoxAnnotation'; - this.prototype.default_view = BoxAnnotationView; - this.mixins(['line', 'fill']); - this.define({ - render_mode: [p.RenderMode, 'canvas'], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - top: [p.Number, null], - top_units: [p.SpatialUnits, 'data'], - bottom: [p.Number, null], - bottom_units: [p.SpatialUnits, 'data'], - left: [p.Number, null], - left_units: [p.SpatialUnits, 'data'], - right: [p.Number, null], - right_units: [p.SpatialUnits, 'data'], - }); - this.internal({ - screen: [p.Boolean, false], - ew_cursor: [p.String, null], - ns_cursor: [p.String, null], - in_cursor: [p.String, null], - }); - this.override({ - fill_color: '#fff9ba', - fill_alpha: 0.4, - line_color: '#cccccc', - line_alpha: 0.3, - }); - }; - BoxAnnotation.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.data_update = new signaling_1.Signal0(this, "data_update"); - }; - BoxAnnotation.prototype.update = function (_a) { - var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom; - this.setv({ left: left, right: right, top: top, bottom: bottom, screen: true }, { silent: true }); - this.data_update.emit(); - }; - return BoxAnnotation; - }(annotation_1.Annotation)); - exports.BoxAnnotation = BoxAnnotation; - BoxAnnotation.initClass(); -} -, -/* models/annotations/color_bar */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var basic_ticker_1 = require(217) /* ../tickers/basic_ticker */; - var basic_tick_formatter_1 = require(107) /* ../formatters/basic_tick_formatter */; - var linear_color_mapper_1 = require(174) /* ../mappers/linear_color_mapper */; - var linear_scale_1 = require(200) /* ../scales/linear_scale */; - var log_scale_1 = require(201) /* ../scales/log_scale */; - var range1d_1 = require(191) /* ../ranges/range1d */; - var p = require(18) /* ../../core/properties */; - var text_util = require(43) /* ../../core/util/text */; - var array_1 = require(24) /* ../../core/util/array */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var object_1 = require(35) /* ../../core/util/object */; - var types_1 = require(46) /* ../../core/util/types */; - var SHORT_DIM = 25; - var LONG_DIM_MIN_SCALAR = 0.3; - var LONG_DIM_MAX_SCALAR = 0.8; - var ColorBarView = /** @class */ (function (_super) { - tslib_1.__extends(ColorBarView, _super); - function ColorBarView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ColorBarView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._set_canvas_image(); - }; - ColorBarView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.visible.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.ticker.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.formatter.change, function () { return _this.plot_view.request_render(); }); - if (this.model.color_mapper != null) { - this.connect(this.model.color_mapper.change, function () { - _this._set_canvas_image(); - _this.plot_view.request_render(); - }); - } - }; - ColorBarView.prototype._get_size = function () { - if (this.model.color_mapper == null) - return { width: 0, height: 0 }; - else { - var _a = this.compute_legend_dimensions(), width = _a.width, height = _a.height; - return { width: width, height: height }; - } - }; - ColorBarView.prototype._set_canvas_image = function () { - var _a, _b; - if (this.model.color_mapper == null) - return; - var palette = this.model.color_mapper.palette; - if (this.model.orientation == 'vertical') - palette = array_1.reversed(palette); - var w, h; - switch (this.model.orientation) { - case "vertical": { - _a = [1, palette.length], w = _a[0], h = _a[1]; - break; - } - case "horizontal": { - _b = [palette.length, 1], w = _b[0], h = _b[1]; - break; - } - default: - throw new Error("unreachable code"); - } - var canvas = document.createElement('canvas'); - canvas.width = w; - canvas.height = h; - var image_ctx = canvas.getContext('2d'); - var image_data = image_ctx.getImageData(0, 0, w, h); - // We always want to draw the entire palette linearly, so we create a new - // LinearColorMapper instance and map a monotonic range of values with - // length = palette.length to get each palette color in order. - var cmap = new linear_color_mapper_1.LinearColorMapper({ palette: palette }).rgba_mapper; - var buf8 = cmap.v_compute(array_1.range(0, palette.length)); - image_data.data.set(buf8); - image_ctx.putImageData(image_data, 0, 0); - this.image = canvas; - }; - ColorBarView.prototype.compute_legend_dimensions = function () { - var image_dimensions = this._computed_image_dimensions(); - var _a = [image_dimensions.height, image_dimensions.width], image_height = _a[0], image_width = _a[1]; - var label_extent = this._get_label_extent(); - var title_extent = this._title_extent(); - var tick_extent = this._tick_extent(); - var padding = this.model.padding; - var legend_height, legend_width; - switch (this.model.orientation) { - case "vertical": - legend_height = image_height + title_extent + 2 * padding; - legend_width = image_width + tick_extent + label_extent + 2 * padding; - break; - case "horizontal": - legend_height = image_height + title_extent + tick_extent + label_extent + 2 * padding; - legend_width = image_width + 2 * padding; - break; - default: - throw new Error("unreachable code"); - } - return { width: legend_width, height: legend_height }; - }; - ColorBarView.prototype.compute_legend_location = function () { - var legend_dimensions = this.compute_legend_dimensions(); - var _a = [legend_dimensions.height, legend_dimensions.width], legend_height = _a[0], legend_width = _a[1]; - var legend_margin = this.model.margin; - var panel = this.panel != null ? this.panel : this.plot_view.frame; - var _b = panel.bbox.ranges, hr = _b[0], vr = _b[1]; - var location = this.model.location; - var sx, sy; - if (types_1.isString(location)) { - switch (location) { - case 'top_left': - sx = hr.start + legend_margin; - sy = vr.start + legend_margin; - break; - case 'top_center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = vr.start + legend_margin; - break; - case 'top_right': - sx = hr.end - legend_margin - legend_width; - sy = vr.start + legend_margin; - break; - case 'bottom_right': - sx = hr.end - legend_margin - legend_width; - sy = vr.end - legend_margin - legend_height; - break; - case 'bottom_center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = vr.end - legend_margin - legend_height; - break; - case 'bottom_left': - sx = hr.start + legend_margin; - sy = vr.end - legend_margin - legend_height; - break; - case 'center_left': - sx = hr.start + legend_margin; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - case 'center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - case 'center_right': - sx = hr.end - legend_margin - legend_width; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - default: - throw new Error("unreachable code"); - } - } - else if (types_1.isArray(location) && location.length == 2) { - var vx = location[0], vy = location[1]; - sx = panel.xview.compute(vx); - sy = panel.yview.compute(vy) - legend_height; - } - else - throw new Error("unreachable code"); - return { sx: sx, sy: sy }; - }; - ColorBarView.prototype.render = function () { - if (!this.model.visible || this.model.color_mapper == null) - return; - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - var _a = this.compute_legend_location(), sx = _a.sx, sy = _a.sy; - ctx.translate(sx, sy); - this._draw_bbox(ctx); - var image_offset = this._get_image_offset(); - ctx.translate(image_offset.x, image_offset.y); - this._draw_image(ctx); - if (this.model.color_mapper.low != null && this.model.color_mapper.high != null) { - var tick_info = this.tick_info(); - this._draw_major_ticks(ctx, tick_info); - this._draw_minor_ticks(ctx, tick_info); - this._draw_major_labels(ctx, tick_info); - } - if (this.model.title) - this._draw_title(ctx); - ctx.restore(); - }; - ColorBarView.prototype._draw_bbox = function (ctx) { - var bbox = this.compute_legend_dimensions(); - ctx.save(); - if (this.visuals.background_fill.doit) { - this.visuals.background_fill.set_value(ctx); - ctx.fillRect(0, 0, bbox.width, bbox.height); - } - if (this.visuals.border_line.doit) { - this.visuals.border_line.set_value(ctx); - ctx.strokeRect(0, 0, bbox.width, bbox.height); - } - ctx.restore(); - }; - ColorBarView.prototype._draw_image = function (ctx) { - var image = this._computed_image_dimensions(); - ctx.save(); - ctx.setImageSmoothingEnabled(false); - ctx.globalAlpha = this.model.scale_alpha; - ctx.drawImage(this.image, 0, 0, image.width, image.height); - if (this.visuals.bar_line.doit) { - this.visuals.bar_line.set_value(ctx); - ctx.strokeRect(0, 0, image.width, image.height); - } - ctx.restore(); - }; - ColorBarView.prototype._draw_major_ticks = function (ctx, tick_info) { - if (!this.visuals.major_tick_line.doit) - return; - var _a = this._normals(), nx = _a[0], ny = _a[1]; - var image = this._computed_image_dimensions(); - var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1]; - var _c = tick_info.coords.major, sx = _c[0], sy = _c[1]; - var tin = this.model.major_tick_in; - var tout = this.model.major_tick_out; - ctx.save(); - ctx.translate(x_offset, y_offset); - this.visuals.major_tick_line.set_value(ctx); - for (var i = 0, end = sx.length; i < end; i++) { - ctx.beginPath(); - ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout)); - ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin)); - ctx.stroke(); - } - ctx.restore(); - }; - ColorBarView.prototype._draw_minor_ticks = function (ctx, tick_info) { - if (!this.visuals.minor_tick_line.doit) - return; - var _a = this._normals(), nx = _a[0], ny = _a[1]; - var image = this._computed_image_dimensions(); - var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1]; - var _c = tick_info.coords.minor, sx = _c[0], sy = _c[1]; - var tin = this.model.minor_tick_in; - var tout = this.model.minor_tick_out; - ctx.save(); - ctx.translate(x_offset, y_offset); - this.visuals.minor_tick_line.set_value(ctx); - for (var i = 0, end = sx.length; i < end; i++) { - ctx.beginPath(); - ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout)); - ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin)); - ctx.stroke(); - } - ctx.restore(); - }; - ColorBarView.prototype._draw_major_labels = function (ctx, tick_info) { - if (!this.visuals.major_label_text.doit) - return; - var _a = this._normals(), nx = _a[0], ny = _a[1]; - var image = this._computed_image_dimensions(); - var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1]; - var standoff = (this.model.label_standoff + this._tick_extent()); - var _c = [standoff * nx, standoff * ny], x_standoff = _c[0], y_standoff = _c[1]; - var _d = tick_info.coords.major, sx = _d[0], sy = _d[1]; - var formatted_labels = tick_info.labels.major; - this.visuals.major_label_text.set_value(ctx); - ctx.save(); - ctx.translate(x_offset + x_standoff, y_offset + y_standoff); - for (var i = 0, end = sx.length; i < end; i++) { - ctx.fillText(formatted_labels[i], Math.round(sx[i] + nx * this.model.label_standoff), Math.round(sy[i] + ny * this.model.label_standoff)); - } - ctx.restore(); - }; - ColorBarView.prototype._draw_title = function (ctx) { - if (!this.visuals.title_text.doit) - return; - ctx.save(); - this.visuals.title_text.set_value(ctx); - ctx.fillText(this.model.title, 0, -this.model.title_standoff); - ctx.restore(); - }; - /*protected*/ ColorBarView.prototype._get_label_extent = function () { - var major_labels = this.tick_info().labels.major; - var label_extent; - if (this.model.color_mapper.low != null && this.model.color_mapper.high != null && !object_1.isEmpty(major_labels)) { - var ctx_1 = this.plot_view.canvas_view.ctx; - ctx_1.save(); - this.visuals.major_label_text.set_value(ctx_1); - switch (this.model.orientation) { - case "vertical": - label_extent = array_1.max((major_labels.map(function (label) { return ctx_1.measureText(label.toString()).width; }))); - break; - case "horizontal": - label_extent = text_util.measure_font(this.visuals.major_label_text.font_value()).height; - break; - default: - throw new Error("unreachable code"); - } - label_extent += this.model.label_standoff; - ctx_1.restore(); - } - else - label_extent = 0; - return label_extent; - }; - /*protected*/ ColorBarView.prototype._get_image_offset = function () { - // Returns image offset relative to legend bounding box - var x = this.model.padding; - var y = this.model.padding + this._title_extent(); - return { x: x, y: y }; - }; - // {{{ TODO: state - ColorBarView.prototype._normals = function () { - return this.model.orientation == 'vertical' ? [1, 0] : [0, 1]; - }; - ColorBarView.prototype._title_extent = function () { - var font_value = this.model.title_text_font + " " + this.model.title_text_font_size + " " + this.model.title_text_font_style; - var title_extent = this.model.title ? text_util.measure_font(font_value).height + this.model.title_standoff : 0; - return title_extent; - }; - ColorBarView.prototype._tick_extent = function () { - if (this.model.color_mapper.low != null && this.model.color_mapper.high != null) - return array_1.max([this.model.major_tick_out, this.model.minor_tick_out]); - else - return 0; - }; - ColorBarView.prototype._computed_image_dimensions = function () { - /* - Heuristics to determine ColorBar image dimensions if set to "auto" - - Note: Returns the height/width values for the ColorBar's scale image, not - the dimensions of the entire ColorBar. - - If the short dimension (the width of a vertical bar or height of a - horizontal bar) is set to "auto", the resulting dimension will be set to - 25 px. - - For a ColorBar in a side panel with the long dimension (the height of a - vertical bar or width of a horizontal bar) set to "auto", the - resulting dimension will be as long as the adjacent frame edge, so that the - bar "fits" to the plot. - - For a ColorBar in the plot frame with the long dimension set to "auto", the - resulting dimension will be the greater of: - * The length of the color palette * 25px - * The parallel frame dimension * 0.30 - (i.e the frame height for a vertical ColorBar) - But not greater than: - * The parallel frame dimension * 0.80 - */ - var frame_height = this.plot_view.frame._height.value; - var frame_width = this.plot_view.frame._width.value; - var title_extent = this._title_extent(); - var height, width; - switch (this.model.orientation) { - case "vertical": { - if (this.model.height == 'auto') { - if (this.panel != null) - height = frame_height - 2 * this.model.padding - title_extent; - else { - height = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_height * LONG_DIM_MIN_SCALAR]); - height = array_1.min([height, frame_height * LONG_DIM_MAX_SCALAR - 2 * this.model.padding - title_extent]); - } - } - else - height = this.model.height; - width = this.model.width == 'auto' ? SHORT_DIM : this.model.width; - break; - } - case "horizontal": { - height = this.model.height == 'auto' ? SHORT_DIM : this.model.height; - if (this.model.width == 'auto') { - if (this.panel != null) - width = frame_width - 2 * this.model.padding; - else { - width = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_width * LONG_DIM_MIN_SCALAR]); - width = array_1.min([width, frame_width * LONG_DIM_MAX_SCALAR - 2 * this.model.padding]); - } - } - else - width = this.model.width; - break; - } - default: - throw new Error("unreachable code"); - } - return { width: width, height: height }; - }; - /*protected*/ ColorBarView.prototype._tick_coordinate_scale = function (scale_length) { - /* - Creates and returns a scale instance that maps the `color_mapper` range - (low to high) to a screen space range equal to the length of the ColorBar's - scale image. The scale is used to calculate the tick coordinates in screen - coordinates for plotting purposes. - - Note: the type of color_mapper has to match the type of scale (i.e. - a LinearColorMapper will require a corresponding LinearScale instance). - */ - var ranges = { - source_range: new range1d_1.Range1d({ - start: this.model.color_mapper.low, - end: this.model.color_mapper.high, - }), - target_range: new range1d_1.Range1d({ - start: 0, - end: scale_length, - }), - }; - switch (this.model.color_mapper.type) { - case "LinearColorMapper": return new linear_scale_1.LinearScale(ranges); - case "LogColorMapper": return new log_scale_1.LogScale(ranges); - default: - throw new Error("unreachable code"); - } - }; - ColorBarView.prototype._format_major_labels = function (initial_labels, major_ticks) { - // XXX: passing null as cross_loc probably means MercatorTickFormatters, etc - // will not function properly in conjunction with colorbars - var formatted_labels = this.model.formatter.doFormat(initial_labels, null); - for (var i = 0, end = major_ticks.length; i < end; i++) { - if (major_ticks[i] in this.model.major_label_overrides) - formatted_labels[i] = this.model.major_label_overrides[major_ticks[i]]; - } - return formatted_labels; - }; - ColorBarView.prototype.tick_info = function () { - var image_dimensions = this._computed_image_dimensions(); - var scale_length; - switch (this.model.orientation) { - case "vertical": { - scale_length = image_dimensions.height; - break; - } - case "horizontal": { - scale_length = image_dimensions.width; - break; - } - default: - throw new Error("unreachable code"); - } - var scale = this._tick_coordinate_scale(scale_length); - var _a = this._normals(), i = _a[0], j = _a[1]; - var _b = [this.model.color_mapper.low, this.model.color_mapper.high], start = _b[0], end = _b[1]; - // XXX: passing null as cross_loc probably means MercatorTickers, etc - // will not function properly in conjunction with colorbars - var ticks = this.model.ticker.get_ticks(start, end, null, null, this.model.ticker.desired_num_ticks); - var majors = ticks.major; - var minors = ticks.minor; - var major_coords = [[], []]; - var minor_coords = [[], []]; - for (var ii = 0, _end = majors.length; ii < _end; ii++) { - if (majors[ii] < start || majors[ii] > end) - continue; - major_coords[i].push(majors[ii]); - major_coords[j].push(0); - } - for (var ii = 0, _end = minors.length; ii < _end; ii++) { - if (minors[ii] < start || minors[ii] > end) - continue; - minor_coords[i].push(minors[ii]); - minor_coords[j].push(0); - } - var labels = { major: this._format_major_labels(major_coords[i], majors) }; - var coords = { - major: [[], []], - minor: [[], []], - }; - coords.major[i] = scale.v_compute(major_coords[i]); - coords.minor[i] = scale.v_compute(minor_coords[i]); - coords.major[j] = major_coords[j]; - coords.minor[j] = minor_coords[j]; - // Because we want the scale to be reversed - if (this.model.orientation == 'vertical') { - coords.major[i] = arrayable_1.map(coords.major[i], function (coord) { return scale_length - coord; }); - coords.minor[i] = arrayable_1.map(coords.minor[i], function (coord) { return scale_length - coord; }); - } - return { coords: coords, labels: labels }; - }; - return ColorBarView; - }(annotation_1.AnnotationView)); - exports.ColorBarView = ColorBarView; - var ColorBar = /** @class */ (function (_super) { - tslib_1.__extends(ColorBar, _super); - function ColorBar(attrs) { - return _super.call(this, attrs) || this; - } - ColorBar.initClass = function () { - this.prototype.type = 'ColorBar'; - this.prototype.default_view = ColorBarView; - this.mixins([ - 'text:major_label_', - 'text:title_', - 'line:major_tick_', - 'line:minor_tick_', - 'line:border_', - 'line:bar_', - 'fill:background_', - ]); - this.define({ - location: [p.Any, 'top_right'], - orientation: [p.Orientation, 'vertical'], - title: [p.String,], - title_standoff: [p.Number, 2], - width: [p.Any, 'auto'], - height: [p.Any, 'auto'], - scale_alpha: [p.Number, 1.0], - ticker: [p.Instance, function () { return new basic_ticker_1.BasicTicker(); }], - formatter: [p.Instance, function () { return new basic_tick_formatter_1.BasicTickFormatter(); }], - major_label_overrides: [p.Any, {}], - color_mapper: [p.Instance], - label_standoff: [p.Number, 5], - margin: [p.Number, 30], - padding: [p.Number, 10], - major_tick_in: [p.Number, 5], - major_tick_out: [p.Number, 0], - minor_tick_in: [p.Number, 0], - minor_tick_out: [p.Number, 0], - }); - this.override({ - background_fill_color: "#ffffff", - background_fill_alpha: 0.95, - bar_line_color: null, - border_line_color: null, - major_label_text_align: "center", - major_label_text_baseline: "middle", - major_label_text_font_size: "8pt", - major_tick_line_color: "#ffffff", - minor_tick_line_color: null, - title_text_font_size: "10pt", - title_text_font_style: "italic", - }); - }; - return ColorBar; - }(annotation_1.Annotation)); - exports.ColorBar = ColorBar; - ColorBar.initClass(); -} -, -/* models/annotations/index */ function _(require, module, exports) { - var annotation_1 = require(63) /* ./annotation */; - exports.Annotation = annotation_1.Annotation; - var arrow_1 = require(64) /* ./arrow */; - exports.Arrow = arrow_1.Arrow; - var arrow_head_1 = require(65) /* ./arrow_head */; - exports.ArrowHead = arrow_head_1.ArrowHead; - var arrow_head_2 = require(65) /* ./arrow_head */; - exports.OpenHead = arrow_head_2.OpenHead; - var arrow_head_3 = require(65) /* ./arrow_head */; - exports.NormalHead = arrow_head_3.NormalHead; - var arrow_head_4 = require(65) /* ./arrow_head */; - exports.TeeHead = arrow_head_4.TeeHead; - var arrow_head_5 = require(65) /* ./arrow_head */; - exports.VeeHead = arrow_head_5.VeeHead; - var band_1 = require(66) /* ./band */; - exports.Band = band_1.Band; - var box_annotation_1 = require(67) /* ./box_annotation */; - exports.BoxAnnotation = box_annotation_1.BoxAnnotation; - var color_bar_1 = require(68) /* ./color_bar */; - exports.ColorBar = color_bar_1.ColorBar; - var label_1 = require(70) /* ./label */; - exports.Label = label_1.Label; - var label_set_1 = require(71) /* ./label_set */; - exports.LabelSet = label_set_1.LabelSet; - var legend_1 = require(72) /* ./legend */; - exports.Legend = legend_1.Legend; - var legend_item_1 = require(73) /* ./legend_item */; - exports.LegendItem = legend_item_1.LegendItem; - var poly_annotation_1 = require(74) /* ./poly_annotation */; - exports.PolyAnnotation = poly_annotation_1.PolyAnnotation; - var slope_1 = require(75) /* ./slope */; - exports.Slope = slope_1.Slope; - var span_1 = require(76) /* ./span */; - exports.Span = span_1.Span; - var text_annotation_1 = require(77) /* ./text_annotation */; - exports.TextAnnotation = text_annotation_1.TextAnnotation; - var title_1 = require(78) /* ./title */; - exports.Title = title_1.Title; - var toolbar_panel_1 = require(79) /* ./toolbar_panel */; - exports.ToolbarPanel = toolbar_panel_1.ToolbarPanel; - var tooltip_1 = require(80) /* ./tooltip */; - exports.Tooltip = tooltip_1.Tooltip; - var whisker_1 = require(81) /* ./whisker */; - exports.Whisker = whisker_1.Whisker; -} -, -/* models/annotations/label */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var text_annotation_1 = require(77) /* ./text_annotation */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var LabelView = /** @class */ (function (_super) { - tslib_1.__extends(LabelView, _super); - function LabelView() { - return _super !== null && _super.apply(this, arguments) || this; - } - LabelView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.visuals.warm_cache(); - }; - LabelView.prototype._get_size = function () { - var ctx = this.plot_view.canvas_view.ctx; - this.visuals.text.set_value(ctx); - var _a = ctx.measureText(this.model.text), width = _a.width, ascent = _a.ascent; - return { width: width, height: ascent }; - }; - LabelView.prototype.render = function () { - if (!this.model.visible && this.model.render_mode == 'css') - dom_1.undisplay(this.el); - if (!this.model.visible) - return; - // Here because AngleSpec does units tranform and label doesn't support specs - var angle; - switch (this.model.angle_units) { - case "rad": { - angle = -this.model.angle; - break; - } - case "deg": { - angle = (-this.model.angle * Math.PI) / 180.0; - break; - } - default: - throw new Error("unreachable code"); - } - var panel = this.panel != null ? this.panel : this.plot_view.frame; - var xscale = this.plot_view.frame.xscales[this.model.x_range_name]; - var yscale = this.plot_view.frame.yscales[this.model.y_range_name]; - var sx = this.model.x_units == "data" ? xscale.compute(this.model.x) : panel.xview.compute(this.model.x); - var sy = this.model.y_units == "data" ? yscale.compute(this.model.y) : panel.yview.compute(this.model.y); - sx += this.model.x_offset; - sy -= this.model.y_offset; - var draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this); - draw(this.plot_view.canvas_view.ctx, this.model.text, sx, sy, angle); - }; - return LabelView; - }(text_annotation_1.TextAnnotationView)); - exports.LabelView = LabelView; - var Label = /** @class */ (function (_super) { - tslib_1.__extends(Label, _super); - function Label(attrs) { - return _super.call(this, attrs) || this; - } - Label.initClass = function () { - this.prototype.type = 'Label'; - this.prototype.default_view = LabelView; - this.mixins(['text', 'line:border_', 'fill:background_']); - this.define({ - x: [p.Number,], - x_units: [p.SpatialUnits, 'data'], - y: [p.Number,], - y_units: [p.SpatialUnits, 'data'], - text: [p.String,], - angle: [p.Angle, 0], - angle_units: [p.AngleUnits, 'rad'], - x_offset: [p.Number, 0], - y_offset: [p.Number, 0], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - background_fill_color: null, - border_line_color: null, - }); - }; - return Label; - }(text_annotation_1.TextAnnotation)); - exports.Label = Label; - Label.initClass(); -} -, -/* models/annotations/label_set */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var text_annotation_1 = require(77) /* ./text_annotation */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var LabelSetView = /** @class */ (function (_super) { - tslib_1.__extends(LabelSetView, _super); - function LabelSetView() { - return _super !== null && _super.apply(this, arguments) || this; - } - LabelSetView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.set_data(this.model.source); - if (this.model.render_mode == 'css') { - for (var i = 0, end = this._text.length; i < end; i++) { - var el = dom_1.div({ class: 'bk-annotation-child', style: { display: "none" } }); - this.el.appendChild(el); - } - } - }; - LabelSetView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - if (this.model.render_mode == 'css') { - // dispatch CSS update immediately - this.connect(this.model.change, function () { - _this.set_data(_this.model.source); - _this.render(); - }); - this.connect(this.model.source.streaming, function () { - _this.set_data(_this.model.source); - _this.render(); - }); - this.connect(this.model.source.patching, function () { - _this.set_data(_this.model.source); - _this.render(); - }); - this.connect(this.model.source.change, function () { - _this.set_data(_this.model.source); - _this.render(); - }); - } - else { - this.connect(this.model.change, function () { - _this.set_data(_this.model.source); - _this.plot_view.request_render(); - }); - this.connect(this.model.source.streaming, function () { - _this.set_data(_this.model.source); - _this.plot_view.request_render(); - }); - this.connect(this.model.source.patching, function () { - _this.set_data(_this.model.source); - _this.plot_view.request_render(); - }); - this.connect(this.model.source.change, function () { - _this.set_data(_this.model.source); - _this.plot_view.request_render(); - }); - } - }; - LabelSetView.prototype.set_data = function (source) { - _super.prototype.set_data.call(this, source); - this.visuals.warm_cache(source); - }; - LabelSetView.prototype._map_data = function () { - var xscale = this.plot_view.frame.xscales[this.model.x_range_name]; - var yscale = this.plot_view.frame.yscales[this.model.y_range_name]; - var panel = this.panel != null ? this.panel : this.plot_view.frame; - var sx = this.model.x_units == "data" ? xscale.v_compute(this._x) : panel.xview.v_compute(this._x); - var sy = this.model.y_units == "data" ? yscale.v_compute(this._y) : panel.yview.v_compute(this._y); - return [sx, sy]; - }; - LabelSetView.prototype.render = function () { - if (!this.model.visible && this.model.render_mode == 'css') - dom_1.undisplay(this.el); - if (!this.model.visible) - return; - var draw = this.model.render_mode == 'canvas' ? this._v_canvas_text.bind(this) : this._v_css_text.bind(this); - var ctx = this.plot_view.canvas_view.ctx; - var _a = this._map_data(), sx = _a[0], sy = _a[1]; - for (var i = 0, end = this._text.length; i < end; i++) { - draw(ctx, i, this._text[i], sx[i] + this._x_offset[i], sy[i] - this._y_offset[i], this._angle[i]); - } - }; - LabelSetView.prototype._get_size = function () { - var ctx = this.plot_view.canvas_view.ctx; - this.visuals.text.set_value(ctx); - var _a = ctx.measureText(this._text[0]), width = _a.width, ascent = _a.ascent; - return { width: width, height: ascent }; - }; - LabelSetView.prototype._v_canvas_text = function (ctx, i, text, sx, sy, angle) { - this.visuals.text.set_vectorize(ctx, i); - var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text); - ctx.save(); - ctx.beginPath(); - ctx.translate(sx, sy); - ctx.rotate(angle); - ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]); - if (this.visuals.background_fill.doit) { - this.visuals.background_fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.border_line.doit) { - this.visuals.border_line.set_vectorize(ctx, i); - ctx.stroke(); - } - if (this.visuals.text.doit) { - this.visuals.text.set_vectorize(ctx, i); - ctx.fillText(text, 0, 0); - } - ctx.restore(); - }; - LabelSetView.prototype._v_css_text = function (ctx, i, text, sx, sy, angle) { - var el = this.el.children[i]; - el.textContent = text; - this.visuals.text.set_vectorize(ctx, i); - var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text); - // attempt to support vector-style ("8 4 8") line dashing for css mode - var ld = this.visuals.border_line.line_dash.value(); - var line_dash = ld.length < 2 ? "solid" : "dashed"; - this.visuals.border_line.set_vectorize(ctx, i); - this.visuals.background_fill.set_vectorize(ctx, i); - el.style.position = 'absolute'; - el.style.left = sx + bbox_dims[0] + "px"; - el.style.top = sy + bbox_dims[1] + "px"; - el.style.color = "" + this.visuals.text.text_color.value(); - el.style.opacity = "" + this.visuals.text.text_alpha.value(); - el.style.font = "" + this.visuals.text.font_value(); - el.style.lineHeight = "normal"; // needed to prevent ipynb css override - if (angle) { - el.style.transform = "rotate(" + angle + "rad)"; - } - if (this.visuals.background_fill.doit) { - el.style.backgroundColor = "" + this.visuals.background_fill.color_value(); - } - if (this.visuals.border_line.doit) { - el.style.borderStyle = "" + line_dash; - el.style.borderWidth = this.visuals.border_line.line_width.value() + "px"; - el.style.borderColor = "" + this.visuals.border_line.color_value(); - } - dom_1.display(el); - }; - return LabelSetView; - }(text_annotation_1.TextAnnotationView)); - exports.LabelSetView = LabelSetView; - var LabelSet = /** @class */ (function (_super) { - tslib_1.__extends(LabelSet, _super); - function LabelSet(attrs) { - return _super.call(this, attrs) || this; - } - LabelSet.initClass = function () { - this.prototype.type = 'LabelSet'; - this.prototype.default_view = LabelSetView; - this.mixins(['text', 'line:border_', 'fill:background_']); - this.define({ - x: [p.NumberSpec], - y: [p.NumberSpec], - x_units: [p.SpatialUnits, 'data'], - y_units: [p.SpatialUnits, 'data'], - text: [p.StringSpec, { field: "text" }], - angle: [p.AngleSpec, 0], - x_offset: [p.NumberSpec, { value: 0 }], - y_offset: [p.NumberSpec, { value: 0 }], - source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - background_fill_color: null, - border_line_color: null, - }); - }; - return LabelSet; - }(text_annotation_1.TextAnnotation)); - exports.LabelSet = LabelSet; - LabelSet.initClass(); -} -, -/* models/annotations/legend */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var p = require(18) /* ../../core/properties */; - var signaling_1 = require(22) /* ../../core/signaling */; - var text_1 = require(43) /* ../../core/util/text */; - var bbox_1 = require(27) /* ../../core/util/bbox */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var types_1 = require(46) /* ../../core/util/types */; - var LegendView = /** @class */ (function (_super) { - tslib_1.__extends(LegendView, _super); - function LegendView() { - return _super !== null && _super.apply(this, arguments) || this; - } - LegendView.prototype.cursor = function (_sx, _sy) { - return this.model.click_policy == "none" ? null : "pointer"; - }; - Object.defineProperty(LegendView.prototype, "legend_padding", { - get: function () { - return this.visuals.border_line.line_color.value() != null ? this.model.padding : 0; - }, - enumerable: true, - configurable: true - }); - LegendView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.item_change, function () { return _this.plot_view.request_render(); }); - }; - LegendView.prototype.compute_legend_bbox = function () { - var legend_names = this.model.get_legend_names(); - var _a = this.model, glyph_height = _a.glyph_height, glyph_width = _a.glyph_width; - var _b = this.model, label_height = _b.label_height, label_width = _b.label_width; - this.max_label_height = array_1.max([text_1.measure_font(this.visuals.label_text.font_value()).height, label_height, glyph_height]); - // this is to measure text properties - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - this.visuals.label_text.set_value(ctx); - this.text_widths = {}; - for (var _i = 0, legend_names_1 = legend_names; _i < legend_names_1.length; _i++) { - var name_1 = legend_names_1[_i]; - this.text_widths[name_1] = array_1.max([ctx.measureText(name_1).width, label_width]); - } - ctx.restore(); - var max_label_width = Math.max(array_1.max(object_1.values(this.text_widths)), 0); - var legend_margin = this.model.margin; - var legend_padding = this.legend_padding; - var legend_spacing = this.model.spacing; - var label_standoff = this.model.label_standoff; - var legend_height, legend_width; - if (this.model.orientation == "vertical") { - legend_height = legend_names.length * this.max_label_height + Math.max(legend_names.length - 1, 0) * legend_spacing + 2 * legend_padding; - legend_width = max_label_width + glyph_width + label_standoff + 2 * legend_padding; - } - else { - legend_width = 2 * legend_padding + Math.max(legend_names.length - 1, 0) * legend_spacing; - for (var name_2 in this.text_widths) { - var width = this.text_widths[name_2]; - legend_width += array_1.max([width, label_width]) + glyph_width + label_standoff; - } - legend_height = this.max_label_height + 2 * legend_padding; - } - var panel = this.panel != null ? this.panel : this.plot_view.frame; - var _c = panel.bbox.ranges, hr = _c[0], vr = _c[1]; - var location = this.model.location; - var sx, sy; - if (types_1.isString(location)) { - switch (location) { - case 'top_left': - sx = hr.start + legend_margin; - sy = vr.start + legend_margin; - break; - case 'top_center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = vr.start + legend_margin; - break; - case 'top_right': - sx = hr.end - legend_margin - legend_width; - sy = vr.start + legend_margin; - break; - case 'bottom_right': - sx = hr.end - legend_margin - legend_width; - sy = vr.end - legend_margin - legend_height; - break; - case 'bottom_center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = vr.end - legend_margin - legend_height; - break; - case 'bottom_left': - sx = hr.start + legend_margin; - sy = vr.end - legend_margin - legend_height; - break; - case 'center_left': - sx = hr.start + legend_margin; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - case 'center': - sx = (hr.end + hr.start) / 2 - legend_width / 2; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - case 'center_right': - sx = hr.end - legend_margin - legend_width; - sy = (vr.end + vr.start) / 2 - legend_height / 2; - break; - default: - throw new Error("unreachable code"); - } - } - else if (types_1.isArray(location) && location.length == 2) { - var vx = location[0], vy = location[1]; - sx = panel.xview.compute(vx); - sy = panel.yview.compute(vy) - legend_height; - } - else - throw new Error("unreachable code"); - return new bbox_1.BBox({ left: sx, top: sy, width: legend_width, height: legend_height }); - }; - LegendView.prototype.interactive_bbox = function () { - return this.compute_legend_bbox(); - }; - LegendView.prototype.interactive_hit = function (sx, sy) { - var bbox = this.interactive_bbox(); - return bbox.contains(sx, sy); - }; - LegendView.prototype.on_hit = function (sx, sy) { - var _a, _b; - var yoffset; - var glyph_width = this.model.glyph_width; - var legend_padding = this.legend_padding; - var legend_spacing = this.model.spacing; - var label_standoff = this.model.label_standoff; - var xoffset = (yoffset = legend_padding); - var legend_bbox = this.compute_legend_bbox(); - var vertical = this.model.orientation == "vertical"; - for (var _i = 0, _c = this.model.items; _i < _c.length; _i++) { - var item = _c[_i]; - var labels = item.get_labels_list_from_label_prop(); - for (var _d = 0, labels_1 = labels; _d < labels_1.length; _d++) { - var label = labels_1[_d]; - var x1 = legend_bbox.x + xoffset; - var y1 = legend_bbox.y + yoffset; - var w = void 0, h = void 0; - if (vertical) - _a = [legend_bbox.width - 2 * legend_padding, this.max_label_height], w = _a[0], h = _a[1]; - else - _b = [this.text_widths[label] + glyph_width + label_standoff, this.max_label_height], w = _b[0], h = _b[1]; - var bbox = new bbox_1.BBox({ left: x1, top: y1, width: w, height: h }); - if (bbox.contains(sx, sy)) { - switch (this.model.click_policy) { - case "hide": { - for (var _e = 0, _f = item.renderers; _e < _f.length; _e++) { - var r = _f[_e]; - r.visible = !r.visible; - } - break; - } - case "mute": { - for (var _g = 0, _h = item.renderers; _g < _h.length; _g++) { - var r = _h[_g]; - r.muted = !r.muted; - } - break; - } - } - return true; - } - if (vertical) - yoffset += this.max_label_height + legend_spacing; - else - xoffset += this.text_widths[label] + glyph_width + label_standoff + legend_spacing; - } - } - return false; - }; - LegendView.prototype.render = function () { - if (!this.model.visible) - return; - if (this.model.items.length == 0) - return; - // set a backref on render so that items can later signal item_change upates - // on the model to trigger a re-render - for (var _i = 0, _a = this.model.items; _i < _a.length; _i++) { - var item = _a[_i]; - item.legend = this.model; - } - var ctx = this.plot_view.canvas_view.ctx; - var bbox = this.compute_legend_bbox(); - ctx.save(); - this._draw_legend_box(ctx, bbox); - this._draw_legend_items(ctx, bbox); - ctx.restore(); - }; - LegendView.prototype._draw_legend_box = function (ctx, bbox) { - ctx.beginPath(); - ctx.rect(bbox.x, bbox.y, bbox.width, bbox.height); - this.visuals.background_fill.set_value(ctx); - ctx.fill(); - if (this.visuals.border_line.doit) { - this.visuals.border_line.set_value(ctx); - ctx.stroke(); - } - }; - LegendView.prototype._draw_legend_items = function (ctx, bbox) { - var _this = this; - var _a = this.model, glyph_width = _a.glyph_width, glyph_height = _a.glyph_height; - var legend_padding = this.legend_padding; - var legend_spacing = this.model.spacing; - var label_standoff = this.model.label_standoff; - var xoffset = legend_padding; - var yoffset = legend_padding; - var vertical = this.model.orientation == "vertical"; - var _loop_1 = function (item) { - var _a, _b; - var labels = item.get_labels_list_from_label_prop(); - var field = item.get_field_from_label_prop(); - if (labels.length == 0) - return "continue"; - var active = (function () { - switch (_this.model.click_policy) { - case "none": return true; - case "hide": return array_1.every(item.renderers, function (r) { return r.visible; }); - case "mute": return array_1.every(item.renderers, function (r) { return !r.muted; }); - } - })(); - for (var _i = 0, labels_2 = labels; _i < labels_2.length; _i++) { - var label = labels_2[_i]; - var x1 = bbox.x + xoffset; - var y1 = bbox.y + yoffset; - var x2 = x1 + glyph_width; - var y2 = y1 + glyph_height; - if (vertical) - yoffset += this_1.max_label_height + legend_spacing; - else - xoffset += this_1.text_widths[label] + glyph_width + label_standoff + legend_spacing; - this_1.visuals.label_text.set_value(ctx); - ctx.fillText(label, x2 + label_standoff, y1 + this_1.max_label_height / 2.0); - for (var _c = 0, _d = item.renderers; _c < _d.length; _c++) { - var r = _d[_c]; - var view = this_1.plot_view.renderer_views[r.id]; - view.draw_legend(ctx, x1, x2, y1, y2, field, label, item.index); - } - if (!active) { - var w = void 0, h = void 0; - if (vertical) - _a = [bbox.width - 2 * legend_padding, this_1.max_label_height], w = _a[0], h = _a[1]; - else - _b = [this_1.text_widths[label] + glyph_width + label_standoff, this_1.max_label_height], w = _b[0], h = _b[1]; - ctx.beginPath(); - ctx.rect(x1, y1, w, h); - this_1.visuals.inactive_fill.set_value(ctx); - ctx.fill(); - } - } - }; - var this_1 = this; - for (var _i = 0, _b = this.model.items; _i < _b.length; _i++) { - var item = _b[_i]; - _loop_1(item); - } - }; - LegendView.prototype._get_size = function () { - var _a = this.compute_legend_bbox(), width = _a.width, height = _a.height; - return { - width: width + 2 * this.model.margin, - height: height + 2 * this.model.margin, - }; - }; - return LegendView; - }(annotation_1.AnnotationView)); - exports.LegendView = LegendView; - var Legend = /** @class */ (function (_super) { - tslib_1.__extends(Legend, _super); - function Legend(attrs) { - return _super.call(this, attrs) || this; - } - Legend.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.item_change = new signaling_1.Signal0(this, "item_change"); - }; - Legend.initClass = function () { - this.prototype.type = 'Legend'; - this.prototype.default_view = LegendView; - this.mixins(['text:label_', 'fill:inactive_', 'line:border_', 'fill:background_']); - this.define({ - orientation: [p.Orientation, 'vertical'], - location: [p.Any, 'top_right'], - label_standoff: [p.Number, 5], - glyph_height: [p.Number, 20], - glyph_width: [p.Number, 20], - label_height: [p.Number, 20], - label_width: [p.Number, 20], - margin: [p.Number, 10], - padding: [p.Number, 10], - spacing: [p.Number, 3], - items: [p.Array, []], - click_policy: [p.Any, "none"], - }); - this.override({ - border_line_color: "#e5e5e5", - border_line_alpha: 0.5, - border_line_width: 1, - background_fill_color: "#ffffff", - background_fill_alpha: 0.95, - inactive_fill_color: "white", - inactive_fill_alpha: 0.7, - label_text_font_size: "10pt", - label_text_baseline: "middle", - }); - }; - Legend.prototype.get_legend_names = function () { - var legend_names = []; - for (var _i = 0, _a = this.items; _i < _a.length; _i++) { - var item = _a[_i]; - var labels = item.get_labels_list_from_label_prop(); - legend_names.push.apply(legend_names, labels); - } - return legend_names; - }; - return Legend; - }(annotation_1.Annotation)); - exports.Legend = Legend; - Legend.initClass(); -} -, -/* models/annotations/legend_item */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var columnar_data_source_1 = require(209) /* ../sources/columnar_data_source */; - var vectorization_1 = require(49) /* ../../core/vectorization */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var array_1 = require(24) /* ../../core/util/array */; - var LegendItem = /** @class */ (function (_super) { - tslib_1.__extends(LegendItem, _super); - function LegendItem(attrs) { - return _super.call(this, attrs) || this; - } - LegendItem.initClass = function () { - this.prototype.type = "LegendItem"; - this.define({ - label: [p.StringSpec, null], - renderers: [p.Array, []], - index: [p.Number, null], - }); - }; - /*protected*/ LegendItem.prototype._check_data_sources_on_renderers = function () { - var field = this.get_field_from_label_prop(); - if (field != null) { - if (this.renderers.length < 1) { - return false; - } - var source = this.renderers[0].data_source; - if (source != null) { - for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) { - var r = _a[_i]; - if (r.data_source != source) { - return false; - } - } - } - } - return true; - }; - /*protected*/ LegendItem.prototype._check_field_label_on_data_source = function () { - var field = this.get_field_from_label_prop(); - if (field != null) { - if (this.renderers.length < 1) { - return false; - } - var source = this.renderers[0].data_source; - if (source != null && !array_1.includes(source.columns(), field)) { - return false; - } - } - return true; - }; - LegendItem.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this.legend = null; - this.connect(this.change, function () { - if (_this.legend != null) - _this.legend.item_change.emit(); - }); - // Validate data_sources match - var data_source_validation = this._check_data_sources_on_renderers(); - if (!data_source_validation) - logging_1.logger.error("Non matching data sources on legend item renderers"); - // Validate label in data_source - var field_validation = this._check_field_label_on_data_source(); - if (!field_validation) - logging_1.logger.error("Bad column name on label: " + this.label); - }; - LegendItem.prototype.get_field_from_label_prop = function () { - var label = this.label; - return vectorization_1.isField(label) ? label.field : null; - }; - LegendItem.prototype.get_labels_list_from_label_prop = function () { - // Always return a list of the labels - if (vectorization_1.isValue(this.label)) { - var value = this.label.value; - return value != null ? [value] : []; - } - var field = this.get_field_from_label_prop(); - if (field != null) { - var source = void 0; - if (this.renderers[0] && this.renderers[0].data_source != null) - source = this.renderers[0].data_source; - else - return ["No source found"]; - if (source instanceof columnar_data_source_1.ColumnarDataSource) { - var data = source.get_column(field); - if (data != null) - return array_1.uniq(Array.from(data)); - else - return ["Invalid field"]; - } - } - return []; - }; - return LegendItem; - }(model_1.Model)); - exports.LegendItem = LegendItem; - LegendItem.initClass(); -} -, -/* models/annotations/poly_annotation */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var signaling_1 = require(22) /* ../../core/signaling */; - var p = require(18) /* ../../core/properties */; - var PolyAnnotationView = /** @class */ (function (_super) { - tslib_1.__extends(PolyAnnotationView, _super); - function PolyAnnotationView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PolyAnnotationView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - // need to respond to either normal BB change events or silent - // "data only updates" that tools might want to use - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.data_update, function () { return _this.plot_view.request_render(); }); - }; - PolyAnnotationView.prototype.render = function () { - if (!this.model.visible) - return; - var _a = this.model, xs = _a.xs, ys = _a.ys; - if (xs.length != ys.length) - return; - if (xs.length < 3 || ys.length < 3) - return; - var frame = this.plot_view.frame; - var ctx = this.plot_view.canvas_view.ctx; - for (var i = 0, end = xs.length; i < end; i++) { - var sx = void 0; - if (this.model.xs_units == 'screen') - sx = this.model.screen ? xs[i] : frame.xview.compute(xs[i]); - else - throw new Error("not implemented"); - var sy = void 0; - if (this.model.ys_units == 'screen') - sy = this.model.screen ? ys[i] : frame.yview.compute(ys[i]); - else - throw new Error("not implemented"); - if (i == 0) { - ctx.beginPath(); - ctx.moveTo(sx, sy); - } - else { - ctx.lineTo(sx, sy); - } - } - ctx.closePath(); - if (this.visuals.line.doit) { - this.visuals.line.set_value(ctx); - ctx.stroke(); - } - if (this.visuals.fill.doit) { - this.visuals.fill.set_value(ctx); - ctx.fill(); - } - }; - return PolyAnnotationView; - }(annotation_1.AnnotationView)); - exports.PolyAnnotationView = PolyAnnotationView; - var PolyAnnotation = /** @class */ (function (_super) { - tslib_1.__extends(PolyAnnotation, _super); - function PolyAnnotation(attrs) { - return _super.call(this, attrs) || this; - } - PolyAnnotation.initClass = function () { - this.prototype.type = "PolyAnnotation"; - this.prototype.default_view = PolyAnnotationView; - this.mixins(['line', 'fill']); - this.define({ - xs: [p.Array, []], - xs_units: [p.SpatialUnits, 'data'], - ys: [p.Array, []], - ys_units: [p.SpatialUnits, 'data'], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.internal({ - screen: [p.Boolean, false], - }); - this.override({ - fill_color: "#fff9ba", - fill_alpha: 0.4, - line_color: "#cccccc", - line_alpha: 0.3, - }); - }; - PolyAnnotation.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.data_update = new signaling_1.Signal0(this, "data_update"); - }; - PolyAnnotation.prototype.update = function (_a) { - var xs = _a.xs, ys = _a.ys; - this.setv({ xs: xs, ys: ys, screen: true }, { silent: true }); - this.data_update.emit(); - }; - return PolyAnnotation; - }(annotation_1.Annotation)); - exports.PolyAnnotation = PolyAnnotation; - PolyAnnotation.initClass(); -} -, -/* models/annotations/slope */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var p = require(18) /* ../../core/properties */; - var SlopeView = /** @class */ (function (_super) { - tslib_1.__extends(SlopeView, _super); - function SlopeView() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlopeView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - }; - SlopeView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - }; - SlopeView.prototype.render = function () { - if (!this.model.visible) - return; - this._draw_slope(); - }; - SlopeView.prototype._draw_slope = function () { - var gradient = this.model.gradient; - var y_intercept = this.model.y_intercept; - if (gradient == null || y_intercept == null) { - return; - } - var frame = this.plot_view.frame; - var xscale = frame.xscales[this.model.x_range_name]; - var yscale = frame.yscales[this.model.y_range_name]; - var sy_start = frame._top.value; - var sy_end = sy_start + frame._height.value; - var y_start = yscale.invert(sy_start); - var y_end = yscale.invert(sy_end); - var x_start = (y_start - y_intercept) / gradient; - var x_end = (y_end - y_intercept) / gradient; - var sx_start = xscale.compute(x_start); - var sx_end = xscale.compute(x_end); - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - ctx.beginPath(); - this.visuals.line.set_value(ctx); - ctx.moveTo(sx_start, sy_start); - ctx.lineTo(sx_end, sy_end); - ctx.stroke(); - ctx.restore(); - }; - return SlopeView; - }(annotation_1.AnnotationView)); - exports.SlopeView = SlopeView; - var Slope = /** @class */ (function (_super) { - tslib_1.__extends(Slope, _super); - function Slope(attrs) { - return _super.call(this, attrs) || this; - } - Slope.initClass = function () { - this.prototype.type = 'Slope'; - this.prototype.default_view = SlopeView; - this.mixins(['line']); - this.define({ - gradient: [p.Number, null], - y_intercept: [p.Number, null], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - line_color: 'black', - }); - }; - return Slope; - }(annotation_1.Annotation)); - exports.Slope = Slope; - Slope.initClass(); -} -, -/* models/annotations/span */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var SpanView = /** @class */ (function (_super) { - tslib_1.__extends(SpanView, _super); - function SpanView() { - return _super !== null && _super.apply(this, arguments) || this; - } - SpanView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.plot_view.canvas_overlays.appendChild(this.el); - this.el.style.position = "absolute"; - dom_1.undisplay(this.el); - }; - SpanView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - if (this.model.for_hover) - this.connect(this.model.properties.computed_location.change, function () { return _this._draw_span(); }); - else { - if (this.model.render_mode == 'canvas') { - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - this.connect(this.model.properties.location.change, function () { return _this.plot_view.request_render(); }); - } - else { - this.connect(this.model.change, function () { return _this.render(); }); - this.connect(this.model.properties.location.change, function () { return _this._draw_span(); }); - } - } - }; - SpanView.prototype.render = function () { - if (!this.model.visible && this.model.render_mode == 'css') - dom_1.undisplay(this.el); - if (!this.model.visible) - return; - this._draw_span(); - }; - SpanView.prototype._draw_span = function () { - var _this = this; - var loc = this.model.for_hover ? this.model.computed_location : this.model.location; - if (loc == null) { - dom_1.undisplay(this.el); - return; - } - var frame = this.plot_view.frame; - var xscale = frame.xscales[this.model.x_range_name]; - var yscale = frame.yscales[this.model.y_range_name]; - var _calc_dim = function (scale, view) { - if (_this.model.for_hover) - return _this.model.computed_location; - else { - if (_this.model.location_units == 'data') - return scale.compute(loc); - else - return view.compute(loc); - } - }; - var height, sleft, stop, width; - if (this.model.dimension == 'width') { - stop = _calc_dim(yscale, frame.yview); - sleft = frame._left.value; - width = frame._width.value; - height = this.model.properties.line_width.value(); - } - else { - stop = frame._top.value; - sleft = _calc_dim(xscale, frame.xview); - width = this.model.properties.line_width.value(); - height = frame._height.value; - } - if (this.model.render_mode == "css") { - this.el.style.top = stop + "px"; - this.el.style.left = sleft + "px"; - this.el.style.width = width + "px"; - this.el.style.height = height + "px"; - this.el.style.backgroundColor = this.model.properties.line_color.value(); - this.el.style.opacity = this.model.properties.line_alpha.value(); - dom_1.display(this.el); - } - else if (this.model.render_mode == "canvas") { - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - ctx.beginPath(); - this.visuals.line.set_value(ctx); - ctx.moveTo(sleft, stop); - if (this.model.dimension == "width") { - ctx.lineTo(sleft + width, stop); - } - else { - ctx.lineTo(sleft, stop + height); - } - ctx.stroke(); - ctx.restore(); - } - }; - return SpanView; - }(annotation_1.AnnotationView)); - exports.SpanView = SpanView; - var Span = /** @class */ (function (_super) { - tslib_1.__extends(Span, _super); - function Span(attrs) { - return _super.call(this, attrs) || this; - } - Span.initClass = function () { - this.prototype.type = 'Span'; - this.prototype.default_view = SpanView; - this.mixins(['line']); - this.define({ - render_mode: [p.RenderMode, 'canvas'], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - location: [p.Number, null], - location_units: [p.SpatialUnits, 'data'], - dimension: [p.Dimension, 'width'], - }); - this.override({ - line_color: 'black', - }); - this.internal({ - for_hover: [p.Boolean, false], - computed_location: [p.Number, null], - }); - }; - return Span; - }(annotation_1.Annotation)); - exports.Span = Span; - Span.initClass(); -} -, -/* models/annotations/text_annotation */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var text_1 = require(43) /* ../../core/util/text */; - var TextAnnotationView = /** @class */ (function (_super) { - tslib_1.__extends(TextAnnotationView, _super); - function TextAnnotationView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rotate = true; - return _this; - } - TextAnnotationView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - if (this.model.render_mode == 'css') { - this.el.classList.add('bk-annotation'); - this.plot_view.canvas_overlays.appendChild(this.el); - } - }; - TextAnnotationView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - if (this.model.render_mode == 'css') { - // dispatch CSS update immediately - this.connect(this.model.change, function () { return _this.render(); }); - } - else { - this.connect(this.model.change, function () { return _this.plot_view.request_render(); }); - } - }; - TextAnnotationView.prototype._calculate_text_dimensions = function (ctx, text) { - var width = ctx.measureText(text).width; - var height = text_1.measure_font(this.visuals.text.font_value()).height; - return [width, height]; - }; - TextAnnotationView.prototype._calculate_bounding_box_dimensions = function (ctx, text) { - var _a = this._calculate_text_dimensions(ctx, text), width = _a[0], height = _a[1]; - var x_offset; - switch (ctx.textAlign) { - case 'left': - x_offset = 0; - break; - case 'center': - x_offset = -width / 2; - break; - case 'right': - x_offset = -width; - break; - default: - throw new Error("unreachable code"); - } - // guestimated from https://www.w3.org/TR/2dcontext/#dom-context-2d-textbaseline - var y_offset; - switch (ctx.textBaseline) { - case 'top': - y_offset = 0.0; - break; - case 'middle': - y_offset = -0.5 * height; - break; - case 'bottom': - y_offset = -1.0 * height; - break; - case 'alphabetic': - y_offset = -0.8 * height; - break; - case 'hanging': - y_offset = -0.17 * height; - break; - case 'ideographic': - y_offset = -0.83 * height; - break; - default: - throw new Error("unreachable code"); - } - return [x_offset, y_offset, width, height]; - }; - TextAnnotationView.prototype._canvas_text = function (ctx, text, sx, sy, angle) { - this.visuals.text.set_value(ctx); - var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text); - ctx.save(); - ctx.beginPath(); - ctx.translate(sx, sy); - if (angle) - ctx.rotate(angle); - ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]); - if (this.visuals.background_fill.doit) { - this.visuals.background_fill.set_value(ctx); - ctx.fill(); - } - if (this.visuals.border_line.doit) { - this.visuals.border_line.set_value(ctx); - ctx.stroke(); - } - if (this.visuals.text.doit) { - this.visuals.text.set_value(ctx); - ctx.fillText(text, 0, 0); - } - ctx.restore(); - }; - TextAnnotationView.prototype._css_text = function (ctx, text, sx, sy, angle) { - dom_1.undisplay(this.el); - this.visuals.text.set_value(ctx); - var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text); - // attempt to support vector string-style ("8 4 8") line dashing for css mode - var ld = this.visuals.border_line.line_dash.value(); - var line_dash = ld.length < 2 ? "solid" : "dashed"; - this.visuals.border_line.set_value(ctx); - this.visuals.background_fill.set_value(ctx); - this.el.style.position = 'absolute'; - this.el.style.left = sx + bbox_dims[0] + "px"; - this.el.style.top = sy + bbox_dims[1] + "px"; - this.el.style.color = "" + this.visuals.text.text_color.value(); - this.el.style.opacity = "" + this.visuals.text.text_alpha.value(); - this.el.style.font = "" + this.visuals.text.font_value(); - this.el.style.lineHeight = "normal"; // needed to prevent ipynb css override - if (angle) { - this.el.style.transform = "rotate(" + angle + "rad)"; - } - if (this.visuals.background_fill.doit) { - this.el.style.backgroundColor = "" + this.visuals.background_fill.color_value(); - } - if (this.visuals.border_line.doit) { - this.el.style.borderStyle = "" + line_dash; - this.el.style.borderWidth = this.visuals.border_line.line_width.value() + "px"; - this.el.style.borderColor = "" + this.visuals.border_line.color_value(); - } - this.el.textContent = text; - dom_1.display(this.el); - }; - return TextAnnotationView; - }(annotation_1.AnnotationView)); - exports.TextAnnotationView = TextAnnotationView; - var TextAnnotation = /** @class */ (function (_super) { - tslib_1.__extends(TextAnnotation, _super); - function TextAnnotation(attrs) { - return _super.call(this, attrs) || this; - } - TextAnnotation.initClass = function () { - this.prototype.type = "TextAnnotation"; - this.define({ - render_mode: [p.RenderMode, "canvas"], - }); - }; - return TextAnnotation; - }(annotation_1.Annotation)); - exports.TextAnnotation = TextAnnotation; - TextAnnotation.initClass(); -} -, -/* models/annotations/title */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var text_annotation_1 = require(77) /* ./text_annotation */; - var dom_1 = require(5) /* ../../core/dom */; - var visuals_1 = require(51) /* ../../core/visuals */; - var p = require(18) /* ../../core/properties */; - var TitleView = /** @class */ (function (_super) { - tslib_1.__extends(TitleView, _super); - function TitleView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TitleView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.visuals.text = new visuals_1.Text(this.model); - }; - TitleView.prototype._get_location = function () { - var panel = this.panel; - var hmargin = this.model.offset; - var vmargin = 5; - var sx, sy; - switch (panel.side) { - case 'above': - case 'below': { - switch (this.model.vertical_align) { - case 'top': - sy = panel._top.value + vmargin; - break; - case 'middle': - sy = panel._vcenter.value; - break; - case 'bottom': - sy = panel._bottom.value - vmargin; - break; - default: throw new Error("unreachable code"); - } - switch (this.model.align) { - case 'left': - sx = panel._left.value + hmargin; - break; - case 'center': - sx = panel._hcenter.value; - break; - case 'right': - sx = panel._right.value - hmargin; - break; - default: throw new Error("unreachable code"); - } - break; - } - case 'left': { - switch (this.model.vertical_align) { - case 'top': - sx = panel._left.value - vmargin; - break; - case 'middle': - sx = panel._hcenter.value; - break; - case 'bottom': - sx = panel._right.value + vmargin; - break; - default: throw new Error("unreachable code"); - } - switch (this.model.align) { - case 'left': - sy = panel._bottom.value - hmargin; - break; - case 'center': - sy = panel._vcenter.value; - break; - case 'right': - sy = panel._top.value + hmargin; - break; - default: throw new Error("unreachable code"); - } - break; - } - case 'right': { - switch (this.model.vertical_align) { - case 'top': - sx = panel._right.value - vmargin; - break; - case 'middle': - sx = panel._hcenter.value; - break; - case 'bottom': - sx = panel._left.value + vmargin; - break; - default: throw new Error("unreachable code"); - } - switch (this.model.align) { - case 'left': - sy = panel._top.value + hmargin; - break; - case 'center': - sy = panel._vcenter.value; - break; - case 'right': - sy = panel._bottom.value - hmargin; - break; - default: throw new Error("unreachable code"); - } - break; - } - default: throw new Error("unreachable code"); - } - return [sx, sy]; - }; - TitleView.prototype.render = function () { - if (!this.model.visible) { - if (this.model.render_mode == 'css') - dom_1.undisplay(this.el); - return; - } - var text = this.model.text; - if (text == null || text.length == 0) - return; - this.model.text_baseline = this.model.vertical_align; - this.model.text_align = this.model.align; - var _a = this._get_location(), sx = _a[0], sy = _a[1]; - var angle = this.panel.get_label_angle_heuristic('parallel'); - var draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this); - draw(this.plot_view.canvas_view.ctx, text, sx, sy, angle); - }; - TitleView.prototype._get_size = function () { - var text = this.model.text; - if (text == null || text.length == 0) - return { width: 0, height: 0 }; - else { - this.visuals.text.set_value(this.ctx); - var _a = this.ctx.measureText(text), width = _a.width, ascent = _a.ascent; - return { width: width, height: ascent + 10 }; - } - }; - return TitleView; - }(text_annotation_1.TextAnnotationView)); - exports.TitleView = TitleView; - var Title = /** @class */ (function (_super) { - tslib_1.__extends(Title, _super); - function Title(attrs) { - return _super.call(this, attrs) || this; - } - Title.initClass = function () { - this.prototype.type = 'Title'; - this.prototype.default_view = TitleView; - this.mixins(['line:border_', 'fill:background_']); - this.define({ - text: [p.String,], - text_font: [p.Font, 'helvetica'], - text_font_size: [p.FontSizeSpec, '10pt'], - text_font_style: [p.FontStyle, 'bold'], - text_color: [p.ColorSpec, '#444444'], - text_alpha: [p.NumberSpec, 1.0], - vertical_align: [p.VerticalAlign, 'bottom'], - align: [p.TextAlign, 'left'], - offset: [p.Number, 0], - }); - this.override({ - background_fill_color: null, - border_line_color: null, - }); - this.internal({ - text_align: [p.TextAlign, 'left'], - text_baseline: [p.TextBaseline, 'bottom'], - }); - }; - return Title; - }(text_annotation_1.TextAnnotation)); - exports.Title = Title; - Title.initClass(); -} -, -/* models/annotations/toolbar_panel */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var build_views_1 = require(4) /* ../../core/build_views */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var ToolbarPanelView = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarPanelView, _super); - function ToolbarPanelView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rotate = true; - return _this; - } - ToolbarPanelView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.plot_view.canvas_events.appendChild(this.el); - this._toolbar_views = {}; - build_views_1.build_views(this._toolbar_views, [this.model.toolbar], { parent: this }); - var toolbar_view = this._toolbar_views[this.model.toolbar.id]; - this.plot_view.visibility_callbacks.push(function (visible) { return toolbar_view.set_visibility(visible); }); - }; - ToolbarPanelView.prototype.remove = function () { - build_views_1.remove_views(this._toolbar_views); - _super.prototype.remove.call(this); - }; - ToolbarPanelView.prototype.render = function () { - _super.prototype.render.call(this); - if (!this.model.visible) { - dom_1.undisplay(this.el); - return; - } - this.el.style.position = "absolute"; - this.el.style.overflow = "hidden"; - dom_1.position(this.el, this.panel.bbox); - var toolbar_view = this._toolbar_views[this.model.toolbar.id]; - toolbar_view.render(); - dom_1.empty(this.el); - this.el.appendChild(toolbar_view.el); - dom_1.display(this.el); - }; - ToolbarPanelView.prototype._get_size = function () { - var _a = this.model.toolbar, tools = _a.tools, logo = _a.logo; - return { - width: tools.length * 30 + (logo != null ? 25 : 0), - height: 30, - }; - }; - return ToolbarPanelView; - }(annotation_1.AnnotationView)); - exports.ToolbarPanelView = ToolbarPanelView; - var ToolbarPanel = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarPanel, _super); - function ToolbarPanel(attrs) { - return _super.call(this, attrs) || this; - } - ToolbarPanel.initClass = function () { - this.prototype.type = 'ToolbarPanel'; - this.prototype.default_view = ToolbarPanelView; - this.define({ - toolbar: [p.Instance], - }); - }; - return ToolbarPanel; - }(annotation_1.Annotation)); - exports.ToolbarPanel = ToolbarPanel; - ToolbarPanel.initClass(); -} -, -/* models/annotations/tooltip */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - function compute_side(attachment, sx, sy, hcenter, vcenter) { - var side; - switch (attachment) { - case "horizontal": - side = sx < hcenter ? 'right' : 'left'; - break; - case "vertical": - side = sy < vcenter ? 'below' : 'above'; - break; - default: - side = attachment; - } - return side; - } - exports.compute_side = compute_side; - var TooltipView = /** @class */ (function (_super) { - tslib_1.__extends(TooltipView, _super); - function TooltipView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TooltipView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - // TODO (bev) really probably need multiple divs - this.plot_view.canvas_overlays.appendChild(this.el); - dom_1.undisplay(this.el); - }; - TooltipView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.data.change, function () { return _this._draw_tips(); }); - }; - TooltipView.prototype.css_classes = function () { - return _super.prototype.css_classes.call(this).concat("bk-tooltip"); - }; - TooltipView.prototype.render = function () { - if (!this.model.visible) - return; - this._draw_tips(); - }; - TooltipView.prototype._draw_tips = function () { - var data = this.model.data; - dom_1.empty(this.el); - dom_1.undisplay(this.el); - if (this.model.custom) - this.el.classList.add("bk-tooltip-custom"); - else - this.el.classList.remove("bk-tooltip-custom"); - if (data.length == 0) - return; - var frame = this.plot_view.frame; - for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { - var _a = data_1[_i], sx_1 = _a[0], sy_1 = _a[1], content = _a[2]; - if (this.model.inner_only && !frame.bbox.contains(sx_1, sy_1)) - continue; - var tip = dom_1.div({}, content); - this.el.appendChild(tip); - } - var _b = data[data.length - 1], sx = _b[0], sy = _b[1]; // XXX: this previously depended on {sx, sy} leaking from the for-loop - var side = compute_side(this.model.attachment, sx, sy, frame._hcenter.value, frame._vcenter.value); - this.el.classList.remove("bk-right"); - this.el.classList.remove("bk-left"); - this.el.classList.remove("bk-above"); - this.el.classList.remove("bk-below"); - var arrow_size = 10; // XXX: keep in sync with less - dom_1.display(this.el); // XXX: {offset,client}Width() gives 0 when display="none" - // slightly confusing: side "left" (for example) is relative to point that - // is being annotated but CS class "bk-left" is relative to the tooltip itself - var left, top; - switch (side) { - case "right": - this.el.classList.add("bk-left"); - left = sx + (this.el.offsetWidth - this.el.clientWidth) + arrow_size; - top = sy - this.el.offsetHeight / 2; - break; - case "left": - this.el.classList.add("bk-right"); - left = sx - this.el.offsetWidth - arrow_size; - top = sy - this.el.offsetHeight / 2; - break; - case "below": - this.el.classList.add("bk-above"); - top = sy + (this.el.offsetHeight - this.el.clientHeight) + arrow_size; - left = Math.round(sx - this.el.offsetWidth / 2); - break; - case "above": - this.el.classList.add("bk-below"); - top = sy - this.el.offsetHeight - arrow_size; - left = Math.round(sx - this.el.offsetWidth / 2); - break; - default: - throw new Error("unreachable code"); - } - if (this.model.show_arrow) - this.el.classList.add("bk-tooltip-arrow"); - // TODO (bev) this is not currently bulletproof. If there are - // two hits, not colocated and one is off the screen, that can - // be problematic - if (this.el.childNodes.length > 0) { - this.el.style.top = top + "px"; - this.el.style.left = left + "px"; - } - else - dom_1.undisplay(this.el); - }; - return TooltipView; - }(annotation_1.AnnotationView)); - exports.TooltipView = TooltipView; - var Tooltip = /** @class */ (function (_super) { - tslib_1.__extends(Tooltip, _super); - function Tooltip(attrs) { - return _super.call(this, attrs) || this; - } - Tooltip.initClass = function () { - this.prototype.type = 'Tooltip'; - this.prototype.default_view = TooltipView; - this.define({ - attachment: [p.TooltipAttachment, 'horizontal'], - inner_only: [p.Boolean, true], - show_arrow: [p.Boolean, true], - }); - this.override({ - level: 'overlay', - }); - this.internal({ - data: [p.Any, []], - custom: [p.Any], - }); - }; - Tooltip.prototype.clear = function () { - this.data = []; - }; - Tooltip.prototype.add = function (sx, sy, content) { - this.data = this.data.concat([[sx, sy, content]]); - }; - return Tooltip; - }(annotation_1.Annotation)); - exports.Tooltip = Tooltip; - Tooltip.initClass(); -} -, -/* models/annotations/whisker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var annotation_1 = require(63) /* ./annotation */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var arrow_head_1 = require(65) /* ./arrow_head */; - var p = require(18) /* ../../core/properties */; - var WhiskerView = /** @class */ (function (_super) { - tslib_1.__extends(WhiskerView, _super); - function WhiskerView() { - return _super !== null && _super.apply(this, arguments) || this; - } - WhiskerView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.set_data(this.model.source); - }; - WhiskerView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); }); - this.connect(this.model.source.change, function () { return _this.set_data(_this.model.source); }); - }; - WhiskerView.prototype.set_data = function (source) { - _super.prototype.set_data.call(this, source); - this.visuals.warm_cache(source); - this.plot_view.request_render(); - }; - WhiskerView.prototype._map_data = function () { - var frame = this.plot_view.frame; - var dim = this.model.dimension; - var xscale = frame.xscales[this.model.x_range_name]; - var yscale = frame.yscales[this.model.y_range_name]; - var limit_scale = dim == "height" ? yscale : xscale; - var base_scale = dim == "height" ? xscale : yscale; - var limit_view = dim == "height" ? frame.yview : frame.xview; - var base_view = dim == "height" ? frame.xview : frame.yview; - var _lower_sx; - if (this.model.properties.lower.units == "data") - _lower_sx = limit_scale.v_compute(this._lower); - else - _lower_sx = limit_view.v_compute(this._lower); - var _upper_sx; - if (this.model.properties.upper.units == "data") - _upper_sx = limit_scale.v_compute(this._upper); - else - _upper_sx = limit_view.v_compute(this._upper); - var _base_sx; - if (this.model.properties.base.units == "data") - _base_sx = base_scale.v_compute(this._base); - else - _base_sx = base_view.v_compute(this._base); - var _a = dim == 'height' ? [1, 0] : [0, 1], i = _a[0], j = _a[1]; - var _lower = [_lower_sx, _base_sx]; - var _upper = [_upper_sx, _base_sx]; - this._lower_sx = _lower[i]; - this._lower_sy = _lower[j]; - this._upper_sx = _upper[i]; - this._upper_sy = _upper[j]; - }; - WhiskerView.prototype.render = function () { - if (!this.model.visible) - return; - this._map_data(); - var ctx = this.plot_view.canvas_view.ctx; - if (this.visuals.line.doit) { - for (var i = 0, end = this._lower_sx.length; i < end; i++) { - this.visuals.line.set_vectorize(ctx, i); - ctx.beginPath(); - ctx.moveTo(this._lower_sx[i], this._lower_sy[i]); - ctx.lineTo(this._upper_sx[i], this._upper_sy[i]); - ctx.stroke(); - } - } - var angle = this.model.dimension == "height" ? 0 : Math.PI / 2; - if (this.model.lower_head != null) { - for (var i = 0, end = this._lower_sx.length; i < end; i++) { - ctx.save(); - ctx.translate(this._lower_sx[i], this._lower_sy[i]); - ctx.rotate(angle + Math.PI); - this.model.lower_head.render(ctx, i); - ctx.restore(); - } - } - if (this.model.upper_head != null) { - for (var i = 0, end = this._upper_sx.length; i < end; i++) { - ctx.save(); - ctx.translate(this._upper_sx[i], this._upper_sy[i]); - ctx.rotate(angle); - this.model.upper_head.render(ctx, i); - ctx.restore(); - } - } - }; - return WhiskerView; - }(annotation_1.AnnotationView)); - exports.WhiskerView = WhiskerView; - var Whisker = /** @class */ (function (_super) { - tslib_1.__extends(Whisker, _super); - function Whisker(attrs) { - return _super.call(this, attrs) || this; - } - Whisker.initClass = function () { - this.prototype.type = 'Whisker'; - this.prototype.default_view = WhiskerView; - this.mixins(['line']); - this.define({ - lower: [p.DistanceSpec], - lower_head: [p.Instance, function () { return new arrow_head_1.TeeHead({ level: "underlay", size: 10 }); }], - upper: [p.DistanceSpec], - upper_head: [p.Instance, function () { return new arrow_head_1.TeeHead({ level: "underlay", size: 10 }); }], - base: [p.DistanceSpec], - dimension: [p.Dimension, 'height'], - source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - level: 'underlay', - }); - }; - return Whisker; - }(annotation_1.Annotation)); - exports.Whisker = Whisker; - Whisker.initClass(); -} -, -/* models/axes/axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var guide_renderer_1 = require(195) /* ../renderers/guide_renderer */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var abs = Math.abs, min = Math.min, max = Math.max; - var AxisView = /** @class */ (function (_super) { - tslib_1.__extends(AxisView, _super); - function AxisView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rotate = true; - return _this; - } - Object.defineProperty(AxisView.prototype, "panel", { - get: function () { - return this.layout; - }, - enumerable: true, - configurable: true - }); - AxisView.prototype.render = function () { - if (!this.model.visible) - return; - var extents = { - tick: this._tick_extent(), - tick_label: this._tick_label_extents(), - axis_label: this._axis_label_extent(), - }; - var tick_coords = this.tick_coords; - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - this._draw_rule(ctx, extents); - this._draw_major_ticks(ctx, extents, tick_coords); - this._draw_minor_ticks(ctx, extents, tick_coords); - this._draw_major_labels(ctx, extents, tick_coords); - this._draw_axis_label(ctx, extents, tick_coords); - if (this._render != null) - this._render(ctx, extents, tick_coords); - ctx.restore(); - }; - AxisView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.plot_view.request_paint(); }); - var p = this.model.properties; - this.on_change(p.visible, function () { return _this.plot_view.request_layout(); }); - }; - AxisView.prototype.get_size = function () { - if (this.model.visible && this.model.fixed_location == null) { - var size = this._get_size(); - return { width: 0 /* max */, height: Math.round(size) }; - } - else - return { width: 0, height: 0 }; - }; - AxisView.prototype._get_size = function () { - return this._tick_extent() + this._tick_label_extent() + this._axis_label_extent(); - }; - Object.defineProperty(AxisView.prototype, "needs_clip", { - get: function () { - return this.model.fixed_location != null; - }, - enumerable: true, - configurable: true - }); - // drawing sub functions ----------------------------------------------------- - AxisView.prototype._draw_rule = function (ctx, _extents) { - if (!this.visuals.axis_line.doit) - return; - var _a = this.rule_coords, xs = _a[0], ys = _a[1]; - var _b = this.plot_view.map_to_screen(xs, ys, this.model.x_range_name, this.model.y_range_name), sxs = _b[0], sys = _b[1]; - var _c = this.normals, nx = _c[0], ny = _c[1]; - var _d = this.offsets, xoff = _d[0], yoff = _d[1]; - this.visuals.axis_line.set_value(ctx); - ctx.beginPath(); - ctx.moveTo(Math.round(sxs[0] + nx * xoff), Math.round(sys[0] + ny * yoff)); - for (var i = 1; i < sxs.length; i++) { - var sx = Math.round(sxs[i] + nx * xoff); - var sy = Math.round(sys[i] + ny * yoff); - ctx.lineTo(sx, sy); - } - ctx.stroke(); - }; - AxisView.prototype._draw_major_ticks = function (ctx, _extents, tick_coords) { - var tin = this.model.major_tick_in; - var tout = this.model.major_tick_out; - var visuals = this.visuals.major_tick_line; - this._draw_ticks(ctx, tick_coords.major, tin, tout, visuals); - }; - AxisView.prototype._draw_minor_ticks = function (ctx, _extents, tick_coords) { - var tin = this.model.minor_tick_in; - var tout = this.model.minor_tick_out; - var visuals = this.visuals.minor_tick_line; - this._draw_ticks(ctx, tick_coords.minor, tin, tout, visuals); - }; - AxisView.prototype._draw_major_labels = function (ctx, extents, tick_coords) { - var coords = tick_coords.major; - var labels = this.compute_labels(coords[this.dimension]); - var orient = this.model.major_label_orientation; - var standoff = extents.tick + this.model.major_label_standoff; - var visuals = this.visuals.major_label_text; - this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals); - }; - AxisView.prototype._draw_axis_label = function (ctx, extents, _tick_coords) { - if (this.model.axis_label == null || this.model.axis_label.length == 0 || this.model.fixed_location != null) - return; - var sx; - var sy; - switch (this.panel.side) { - case "above": - sx = this.panel._hcenter.value; - sy = this.panel._bottom.value; - break; - case "below": - sx = this.panel._hcenter.value; - sy = this.panel._top.value; - break; - case "left": - sx = this.panel._right.value; - sy = this.panel._vcenter.value; - break; - case "right": - sx = this.panel._left.value; - sy = this.panel._vcenter.value; - break; - default: - throw new Error("unknown side: " + this.panel.side); - } - var coords = [[sx], [sy]]; - var standoff = extents.tick + array_1.sum(extents.tick_label) + this.model.axis_label_standoff; - var visuals = this.visuals.axis_label_text; - this._draw_oriented_labels(ctx, [this.model.axis_label], coords, 'parallel', this.panel.side, standoff, visuals, "screen"); - }; - AxisView.prototype._draw_ticks = function (ctx, coords, tin, tout, visuals) { - if (!visuals.doit) - return; - var x = coords[0], y = coords[1]; - var _a = this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name), sxs = _a[0], sys = _a[1]; - var _b = this.normals, nx = _b[0], ny = _b[1]; - var _c = this.offsets, xoff = _c[0], yoff = _c[1]; - var _d = [nx * (xoff - tin), ny * (yoff - tin)], nxin = _d[0], nyin = _d[1]; - var _e = [nx * (xoff + tout), ny * (yoff + tout)], nxout = _e[0], nyout = _e[1]; - visuals.set_value(ctx); - for (var i = 0; i < sxs.length; i++) { - var sx0 = Math.round(sxs[i] + nxout); - var sy0 = Math.round(sys[i] + nyout); - var sx1 = Math.round(sxs[i] + nxin); - var sy1 = Math.round(sys[i] + nyin); - ctx.beginPath(); - ctx.moveTo(sx0, sy0); - ctx.lineTo(sx1, sy1); - ctx.stroke(); - } - }; - AxisView.prototype._draw_oriented_labels = function (ctx, labels, coords, orient, _side, standoff, visuals, units) { - var _a, _b, _c; - if (units === void 0) { - units = "data"; - } - if (!visuals.doit || labels.length == 0) - return; - var sxs, sys; - var xoff, yoff; - if (units == "screen") { - sxs = coords[0], sys = coords[1]; - _a = [0, 0], xoff = _a[0], yoff = _a[1]; - } - else { - var dxs = coords[0], dys = coords[1]; - _b = this.plot_view.map_to_screen(dxs, dys, this.model.x_range_name, this.model.y_range_name), sxs = _b[0], sys = _b[1]; - _c = this.offsets, xoff = _c[0], yoff = _c[1]; - } - var _d = this.normals, nx = _d[0], ny = _d[1]; - var nxd = nx * (xoff + standoff); - var nyd = ny * (yoff + standoff); - visuals.set_value(ctx); - this.panel.apply_label_text_heuristics(ctx, orient); - var angle; - if (types_1.isString(orient)) - angle = this.panel.get_label_angle_heuristic(orient); - else - angle = -orient; - for (var i = 0; i < sxs.length; i++) { - var sx = Math.round(sxs[i] + nxd); - var sy = Math.round(sys[i] + nyd); - ctx.translate(sx, sy); - ctx.rotate(angle); - ctx.fillText(labels[i], 0, 0); - ctx.rotate(-angle); - ctx.translate(-sx, -sy); - } - }; - // extents sub functions ----------------------------------------------------- - /*protected*/ AxisView.prototype._axis_label_extent = function () { - if (this.model.axis_label == null || this.model.axis_label == "") - return 0; - var standoff = this.model.axis_label_standoff; - var visuals = this.visuals.axis_label_text; - return this._oriented_labels_extent([this.model.axis_label], "parallel", this.panel.side, standoff, visuals); - }; - /*protected*/ AxisView.prototype._tick_extent = function () { - return this.model.major_tick_out; - }; - /*protected*/ AxisView.prototype._tick_label_extent = function () { - return array_1.sum(this._tick_label_extents()); - }; - AxisView.prototype._tick_label_extents = function () { - var coords = this.tick_coords.major; - var labels = this.compute_labels(coords[this.dimension]); - var orient = this.model.major_label_orientation; - var standoff = this.model.major_label_standoff; - var visuals = this.visuals.major_label_text; - return [this._oriented_labels_extent(labels, orient, this.panel.side, standoff, visuals)]; - }; - AxisView.prototype._oriented_labels_extent = function (labels, orient, side, standoff, visuals) { - if (labels.length == 0) - return 0; - var ctx = this.plot_view.canvas_view.ctx; - visuals.set_value(ctx); - var hscale; - var angle; - if (types_1.isString(orient)) { - hscale = 1; - angle = this.panel.get_label_angle_heuristic(orient); - } - else { - hscale = 2; - angle = -orient; - } - angle = Math.abs(angle); - var c = Math.cos(angle); - var s = Math.sin(angle); - var extent = 0; - for (var i = 0; i < labels.length; i++) { - var w = ctx.measureText(labels[i]).width * 1.1; - var h = ctx.measureText(labels[i]).ascent * 0.9; - var val = void 0; - if (side == "above" || side == "below") - val = w * s + (h / hscale) * c; - else - val = w * c + (h / hscale) * s; - // update extent if current value is larger - if (val > extent) - extent = val; - } - // only apply the standoff if we already have non-zero extent - if (extent > 0) - extent += standoff; - return extent; - }; - Object.defineProperty(AxisView.prototype, "normals", { - // {{{ TODO: state - get: function () { - return this.panel.normals; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "dimension", { - get: function () { - return this.panel.dimension; - }, - enumerable: true, - configurable: true - }); - AxisView.prototype.compute_labels = function (ticks) { - var labels = this.model.formatter.doFormat(ticks, this); - for (var i = 0; i < ticks.length; i++) { - if (ticks[i] in this.model.major_label_overrides) - labels[i] = this.model.major_label_overrides[ticks[i]]; - } - return labels; - }; - Object.defineProperty(AxisView.prototype, "offsets", { - get: function () { - // If we have a fixed_position then we should respect that exactly and - // not apply any offsets (https://github.com/bokeh/bokeh/issues/8552) - if (this.model.fixed_location != null) - return [0, 0]; - var frame = this.plot_view.frame; - var _a = [0, 0], xoff = _a[0], yoff = _a[1]; - switch (this.panel.side) { - case "below": - yoff = abs(this.panel._top.value - frame._bottom.value); - break; - case "above": - yoff = abs(this.panel._bottom.value - frame._top.value); - break; - case "right": - xoff = abs(this.panel._left.value - frame._right.value); - break; - case "left": - xoff = abs(this.panel._right.value - frame._left.value); - break; - } - return [xoff, yoff]; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "ranges", { - get: function () { - var i = this.dimension; - var j = (i + 1) % 2; - var frame = this.plot_view.frame; - var ranges = [ - frame.x_ranges[this.model.x_range_name], - frame.y_ranges[this.model.y_range_name], - ]; - return [ranges[i], ranges[j]]; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "computed_bounds", { - get: function () { - var range = this.ranges[0]; - var user_bounds = this.model.bounds; // XXX: ? 'auto' - var range_bounds = [range.min, range.max]; - if (user_bounds == 'auto') - return [range.min, range.max]; - else if (types_1.isArray(user_bounds)) { - var start = void 0; - var end = void 0; - var user_start = user_bounds[0], user_end = user_bounds[1]; - var range_start = range_bounds[0], range_end = range_bounds[1]; - if (abs(user_start - user_end) > abs(range_start - range_end)) { - start = max(min(user_start, user_end), range_start); - end = min(max(user_start, user_end), range_end); - } - else { - start = min(user_start, user_end); - end = max(user_start, user_end); - } - return [start, end]; - } - else - throw new Error("user bounds '" + user_bounds + "' not understood"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "rule_coords", { - get: function () { - var i = this.dimension; - var j = (i + 1) % 2; - var range = this.ranges[0]; - var _a = this.computed_bounds, start = _a[0], end = _a[1]; - var xs = new Array(2); - var ys = new Array(2); - var coords = [xs, ys]; - coords[i][0] = Math.max(start, range.min); - coords[i][1] = Math.min(end, range.max); - if (coords[i][0] > coords[i][1]) - coords[i][0] = coords[i][1] = NaN; - coords[j][0] = this.loc; - coords[j][1] = this.loc; - return coords; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "tick_coords", { - get: function () { - var i = this.dimension; - var j = (i + 1) % 2; - var range = this.ranges[0]; - var _a = this.computed_bounds, start = _a[0], end = _a[1]; - var ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {}); - var majors = ticks.major; - var minors = ticks.minor; - var xs = []; - var ys = []; - var coords = [xs, ys]; - var minor_xs = []; - var minor_ys = []; - var minor_coords = [minor_xs, minor_ys]; - var _b = [range.min, range.max], range_min = _b[0], range_max = _b[1]; - for (var ii = 0; ii < majors.length; ii++) { - if (majors[ii] < range_min || majors[ii] > range_max) - continue; - coords[i].push(majors[ii]); - coords[j].push(this.loc); - } - for (var ii = 0; ii < minors.length; ii++) { - if (minors[ii] < range_min || minors[ii] > range_max) - continue; - minor_coords[i].push(minors[ii]); - minor_coords[j].push(this.loc); - } - return { - major: coords, - minor: minor_coords, - }; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AxisView.prototype, "loc", { - get: function () { - var fixed_location = this.model.fixed_location; - if (fixed_location != null) { - if (types_1.isNumber(fixed_location)) - return fixed_location; - var _a = this.ranges, cross_range_1 = _a[1]; - if (cross_range_1 instanceof factor_range_1.FactorRange) - return cross_range_1.synthetic(fixed_location); - throw new Error("unexpected"); - } - var _b = this.ranges, cross_range = _b[1]; - switch (this.panel.side) { - case 'left': - case 'below': - return cross_range.start; - case 'right': - case 'above': - return cross_range.end; - } - }, - enumerable: true, - configurable: true - }); - // }}} - AxisView.prototype.serializable_state = function () { - return tslib_1.__assign({}, _super.prototype.serializable_state.call(this), { bbox: this.layout.bbox.rect }); - }; - return AxisView; - }(guide_renderer_1.GuideRendererView)); - exports.AxisView = AxisView; - var Axis = /** @class */ (function (_super) { - tslib_1.__extends(Axis, _super); - function Axis(attrs) { - return _super.call(this, attrs) || this; - } - Axis.initClass = function () { - this.prototype.type = "Axis"; - this.prototype.default_view = AxisView; - this.mixins([ - 'line:axis_', - 'line:major_tick_', - 'line:minor_tick_', - 'text:major_label_', - 'text:axis_label_', - ]); - this.define({ - bounds: [p.Any, 'auto'], - ticker: [p.Instance], - formatter: [p.Instance], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - axis_label: [p.String, ''], - axis_label_standoff: [p.Int, 5], - major_label_standoff: [p.Int, 5], - major_label_orientation: [p.Any, "horizontal"], - major_label_overrides: [p.Any, {}], - major_tick_in: [p.Number, 2], - major_tick_out: [p.Number, 6], - minor_tick_in: [p.Number, 0], - minor_tick_out: [p.Number, 4], - fixed_location: [p.Any, null], - }); - this.override({ - axis_line_color: 'black', - major_tick_line_color: 'black', - minor_tick_line_color: 'black', - major_label_text_font_size: "8pt", - major_label_text_align: "center", - major_label_text_baseline: "alphabetic", - axis_label_text_font_size: "10pt", - axis_label_text_font_style: "italic", - }); - }; - return Axis; - }(guide_renderer_1.GuideRenderer)); - exports.Axis = Axis; - Axis.initClass(); -} -, -/* models/axes/categorical_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var axis_1 = require(82) /* ./axis */; - var categorical_ticker_1 = require(218) /* ../tickers/categorical_ticker */; - var categorical_tick_formatter_1 = require(108) /* ../formatters/categorical_tick_formatter */; - var p = require(18) /* ../../core/properties */; - var CategoricalAxisView = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalAxisView, _super); - function CategoricalAxisView() { - return _super !== null && _super.apply(this, arguments) || this; - } - CategoricalAxisView.prototype._render = function (ctx, extents, tick_coords) { - this._draw_group_separators(ctx, extents, tick_coords); - }; - CategoricalAxisView.prototype._draw_group_separators = function (ctx, _extents, _tick_coords) { - var _a; - var range = this.ranges[0]; - var _b = this.computed_bounds, start = _b[0], end = _b[1]; - if (!range.tops || range.tops.length < 2 || !this.visuals.separator_line.doit) - return; - var dim = this.dimension; - var alt = (dim + 1) % 2; - var coords = [[], []]; - var ind = 0; - for (var i = 0; i < range.tops.length - 1; i++) { - var first = void 0, last = void 0; - for (var j = ind; j < range.factors.length; j++) { - if (range.factors[j][0] == range.tops[i + 1]) { - _a = [range.factors[j - 1], range.factors[j]], first = _a[0], last = _a[1]; - ind = j; - break; - } - } - var pt = (range.synthetic(first) + range.synthetic(last)) / 2; - if (pt > start && pt < end) { - coords[dim].push(pt); - coords[alt].push(this.loc); - } - } - var tex = this._tick_label_extent(); - this._draw_ticks(ctx, coords, -3, (tex - 6), this.visuals.separator_line); - }; - CategoricalAxisView.prototype._draw_major_labels = function (ctx, extents, _tick_coords) { - var info = this._get_factor_info(); - var standoff = extents.tick + this.model.major_label_standoff; - for (var i = 0; i < info.length; i++) { - var _a = info[i], labels = _a[0], coords = _a[1], orient = _a[2], visuals_1 = _a[3]; - this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals_1); - standoff += extents.tick_label[i]; - } - }; - CategoricalAxisView.prototype._tick_label_extents = function () { - var info = this._get_factor_info(); - var extents = []; - for (var _i = 0, info_1 = info; _i < info_1.length; _i++) { - var _a = info_1[_i], labels = _a[0], orient = _a[2], visuals_2 = _a[3]; - var extent = this._oriented_labels_extent(labels, orient, this.panel.side, this.model.major_label_standoff, visuals_2); - extents.push(extent); - } - return extents; - }; - CategoricalAxisView.prototype._get_factor_info = function () { - var range = this.ranges[0]; - var _a = this.computed_bounds, start = _a[0], end = _a[1]; - var loc = this.loc; - var ticks = this.model.ticker.get_ticks(start, end, range, loc, {}); - var coords = this.tick_coords; - var info = []; - if (range.levels == 1) { - var major = ticks.major; - var labels = this.model.formatter.doFormat(major, this); - info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]); - } - else if (range.levels == 2) { - var major = ticks.major.map(function (x) { return x[1]; }); - var labels = this.model.formatter.doFormat(major, this); - info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]); - info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]); - } - else if (range.levels == 3) { - var major = ticks.major.map(function (x) { return x[2]; }); - var labels = this.model.formatter.doFormat(major, this); - var mid_labels = ticks.mids.map(function (x) { return x[1]; }); - info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]); - info.push([mid_labels, coords.mids, this.model.subgroup_label_orientation, this.visuals.subgroup_text]); - info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]); - } - return info; - }; - Object.defineProperty(CategoricalAxisView.prototype, "tick_coords", { - // {{{ TODO: state - get: function () { - var _this = this; - var i = this.dimension; - var j = (i + 1) % 2; - var range = this.ranges[0]; - var _a = this.computed_bounds, start = _a[0], end = _a[1]; - var ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {}); - var coords = { - major: [[], []], - mids: [[], []], - tops: [[], []], - minor: [[], []], - }; - coords.major[i] = ticks.major; - coords.major[j] = ticks.major.map(function (_x) { return _this.loc; }); - if (range.levels == 3) - coords.mids[i] = ticks.mids; - coords.mids[j] = ticks.mids.map(function (_x) { return _this.loc; }); - if (range.levels > 1) - coords.tops[i] = ticks.tops; - coords.tops[j] = ticks.tops.map(function (_x) { return _this.loc; }); - return coords; - }, - enumerable: true, - configurable: true - }); - return CategoricalAxisView; - }(axis_1.AxisView)); - exports.CategoricalAxisView = CategoricalAxisView; - var CategoricalAxis = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalAxis, _super); - function CategoricalAxis(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalAxis.initClass = function () { - this.prototype.type = "CategoricalAxis"; - this.prototype.default_view = CategoricalAxisView; - this.mixins([ - "line:separator_", - "text:group_", - "text:subgroup_", - ]); - this.define({ - group_label_orientation: [p.Any, "parallel"], - subgroup_label_orientation: [p.Any, "parallel"], - }); - this.override({ - ticker: function () { return new categorical_ticker_1.CategoricalTicker(); }, - formatter: function () { return new categorical_tick_formatter_1.CategoricalTickFormatter(); }, - separator_line_color: "lightgrey", - separator_line_width: 2, - group_text_font_style: "bold", - group_text_font_size: "8pt", - group_text_color: "grey", - subgroup_text_font_style: "bold", - subgroup_text_font_size: "8pt", - }); - }; - return CategoricalAxis; - }(axis_1.Axis)); - exports.CategoricalAxis = CategoricalAxis; - CategoricalAxis.initClass(); -} -, -/* models/axes/continuous_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var axis_1 = require(82) /* ./axis */; - var ContinuousAxis = /** @class */ (function (_super) { - tslib_1.__extends(ContinuousAxis, _super); - function ContinuousAxis(attrs) { - return _super.call(this, attrs) || this; - } - ContinuousAxis.initClass = function () { - this.prototype.type = "ContinuousAxis"; - }; - return ContinuousAxis; - }(axis_1.Axis)); - exports.ContinuousAxis = ContinuousAxis; - ContinuousAxis.initClass(); -} -, -/* models/axes/datetime_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var linear_axis_1 = require(87) /* ./linear_axis */; - var datetime_tick_formatter_1 = require(109) /* ../formatters/datetime_tick_formatter */; - var datetime_ticker_1 = require(221) /* ../tickers/datetime_ticker */; - var DatetimeAxisView = /** @class */ (function (_super) { - tslib_1.__extends(DatetimeAxisView, _super); - function DatetimeAxisView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return DatetimeAxisView; - }(linear_axis_1.LinearAxisView)); - exports.DatetimeAxisView = DatetimeAxisView; - var DatetimeAxis = /** @class */ (function (_super) { - tslib_1.__extends(DatetimeAxis, _super); - function DatetimeAxis(attrs) { - return _super.call(this, attrs) || this; - } - DatetimeAxis.initClass = function () { - this.prototype.type = "DatetimeAxis"; - this.prototype.default_view = DatetimeAxisView; - this.override({ - ticker: function () { return new datetime_ticker_1.DatetimeTicker(); }, - formatter: function () { return new datetime_tick_formatter_1.DatetimeTickFormatter(); }, - }); - }; - return DatetimeAxis; - }(linear_axis_1.LinearAxis)); - exports.DatetimeAxis = DatetimeAxis; - DatetimeAxis.initClass(); -} -, -/* models/axes/index */ function _(require, module, exports) { - var axis_1 = require(82) /* ./axis */; - exports.Axis = axis_1.Axis; - var categorical_axis_1 = require(83) /* ./categorical_axis */; - exports.CategoricalAxis = categorical_axis_1.CategoricalAxis; - var continuous_axis_1 = require(84) /* ./continuous_axis */; - exports.ContinuousAxis = continuous_axis_1.ContinuousAxis; - var datetime_axis_1 = require(85) /* ./datetime_axis */; - exports.DatetimeAxis = datetime_axis_1.DatetimeAxis; - var linear_axis_1 = require(87) /* ./linear_axis */; - exports.LinearAxis = linear_axis_1.LinearAxis; - var log_axis_1 = require(88) /* ./log_axis */; - exports.LogAxis = log_axis_1.LogAxis; - var mercator_axis_1 = require(89) /* ./mercator_axis */; - exports.MercatorAxis = mercator_axis_1.MercatorAxis; -} -, -/* models/axes/linear_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var axis_1 = require(82) /* ./axis */; - var continuous_axis_1 = require(84) /* ./continuous_axis */; - var basic_tick_formatter_1 = require(107) /* ../formatters/basic_tick_formatter */; - var basic_ticker_1 = require(217) /* ../tickers/basic_ticker */; - var LinearAxisView = /** @class */ (function (_super) { - tslib_1.__extends(LinearAxisView, _super); - function LinearAxisView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return LinearAxisView; - }(axis_1.AxisView)); - exports.LinearAxisView = LinearAxisView; - var LinearAxis = /** @class */ (function (_super) { - tslib_1.__extends(LinearAxis, _super); - function LinearAxis(attrs) { - return _super.call(this, attrs) || this; - } - LinearAxis.initClass = function () { - this.prototype.type = "LinearAxis"; - this.prototype.default_view = LinearAxisView; - this.override({ - ticker: function () { return new basic_ticker_1.BasicTicker(); }, - formatter: function () { return new basic_tick_formatter_1.BasicTickFormatter(); }, - }); - }; - return LinearAxis; - }(continuous_axis_1.ContinuousAxis)); - exports.LinearAxis = LinearAxis; - LinearAxis.initClass(); -} -, -/* models/axes/log_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var axis_1 = require(82) /* ./axis */; - var continuous_axis_1 = require(84) /* ./continuous_axis */; - var log_tick_formatter_1 = require(112) /* ../formatters/log_tick_formatter */; - var log_ticker_1 = require(225) /* ../tickers/log_ticker */; - var LogAxisView = /** @class */ (function (_super) { - tslib_1.__extends(LogAxisView, _super); - function LogAxisView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return LogAxisView; - }(axis_1.AxisView)); - exports.LogAxisView = LogAxisView; - var LogAxis = /** @class */ (function (_super) { - tslib_1.__extends(LogAxis, _super); - function LogAxis(attrs) { - return _super.call(this, attrs) || this; - } - LogAxis.initClass = function () { - this.prototype.type = "LogAxis"; - this.prototype.default_view = LogAxisView; - this.override({ - ticker: function () { return new log_ticker_1.LogTicker(); }, - formatter: function () { return new log_tick_formatter_1.LogTickFormatter(); }, - }); - }; - return LogAxis; - }(continuous_axis_1.ContinuousAxis)); - exports.LogAxis = LogAxis; - LogAxis.initClass(); -} -, -/* models/axes/mercator_axis */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var axis_1 = require(82) /* ./axis */; - var linear_axis_1 = require(87) /* ./linear_axis */; - var mercator_tick_formatter_1 = require(113) /* ../formatters/mercator_tick_formatter */; - var mercator_ticker_1 = require(226) /* ../tickers/mercator_ticker */; - var MercatorAxisView = /** @class */ (function (_super) { - tslib_1.__extends(MercatorAxisView, _super); - function MercatorAxisView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return MercatorAxisView; - }(axis_1.AxisView)); - exports.MercatorAxisView = MercatorAxisView; - var MercatorAxis = /** @class */ (function (_super) { - tslib_1.__extends(MercatorAxis, _super); - function MercatorAxis(attrs) { - return _super.call(this, attrs) || this; - } - MercatorAxis.initClass = function () { - this.prototype.type = "MercatorAxis"; - this.prototype.default_view = MercatorAxisView; - this.override({ - ticker: function () { return new mercator_ticker_1.MercatorTicker({ dimension: "lat" }); }, - formatter: function () { return new mercator_tick_formatter_1.MercatorTickFormatter({ dimension: "lat" }); }, - }); - }; - return MercatorAxis; - }(linear_axis_1.LinearAxis)); - exports.MercatorAxis = MercatorAxis; - MercatorAxis.initClass(); -} -, -/* models/callbacks/callback */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var Callback = /** @class */ (function (_super) { - tslib_1.__extends(Callback, _super); - function Callback(attrs) { - return _super.call(this, attrs) || this; - } - Callback.initClass = function () { - this.prototype.type = 'Callback'; - }; - return Callback; - }(model_1.Model)); - exports.Callback = Callback; - Callback.initClass(); -} -, -/* models/callbacks/customjs */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var callback_1 = require(90) /* ./callback */; - var p = require(18) /* ../../core/properties */; - var object_1 = require(35) /* ../../core/util/object */; - var string_1 = require(40) /* ../../core/util/string */; - var CustomJS = /** @class */ (function (_super) { - tslib_1.__extends(CustomJS, _super); - function CustomJS(attrs) { - return _super.call(this, attrs) || this; - } - CustomJS.initClass = function () { - this.prototype.type = 'CustomJS'; - this.define({ - args: [p.Any, {}], - code: [p.String, ''], - use_strict: [p.Boolean, false], - }); - }; - Object.defineProperty(CustomJS.prototype, "names", { - get: function () { - return object_1.keys(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJS.prototype, "values", { - get: function () { - return object_1.values(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJS.prototype, "func", { - get: function () { - var code = this.use_strict ? string_1.use_strict(this.code) : this.code; - return new (Function.bind.apply(Function, [void 0].concat(this.names, ["cb_obj", "cb_data", "require", "exports", code])))(); - }, - enumerable: true, - configurable: true - }); - CustomJS.prototype.execute = function (cb_obj, cb_data) { - if (cb_data === void 0) { - cb_data = {}; - } - return this.func.apply(cb_obj, this.values.concat(cb_obj, cb_data, require, {})); - }; - return CustomJS; - }(callback_1.Callback)); - exports.CustomJS = CustomJS; - CustomJS.initClass(); -} -, -/* models/callbacks/index */ function _(require, module, exports) { - var customjs_1 = require(91) /* ./customjs */; - exports.CustomJS = customjs_1.CustomJS; - var open_url_1 = require(93) /* ./open_url */; - exports.OpenURL = open_url_1.OpenURL; -} -, -/* models/callbacks/open_url */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var callback_1 = require(90) /* ./callback */; - var templating_1 = require(42) /* ../../core/util/templating */; - var p = require(18) /* ../../core/properties */; - var OpenURL = /** @class */ (function (_super) { - tslib_1.__extends(OpenURL, _super); - function OpenURL(attrs) { - return _super.call(this, attrs) || this; - } - OpenURL.initClass = function () { - this.prototype.type = 'OpenURL'; - this.define({ - url: [p.String, 'http://'], - same_tab: [p.Boolean, false], - }); - }; - OpenURL.prototype.execute = function (_cb_obj, _a) { - var _this = this; - var source = _a.source; - var open_url = function (i) { - var url = templating_1.replace_placeholders(_this.url, source, i); - if (_this.same_tab) - window.location.href = url; - else - window.open(url); - }; - var selected = source.selected; - for (var _i = 0, _b = selected.indices; _i < _b.length; _i++) { - var i = _b[_i]; - open_url(i); - } - for (var _c = 0, _d = selected.line_indices; _c < _d.length; _c++) { - var i = _d[_c]; - open_url(i); - } - // TODO: multiline_indices: {[key: string]: number[]} - }; - return OpenURL; - }(callback_1.Callback)); - exports.OpenURL = OpenURL; - OpenURL.initClass(); -} -, -/* models/canvas/canvas */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var has_props_1 = require(8) /* ../../core/has_props */; - var dom_view_1 = require(6) /* ../../core/dom_view */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var dom_1 = require(5) /* ../../core/dom */; - var bbox_1 = require(27) /* ../../core/util/bbox */; - var compat_1 = require(31) /* ../../core/util/compat */; - var canvas_1 = require(29) /* ../../core/util/canvas */; - // fixes up a problem with some versions of IE11 - // ref: http://stackoverflow.com/questions/22062313/imagedata-set-in-internetexplorer - if (compat_1.is_ie && typeof CanvasPixelArray !== "undefined") { - CanvasPixelArray.prototype.set = function (arr) { - for (var i = 0; i < this.length; i++) { - this[i] = arr[i]; - } - }; - } - var canvas2svg = require(297) /* canvas2svg */; - var CanvasView = /** @class */ (function (_super) { - tslib_1.__extends(CanvasView, _super); - function CanvasView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(CanvasView.prototype, "ctx", { - get: function () { - return this._ctx; - }, - enumerable: true, - configurable: true - }); - CanvasView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.map_el = this.model.map ? this.el.appendChild(dom_1.div({ class: "bk-canvas-map" })) : null; - var style = { - position: "absolute", - top: "0", - left: "0", - width: "100%", - height: "100%", - }; - switch (this.model.output_backend) { - case "canvas": - case "webgl": { - this.canvas_el = this.el.appendChild(dom_1.canvas({ class: "bk-canvas", style: style })); - var ctx = this.canvas_el.getContext('2d'); - if (ctx == null) - throw new Error("unable to obtain 2D rendering context"); - this._ctx = ctx; - break; - } - case "svg": { - var ctx = new canvas2svg(); - this._ctx = ctx; - this.canvas_el = this.el.appendChild(ctx.getSvg()); - break; - } - } - this.overlays_el = this.el.appendChild(dom_1.div({ class: "bk-canvas-overlays", style: style })); - this.events_el = this.el.appendChild(dom_1.div({ class: "bk-canvas-events", style: style })); - canvas_1.fixup_ctx(this._ctx); - logging_1.logger.debug("CanvasView initialized"); - }; - CanvasView.prototype.get_canvas_element = function () { - return this.canvas_el; - }; - CanvasView.prototype.prepare_canvas = function (width, height) { - // Ensure canvas has the correct size, taking HIDPI into account - this.bbox = new bbox_1.BBox({ left: 0, top: 0, width: width, height: height }); - this.el.style.width = width + "px"; - this.el.style.height = height + "px"; - var pixel_ratio = canvas_1.get_scale_ratio(this.ctx, this.model.use_hidpi, this.model.output_backend); - this.model.pixel_ratio = pixel_ratio; - this.canvas_el.style.width = width + "px"; - this.canvas_el.style.height = height + "px"; - // XXX: io.export and canvas2svg don't like this - // this.canvas_el.width = width*pixel_ratio - // this.canvas_el.height = height*pixel_ratio - this.canvas_el.setAttribute("width", "" + width * pixel_ratio); - this.canvas_el.setAttribute("height", "" + height * pixel_ratio); - logging_1.logger.debug("Rendering CanvasView with width: " + width + ", height: " + height + ", pixel ratio: " + pixel_ratio); - }; - return CanvasView; - }(dom_view_1.DOMView)); - exports.CanvasView = CanvasView; - var Canvas = /** @class */ (function (_super) { - tslib_1.__extends(Canvas, _super); - function Canvas(attrs) { - return _super.call(this, attrs) || this; - } - Canvas.initClass = function () { - this.prototype.type = "Canvas"; - this.prototype.default_view = CanvasView; - this.internal({ - map: [p.Boolean, false], - use_hidpi: [p.Boolean, true], - pixel_ratio: [p.Number, 1], - output_backend: [p.OutputBackend, "canvas"], - }); - }; - return Canvas; - }(has_props_1.HasProps)); - exports.Canvas = Canvas; - Canvas.initClass(); -} -, -/* models/canvas/cartesian_frame */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var categorical_scale_1 = require(198) /* ../scales/categorical_scale */; - var linear_scale_1 = require(200) /* ../scales/linear_scale */; - var log_scale_1 = require(201) /* ../scales/log_scale */; - var range1d_1 = require(191) /* ../ranges/range1d */; - var data_range1d_1 = require(187) /* ../ranges/data_range1d */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var layout_1 = require(13) /* ../../core/layout */; - var CartesianFrame = /** @class */ (function (_super) { - tslib_1.__extends(CartesianFrame, _super); - function CartesianFrame(x_scale, y_scale, x_range, y_range, extra_x_ranges, extra_y_ranges) { - if (extra_x_ranges === void 0) { - extra_x_ranges = {}; - } - if (extra_y_ranges === void 0) { - extra_y_ranges = {}; - } - var _this = _super.call(this) || this; - _this.x_scale = x_scale; - _this.y_scale = y_scale; - _this.x_range = x_range; - _this.y_range = y_range; - _this.extra_x_ranges = extra_x_ranges; - _this.extra_y_ranges = extra_y_ranges; - _this._configure_scales(); - return _this; - } - CartesianFrame.prototype.map_to_screen = function (x, y, x_name, y_name) { - if (x_name === void 0) { - x_name = "default"; - } - if (y_name === void 0) { - y_name = "default"; - } - var sx = this.xscales[x_name].v_compute(x); - var sy = this.yscales[y_name].v_compute(y); - return [sx, sy]; - }; - CartesianFrame.prototype._get_ranges = function (range, extra_ranges) { - var ranges = {}; - ranges.default = range; - if (extra_ranges != null) { - for (var name_1 in extra_ranges) - ranges[name_1] = extra_ranges[name_1]; - } - return ranges; - }; - /*protected*/ CartesianFrame.prototype._get_scales = function (scale, ranges, frame_range) { - var scales = {}; - for (var name_2 in ranges) { - var range = ranges[name_2]; - if (range instanceof data_range1d_1.DataRange1d || range instanceof range1d_1.Range1d) { - if (!(scale instanceof log_scale_1.LogScale) && !(scale instanceof linear_scale_1.LinearScale)) - throw new Error("Range " + range.type + " is incompatible is Scale " + scale.type); - // XXX: special case because CategoricalScale is a subclass of LinearScale, should be removed in future - if (scale instanceof categorical_scale_1.CategoricalScale) - throw new Error("Range " + range.type + " is incompatible is Scale " + scale.type); - } - if (range instanceof factor_range_1.FactorRange) { - if (!(scale instanceof categorical_scale_1.CategoricalScale)) - throw new Error("Range " + range.type + " is incompatible is Scale " + scale.type); - } - if (scale instanceof log_scale_1.LogScale && range instanceof data_range1d_1.DataRange1d) - range.scale_hint = "log"; - var s = scale.clone(); - s.setv({ source_range: range, target_range: frame_range }); - scales[name_2] = s; - } - return scales; - }; - CartesianFrame.prototype._configure_frame_ranges = function () { - // data to/from screen space transform (left-bottom <-> left-top origin) - this._h_target = new range1d_1.Range1d({ start: this._left.value, end: this._right.value }); - this._v_target = new range1d_1.Range1d({ start: this._bottom.value, end: this._top.value }); - }; - CartesianFrame.prototype._configure_scales = function () { - this._configure_frame_ranges(); - this._x_ranges = this._get_ranges(this.x_range, this.extra_x_ranges); - this._y_ranges = this._get_ranges(this.y_range, this.extra_y_ranges); - this._xscales = this._get_scales(this.x_scale, this._x_ranges, this._h_target); - this._yscales = this._get_scales(this.y_scale, this._y_ranges, this._v_target); - }; - CartesianFrame.prototype._update_scales = function () { - this._configure_frame_ranges(); - for (var name_3 in this._xscales) { - var scale = this._xscales[name_3]; - scale.target_range = this._h_target; - } - for (var name_4 in this._yscales) { - var scale = this._yscales[name_4]; - scale.target_range = this._v_target; - } - }; - CartesianFrame.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - this._update_scales(); - }; - Object.defineProperty(CartesianFrame.prototype, "x_ranges", { - get: function () { - return this._x_ranges; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CartesianFrame.prototype, "y_ranges", { - get: function () { - return this._y_ranges; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CartesianFrame.prototype, "xscales", { - get: function () { - return this._xscales; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CartesianFrame.prototype, "yscales", { - get: function () { - return this._yscales; - }, - enumerable: true, - configurable: true - }); - return CartesianFrame; - }(layout_1.LayoutItem)); - exports.CartesianFrame = CartesianFrame; -} -, -/* models/canvas/index */ function _(require, module, exports) { - var canvas_1 = require(94) /* ./canvas */; - exports.Canvas = canvas_1.Canvas; - var cartesian_frame_1 = require(95) /* ./cartesian_frame */; - exports.CartesianFrame = cartesian_frame_1.CartesianFrame; -} -, -/* models/expressions/cumsum */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var expression_1 = require(98) /* ./expression */; - var p = require(18) /* ../../core/properties */; - var CumSum = /** @class */ (function (_super) { - tslib_1.__extends(CumSum, _super); - function CumSum(attrs) { - return _super.call(this, attrs) || this; - } - CumSum.initClass = function () { - this.prototype.type = "CumSum"; - this.define({ - field: [p.String], - include_zero: [p.Boolean, false], - }); - }; - CumSum.prototype._v_compute = function (source) { - var result = new Float64Array(source.get_length() || 0); - var col = source.data[this.field]; - var offset = this.include_zero ? 1 : 0; - result[0] = this.include_zero ? 0 : col[0]; - for (var i = 1; i < result.length; i++) { - result[i] = result[i - 1] + col[i - offset]; - } - return result; - }; - return CumSum; - }(expression_1.Expression)); - exports.CumSum = CumSum; - CumSum.initClass(); -} -, -/* models/expressions/expression */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var Expression = /** @class */ (function (_super) { - tslib_1.__extends(Expression, _super); - function Expression(attrs) { - var _this = _super.call(this, attrs) || this; - _this._connected = {}; - _this._result = {}; - return _this; - } - Expression.initClass = function () { - this.prototype.type = "Expression"; - }; - Expression.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._connected = {}; - this._result = {}; - }; - Expression.prototype.v_compute = function (source) { - var _this = this; - if (this._connected[source.id] == null) { - this.connect(source.change, function () { return delete _this._result[source.id]; }); - this.connect(source.patching, function () { return delete _this._result[source.id]; }); - this.connect(source.streaming, function () { return delete _this._result[source.id]; }); - this._connected[source.id] = true; - } - var result = this._result[source.id]; - if (result == null) - this._result[source.id] = result = this._v_compute(source); - return result; - }; - return Expression; - }(model_1.Model)); - exports.Expression = Expression; - Expression.initClass(); -} -, -/* models/expressions/index */ function _(require, module, exports) { - var expression_1 = require(98) /* ./expression */; - exports.Expression = expression_1.Expression; - var stack_1 = require(100) /* ./stack */; - exports.Stack = stack_1.Stack; - var cumsum_1 = require(97) /* ./cumsum */; - exports.CumSum = cumsum_1.CumSum; -} -, -/* models/expressions/stack */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var expression_1 = require(98) /* ./expression */; - var p = require(18) /* ../../core/properties */; - var Stack = /** @class */ (function (_super) { - tslib_1.__extends(Stack, _super); - function Stack(attrs) { - return _super.call(this, attrs) || this; - } - Stack.initClass = function () { - this.prototype.type = "Stack"; - this.define({ - fields: [p.Array, []], - }); - }; - Stack.prototype._v_compute = function (source) { - var result = new Float64Array(source.get_length() || 0); - for (var _i = 0, _a = this.fields; _i < _a.length; _i++) { - var f = _a[_i]; - for (var i = 0; i < source.data[f].length; i++) { - var x = source.data[f][i]; - result[i] += x; - } - } - return result; - }; - return Stack; - }(expression_1.Expression)); - exports.Stack = Stack; - Stack.initClass(); -} -, -/* models/filters/boolean_filter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var filter_1 = require(103) /* ./filter */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var BooleanFilter = /** @class */ (function (_super) { - tslib_1.__extends(BooleanFilter, _super); - function BooleanFilter(attrs) { - return _super.call(this, attrs) || this; - } - BooleanFilter.initClass = function () { - this.prototype.type = 'BooleanFilter'; - this.define({ - booleans: [p.Array, null], - }); - }; - BooleanFilter.prototype.compute_indices = function (source) { - var booleans = this.booleans; - if (booleans != null && booleans.length > 0) { - if (array_1.every(booleans, types_1.isBoolean)) { - if (booleans.length !== source.get_length()) { - logging_1.logger.warn("BooleanFilter " + this.id + ": length of booleans doesn't match data source"); - } - return array_1.range(0, booleans.length).filter(function (i) { return booleans[i] === true; }); - } - else { - logging_1.logger.warn("BooleanFilter " + this.id + ": booleans should be array of booleans, defaulting to no filtering"); - return null; - } - } - else { - if (booleans != null && booleans.length == 0) - logging_1.logger.warn("BooleanFilter " + this.id + ": booleans is empty, defaulting to no filtering"); - else - logging_1.logger.warn("BooleanFilter " + this.id + ": booleans was not set, defaulting to no filtering"); - return null; - } - }; - return BooleanFilter; - }(filter_1.Filter)); - exports.BooleanFilter = BooleanFilter; - BooleanFilter.initClass(); -} -, -/* models/filters/customjs_filter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var filter_1 = require(103) /* ./filter */; - var p = require(18) /* ../../core/properties */; - var object_1 = require(35) /* ../../core/util/object */; - var string_1 = require(40) /* ../../core/util/string */; - var CustomJSFilter = /** @class */ (function (_super) { - tslib_1.__extends(CustomJSFilter, _super); - function CustomJSFilter(attrs) { - return _super.call(this, attrs) || this; - } - CustomJSFilter.initClass = function () { - this.prototype.type = 'CustomJSFilter'; - this.define({ - args: [p.Any, {}], - code: [p.String, ''], - use_strict: [p.Boolean, false], - }); - }; - Object.defineProperty(CustomJSFilter.prototype, "names", { - get: function () { - return object_1.keys(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJSFilter.prototype, "values", { - get: function () { - return object_1.values(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJSFilter.prototype, "func", { - get: function () { - var code = this.use_strict ? string_1.use_strict(this.code) : this.code; - return new (Function.bind.apply(Function, [void 0].concat(this.names, ["source", "require", "exports", code])))(); - }, - enumerable: true, - configurable: true - }); - CustomJSFilter.prototype.compute_indices = function (source) { - this.filter = this.func.apply(this, this.values.concat([source, require, {}])); - return _super.prototype.compute_indices.call(this, source); - }; - return CustomJSFilter; - }(filter_1.Filter)); - exports.CustomJSFilter = CustomJSFilter; - CustomJSFilter.initClass(); -} -, -/* models/filters/filter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var logging_1 = require(17) /* ../../core/logging */; - var Filter = /** @class */ (function (_super) { - tslib_1.__extends(Filter, _super); - function Filter(attrs) { - return _super.call(this, attrs) || this; - } - Filter.initClass = function () { - this.prototype.type = 'Filter'; - this.define({ - filter: [p.Array, null], - }); - }; - Filter.prototype.compute_indices = function (_source) { - var filter = this.filter; - if (filter != null && filter.length >= 0) { - if (types_1.isArrayOf(filter, types_1.isBoolean)) { - return array_1.range(0, filter.length).filter(function (i) { return filter[i] === true; }); - } - if (types_1.isArrayOf(filter, types_1.isInteger)) { - return filter; - } - logging_1.logger.warn("Filter " + this.id + ": filter should either be array of only booleans or only integers, defaulting to no filtering"); - return null; - } - else { - logging_1.logger.warn("Filter " + this.id + ": filter was not set to be an array, defaulting to no filtering"); - return null; - } - }; - return Filter; - }(model_1.Model)); - exports.Filter = Filter; - Filter.initClass(); -} -, -/* models/filters/group_filter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var filter_1 = require(103) /* ./filter */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var array_1 = require(24) /* ../../core/util/array */; - var GroupFilter = /** @class */ (function (_super) { - tslib_1.__extends(GroupFilter, _super); - function GroupFilter(attrs) { - var _this = _super.call(this, attrs) || this; - _this.indices = null; - return _this; - } - GroupFilter.initClass = function () { - this.prototype.type = 'GroupFilter'; - this.define({ - column_name: [p.String], - group: [p.String], - }); - }; - GroupFilter.prototype.compute_indices = function (source) { - var _this = this; - var column = source.get_column(this.column_name); - if (column == null) { - logging_1.logger.warn("group filter: groupby column not found in data source"); - return null; - } - else { - this.indices = array_1.range(0, source.get_length() || 0).filter(function (i) { return column[i] === _this.group; }); - if (this.indices.length === 0) { - logging_1.logger.warn("group filter: group '" + this.group + "' did not match any values in column '" + this.column_name + "'"); - } - return this.indices; - } - }; - return GroupFilter; - }(filter_1.Filter)); - exports.GroupFilter = GroupFilter; - GroupFilter.initClass(); -} -, -/* models/filters/index */ function _(require, module, exports) { - var boolean_filter_1 = require(101) /* ./boolean_filter */; - exports.BooleanFilter = boolean_filter_1.BooleanFilter; - var customjs_filter_1 = require(102) /* ./customjs_filter */; - exports.CustomJSFilter = customjs_filter_1.CustomJSFilter; - var filter_1 = require(103) /* ./filter */; - exports.Filter = filter_1.Filter; - var group_filter_1 = require(104) /* ./group_filter */; - exports.GroupFilter = group_filter_1.GroupFilter; - var index_filter_1 = require(106) /* ./index_filter */; - exports.IndexFilter = index_filter_1.IndexFilter; -} -, -/* models/filters/index_filter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var filter_1 = require(103) /* ./filter */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var IndexFilter = /** @class */ (function (_super) { - tslib_1.__extends(IndexFilter, _super); - function IndexFilter(attrs) { - return _super.call(this, attrs) || this; - } - IndexFilter.initClass = function () { - this.prototype.type = 'IndexFilter'; - this.define({ - indices: [p.Array, null], - }); - }; - IndexFilter.prototype.compute_indices = function (_source) { - if (this.indices != null && this.indices.length >= 0) { - if (array_1.every(this.indices, types_1.isInteger)) - return this.indices; - else { - logging_1.logger.warn("IndexFilter " + this.id + ": indices should be array of integers, defaulting to no filtering"); - return null; - } - } - else { - logging_1.logger.warn("IndexFilter " + this.id + ": indices was not set, defaulting to no filtering"); - return null; - } - }; - return IndexFilter; - }(filter_1.Filter)); - exports.IndexFilter = IndexFilter; - IndexFilter.initClass(); -} -, -/* models/formatters/basic_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var BasicTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(BasicTickFormatter, _super); - function BasicTickFormatter(attrs) { - var _this = _super.call(this, attrs) || this; - _this.last_precision = 3; - return _this; - } - BasicTickFormatter.initClass = function () { - this.prototype.type = 'BasicTickFormatter'; - this.define({ - precision: [p.Any, 'auto'], - use_scientific: [p.Boolean, true], - power_limit_high: [p.Number, 5], - power_limit_low: [p.Number, -3], - }); - }; - Object.defineProperty(BasicTickFormatter.prototype, "scientific_limit_low", { - get: function () { - return Math.pow(10.0, this.power_limit_low); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BasicTickFormatter.prototype, "scientific_limit_high", { - get: function () { - return Math.pow(10.0, this.power_limit_high); - }, - enumerable: true, - configurable: true - }); - BasicTickFormatter.prototype.doFormat = function (ticks, _opts) { - if (ticks.length == 0) - return []; - var zero_eps = 0; - if (ticks.length >= 2) - zero_eps = Math.abs(ticks[1] - ticks[0]) / 10000; - var need_sci = false; - if (this.use_scientific) { - for (var _i = 0, ticks_1 = ticks; _i < ticks_1.length; _i++) { - var tick = ticks_1[_i]; - var tick_abs = Math.abs(tick); - if (tick_abs > zero_eps && (tick_abs >= this.scientific_limit_high || tick_abs <= this.scientific_limit_low)) { - need_sci = true; - break; - } - } - } - var labels = new Array(ticks.length); - var precision = this.precision; - if (precision == null || types_1.isNumber(precision)) { - if (need_sci) { - for (var i = 0, end = ticks.length; i < end; i++) { - labels[i] = ticks[i].toExponential(precision || undefined); - } - } - else { - for (var i = 0, end = ticks.length; i < end; i++) { - labels[i] = ticks[i].toFixed(precision || undefined).replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, ""); - } - } - } - else { - for (var x = this.last_precision, asc = this.last_precision <= 15; asc ? x <= 15 : x >= 15; asc ? x++ : x--) { - var is_ok = true; - if (need_sci) { - for (var i = 0, end = ticks.length; i < end; i++) { - labels[i] = ticks[i].toExponential(x); - if (i > 0) { - if (labels[i] === labels[i - 1]) { - is_ok = false; - break; - } - } - } - if (is_ok) { - break; - } - } - else { - for (var i = 0, end = ticks.length; i < end; i++) { - labels[i] = ticks[i].toFixed(x).replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, ""); - if (i > 0) { - if (labels[i] == labels[i - 1]) { - is_ok = false; - break; - } - } - } - if (is_ok) { - break; - } - } - if (is_ok) { - this.last_precision = x; - break; - } - } - } - return labels; - }; - return BasicTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.BasicTickFormatter = BasicTickFormatter; - BasicTickFormatter.initClass(); -} -, -/* models/formatters/categorical_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var array_1 = require(24) /* ../../core/util/array */; - var CategoricalTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalTickFormatter, _super); - function CategoricalTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalTickFormatter.initClass = function () { - this.prototype.type = 'CategoricalTickFormatter'; - }; - CategoricalTickFormatter.prototype.doFormat = function (ticks, _opts) { - return array_1.copy(ticks); - }; - return CategoricalTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.CategoricalTickFormatter = CategoricalTickFormatter; - CategoricalTickFormatter.initClass(); -} -, -/* models/formatters/datetime_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tz = require(399) /* timezone */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var templating_1 = require(42) /* ../../core/util/templating */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - function _us(t) { - // From double-precision unix (millisecond) timestamp get - // microsecond since last second. Precision seems to run - // out around the hundreds of nanoseconds scale, so rounding - // to the nearest microsecond should round to a nice - // microsecond / millisecond tick. - return Math.round(((t / 1000) % 1) * 1000000); - } - function _array(t) { - return tz(t, "%Y %m %d %H %M %S").split(/\s+/).map(function (e) { return parseInt(e, 10); }); - } - function _strftime(t, format) { - if (types_1.isFunction(format)) { - return format(t); - } - else { - // Python's datetime library augments the microsecond directive %f, which is not - // supported by the javascript library timezone: http://bigeasy.github.io/timezone/. - // Use a regular expression to replace %f directive with microseconds. - // TODO: what should we do for negative microsecond strings? - var microsecond_replacement_string = templating_1.sprintf("$1%06d", _us(t)); - format = format.replace(/((^|[^%])(%%)*)%f/, microsecond_replacement_string); - if (format.indexOf("%") == -1) { - // timezone seems to ignore any strings without any formatting directives, - // and just return the time argument back instead of the string argument. - // But we want the string argument, in case a user supplies a format string - // which doesn't contain a formatting directive or is only using %f. - return format; - } - return tz(t, format); - } - } - // Labels of time units, from finest to coarsest. - var format_order = [ - 'microseconds', 'milliseconds', 'seconds', 'minsec', 'minutes', 'hourmin', 'hours', 'days', 'months', 'years', - ]; - var DatetimeTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(DatetimeTickFormatter, _super); - function DatetimeTickFormatter(attrs) { - var _this = _super.call(this, attrs) || this; - // Whether or not to strip the leading zeros on tick labels. - _this.strip_leading_zeros = true; - return _this; - } - DatetimeTickFormatter.initClass = function () { - this.prototype.type = 'DatetimeTickFormatter'; - this.define({ - microseconds: [p.Array, ['%fus']], - milliseconds: [p.Array, ['%3Nms', '%S.%3Ns']], - seconds: [p.Array, ['%Ss']], - minsec: [p.Array, [':%M:%S']], - minutes: [p.Array, [':%M', '%Mm']], - hourmin: [p.Array, ['%H:%M']], - hours: [p.Array, ['%Hh', '%H:%M']], - days: [p.Array, ['%m/%d', '%a%d']], - months: [p.Array, ['%m/%Y', '%b %Y']], - years: [p.Array, ['%Y']], - }); - }; - DatetimeTickFormatter.prototype.initialize = function () { - _super.prototype.initialize.call(this); - // TODO (bev) trigger update on format change - this._update_width_formats(); - }; - DatetimeTickFormatter.prototype._update_width_formats = function () { - var now = +tz(new Date()); - var _widths = function (fmt_strings) { - var sizes = fmt_strings.map(function (fmt_string) { return _strftime(now, fmt_string).length; }); - var sorted = array_1.sort_by(array_1.zip(sizes, fmt_strings), function (_a) { - var size = _a[0]; - return size; - }); - return array_1.unzip(sorted); - }; - this._width_formats = { - microseconds: _widths(this.microseconds), - milliseconds: _widths(this.milliseconds), - seconds: _widths(this.seconds), - minsec: _widths(this.minsec), - minutes: _widths(this.minutes), - hourmin: _widths(this.hourmin), - hours: _widths(this.hours), - days: _widths(this.days), - months: _widths(this.months), - years: _widths(this.years), - }; - }; - // FIXME There is some unfortunate flicker when panning/zooming near the - // span boundaries. - // FIXME Rounding is weird at the 20-us scale and below. - DatetimeTickFormatter.prototype._get_resolution_str = function (resolution_secs, span_secs) { - // Our resolution boundaries should not be round numbers, because we want - // them to fall between the possible tick intervals (which *are* round - // numbers, as we've worked hard to ensure). Consequently, we adjust the - // resolution upwards a small amount (less than any possible step in - // scales) to make the effective boundaries slightly lower. - var adjusted_secs = resolution_secs * 1.1; - switch (false) { - case !(adjusted_secs < 1e-3): return "microseconds"; - case !(adjusted_secs < 1.0): return "milliseconds"; - case !(adjusted_secs < 60): return span_secs >= 60 ? "minsec" : "seconds"; - case !(adjusted_secs < 3600): return span_secs >= 3600 ? "hourmin" : "minutes"; - case !(adjusted_secs < (24 * 3600)): return "hours"; - case !(adjusted_secs < (31 * 24 * 3600)): return "days"; - case !(adjusted_secs < (365 * 24 * 3600)): return "months"; - default: return "years"; - } - }; - DatetimeTickFormatter.prototype.doFormat = function (ticks, _opts) { - // In order to pick the right set of labels, we need to determine - // the resolution of the ticks. We can do this using a ticker if - // it's provided, or by computing the resolution from the actual - // ticks we've been given. - if (ticks.length == 0) - return []; - var span = Math.abs(ticks[ticks.length - 1] - ticks[0]) / 1000.0; - var r = span / (ticks.length - 1); - var resol = this._get_resolution_str(r, span); - var _a = this._width_formats[resol], format = _a[1][0]; - // Apply the format to the tick values - var labels = []; - var resol_ndx = format_order.indexOf(resol); - // This dictionary maps the name of a time resolution (in @format_order) - // to its index in a time.localtime() timetuple. The default is to map - // everything to index 0, which is year. This is not ideal; it might cause - // a problem with the tick at midnight, january 1st, 0 a.d. being incorrectly - // promoted at certain tick resolutions. - var time_tuple_ndx_for_resol = {}; - for (var _i = 0, format_order_1 = format_order; _i < format_order_1.length; _i++) { - var fmt = format_order_1[_i]; - time_tuple_ndx_for_resol[fmt] = 0; - } - time_tuple_ndx_for_resol.seconds = 5; - time_tuple_ndx_for_resol.minsec = 4; - time_tuple_ndx_for_resol.minutes = 4; - time_tuple_ndx_for_resol.hourmin = 3; - time_tuple_ndx_for_resol.hours = 3; - // As we format each tick, check to see if we are at a boundary of the - // next higher unit of time. If so, replace the current format with one - // from that resolution. This is not the best heuristic in the world, - // but it works! There is some trickiness here due to having to deal - // with hybrid formats in a reasonable manner. - for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) { - var t = ticks_1[_b]; - var s = void 0, tm = void 0; - try { - tm = _array(t); - s = _strftime(t, format); - } - catch (error) { - logging_1.logger.warn("unable to format tick for timestamp value " + t); - logging_1.logger.warn(" - " + error); - labels.push("ERR"); - continue; - } - var hybrid_handled = false; - var next_ndx = resol_ndx; - // The way to check that we are at the boundary of the next unit of - // time is by checking that we have 0 units of the resolution, i.e. - // we are at zero minutes, so display hours, or we are at zero seconds, - // so display minutes (and if that is zero as well, then display hours). - while (tm[time_tuple_ndx_for_resol[format_order[next_ndx]]] == 0) { - var next_format = void 0; - next_ndx += 1; - if (next_ndx == format_order.length) - break; - if ((resol == "minsec" || resol == "hourmin") && !hybrid_handled) { - if ((resol == "minsec" && tm[4] == 0 && tm[5] != 0) || (resol == "hourmin" && tm[3] == 0 && tm[4] != 0)) { - next_format = this._width_formats[format_order[resol_ndx - 1]][1][0]; - s = _strftime(t, next_format); - break; - } - else { - hybrid_handled = true; - } - } - next_format = this._width_formats[format_order[next_ndx]][1][0]; - s = _strftime(t, next_format); - } - // TODO: should expose this in api. %H, %d, etc use leading zeros and - // users might prefer to see them lined up correctly. - if (this.strip_leading_zeros) { - var ss = s.replace(/^0+/g, ""); - if (ss != s && isNaN(parseInt(ss))) { - // If the string can now be parsed as starting with an integer, then - // leave all zeros stripped, otherwise start with a zero. Hence: - // A label such as '000ms' should leave one zero. - // A label such as '001ms' or '0-1ms' should not leave a leading zero. - ss = "0" + ss; - } - labels.push(ss); - } - else - labels.push(s); - } - return labels; - }; - return DatetimeTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.DatetimeTickFormatter = DatetimeTickFormatter; - DatetimeTickFormatter.initClass(); -} -, -/* models/formatters/func_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var p = require(18) /* ../../core/properties */; - var object_1 = require(35) /* ../../core/util/object */; - var string_1 = require(40) /* ../../core/util/string */; - var FuncTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(FuncTickFormatter, _super); - function FuncTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - FuncTickFormatter.initClass = function () { - this.prototype.type = 'FuncTickFormatter'; - this.define({ - args: [p.Any, {}], - code: [p.String, ''], - use_strict: [p.Boolean, false], - }); - }; - Object.defineProperty(FuncTickFormatter.prototype, "names", { - get: function () { - return object_1.keys(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FuncTickFormatter.prototype, "values", { - get: function () { - return object_1.values(this.args); - }, - enumerable: true, - configurable: true - }); - /*protected*/ FuncTickFormatter.prototype._make_func = function () { - var code = this.use_strict ? string_1.use_strict(this.code) : this.code; - return new (Function.bind.apply(Function, [void 0, "tick", "index", "ticks"].concat(this.names, ["require", "exports", code])))(); - }; - FuncTickFormatter.prototype.doFormat = function (ticks, _opts) { - var _this = this; - var cache = {}; - var func = this._make_func().bind(cache); - return ticks.map(function (tick, index, ticks) { return func.apply(void 0, [tick, index, ticks].concat(_this.values, [require, {}])); }); - }; - return FuncTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.FuncTickFormatter = FuncTickFormatter; - FuncTickFormatter.initClass(); -} -, -/* models/formatters/index */ function _(require, module, exports) { - var basic_tick_formatter_1 = require(107) /* ./basic_tick_formatter */; - exports.BasicTickFormatter = basic_tick_formatter_1.BasicTickFormatter; - var categorical_tick_formatter_1 = require(108) /* ./categorical_tick_formatter */; - exports.CategoricalTickFormatter = categorical_tick_formatter_1.CategoricalTickFormatter; - var datetime_tick_formatter_1 = require(109) /* ./datetime_tick_formatter */; - exports.DatetimeTickFormatter = datetime_tick_formatter_1.DatetimeTickFormatter; - var func_tick_formatter_1 = require(110) /* ./func_tick_formatter */; - exports.FuncTickFormatter = func_tick_formatter_1.FuncTickFormatter; - var log_tick_formatter_1 = require(112) /* ./log_tick_formatter */; - exports.LogTickFormatter = log_tick_formatter_1.LogTickFormatter; - var mercator_tick_formatter_1 = require(113) /* ./mercator_tick_formatter */; - exports.MercatorTickFormatter = mercator_tick_formatter_1.MercatorTickFormatter; - var numeral_tick_formatter_1 = require(114) /* ./numeral_tick_formatter */; - exports.NumeralTickFormatter = numeral_tick_formatter_1.NumeralTickFormatter; - var printf_tick_formatter_1 = require(115) /* ./printf_tick_formatter */; - exports.PrintfTickFormatter = printf_tick_formatter_1.PrintfTickFormatter; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - exports.TickFormatter = tick_formatter_1.TickFormatter; -} -, -/* models/formatters/log_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var basic_tick_formatter_1 = require(107) /* ./basic_tick_formatter */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var LogTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(LogTickFormatter, _super); - function LogTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - LogTickFormatter.initClass = function () { - this.prototype.type = 'LogTickFormatter'; - this.define({ - ticker: [p.Instance, null], - }); - }; - LogTickFormatter.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.basic_formatter = new basic_tick_formatter_1.BasicTickFormatter(); - if (this.ticker == null) - logging_1.logger.warn("LogTickFormatter not configured with a ticker, using default base of 10 (labels will be incorrect if ticker base is not 10)"); - }; - LogTickFormatter.prototype.doFormat = function (ticks, opts) { - if (ticks.length == 0) - return []; - var base = this.ticker != null ? this.ticker.base : 10; - var small_interval = false; - var labels = new Array(ticks.length); - for (var i = 0, end = ticks.length; i < end; i++) { - labels[i] = base + "^" + Math.round(Math.log(ticks[i]) / Math.log(base)); - if (i > 0 && labels[i] == labels[i - 1]) { - small_interval = true; - break; - } - } - if (small_interval) - return this.basic_formatter.doFormat(ticks, opts); - else - return labels; - }; - return LogTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.LogTickFormatter = LogTickFormatter; - LogTickFormatter.initClass(); -} -, -/* models/formatters/mercator_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var basic_tick_formatter_1 = require(107) /* ./basic_tick_formatter */; - var p = require(18) /* ../../core/properties */; - var projections_1 = require(36) /* ../../core/util/projections */; - var MercatorTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(MercatorTickFormatter, _super); - function MercatorTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - MercatorTickFormatter.initClass = function () { - this.prototype.type = 'MercatorTickFormatter'; - this.define({ - dimension: [p.LatLon], - }); - }; - MercatorTickFormatter.prototype.doFormat = function (ticks, opts) { - if (this.dimension == null) - throw new Error("MercatorTickFormatter.dimension not configured"); - if (ticks.length == 0) - return []; - var n = ticks.length; - var proj_ticks = new Array(n); - if (this.dimension == "lon") { - for (var i = 0; i < n; i++) { - var lon = projections_1.wgs84_mercator.inverse([ticks[i], opts.loc])[0]; - proj_ticks[i] = lon; - } - } - else { - for (var i = 0; i < n; i++) { - var _a = projections_1.wgs84_mercator.inverse([opts.loc, ticks[i]]), lat = _a[1]; - proj_ticks[i] = lat; - } - } - return _super.prototype.doFormat.call(this, proj_ticks, opts); - }; - return MercatorTickFormatter; - }(basic_tick_formatter_1.BasicTickFormatter)); - exports.MercatorTickFormatter = MercatorTickFormatter; - MercatorTickFormatter.initClass(); -} -, -/* models/formatters/numeral_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var Numbro = require(370) /* numbro */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var p = require(18) /* ../../core/properties */; - var NumeralTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(NumeralTickFormatter, _super); - function NumeralTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - NumeralTickFormatter.initClass = function () { - this.prototype.type = 'NumeralTickFormatter'; - this.define({ - // TODO (bev) all of these could be tightened up - format: [p.String, '0,0'], - language: [p.String, 'en'], - rounding: [p.RoundingFunction, 'round'], - }); - }; - Object.defineProperty(NumeralTickFormatter.prototype, "_rounding_fn", { - get: function () { - switch (this.rounding) { - case "round": - case "nearest": - return Math.round; - case "floor": - case "rounddown": - return Math.floor; - case "ceil": - case "roundup": - return Math.ceil; - } - }, - enumerable: true, - configurable: true - }); - NumeralTickFormatter.prototype.doFormat = function (ticks, _opts) { - var _a = this, format = _a.format, language = _a.language, _rounding_fn = _a._rounding_fn; - return ticks.map(function (tick) { return Numbro.format(tick, format, language, _rounding_fn); }); - }; - return NumeralTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.NumeralTickFormatter = NumeralTickFormatter; - NumeralTickFormatter.initClass(); -} -, -/* models/formatters/printf_tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tick_formatter_1 = require(116) /* ./tick_formatter */; - var templating_1 = require(42) /* ../../core/util/templating */; - var p = require(18) /* ../../core/properties */; - var PrintfTickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(PrintfTickFormatter, _super); - function PrintfTickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - PrintfTickFormatter.initClass = function () { - this.prototype.type = 'PrintfTickFormatter'; - this.define({ - format: [p.String, '%s'], - }); - }; - PrintfTickFormatter.prototype.doFormat = function (ticks, _opts) { - var _this = this; - return ticks.map(function (tick) { return templating_1.sprintf(_this.format, tick); }); - }; - return PrintfTickFormatter; - }(tick_formatter_1.TickFormatter)); - exports.PrintfTickFormatter = PrintfTickFormatter; - PrintfTickFormatter.initClass(); -} -, -/* models/formatters/tick_formatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var TickFormatter = /** @class */ (function (_super) { - tslib_1.__extends(TickFormatter, _super); - function TickFormatter(attrs) { - return _super.call(this, attrs) || this; - } - TickFormatter.initClass = function () { - this.prototype.type = "TickFormatter"; - }; - return TickFormatter; - }(model_1.Model)); - exports.TickFormatter = TickFormatter; - TickFormatter.initClass(); -} -, -/* models/glyphs/annular_wedge */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var math_1 = require(34) /* ../../core/util/math */; - var AnnularWedgeView = /** @class */ (function (_super) { - tslib_1.__extends(AnnularWedgeView, _super); - function AnnularWedgeView() { - return _super !== null && _super.apply(this, arguments) || this; - } - AnnularWedgeView.prototype._map_data = function () { - if (this.model.properties.inner_radius.units == "data") - this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius); - else - this.sinner_radius = this._inner_radius; - if (this.model.properties.outer_radius.units == "data") - this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius); - else - this.souter_radius = this._outer_radius; - this._angle = new Float32Array(this._start_angle.length); - for (var i = 0, end = this._start_angle.length; i < end; i++) { - this._angle[i] = this._end_angle[i] - this._start_angle[i]; - } - }; - AnnularWedgeView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, _start_angle = _a._start_angle, _angle = _a._angle, sinner_radius = _a.sinner_radius, souter_radius = _a.souter_radius; - var direction = this.model.properties.direction.value(); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i] + _start_angle[i] + _angle[i])) - continue; - ctx.translate(sx[i], sy[i]); - ctx.rotate(_start_angle[i]); - ctx.moveTo(souter_radius[i], 0); - ctx.beginPath(); - ctx.arc(0, 0, souter_radius[i], 0, _angle[i], direction); - ctx.rotate(_angle[i]); - ctx.lineTo(sinner_radius[i], 0); - ctx.arc(0, 0, sinner_radius[i], 0, -_angle[i], !direction); - ctx.closePath(); - ctx.rotate(-_angle[i] - _start_angle[i]); - ctx.translate(-sx[i], -sy[i]); - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - AnnularWedgeView.prototype._hit_point = function (geometry) { - var _a, _b; - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - // check radius first - var x0, y0; - var x1, y1; - if (this.model.properties.outer_radius.units == "data") { - x0 = x - this.max_outer_radius; - x1 = x + this.max_outer_radius; - y0 = y - this.max_outer_radius; - y1 = y + this.max_outer_radius; - } - else { - var sx0 = sx - this.max_outer_radius; - var sx1 = sx + this.max_outer_radius; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var sy0 = sy - this.max_outer_radius; - var sy1 = sy + this.max_outer_radius; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - } - var candidates = []; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - for (var _i = 0, _c = this.index.indices(bbox); _i < _c.length; _i++) { - var i = _c[_i]; - var or2 = Math.pow(this.souter_radius[i], 2); - var ir2 = Math.pow(this.sinner_radius[i], 2); - var _d = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _d[0], sx1 = _d[1]; - var _e = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _e[0], sy1 = _e[1]; - var dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2); - if (dist <= or2 && dist >= ir2) - candidates.push([i, dist]); - } - var direction = this.model.properties.direction.value(); - var hits = []; - for (var _f = 0, candidates_1 = candidates; _f < candidates_1.length; _f++) { - var _g = candidates_1[_f], i = _g[0], dist = _g[1]; - // NOTE: minus the angle because JS uses non-mathy convention for angles - var angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]); - if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) { - hits.push([i, dist]); - } - } - return hittest.create_hit_test_result_from_hits(hits); - }; - AnnularWedgeView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - AnnularWedgeView.prototype._scenterxy = function (i) { - var r = (this.sinner_radius[i] + this.souter_radius[i]) / 2; - var a = (this._start_angle[i] + this._end_angle[i]) / 2; - return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) }; - }; - AnnularWedgeView.prototype.scenterx = function (i) { - return this._scenterxy(i).x; - }; - AnnularWedgeView.prototype.scentery = function (i) { - return this._scenterxy(i).y; - }; - return AnnularWedgeView; - }(xy_glyph_1.XYGlyphView)); - exports.AnnularWedgeView = AnnularWedgeView; - var AnnularWedge = /** @class */ (function (_super) { - tslib_1.__extends(AnnularWedge, _super); - function AnnularWedge(attrs) { - return _super.call(this, attrs) || this; - } - AnnularWedge.initClass = function () { - this.prototype.type = 'AnnularWedge'; - this.prototype.default_view = AnnularWedgeView; - this.mixins(['line', 'fill']); - this.define({ - direction: [p.Direction, 'anticlock'], - inner_radius: [p.DistanceSpec], - outer_radius: [p.DistanceSpec], - start_angle: [p.AngleSpec], - end_angle: [p.AngleSpec], - }); - }; - return AnnularWedge; - }(xy_glyph_1.XYGlyph)); - exports.AnnularWedge = AnnularWedge; - AnnularWedge.initClass(); -} -, -/* models/glyphs/annulus */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var compat_1 = require(31) /* ../../core/util/compat */; - var AnnulusView = /** @class */ (function (_super) { - tslib_1.__extends(AnnulusView, _super); - function AnnulusView() { - return _super !== null && _super.apply(this, arguments) || this; - } - AnnulusView.prototype._map_data = function () { - if (this.model.properties.inner_radius.units == "data") - this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius); - else - this.sinner_radius = this._inner_radius; - if (this.model.properties.outer_radius.units == "data") - this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius); - else - this.souter_radius = this._outer_radius; - }; - AnnulusView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sinner_radius = _a.sinner_radius, souter_radius = _a.souter_radius; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i])) - continue; - // Because this visual has a whole in it, it proved "challenging" - // for some browsers to render if drawn in one go --- i.e. it did not - // work on IE. If we render in two parts (upper and lower part), - // it is unambiguous what part should be filled. The line is - // better drawn in one go though, otherwise the part where the pieces - // meet will not be fully closed due to aa. - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.beginPath(); - if (compat_1.is_ie) { - // Draw two halves of the donut. Works on IE, but causes an aa line on Safari. - for (var _b = 0, _c = [false, true]; _b < _c.length; _b++) { - var clockwise = _c[_b]; - ctx.arc(sx[i], sy[i], sinner_radius[i], 0, Math.PI, clockwise); - ctx.arc(sx[i], sy[i], souter_radius[i], Math.PI, 0, !clockwise); - } - } - else { - // Draw donut in one go. Does not work on iE. - ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI, true); - ctx.arc(sx[i], sy[i], souter_radius[i], 2 * Math.PI, 0, false); - } - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.beginPath(); - ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI); - ctx.moveTo(sx[i] + souter_radius[i], sy[i]); - ctx.arc(sx[i], sy[i], souter_radius[i], 0, 2 * Math.PI); - ctx.stroke(); - } - } - }; - AnnulusView.prototype._hit_point = function (geometry) { - var _a, _b; - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var x0, y0; - var x1, y1; - if (this.model.properties.outer_radius.units == "data") { - x0 = x - this.max_outer_radius; - x1 = x + this.max_outer_radius; - y0 = y - this.max_outer_radius; - y1 = y + this.max_outer_radius; - } - else { - var sx0 = sx - this.max_outer_radius; - var sx1 = sx + this.max_outer_radius; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var sy0 = sy - this.max_outer_radius; - var sy1 = sy + this.max_outer_radius; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - } - var hits = []; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - for (var _i = 0, _c = this.index.indices(bbox); _i < _c.length; _i++) { - var i = _c[_i]; - var or2 = Math.pow(this.souter_radius[i], 2); - var ir2 = Math.pow(this.sinner_radius[i], 2); - var _d = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _d[0], sx1 = _d[1]; - var _e = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _e[0], sy1 = _e[1]; - var dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2); - if (dist <= or2 && dist >= ir2) - hits.push([i, dist]); - } - return hittest.create_hit_test_result_from_hits(hits); - }; - AnnulusView.prototype.draw_legend_for_index = function (ctx, _a, index) { - var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1; - var len = index + 1; - var sx = new Array(len); - sx[index] = (x0 + x1) / 2; - var sy = new Array(len); - sy[index] = (y0 + y1) / 2; - var r = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.5; - var sinner_radius = new Array(len); - sinner_radius[index] = r * 0.4; - var souter_radius = new Array(len); - souter_radius[index] = r * 0.8; - this._render(ctx, [index], { sx: sx, sy: sy, sinner_radius: sinner_radius, souter_radius: souter_radius }); // XXX - }; - return AnnulusView; - }(xy_glyph_1.XYGlyphView)); - exports.AnnulusView = AnnulusView; - var Annulus = /** @class */ (function (_super) { - tslib_1.__extends(Annulus, _super); - function Annulus(attrs) { - return _super.call(this, attrs) || this; - } - Annulus.initClass = function () { - this.prototype.type = 'Annulus'; - this.prototype.default_view = AnnulusView; - this.mixins(['line', 'fill']); - this.define({ - inner_radius: [p.DistanceSpec], - outer_radius: [p.DistanceSpec], - }); - }; - return Annulus; - }(xy_glyph_1.XYGlyph)); - exports.Annulus = Annulus; - Annulus.initClass(); -} -, -/* models/glyphs/arc */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var p = require(18) /* ../../core/properties */; - var ArcView = /** @class */ (function (_super) { - tslib_1.__extends(ArcView, _super); - function ArcView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ArcView.prototype._map_data = function () { - if (this.model.properties.radius.units == "data") - this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius); - else - this.sradius = this._radius; - }; - ArcView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sradius = _a.sradius, _start_angle = _a._start_angle, _end_angle = _a._end_angle; - if (this.visuals.line.doit) { - var direction = this.model.properties.direction.value(); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i])) - continue; - ctx.beginPath(); - ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - ArcView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - return ArcView; - }(xy_glyph_1.XYGlyphView)); - exports.ArcView = ArcView; - var Arc = /** @class */ (function (_super) { - tslib_1.__extends(Arc, _super); - function Arc(attrs) { - return _super.call(this, attrs) || this; - } - Arc.initClass = function () { - this.prototype.type = 'Arc'; - this.prototype.default_view = ArcView; - this.mixins(['line']); - this.define({ - direction: [p.Direction, 'anticlock'], - radius: [p.DistanceSpec], - start_angle: [p.AngleSpec], - end_angle: [p.AngleSpec], - }); - }; - return Arc; - }(xy_glyph_1.XYGlyph)); - exports.Arc = Arc; - Arc.initClass(); -} -, -/* models/glyphs/bezier */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - // algorithm adapted from http://stackoverflow.com/a/14429749/3406693 - function _cbb(x0, y0, x1, y1, x2, y2, x3, y3) { - var tvalues = []; - var bounds = [[], []]; - for (var i = 0; i <= 2; i++) { - var a = void 0, b = void 0, c = void 0; - if (i === 0) { - b = ((6 * x0) - (12 * x1)) + (6 * x2); - a = (((-3 * x0) + (9 * x1)) - (9 * x2)) + (3 * x3); - c = (3 * x1) - (3 * x0); - } - else { - b = ((6 * y0) - (12 * y1)) + (6 * y2); - a = (((-3 * y0) + (9 * y1)) - (9 * y2)) + (3 * y3); - c = (3 * y1) - (3 * y0); - } - if (Math.abs(a) < 1e-12) { // Numerical robustness - if (Math.abs(b) < 1e-12) // Numerical robustness - continue; - var t = -c / b; - if (0 < t && t < 1) - tvalues.push(t); - continue; - } - var b2ac = (b * b) - (4 * c * a); - var sqrtb2ac = Math.sqrt(b2ac); - if (b2ac < 0) - continue; - var t1 = (-b + sqrtb2ac) / (2 * a); - if (0 < t1 && t1 < 1) - tvalues.push(t1); - var t2 = (-b - sqrtb2ac) / (2 * a); - if (0 < t2 && t2 < 1) - tvalues.push(t2); - } - var j = tvalues.length; - var jlen = j; - while (j--) { - var t = tvalues[j]; - var mt = 1 - t; - var x = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3); - bounds[0][j] = x; - var y = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3); - bounds[1][j] = y; - } - bounds[0][jlen] = x0; - bounds[1][jlen] = y0; - bounds[0][jlen + 1] = x3; - bounds[1][jlen + 1] = y3; - return [ - Math.min.apply(Math, bounds[0]), - Math.max.apply(Math, bounds[1]), - Math.max.apply(Math, bounds[0]), - Math.min.apply(Math, bounds[1]), - ]; - } - var BezierView = /** @class */ (function (_super) { - tslib_1.__extends(BezierView, _super); - function BezierView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BezierView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._x0.length; i < end; i++) { - if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx0[i] + this._cy0[i] + this._cx1[i] + this._cy1[i])) - continue; - var _a = _cbb(this._x0[i], this._y0[i], this._x1[i], this._y1[i], this._cx0[i], this._cy0[i], this._cx1[i], this._cy1[i]), x0 = _a[0], y0 = _a[1], x1 = _a[2], y1 = _a[3]; - points.push({ minX: x0, minY: y0, maxX: x1, maxY: y1, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - BezierView.prototype._render = function (ctx, indices, _a) { - var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1, scx0 = _a.scx0, scy0 = _a.scy0, scx1 = _a.scx1, scy1 = _a.scy1; - if (this.visuals.line.doit) { - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx0[i] + scy0[i] + scx1[i] + scy1[i])) - continue; - ctx.beginPath(); - ctx.moveTo(sx0[i], sy0[i]); - ctx.bezierCurveTo(scx0[i], scy0[i], scx1[i], scy1[i], sx1[i], sy1[i]); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - BezierView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - BezierView.prototype.scenterx = function () { - throw new Error("not implemented"); - }; - BezierView.prototype.scentery = function () { - throw new Error("not implemented"); - }; - return BezierView; - }(glyph_1.GlyphView)); - exports.BezierView = BezierView; - var Bezier = /** @class */ (function (_super) { - tslib_1.__extends(Bezier, _super); - function Bezier(attrs) { - return _super.call(this, attrs) || this; - } - Bezier.initClass = function () { - this.prototype.type = 'Bezier'; - this.prototype.default_view = BezierView; - this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx0', 'cy0'], ['cx1', 'cy1']]); - this.mixins(['line']); - }; - return Bezier; - }(glyph_1.Glyph)); - exports.Bezier = Bezier; - Bezier.initClass(); -} -, -/* models/glyphs/box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - var hittest = require(9) /* ../../core/hittest */; - var BoxView = /** @class */ (function (_super) { - tslib_1.__extends(BoxView, _super); - function BoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxView.prototype._index_box = function (len) { - var points = []; - for (var i = 0; i < len; i++) { - var _a = this._lrtb(i), l = _a[0], r = _a[1], t = _a[2], b = _a[3]; - if (isNaN(l + r + t + b) || !isFinite(l + r + t + b)) - continue; - points.push({ - minX: Math.min(l, r), - minY: Math.min(t, b), - maxX: Math.max(r, l), - maxY: Math.max(t, b), - i: i, - }); - } - return new spatial_1.SpatialIndex(points); - }; - BoxView.prototype._render = function (ctx, indices, _a) { - var sleft = _a.sleft, sright = _a.sright, stop = _a.stop, sbottom = _a.sbottom; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sleft[i] + stop[i] + sright[i] + sbottom[i])) - continue; - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fillRect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]); - } - if (this.visuals.line.doit) { - ctx.beginPath(); - ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - // We need to clamp the endpoints inside the viewport, because various browser canvas - // implementations have issues drawing rects with enpoints far outside the viewport - BoxView.prototype._clamp_viewport = function () { - var hr = this.renderer.plot_view.frame.bbox.h_range; - var vr = this.renderer.plot_view.frame.bbox.v_range; - var n = this.stop.length; - for (var i = 0; i < n; i++) { - this.stop[i] = Math.max(this.stop[i], vr.start); - this.sbottom[i] = Math.min(this.sbottom[i], vr.end); - this.sleft[i] = Math.max(this.sleft[i], hr.start); - this.sright[i] = Math.min(this.sright[i], hr.end); - } - }; - BoxView.prototype._hit_rect = function (geometry) { - return this._hit_rect_against_index(geometry); - }; - BoxView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var hits = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y }); - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - BoxView.prototype._hit_span = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var hits; - if (geometry.direction == 'v') { - var y = this.renderer.yscale.invert(sy); - var hr = this.renderer.plot_view.frame.bbox.h_range; - var _a = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _a[0], maxX = _a[1]; - hits = this.index.indices({ minX: minX, minY: y, maxX: maxX, maxY: y }); - } - else { - var x = this.renderer.xscale.invert(sx); - var vr = this.renderer.plot_view.frame.bbox.v_range; - var _b = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _b[0], maxY = _b[1]; - hits = this.index.indices({ minX: x, minY: minY, maxX: x, maxY: maxY }); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - BoxView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - return BoxView; - }(glyph_1.GlyphView)); - exports.BoxView = BoxView; - var Box = /** @class */ (function (_super) { - tslib_1.__extends(Box, _super); - function Box(attrs) { - return _super.call(this, attrs) || this; - } - Box.initClass = function () { - this.prototype.type = "Box"; - this.mixins(['line', 'fill']); - }; - return Box; - }(glyph_1.Glyph)); - exports.Box = Box; - Box.initClass(); -} -, -/* models/glyphs/center_rotatable */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var p = require(18) /* ../../core/properties */; - var CenterRotatableView = /** @class */ (function (_super) { - tslib_1.__extends(CenterRotatableView, _super); - function CenterRotatableView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CenterRotatableView; - }(xy_glyph_1.XYGlyphView)); - exports.CenterRotatableView = CenterRotatableView; - var CenterRotatable = /** @class */ (function (_super) { - tslib_1.__extends(CenterRotatable, _super); - function CenterRotatable(attrs) { - return _super.call(this, attrs) || this; - } - CenterRotatable.initClass = function () { - this.prototype.type = 'CenterRotatable'; - this.mixins(['line', 'fill']); - this.define({ - angle: [p.AngleSpec, 0], - width: [p.DistanceSpec], - height: [p.DistanceSpec], - }); - }; - return CenterRotatable; - }(xy_glyph_1.XYGlyph)); - exports.CenterRotatable = CenterRotatable; - CenterRotatable.initClass(); -} -, -/* models/glyphs/circle */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var CircleView = /** @class */ (function (_super) { - tslib_1.__extends(CircleView, _super); - function CircleView() { - return _super !== null && _super.apply(this, arguments) || this; - } - CircleView.prototype._map_data = function () { - // XXX: Order is important here: size is always present (at least - // a default), but radius is only present if a user specifies it. - if (this._radius != null) { - if (this.model.properties.radius.spec.units == "data") { - var rd = this.model.properties.radius_dimension.spec.value; - switch (rd) { - case "x": { - this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius); - break; - } - case "y": { - this.sradius = this.sdist(this.renderer.yscale, this._y, this._radius); - break; - } - case "max": { - var sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius); - var sradius_y_1 = this.sdist(this.renderer.yscale, this._y, this._radius); - this.sradius = arrayable_1.map(sradius_x, function (s, i) { return Math.max(s, sradius_y_1[i]); }); - break; - } - case "min": { - var sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius); - var sradius_y_2 = this.sdist(this.renderer.yscale, this._y, this._radius); - this.sradius = arrayable_1.map(sradius_x, function (s, i) { return Math.min(s, sradius_y_2[i]); }); - break; - } - } - } - else { - this.sradius = this._radius; - this.max_size = 2 * this.max_radius; - } - } - else - this.sradius = arrayable_1.map(this._size, function (s) { return s / 2; }); - }; - CircleView.prototype._mask_data = function () { - var _a, _b, _c, _d; - var _e = this.renderer.plot_view.frame.bbox.ranges, hr = _e[0], vr = _e[1]; - var x0, y0; - var x1, y1; - if (this._radius != null && this.model.properties.radius.units == "data") { - var sx0 = hr.start; - var sx1 = hr.end; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - x0 -= this.max_radius; - x1 += this.max_radius; - var sy0 = vr.start; - var sy1 = vr.end; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - y0 -= this.max_radius; - y1 += this.max_radius; - } - else { - var sx0 = hr.start - this.max_size; - var sx1 = hr.end + this.max_size; - _c = this.renderer.xscale.r_invert(sx0, sx1), x0 = _c[0], x1 = _c[1]; - var sy0 = vr.start - this.max_size; - var sy1 = vr.end + this.max_size; - _d = this.renderer.yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1]; - } - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - return this.index.indices(bbox); - }; - CircleView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sradius = _a.sradius; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sradius[i])) - continue; - ctx.beginPath(); - ctx.arc(sx[i], sy[i], sradius[i], 0, 2 * Math.PI, false); - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - CircleView.prototype._hit_point = function (geometry) { - var _a, _b, _c, _d, _e, _f; - var dist, r2, sx0, sx1, sy0, sy1, x0, x1, y0, y1; - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - // check radius first - if ((this._radius != null) && (this.model.properties.radius.units == "data")) { - x0 = x - this.max_radius; - x1 = x + this.max_radius; - y0 = y - this.max_radius; - y1 = y + this.max_radius; - } - else { - sx0 = sx - this.max_size; - sx1 = sx + this.max_size; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - _b = [Math.min(x0, x1), Math.max(x0, x1)], x0 = _b[0], x1 = _b[1]; - sy0 = sy - this.max_size; - sy1 = sy + this.max_size; - _c = this.renderer.yscale.r_invert(sy0, sy1), y0 = _c[0], y1 = _c[1]; - _d = [Math.min(y0, y1), Math.max(y0, y1)], y0 = _d[0], y1 = _d[1]; - } - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var candidates = this.index.indices(bbox); - var hits = []; - if ((this._radius != null) && (this.model.properties.radius.units == "data")) { - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var i = candidates_1[_i]; - r2 = Math.pow(this.sradius[i], 2); - _e = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _e[0], sx1 = _e[1]; - _f = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _f[0], sy1 = _f[1]; - dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2); - if (dist <= r2) { - hits.push([i, dist]); - } - } - } - else { - for (var _g = 0, candidates_2 = candidates; _g < candidates_2.length; _g++) { - var i = candidates_2[_g]; - r2 = Math.pow(this.sradius[i], 2); - dist = Math.pow(this.sx[i] - sx, 2) + Math.pow(this.sy[i] - sy, 2); - if (dist <= r2) { - hits.push([i, dist]); - } - } - } - return hittest.create_hit_test_result_from_hits(hits); - }; - CircleView.prototype._hit_span = function (geometry) { - var _a, _b, _c, _d; - var ms, x0, x1, y0, y1; - var sx = geometry.sx, sy = geometry.sy; - var _e = this.bounds(), minX = _e.minX, minY = _e.minY, maxX = _e.maxX, maxY = _e.maxY; - var result = hittest.create_empty_hit_test_result(); - if (geometry.direction == 'h') { - // use circle bounds instead of current pointer y coordinates - var sx0 = void 0, sx1 = void 0; - y0 = minY; - y1 = maxY; - if (this._radius != null && this.model.properties.radius.units == "data") { - sx0 = sx - this.max_radius; - sx1 = sx + this.max_radius; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - } - else { - ms = this.max_size / 2; - sx0 = sx - ms; - sx1 = sx + ms; - _b = this.renderer.xscale.r_invert(sx0, sx1), x0 = _b[0], x1 = _b[1]; - } - } - else { - // use circle bounds instead of current pointer x coordinates - var sy0 = void 0, sy1 = void 0; - x0 = minX; - x1 = maxX; - if (this._radius != null && this.model.properties.radius.units == "data") { - sy0 = sy - this.max_radius; - sy1 = sy + this.max_radius; - _c = this.renderer.yscale.r_invert(sy0, sy1), y0 = _c[0], y1 = _c[1]; - } - else { - ms = this.max_size / 2; - sy0 = sy - ms; - sy1 = sy + ms; - _d = this.renderer.yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1]; - } - } - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var hits = this.index.indices(bbox); - result.indices = hits; - return result; - }; - CircleView.prototype._hit_rect = function (geometry) { - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var result = hittest.create_empty_hit_test_result(); - result.indices = this.index.indices(bbox); - return result; - }; - CircleView.prototype._hit_poly = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - // TODO (bev) use spatial index to pare candidate list - var candidates = array_1.range(0, this.sx.length); - var hits = []; - for (var i = 0, end = candidates.length; i < end; i++) { - var idx = candidates[i]; - if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) { - hits.push(idx); - } - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - // circle does not inherit from marker (since it also accepts radius) so we - // must supply a draw_legend for it here - CircleView.prototype.draw_legend_for_index = function (ctx, _a, index) { - var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1; - // using objects like this seems a little wonky, since the keys are coerced to - // stings, but it works - var len = index + 1; - var sx = new Array(len); - sx[index] = (x0 + x1) / 2; - var sy = new Array(len); - sy[index] = (y0 + y1) / 2; - var sradius = new Array(len); - sradius[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.2; - this._render(ctx, [index], { sx: sx, sy: sy, sradius: sradius }); // XXX - }; - return CircleView; - }(xy_glyph_1.XYGlyphView)); - exports.CircleView = CircleView; - var Circle = /** @class */ (function (_super) { - tslib_1.__extends(Circle, _super); - function Circle(attrs) { - return _super.call(this, attrs) || this; - } - Circle.initClass = function () { - this.prototype.type = 'Circle'; - this.prototype.default_view = CircleView; - this.mixins(['line', 'fill']); - this.define({ - angle: [p.AngleSpec, 0], - size: [p.DistanceSpec, { units: "screen", value: 4 }], - radius: [p.DistanceSpec], - radius_dimension: [p.RadiusDimension, 'x'], - }); - }; - Circle.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.properties.radius.optional = true; - }; - return Circle; - }(xy_glyph_1.XYGlyph)); - exports.Circle = Circle; - Circle.initClass(); -} -, -/* models/glyphs/ellipse */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var ellipse_oval_1 = require(125) /* ./ellipse_oval */; - var EllipseView = /** @class */ (function (_super) { - tslib_1.__extends(EllipseView, _super); - function EllipseView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return EllipseView; - }(ellipse_oval_1.EllipseOvalView)); - exports.EllipseView = EllipseView; - var Ellipse = /** @class */ (function (_super) { - tslib_1.__extends(Ellipse, _super); - function Ellipse(attrs) { - return _super.call(this, attrs) || this; - } - Ellipse.initClass = function () { - this.prototype.type = 'Ellipse'; - this.prototype.default_view = EllipseView; - }; - return Ellipse; - }(ellipse_oval_1.EllipseOval)); - exports.Ellipse = Ellipse; - Ellipse.initClass(); -} -, -/* models/glyphs/ellipse_oval */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var center_rotatable_1 = require(122) /* ./center_rotatable */; - var hittest = require(9) /* ../../core/hittest */; - var EllipseOvalView = /** @class */ (function (_super) { - tslib_1.__extends(EllipseOvalView, _super); - function EllipseOvalView() { - return _super !== null && _super.apply(this, arguments) || this; - } - EllipseOvalView.prototype._set_data = function () { - this.max_w2 = 0; - if (this.model.properties.width.units == "data") - this.max_w2 = this.max_width / 2; - this.max_h2 = 0; - if (this.model.properties.height.units == "data") - this.max_h2 = this.max_height / 2; - }; - EllipseOvalView.prototype._map_data = function () { - if (this.model.properties.width.units == "data") - this.sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center'); - else - this.sw = this._width; - if (this.model.properties.height.units == "data") - this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center'); - else - this.sh = this._height; - }; - EllipseOvalView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh, _angle = _a._angle; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sw[i] + sh[i] + _angle[i])) - continue; - ctx.beginPath(); - ctx.ellipse(sx[i], sy[i], sw[i] / 2.0, sh[i] / 2.0, _angle[i], 0, 2 * Math.PI); - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - EllipseOvalView.prototype._hit_point = function (geometry) { - var _a, _b, _c, _d; - var x0, x1, y0, y1, cond, dist, sx0, sx1, sy0, sy1; - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - if (this.model.properties.width.units == "data") { - x0 = x - this.max_width; - x1 = x + this.max_width; - } - else { - sx0 = sx - this.max_width; - sx1 = sx + this.max_width; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - } - if (this.model.properties.height.units == "data") { - y0 = y - this.max_height; - y1 = y + this.max_height; - } - else { - sy0 = sy - this.max_height; - sy1 = sy + this.max_height; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - } - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var candidates = this.index.indices(bbox); - var hits = []; - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var i = candidates_1[_i]; - cond = hittest.point_in_ellipse(sx, sy, this._angle[i], this.sh[i] / 2, this.sw[i] / 2, this.sx[i], this.sy[i]); - if (cond) { - _c = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _c[0], sx1 = _c[1]; - _d = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _d[0], sy1 = _d[1]; - dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2); - hits.push([i, dist]); - } - } - return hittest.create_hit_test_result_from_hits(hits); - }; - EllipseOvalView.prototype.draw_legend_for_index = function (ctx, _a, index) { - var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1; - var len = index + 1; - var sx = new Array(len); - sx[index] = (x0 + x1) / 2; - var sy = new Array(len); - sy[index] = (y0 + y1) / 2; - var scale = this.sw[index] / this.sh[index]; - var d = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.8; - var sw = new Array(len); - var sh = new Array(len); - if (scale > 1) { - sw[index] = d; - sh[index] = d / scale; - } - else { - sw[index] = d * scale; - sh[index] = d; - } - this._render(ctx, [index], { sx: sx, sy: sy, sw: sw, sh: sh, _angle: [0] }); // XXX - }; - EllipseOvalView.prototype._bounds = function (_a) { - var minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY; - return { - minX: minX - this.max_w2, - maxX: maxX + this.max_w2, - minY: minY - this.max_h2, - maxY: maxY + this.max_h2, - }; - }; - return EllipseOvalView; - }(center_rotatable_1.CenterRotatableView)); - exports.EllipseOvalView = EllipseOvalView; - var EllipseOval = /** @class */ (function (_super) { - tslib_1.__extends(EllipseOval, _super); - function EllipseOval(attrs) { - return _super.call(this, attrs) || this; - } - EllipseOval.initClass = function () { - this.prototype.type = 'EllipseOval'; - }; - return EllipseOval; - }(center_rotatable_1.CenterRotatable)); - exports.EllipseOval = EllipseOval; - EllipseOval.initClass(); -} -, -/* models/glyphs/glyph */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var bbox = require(27) /* ../../core/util/bbox */; - var proj = require(36) /* ../../core/util/projections */; - var visuals = require(51) /* ../../core/visuals */; - var view_1 = require(50) /* ../../core/view */; - var model_1 = require(62) /* ../../model */; - var logging_1 = require(17) /* ../../core/logging */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var object_1 = require(35) /* ../../core/util/object */; - var types_1 = require(46) /* ../../core/util/types */; - var line_1 = require(134) /* ./line */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var GlyphView = /** @class */ (function (_super) { - tslib_1.__extends(GlyphView, _super); - function GlyphView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._nohit_warned = {}; - return _this; - } - Object.defineProperty(GlyphView.prototype, "renderer", { - get: function () { - return this.parent; - }, - enumerable: true, - configurable: true - }); - GlyphView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._nohit_warned = {}; - this.visuals = new visuals.Visuals(this.model); - // Init gl (this should really be done anytime renderer is set, - // and not done if it isn't ever set, but for now it only - // matters in the unit tests because we build a view without a - // renderer there) - var gl = this.renderer.plot_view.gl; - if (gl != null) { - var webgl_module = null; - try { - webgl_module = require(466) /* ./webgl/index */; - } - catch (e) { - if (e.code === 'MODULE_NOT_FOUND') { - logging_1.logger.warn('WebGL was requested and is supported, but bokeh-gl(.min).js is not available, falling back to 2D rendering.'); - } - else - throw e; - } - if (webgl_module != null) { - var Cls = webgl_module[this.model.type + 'GLGlyph']; - if (Cls != null) - this.glglyph = new Cls(gl.ctx, this); - } - } - }; - GlyphView.prototype.set_visuals = function (source) { - this.visuals.warm_cache(source); - if (this.glglyph != null) - this.glglyph.set_visuals_changed(); - }; - GlyphView.prototype.render = function (ctx, indices, data) { - ctx.beginPath(); - if (this.glglyph != null) { - if (this.glglyph.render(ctx, indices, data)) - return; - } - this._render(ctx, indices, data); - }; - GlyphView.prototype.has_finished = function () { - return true; - }; - GlyphView.prototype.notify_finished = function () { - this.renderer.notify_finished(); - }; - GlyphView.prototype._bounds = function (bounds) { - return bounds; - }; - GlyphView.prototype.bounds = function () { - return this._bounds(this.index.bbox); - }; - GlyphView.prototype.log_bounds = function () { - var bb = bbox.empty(); - var positive_x_bbs = this.index.search(bbox.positive_x()); - for (var _i = 0, positive_x_bbs_1 = positive_x_bbs; _i < positive_x_bbs_1.length; _i++) { - var x = positive_x_bbs_1[_i]; - if (x.minX < bb.minX) - bb.minX = x.minX; - if (x.maxX > bb.maxX) - bb.maxX = x.maxX; - } - var positive_y_bbs = this.index.search(bbox.positive_y()); - for (var _a = 0, positive_y_bbs_1 = positive_y_bbs; _a < positive_y_bbs_1.length; _a++) { - var y = positive_y_bbs_1[_a]; - if (y.minY < bb.minY) - bb.minY = y.minY; - if (y.maxY > bb.maxY) - bb.maxY = y.maxY; - } - return this._bounds(bb); - }; - GlyphView.prototype.get_anchor_point = function (anchor, i, _a) { - var sx = _a[0], sy = _a[1]; - switch (anchor) { - case "center": return { x: this.scenterx(i, sx, sy), y: this.scentery(i, sx, sy) }; - default: return null; - } - }; - GlyphView.prototype.sdist = function (scale, pts, spans, pts_location, dilate) { - if (pts_location === void 0) { - pts_location = "edge"; - } - if (dilate === void 0) { - dilate = false; - } - var pt0; - var pt1; - var n = pts.length; - if (pts_location == 'center') { - var halfspan = arrayable_1.map(spans, function (d) { return d / 2; }); - pt0 = new Float64Array(n); - for (var i = 0; i < n; i++) { - pt0[i] = pts[i] - halfspan[i]; - } - pt1 = new Float64Array(n); - for (var i = 0; i < n; i++) { - pt1[i] = pts[i] + halfspan[i]; - } - } - else { - pt0 = pts; - pt1 = new Float64Array(n); - for (var i = 0; i < n; i++) { - pt1[i] = pt0[i] + spans[i]; - } - } - var spt0 = scale.v_compute(pt0); - var spt1 = scale.v_compute(pt1); - if (dilate) - return arrayable_1.map(spt0, function (_, i) { return Math.ceil(Math.abs(spt1[i] - spt0[i])); }); - else - return arrayable_1.map(spt0, function (_, i) { return Math.abs(spt1[i] - spt0[i]); }); - }; - GlyphView.prototype.draw_legend_for_index = function (_ctx, _bbox, _index) { }; - GlyphView.prototype.hit_test = function (geometry) { - var result = null; - var func = "_hit_" + geometry.type; - if (this[func] != null) { - result = this[func](geometry); - } - else if (this._nohit_warned[geometry.type] == null) { - logging_1.logger.debug("'" + geometry.type + "' selection not available for " + this.model.type); - this._nohit_warned[geometry.type] = true; - } - return result; - }; - GlyphView.prototype._hit_rect_against_index = function (geometry) { - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bb = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var result = hittest.create_empty_hit_test_result(); - result.indices = this.index.indices(bb); - return result; - }; - GlyphView.prototype.set_data = function (source, indices, indices_to_update) { - var _a, _b, _c, _d; - var data = this.model.materialize_dataspecs(source); - this.visuals.set_all_indices(indices); - if (indices && !(this instanceof line_1.LineView)) { - var data_subset = {}; - var _loop_1 = function (k) { - var v = data[k]; - if (k.charAt(0) === '_') - data_subset[k] = indices.map(function (i) { return v[i]; }); - else - data_subset[k] = v; - }; - for (var k in data) { - _loop_1(k); - } - data = data_subset; - } - var self = this; - object_1.extend(self, data); - // TODO (bev) Should really probably delegate computing projected - // coordinates to glyphs, instead of centralizing here in one place. - if (this.renderer.plot_view.model.use_map) { - if (self._x != null) - _a = proj.project_xy(self._x, self._y), self._x = _a[0], self._y = _a[1]; - if (self._xs != null) - _b = proj.project_xsys(self._xs, self._ys), self._xs = _b[0], self._ys = _b[1]; - if (self._x0 != null) - _c = proj.project_xy(self._x0, self._y0), self._x0 = _c[0], self._y0 = _c[1]; - if (self._x1 != null) - _d = proj.project_xy(self._x1, self._y1), self._x1 = _d[0], self._y1 = _d[1]; - } - // if we have any coordinates that are categorical, convert them to - // synthetic coords here - if (this.renderer.plot_view.frame.x_ranges != null) { // XXXX JUST TEMP FOR TESTS TO PASS - var xr_1 = this.renderer.plot_view.frame.x_ranges[this.model.x_range_name]; - var yr_1 = this.renderer.plot_view.frame.y_ranges[this.model.y_range_name]; - for (var _i = 0, _e = this.model._coords; _i < _e.length; _i++) { - var _f = _e[_i], xname = _f[0], yname = _f[1]; - xname = "_" + xname; - yname = "_" + yname; - // TODO (bev) more robust detection of multi-glyph case - // hand multi glyph case - if (self._xs != null) { - if (xr_1 instanceof factor_range_1.FactorRange) { - self[xname] = arrayable_1.map(self[xname], function (arr) { return xr_1.v_synthetic(arr); }); - } - if (yr_1 instanceof factor_range_1.FactorRange) { - self[yname] = arrayable_1.map(self[yname], function (arr) { return yr_1.v_synthetic(arr); }); - } - } - else { - // hand standard glyph case - if (xr_1 instanceof factor_range_1.FactorRange) { - self[xname] = xr_1.v_synthetic(self[xname]); - } - if (yr_1 instanceof factor_range_1.FactorRange) { - self[yname] = yr_1.v_synthetic(self[yname]); - } - } - } - } - if (this.glglyph != null) - this.glglyph.set_data_changed(self._x.length); - this._set_data(indices_to_update); //TODO doesn't take subset indices into account - this.index_data(); - }; - GlyphView.prototype._set_data = function (_indices) { }; - GlyphView.prototype.index_data = function () { - this.index = this._index_data(); - }; - GlyphView.prototype.mask_data = function (indices) { - // WebGL can do the clipping much more efficiently - if (this.glglyph != null || this._mask_data == null) - return indices; - else - return this._mask_data(); - }; - GlyphView.prototype.map_data = function () { - var _a; - // TODO: if using gl, skip this (when is this called?) - // map all the coordinate fields - var self = this; - for (var _i = 0, _b = this.model._coords; _i < _b.length; _i++) { - var _c = _b[_i], xname = _c[0], yname = _c[1]; - var sxname = "s" + xname; - var syname = "s" + yname; - xname = "_" + xname; - yname = "_" + yname; - if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) { - var n = self[xname].length; - self[sxname] = new Array(n); - self[syname] = new Array(n); - for (var i = 0; i < n; i++) { - var _d = this.map_to_screen(self[xname][i], self[yname][i]), sx = _d[0], sy = _d[1]; - self[sxname][i] = sx; - self[syname][i] = sy; - } - } - else - _a = this.map_to_screen(self[xname], self[yname]), self[sxname] = _a[0], self[syname] = _a[1]; - } - this._map_data(); - }; - // This is where specs not included in coords are computed, e.g. radius. - GlyphView.prototype._map_data = function () { }; - GlyphView.prototype.map_to_screen = function (x, y) { - return this.renderer.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name); - }; - return GlyphView; - }(view_1.View)); - exports.GlyphView = GlyphView; - var Glyph = /** @class */ (function (_super) { - tslib_1.__extends(Glyph, _super); - function Glyph(attrs) { - return _super.call(this, attrs) || this; - } - Glyph.initClass = function () { - this.prototype.type = 'Glyph'; - this.prototype._coords = []; - this.internal({ - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - }; - Glyph.coords = function (coords) { - var _coords = this.prototype._coords.concat(coords); - this.prototype._coords = _coords; - var result = {}; - for (var _i = 0, coords_1 = coords; _i < coords_1.length; _i++) { - var _a = coords_1[_i], x = _a[0], y = _a[1]; - result[x] = [p.CoordinateSpec]; - result[y] = [p.CoordinateSpec]; - } - this.define(result); - }; - return Glyph; - }(model_1.Model)); - exports.Glyph = Glyph; - Glyph.initClass(); -} -, -/* models/glyphs/hbar */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_1 = require(121) /* ./box */; - var p = require(18) /* ../../core/properties */; - var HBarView = /** @class */ (function (_super) { - tslib_1.__extends(HBarView, _super); - function HBarView() { - return _super !== null && _super.apply(this, arguments) || this; - } - HBarView.prototype.scenterx = function (i) { - return (this.sleft[i] + this.sright[i]) / 2; - }; - HBarView.prototype.scentery = function (i) { - return this.sy[i]; - }; - HBarView.prototype._index_data = function () { - return this._index_box(this._y.length); - }; - HBarView.prototype._lrtb = function (i) { - var l = Math.min(this._left[i], this._right[i]); - var r = Math.max(this._left[i], this._right[i]); - var t = this._y[i] + 0.5 * this._height[i]; - var b = this._y[i] - 0.5 * this._height[i]; - return [l, r, t, b]; - }; - HBarView.prototype._map_data = function () { - this.sy = this.renderer.yscale.v_compute(this._y); - this.sh = this.sdist(this.renderer.yscale, this._y, this._height, "center"); - this.sleft = this.renderer.xscale.v_compute(this._left); - this.sright = this.renderer.xscale.v_compute(this._right); - var n = this.sy.length; - this.stop = new Float64Array(n); - this.sbottom = new Float64Array(n); - for (var i = 0; i < n; i++) { - this.stop[i] = this.sy[i] - this.sh[i] / 2; - this.sbottom[i] = this.sy[i] + this.sh[i] / 2; - } - this._clamp_viewport(); - }; - return HBarView; - }(box_1.BoxView)); - exports.HBarView = HBarView; - var HBar = /** @class */ (function (_super) { - tslib_1.__extends(HBar, _super); - function HBar(attrs) { - return _super.call(this, attrs) || this; - } - HBar.initClass = function () { - this.prototype.type = 'HBar'; - this.prototype.default_view = HBarView; - this.coords([['left', 'y']]); - this.define({ - height: [p.DistanceSpec], - right: [p.CoordinateSpec], - }); - this.override({ left: 0 }); - }; - return HBar; - }(box_1.Box)); - exports.HBar = HBar; - HBar.initClass(); -} -, -/* models/glyphs/hex_tile */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var glyph_1 = require(126) /* ./glyph */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var utils_1 = require(147) /* ./utils */; - var HexTileView = /** @class */ (function (_super) { - tslib_1.__extends(HexTileView, _super); - function HexTileView() { - return _super !== null && _super.apply(this, arguments) || this; - } - HexTileView.prototype.scenterx = function (i) { return this.sx[i]; }; - HexTileView.prototype.scentery = function (i) { return this.sy[i]; }; - HexTileView.prototype._set_data = function () { - var n = this._q.length; - var size = this.model.size; - var aspect_scale = this.model.aspect_scale; - this._x = new Float64Array(n); - this._y = new Float64Array(n); - if (this.model.orientation == "pointytop") { - for (var i = 0; i < n; i++) { - this._x[i] = size * Math.sqrt(3) * (this._q[i] + this._r[i] / 2) / aspect_scale; - this._y[i] = -size * 3 / 2 * this._r[i]; - } - } - else { - for (var i = 0; i < n; i++) { - this._x[i] = size * 3 / 2 * this._q[i]; - this._y[i] = -size * Math.sqrt(3) * (this._r[i] + this._q[i] / 2) * aspect_scale; - } - } - }; - HexTileView.prototype._index_data = function () { - var _a; - var ysize = this.model.size; - var xsize = Math.sqrt(3) * ysize / 2; - if (this.model.orientation == "flattop") { - _a = [ysize, xsize], xsize = _a[0], ysize = _a[1]; - ysize *= this.model.aspect_scale; - } - else - xsize /= this.model.aspect_scale; - var points = []; - for (var i = 0; i < this._x.length; i++) { - var x = this._x[i]; - var y = this._y[i]; - if (isNaN(x + y) || !isFinite(x + y)) - continue; - points.push({ minX: x - xsize, minY: y - ysize, maxX: x + xsize, maxY: y + ysize, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - // overriding map_data instead of _map_data because the default automatic mappings - // for other glyphs (with cartesian coordinates) is not useful - HexTileView.prototype.map_data = function () { - var _a, _b; - _a = this.map_to_screen(this._x, this._y), this.sx = _a[0], this.sy = _a[1]; - _b = this._get_unscaled_vertices(), this.svx = _b[0], this.svy = _b[1]; - }; - HexTileView.prototype._get_unscaled_vertices = function () { - var size = this.model.size; - var aspect_scale = this.model.aspect_scale; - if (this.model.orientation == "pointytop") { - var rscale = this.renderer.yscale; - var hscale = this.renderer.xscale; - var r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale - var h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) / aspect_scale; // assumes linear scale - var r2 = r / 2.0; - var svx = [0, -h, -h, 0, h, h]; - var svy = [r, r2, -r2, -r, -r2, r2]; - return [svx, svy]; - } - else { - var rscale = this.renderer.xscale; - var hscale = this.renderer.yscale; - var r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale - var h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) * aspect_scale; // assumes linear scale - var r2 = r / 2.0; - var svx = [r, r2, -r2, -r, -r2, r2]; - var svy = [0, -h, -h, 0, h, h]; - return [svx, svy]; - } - }; - HexTileView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, svx = _a.svx, svy = _a.svy, _scale = _a._scale; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _scale[i])) - continue; - ctx.translate(sx[i], sy[i]); - ctx.beginPath(); - for (var j = 0; j < 6; j++) { - ctx.lineTo(svx[j] * _scale[i], svy[j] * _scale[i]); - } - ctx.closePath(); - ctx.translate(-sx[i], -sy[i]); - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - HexTileView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y }); - var hits = []; - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var i = candidates_1[_i]; - if (hittest.point_in_poly(sx - this.sx[i], sy - this.sy[i], this.svx, this.svy)) { - hits.push(i); - } - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - HexTileView.prototype._hit_span = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var hits; - if (geometry.direction == 'v') { - var y = this.renderer.yscale.invert(sy); - var hr = this.renderer.plot_view.frame.bbox.h_range; - var _a = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _a[0], maxX = _a[1]; - hits = this.index.indices({ minX: minX, minY: y, maxX: maxX, maxY: y }); - } - else { - var x = this.renderer.xscale.invert(sx); - var vr = this.renderer.plot_view.frame.bbox.v_range; - var _b = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _b[0], maxY = _b[1]; - hits = this.index.indices({ minX: x, minY: minY, maxX: x, maxY: maxY }); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - HexTileView.prototype._hit_rect = function (geometry) { - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var result = hittest.create_empty_hit_test_result(); - result.indices = this.index.indices(bbox); - return result; - }; - HexTileView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - return HexTileView; - }(glyph_1.GlyphView)); - exports.HexTileView = HexTileView; - var HexTile = /** @class */ (function (_super) { - tslib_1.__extends(HexTile, _super); - function HexTile(attrs) { - return _super.call(this, attrs) || this; - } - HexTile.initClass = function () { - this.prototype.type = 'HexTile'; - this.prototype.default_view = HexTileView; - this.coords([['r', 'q']]); - this.mixins(['line', 'fill']); - this.define({ - size: [p.Number, 1.0], - aspect_scale: [p.Number, 1.0], - scale: [p.NumberSpec, 1.0], - orientation: [p.HexTileOrientation, "pointytop"], - }); - this.override({ line_color: null }); - }; - return HexTile; - }(glyph_1.Glyph)); - exports.HexTile = HexTile; - HexTile.initClass(); -} -, -/* models/glyphs/image */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var image_base_1 = require(130) /* ./image_base */; - var linear_color_mapper_1 = require(174) /* ../mappers/linear_color_mapper */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var ImageView = /** @class */ (function (_super) { - tslib_1.__extends(ImageView, _super); - function ImageView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ImageView.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this.connect(this.model.color_mapper.change, function () { return _this._update_image(); }); - this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); }); - }; - ImageView.prototype._update_image = function () { - // Only reset image_data if already initialized - if (this.image_data != null) { - this._set_data(); - this.renderer.plot_view.request_render(); - } - }; - ImageView.prototype._set_data = function () { - this._set_width_heigh_data(); - var cmap = this.model.color_mapper.rgba_mapper; - for (var i = 0, end = this._image.length; i < end; i++) { - var img = void 0; - if (this._image_shape != null && this._image_shape[i].length > 0) { - img = this._image[i]; - var shape = this._image_shape[i]; - this._height[i] = shape[0]; - this._width[i] = shape[1]; - } - else { - var _image = this._image[i]; - img = array_1.concat(_image); - this._height[i] = _image.length; - this._width[i] = _image[0].length; - } - var buf8 = cmap.v_compute(img); - this._set_image_data_from_buffer(i, buf8); - } - }; - ImageView.prototype._render = function (ctx, indices, _a) { - var image_data = _a.image_data, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh; - var old_smoothing = ctx.getImageSmoothingEnabled(); - ctx.setImageSmoothingEnabled(false); - ctx.globalAlpha = this.model.global_alpha; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (image_data[i] == null) - continue; - if (isNaN(sx[i] + sy[i] + sw[i] + sh[i])) - continue; - var y_offset = sy[i]; - ctx.translate(0, y_offset); - ctx.scale(1, -1); - ctx.translate(0, -y_offset); - ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]); - ctx.translate(0, y_offset); - ctx.scale(1, -1); - ctx.translate(0, -y_offset); - } - ctx.setImageSmoothingEnabled(old_smoothing); - }; - return ImageView; - }(image_base_1.ImageBaseView)); - exports.ImageView = ImageView; - // NOTE: this needs to be redefined here, because palettes are located in bokeh-api.js bundle - var Greys9 = function () { return ["#000000", "#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0", "#ffffff"]; }; - var Image = /** @class */ (function (_super) { - tslib_1.__extends(Image, _super); - function Image(attrs) { - return _super.call(this, attrs) || this; - } - Image.initClass = function () { - this.prototype.type = 'Image'; - this.prototype.default_view = ImageView; - this.define({ - color_mapper: [p.Instance, function () { return new linear_color_mapper_1.LinearColorMapper({ palette: Greys9() }); }], - }); - }; - return Image; - }(image_base_1.ImageBase)); - exports.Image = Image; - Image.initClass(); -} -, -/* models/glyphs/image_base */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var p = require(18) /* ../../core/properties */; - var hittest = require(9) /* ../../core/hittest */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var ImageBaseView = /** @class */ (function (_super) { - tslib_1.__extends(ImageBaseView, _super); - function ImageBaseView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ImageBaseView.prototype._render = function (_ctx, _indices, _data) { }; - ImageBaseView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._x.length; i < end; i++) { - var _a = this._lrtb(i), l = _a[0], r = _a[1], t = _a[2], b = _a[3]; - if (isNaN(l + r + t + b) || !isFinite(l + r + t + b)) { - continue; - } - points.push({ minX: l, minY: b, maxX: r, maxY: t, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - ImageBaseView.prototype._lrtb = function (i) { - var xr = this.renderer.xscale.source_range; - var x1 = this._x[i]; - var x2 = xr.is_reversed ? x1 - this._dw[i] : x1 + this._dw[i]; - var yr = this.renderer.yscale.source_range; - var y1 = this._y[i]; - var y2 = yr.is_reversed ? y1 - this._dh[i] : y1 + this._dh[i]; - var _a = x1 < x2 ? [x1, x2] : [x2, x1], l = _a[0], r = _a[1]; - var _b = y1 < y2 ? [y1, y2] : [y2, y1], b = _b[0], t = _b[1]; - return [l, r, t, b]; - }; - ImageBaseView.prototype._set_width_heigh_data = function () { - if (this.image_data == null || this.image_data.length != this._image.length) - this.image_data = new Array(this._image.length); - if (this._width == null || this._width.length != this._image.length) - this._width = new Array(this._image.length); - if (this._height == null || this._height.length != this._image.length) - this._height = new Array(this._image.length); - }; - ImageBaseView.prototype._get_or_create_canvas = function (i) { - var _image_data = this.image_data[i]; - if (_image_data != null && _image_data.width == this._width[i] && - _image_data.height == this._height[i]) - return _image_data; - else { - var canvas = document.createElement('canvas'); - canvas.width = this._width[i]; - canvas.height = this._height[i]; - return canvas; - } - }; - ImageBaseView.prototype._set_image_data_from_buffer = function (i, buf8) { - var canvas = this._get_or_create_canvas(i); - var ctx = canvas.getContext('2d'); - var image_data = ctx.getImageData(0, 0, this._width[i], this._height[i]); - image_data.data.set(buf8); - ctx.putImageData(image_data, 0, 0); - this.image_data[i] = canvas; - }; - ImageBaseView.prototype._map_data = function () { - switch (this.model.properties.dw.units) { - case "data": { - this.sw = this.sdist(this.renderer.xscale, this._x, this._dw, 'edge', this.model.dilate); - break; - } - case "screen": { - this.sw = this._dw; - break; - } - } - switch (this.model.properties.dh.units) { - case "data": { - this.sh = this.sdist(this.renderer.yscale, this._y, this._dh, 'edge', this.model.dilate); - break; - } - case "screen": { - this.sh = this._dh; - break; - } - } - }; - ImageBaseView.prototype._image_index = function (index, x, y) { - var _a = this._lrtb(index), l = _a[0], r = _a[1], t = _a[2], b = _a[3]; - var width = this._width[index]; - var height = this._height[index]; - var dx = (r - l) / width; - var dy = (t - b) / height; - var dim1 = Math.floor((x - l) / dx); - var dim2 = Math.floor((y - b) / dy); - return { index: index, dim1: dim1, dim2: dim2, flat_index: dim2 * width + dim1 }; - }; - ImageBaseView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var bbox = hittest.validate_bbox_coords([x, x], [y, y]); - var candidates = this.index.indices(bbox); - var result = hittest.create_empty_hit_test_result(); - result.image_indices = []; - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var index = candidates_1[_i]; - if ((sx != Infinity) && (sy != Infinity)) { - result.image_indices.push(this._image_index(index, x, y)); - } - } - return result; - }; - return ImageBaseView; - }(xy_glyph_1.XYGlyphView)); - exports.ImageBaseView = ImageBaseView; - var ImageBase = /** @class */ (function (_super) { - tslib_1.__extends(ImageBase, _super); - function ImageBase(attrs) { - return _super.call(this, attrs) || this; - } - ImageBase.initClass = function () { - this.prototype.type = 'ImageBase'; - this.prototype.default_view = ImageBaseView; - this.define({ - image: [p.NumberSpec], - dw: [p.DistanceSpec], - dh: [p.DistanceSpec], - dilate: [p.Boolean, false], - global_alpha: [p.Number, 1.0], - }); - }; - return ImageBase; - }(xy_glyph_1.XYGlyph)); - exports.ImageBase = ImageBase; - ImageBase.initClass(); -} -, -/* models/glyphs/image_rgba */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var image_base_1 = require(130) /* ./image_base */; - var array_1 = require(24) /* ../../core/util/array */; - var ImageRGBAView = /** @class */ (function (_super) { - tslib_1.__extends(ImageRGBAView, _super); - function ImageRGBAView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ImageRGBAView.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); }); - }; - ImageRGBAView.prototype._set_data = function (indices) { - this._set_width_heigh_data(); - for (var i = 0, end = this._image.length; i < end; i++) { - if (indices != null && indices.indexOf(i) < 0) - continue; - var buf = void 0; - if (this._image_shape != null && this._image_shape[i].length > 0) { - buf = this._image[i].buffer; - var shape = this._image_shape[i]; - this._height[i] = shape[0]; - this._width[i] = shape[1]; - } - else { - var _image = this._image[i]; - var flat = array_1.concat(_image); - buf = new ArrayBuffer(flat.length * 4); - var color = new Uint32Array(buf); - for (var j = 0, endj = flat.length; j < endj; j++) { - color[j] = flat[j]; - } - this._height[i] = _image.length; - this._width[i] = _image[0].length; - } - var buf8 = new Uint8Array(buf); - this._set_image_data_from_buffer(i, buf8); - } - }; - ImageRGBAView.prototype._render = function (ctx, indices, _a) { - var image_data = _a.image_data, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh; - var old_smoothing = ctx.getImageSmoothingEnabled(); - ctx.setImageSmoothingEnabled(false); - ctx.globalAlpha = this.model.global_alpha; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sw[i] + sh[i])) - continue; - var y_offset = sy[i]; - ctx.translate(0, y_offset); - ctx.scale(1, -1); - ctx.translate(0, -y_offset); - ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]); - ctx.translate(0, y_offset); - ctx.scale(1, -1); - ctx.translate(0, -y_offset); - } - ctx.setImageSmoothingEnabled(old_smoothing); - }; - return ImageRGBAView; - }(image_base_1.ImageBaseView)); - exports.ImageRGBAView = ImageRGBAView; - var ImageRGBA = /** @class */ (function (_super) { - tslib_1.__extends(ImageRGBA, _super); - function ImageRGBA(attrs) { - return _super.call(this, attrs) || this; - } - ImageRGBA.initClass = function () { - this.prototype.type = 'ImageRGBA'; - this.prototype.default_view = ImageRGBAView; - }; - return ImageRGBA; - }(image_base_1.ImageBase)); - exports.ImageRGBA = ImageRGBA; - ImageRGBA.initClass(); -} -, -/* models/glyphs/image_url */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var ImageURLView = /** @class */ (function (_super) { - tslib_1.__extends(ImageURLView, _super); - function ImageURLView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._images_rendered = false; - return _this; - } - ImageURLView.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); }); - }; - ImageURLView.prototype._index_data = function () { - return new spatial_1.SpatialIndex([]); - }; - ImageURLView.prototype._set_data = function () { - var _this = this; - if (this.image == null || this.image.length != this._url.length) - this.image = arrayable_1.map(this._url, function () { return null; }); - var _a = this.model, retry_attempts = _a.retry_attempts, retry_timeout = _a.retry_timeout; - this.retries = arrayable_1.map(this._url, function () { return retry_attempts; }); - var _loop_1 = function (i, end) { - var url = this_1._url[i]; - if (url == null || url == "") - return "continue"; - var img = new Image(); - img.onerror = function () { - if (_this.retries[i] > 0) { - logging_1.logger.trace("ImageURL failed to load " + url + " image, retrying in " + retry_timeout + " ms"); - setTimeout(function () { return img.src = url; }, retry_timeout); - } - else - logging_1.logger.warn("ImageURL unable to load " + url + " image after " + retry_attempts + " retries"); - _this.retries[i] -= 1; - }; - img.onload = function () { - _this.image[i] = img; - _this.renderer.request_render(); - }; - img.src = url; - }; - var this_1 = this; - for (var i = 0, end = this._url.length; i < end; i++) { - _loop_1(i, end); - } - var w_data = this.model.properties.w.units == "data"; - var h_data = this.model.properties.h.units == "data"; - var n = this._x.length; - var xs = new Array(w_data ? 2 * n : n); - var ys = new Array(h_data ? 2 * n : n); - for (var i = 0; i < n; i++) { - xs[i] = this._x[i]; - ys[i] = this._y[i]; - } - // if the width/height are in screen units, don't try to include them in bounds - if (w_data) { - for (var i = 0; i < n; i++) - xs[n + i] = this._x[i] + this._w[i]; - } - if (h_data) { - for (var i = 0; i < n; i++) - ys[n + i] = this._y[i] + this._h[i]; - } - var minX = arrayable_1.min(xs); - var maxX = arrayable_1.max(xs); - var minY = arrayable_1.min(ys); - var maxY = arrayable_1.max(ys); - this._bounds_rect = { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; - }; - ImageURLView.prototype.has_finished = function () { - return _super.prototype.has_finished.call(this) && this._images_rendered == true; - }; - ImageURLView.prototype._map_data = function () { - // Better to check this.model.w and this.model.h for null since the set_data - // machinery will have converted this._w and this._w to lists of null - var ws = this.model.w != null ? this._w : arrayable_1.map(this._x, function () { return NaN; }); - var hs = this.model.h != null ? this._h : arrayable_1.map(this._x, function () { return NaN; }); - switch (this.model.properties.w.units) { - case "data": { - this.sw = this.sdist(this.renderer.xscale, this._x, ws, "edge", this.model.dilate); - break; - } - case "screen": { - this.sw = ws; - break; - } - } - switch (this.model.properties.h.units) { - case "data": { - this.sh = this.sdist(this.renderer.yscale, this._y, hs, "edge", this.model.dilate); - break; - } - case "screen": { - this.sh = hs; - break; - } - } - }; - ImageURLView.prototype._render = function (ctx, indices, _a) { - var image = _a.image, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh, _angle = _a._angle; - // TODO (bev): take actual border width into account when clipping - var frame = this.renderer.plot_view.frame; - ctx.rect(frame._left.value + 1, frame._top.value + 1, frame._width.value - 2, frame._height.value - 2); - ctx.clip(); - var finished = true; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _angle[i])) - continue; - if (this.retries[i] == -1) - continue; - var img = image[i]; - if (img == null) { - finished = false; - continue; - } - this._render_image(ctx, i, img, sx, sy, sw, sh, _angle); - } - if (finished && !this._images_rendered) { - this._images_rendered = true; - this.notify_finished(); - } - }; - ImageURLView.prototype._final_sx_sy = function (anchor, sx, sy, sw, sh) { - switch (anchor) { - case 'top_left': return [sx, sy]; - case 'top_center': return [sx - (sw / 2), sy]; - case 'top_right': return [sx - sw, sy]; - case 'center_right': return [sx - sw, sy - (sh / 2)]; - case 'bottom_right': return [sx - sw, sy - sh]; - case 'bottom_center': return [sx - (sw / 2), sy - sh]; - case 'bottom_left': return [sx, sy - sh]; - case 'center_left': return [sx, sy - (sh / 2)]; - case 'center': return [sx - (sw / 2), sy - (sh / 2)]; - } - }; - ImageURLView.prototype._render_image = function (ctx, i, image, sx, sy, sw, sh, angle) { - if (isNaN(sw[i])) - sw[i] = image.width; - if (isNaN(sh[i])) - sh[i] = image.height; - var anchor = this.model.anchor; - var _a = this._final_sx_sy(anchor, sx[i], sy[i], sw[i], sh[i]), sxi = _a[0], syi = _a[1]; - ctx.save(); - ctx.globalAlpha = this.model.global_alpha; - if (angle[i]) { - ctx.translate(sxi, syi); - ctx.rotate(angle[i]); - ctx.drawImage(image, 0, 0, sw[i], sh[i]); - ctx.rotate(-angle[i]); - ctx.translate(-sxi, -syi); - } - else - ctx.drawImage(image, sxi, syi, sw[i], sh[i]); - ctx.restore(); - }; - ImageURLView.prototype.bounds = function () { - return this._bounds_rect; - }; - return ImageURLView; - }(xy_glyph_1.XYGlyphView)); - exports.ImageURLView = ImageURLView; - var ImageURL = /** @class */ (function (_super) { - tslib_1.__extends(ImageURL, _super); - function ImageURL(attrs) { - return _super.call(this, attrs) || this; - } - ImageURL.initClass = function () { - this.prototype.type = 'ImageURL'; - this.prototype.default_view = ImageURLView; - this.define({ - url: [p.StringSpec], - anchor: [p.Anchor, 'top_left'], - global_alpha: [p.Number, 1.0], - angle: [p.AngleSpec, 0], - w: [p.DistanceSpec], - h: [p.DistanceSpec], - dilate: [p.Boolean, false], - retry_attempts: [p.Number, 0], - retry_timeout: [p.Number, 0], - }); - }; - return ImageURL; - }(xy_glyph_1.XYGlyph)); - exports.ImageURL = ImageURL; - ImageURL.initClass(); -} -, -/* models/glyphs/index */ function _(require, module, exports) { - var annular_wedge_1 = require(117) /* ./annular_wedge */; - exports.AnnularWedge = annular_wedge_1.AnnularWedge; - var annulus_1 = require(118) /* ./annulus */; - exports.Annulus = annulus_1.Annulus; - var arc_1 = require(119) /* ./arc */; - exports.Arc = arc_1.Arc; - var bezier_1 = require(120) /* ./bezier */; - exports.Bezier = bezier_1.Bezier; - var circle_1 = require(123) /* ./circle */; - exports.Circle = circle_1.Circle; - var center_rotatable_1 = require(122) /* ./center_rotatable */; - exports.CenterRotatable = center_rotatable_1.CenterRotatable; - var ellipse_1 = require(124) /* ./ellipse */; - exports.Ellipse = ellipse_1.Ellipse; - var ellipse_oval_1 = require(125) /* ./ellipse_oval */; - exports.EllipseOval = ellipse_oval_1.EllipseOval; - var glyph_1 = require(126) /* ./glyph */; - exports.Glyph = glyph_1.Glyph; - var hbar_1 = require(127) /* ./hbar */; - exports.HBar = hbar_1.HBar; - var hex_tile_1 = require(128) /* ./hex_tile */; - exports.HexTile = hex_tile_1.HexTile; - var image_1 = require(129) /* ./image */; - exports.Image = image_1.Image; - var image_rgba_1 = require(131) /* ./image_rgba */; - exports.ImageRGBA = image_rgba_1.ImageRGBA; - var image_url_1 = require(132) /* ./image_url */; - exports.ImageURL = image_url_1.ImageURL; - var line_1 = require(134) /* ./line */; - exports.Line = line_1.Line; - var multi_line_1 = require(135) /* ./multi_line */; - exports.MultiLine = multi_line_1.MultiLine; - var multi_polygons_1 = require(136) /* ./multi_polygons */; - exports.MultiPolygons = multi_polygons_1.MultiPolygons; - var oval_1 = require(137) /* ./oval */; - exports.Oval = oval_1.Oval; - var patch_1 = require(138) /* ./patch */; - exports.Patch = patch_1.Patch; - var patches_1 = require(139) /* ./patches */; - exports.Patches = patches_1.Patches; - var quad_1 = require(140) /* ./quad */; - exports.Quad = quad_1.Quad; - var quadratic_1 = require(141) /* ./quadratic */; - exports.Quadratic = quadratic_1.Quadratic; - var ray_1 = require(142) /* ./ray */; - exports.Ray = ray_1.Ray; - var rect_1 = require(143) /* ./rect */; - exports.Rect = rect_1.Rect; - var segment_1 = require(144) /* ./segment */; - exports.Segment = segment_1.Segment; - var step_1 = require(145) /* ./step */; - exports.Step = step_1.Step; - var text_1 = require(146) /* ./text */; - exports.Text = text_1.Text; - var vbar_1 = require(148) /* ./vbar */; - exports.VBar = vbar_1.VBar; - var wedge_1 = require(149) /* ./wedge */; - exports.Wedge = wedge_1.Wedge; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - exports.XYGlyph = xy_glyph_1.XYGlyph; -} -, -/* models/glyphs/line */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var hittest = require(9) /* ../../core/hittest */; - var LineView = /** @class */ (function (_super) { - tslib_1.__extends(LineView, _super); - function LineView() { - return _super !== null && _super.apply(this, arguments) || this; - } - LineView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy; - var drawing = false; - var last_index = null; - this.visuals.line.set_value(ctx); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (drawing) { - if (!isFinite(sx[i] + sy[i])) { - ctx.stroke(); - ctx.beginPath(); - drawing = false; - last_index = i; - continue; - } - if (last_index != null && i - last_index > 1) { - ctx.stroke(); - drawing = false; - } - } - if (drawing) - ctx.lineTo(sx[i], sy[i]); - else { - ctx.beginPath(); - ctx.moveTo(sx[i], sy[i]); - drawing = true; - } - last_index = i; - } - if (drawing) - ctx.stroke(); - }; - LineView.prototype._hit_point = function (geometry) { - var _this = this; - /* Check if the point geometry hits this line glyph and return an object - that describes the hit result: - Args: - * geometry (object): object with the following keys - * sx (float): screen x coordinate of the point - * sy (float): screen y coordinate of the point - * type (str): type of geometry (in this case it's a point) - Output: - Object with the following keys: - * 0d (bool): whether the point hits the glyph or not - * 1d (array(int)): array with the indices hit by the point - */ - var result = hittest.create_empty_hit_test_result(); - var point = { x: geometry.sx, y: geometry.sy }; - var shortest = 9999; - var threshold = Math.max(2, this.visuals.line.line_width.value() / 2); - for (var i = 0, end = this.sx.length - 1; i < end; i++) { - var p0 = { x: this.sx[i], y: this.sy[i] }; - var p1 = { x: this.sx[i + 1], y: this.sy[i + 1] }; - var dist = hittest.dist_to_segment(point, p0, p1); - if (dist < threshold && dist < shortest) { - shortest = dist; - result.add_to_selected_glyphs(this.model); - result.get_view = function () { return _this; }; - result.line_indices = [i]; - } - } - return result; - }; - LineView.prototype._hit_span = function (geometry) { - var _this = this; - var sx = geometry.sx, sy = geometry.sy; - var result = hittest.create_empty_hit_test_result(); - var val; - var values; - if (geometry.direction == 'v') { - val = this.renderer.yscale.invert(sy); - values = this._y; - } - else { - val = this.renderer.xscale.invert(sx); - values = this._x; - } - for (var i = 0, end = values.length - 1; i < end; i++) { - if ((values[i] <= val && val <= values[i + 1]) || (values[i + 1] <= val && val <= values[i])) { - result.add_to_selected_glyphs(this.model); - result.get_view = function () { return _this; }; - result.line_indices.push(i); - } - } - return result; - }; - LineView.prototype.get_interpolation_hit = function (i, geometry) { - var _a = [this._x[i], this._y[i], this._x[i + 1], this._y[i + 1]], x2 = _a[0], y2 = _a[1], x3 = _a[2], y3 = _a[3]; - return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3); - }; - LineView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - return LineView; - }(xy_glyph_1.XYGlyphView)); - exports.LineView = LineView; - var Line = /** @class */ (function (_super) { - tslib_1.__extends(Line, _super); - function Line(attrs) { - return _super.call(this, attrs) || this; - } - Line.initClass = function () { - this.prototype.type = 'Line'; - this.prototype.default_view = LineView; - this.mixins(['line']); - }; - return Line; - }(xy_glyph_1.XYGlyph)); - exports.Line = Line; - Line.initClass(); -} -, -/* models/glyphs/multi_line */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var hittest = require(9) /* ../../core/hittest */; - var object_1 = require(35) /* ../../core/util/object */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - var MultiLineView = /** @class */ (function (_super) { - tslib_1.__extends(MultiLineView, _super); - function MultiLineView() { - return _super !== null && _super.apply(this, arguments) || this; - } - MultiLineView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._xs.length; i < end; i++) { - if (this._xs[i] == null || this._xs[i].length === 0) - continue; - var _xsi = this._xs[i]; - var xs = []; - for (var j = 0, n = _xsi.length; j < n; j++) { - var x = _xsi[j]; - if (!types_1.isStrictNaN(x)) - xs.push(x); - } - var _ysi = this._ys[i]; - var ys = []; - for (var j = 0, n = _ysi.length; j < n; j++) { - var y = _ysi[j]; - if (!types_1.isStrictNaN(y)) - ys.push(y); - } - var _a = [array_1.min(xs), array_1.max(xs)], minX = _a[0], maxX = _a[1]; - var _b = [array_1.min(ys), array_1.max(ys)], minY = _b[0], maxY = _b[1]; - points.push({ minX: minX, minY: minY, maxX: maxX, maxY: maxY, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - MultiLineView.prototype._render = function (ctx, indices, _a) { - var sxs = _a.sxs, sys = _a.sys; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - var _b = [sxs[i], sys[i]], sx = _b[0], sy = _b[1]; - this.visuals.line.set_vectorize(ctx, i); - for (var j = 0, end = sx.length; j < end; j++) { - if (j == 0) { - ctx.beginPath(); - ctx.moveTo(sx[j], sy[j]); - continue; - } - else if (isNaN(sx[j]) || isNaN(sy[j])) { - ctx.stroke(); - ctx.beginPath(); - continue; - } - else - ctx.lineTo(sx[j], sy[j]); - } - ctx.stroke(); - } - }; - MultiLineView.prototype._hit_point = function (geometry) { - var result = hittest.create_empty_hit_test_result(); - var point = { x: geometry.sx, y: geometry.sy }; - var shortest = 9999; - var hits = {}; - for (var i = 0, end = this.sxs.length; i < end; i++) { - var threshold = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2); - var points = null; - for (var j = 0, endj = this.sxs[i].length - 1; j < endj; j++) { - var p0 = { x: this.sxs[i][j], y: this.sys[i][j] }; - var p1 = { x: this.sxs[i][j + 1], y: this.sys[i][j + 1] }; - var dist = hittest.dist_to_segment(point, p0, p1); - if (dist < threshold && dist < shortest) { - shortest = dist; - points = [j]; - } - } - if (points) - hits[i] = points; - } - result.indices = object_1.keys(hits).map(function (x) { return parseInt(x, 10); }); - result.multiline_indices = hits; - return result; - }; - MultiLineView.prototype._hit_span = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var result = hittest.create_empty_hit_test_result(); - var val; - var values; - if (geometry.direction === 'v') { - val = this.renderer.yscale.invert(sy); - values = this._ys; - } - else { - val = this.renderer.xscale.invert(sx); - values = this._xs; - } - var hits = {}; - for (var i = 0, end = values.length; i < end; i++) { - var points = []; - for (var j = 0, endj = values[i].length - 1; j < endj; j++) { - if (values[i][j] <= val && val <= values[i][j + 1]) - points.push(j); - } - if (points.length > 0) - hits[i] = points; - } - result.indices = object_1.keys(hits).map(function (x) { return parseInt(x, 10); }); - result.multiline_indices = hits; - return result; - }; - MultiLineView.prototype.get_interpolation_hit = function (i, point_i, geometry) { - var _a = [this._xs[i][point_i], this._ys[i][point_i], this._xs[i][point_i + 1], this._ys[i][point_i + 1]], x2 = _a[0], y2 = _a[1], x3 = _a[2], y3 = _a[3]; - return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3); - }; - MultiLineView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - MultiLineView.prototype.scenterx = function () { - throw new Error("not implemented"); - }; - MultiLineView.prototype.scentery = function () { - throw new Error("not implemented"); - }; - return MultiLineView; - }(glyph_1.GlyphView)); - exports.MultiLineView = MultiLineView; - var MultiLine = /** @class */ (function (_super) { - tslib_1.__extends(MultiLine, _super); - function MultiLine(attrs) { - return _super.call(this, attrs) || this; - } - MultiLine.initClass = function () { - this.prototype.type = 'MultiLine'; - this.prototype.default_view = MultiLineView; - this.coords([['xs', 'ys']]); - this.mixins(['line']); - }; - return MultiLine; - }(glyph_1.Glyph)); - exports.MultiLine = MultiLine; - MultiLine.initClass(); -} -, -/* models/glyphs/multi_polygons */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - var array_1 = require(24) /* ../../core/util/array */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var hittest = require(9) /* ../../core/hittest */; - var types_1 = require(46) /* ../../core/util/types */; - var MultiPolygonsView = /** @class */ (function (_super) { - tslib_1.__extends(MultiPolygonsView, _super); - function MultiPolygonsView() { - return _super !== null && _super.apply(this, arguments) || this; - } - MultiPolygonsView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._xs.length; i < end; i++) { - for (var j = 0, endj = this._xs[i].length; j < endj; j++) { - var xs = this._xs[i][j][0]; // do not use holes - var ys = this._ys[i][j][0]; // do not use holes - if (xs.length == 0) - continue; - points.push({ - minX: array_1.min(xs), - minY: array_1.min(ys), - maxX: array_1.max(xs), - maxY: array_1.max(ys), - i: i, - }); - } - } - this.hole_index = this._index_hole_data(); // should this be set here? - return new spatial_1.SpatialIndex(points); - }; - MultiPolygonsView.prototype._index_hole_data = function () { - // need advice on how to use this sure if this could be more useful - var points = []; - for (var i = 0, end = this._xs.length; i < end; i++) { - for (var j = 0, endj = this._xs[i].length; j < endj; j++) { - if (this._xs[i][j].length > 1) { - for (var k = 1, endk = this._xs[i][j].length; k < endk; k++) { - var xs = this._xs[i][j][k]; // only use holes - var ys = this._ys[i][j][k]; // only use holes - if (xs.length == 0) - continue; - points.push({ - minX: array_1.min(xs), - minY: array_1.min(ys), - maxX: array_1.max(xs), - maxY: array_1.max(ys), - i: i, - }); - } - } - } - } - return new spatial_1.SpatialIndex(points); - }; - MultiPolygonsView.prototype._mask_data = function () { - var xr = this.renderer.plot_view.frame.x_ranges.default; - var _a = [xr.min, xr.max], x0 = _a[0], x1 = _a[1]; - var yr = this.renderer.plot_view.frame.y_ranges.default; - var _b = [yr.min, yr.max], y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var indices = this.index.indices(bbox); - // TODO this is probably needed in patches as well so that we don't draw glyphs multiple times - return indices.sort(function (a, b) { return a - b; }).filter(function (value, index, array) { - return (index === 0) || (value !== array[index - 1]); - }); - }; - MultiPolygonsView.prototype._render = function (ctx, indices, _a) { - var sxs = _a.sxs, sys = _a.sys; - if (this.visuals.fill.doit || this.visuals.line.doit) { - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - ctx.beginPath(); - for (var j = 0, endj = sxs[i].length; j < endj; j++) { - for (var k = 0, endk = sxs[i][j].length; k < endk; k++) { - var _sx = sxs[i][j][k]; - var _sy = sys[i][j][k]; - for (var l = 0, endl = _sx.length; l < endl; l++) { - if (l == 0) { - ctx.moveTo(_sx[l], _sy[l]); - continue; - } - else - ctx.lineTo(_sx[l], _sy[l]); - } - ctx.closePath(); - } - } - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill("evenodd"); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - } - }; - MultiPolygonsView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y }); - var hole_candidates = this.hole_index.indices({ minX: x, minY: y, maxX: x, maxY: y }); - var hits = []; - for (var i = 0, end = candidates.length; i < end; i++) { - var idx = candidates[i]; - var sxs = this.sxs[idx]; - var sys = this.sys[idx]; - for (var j = 0, endj = sxs.length; j < endj; j++) { - var nk = sxs[j].length; - if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) { - if (nk == 1) { - hits.push(idx); - } - else if (hole_candidates.indexOf(idx) == -1) { - hits.push(idx); - } - else if (nk > 1) { - var in_a_hole = false; - for (var k = 1; k < nk; k++) { - var sxs_k = sxs[j][k]; - var sys_k = sys[j][k]; - if (hittest.point_in_poly(sx, sy, sxs_k, sys_k)) { - in_a_hole = true; - break; - } - else { - continue; - } - } - if (!in_a_hole) { - hits.push(idx); - } - } - } - } - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - MultiPolygonsView.prototype._get_snap_coord = function (array) { - return arrayable_1.sum(array) / array.length; - }; - MultiPolygonsView.prototype.scenterx = function (i, sx, sy) { - if (this.sxs[i].length == 1) { - // We don't have discontinuous objects so we're ok - return this._get_snap_coord(this.sxs[i][0][0]); - } - else { - // We have discontinuous objects, so we need to find which - // one we're in, we can use point_in_poly again - var sxs = this.sxs[i]; - var sys = this.sys[i]; - for (var j = 0, end = sxs.length; j < end; j++) { - if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) - return this._get_snap_coord(sxs[j][0]); - } - } - throw new Error("unreachable code"); - }; - MultiPolygonsView.prototype.scentery = function (i, sx, sy) { - if (this.sys[i].length == 1) { - // We don't have discontinuous objects so we're ok - return this._get_snap_coord(this.sys[i][0][0]); - } - else { - // We have discontinuous objects, so we need to find which - // one we're in, we can use point_in_poly again - var sxs = this.sxs[i]; - var sys = this.sys[i]; - for (var j = 0, end = sxs.length; j < end; j++) { - if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) - return this._get_snap_coord(sys[j][0]); - } - } - throw new Error("unreachable code"); - }; - MultiPolygonsView.prototype.map_data = function () { - var self = this; - for (var _i = 0, _a = this.model._coords; _i < _a.length; _i++) { - var _b = _a[_i], xname = _b[0], yname = _b[1]; - var sxname = "s" + xname; - var syname = "s" + yname; - xname = "_" + xname; - yname = "_" + yname; - if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) { - var ni = self[xname].length; - self[sxname] = new Array(ni); - self[syname] = new Array(ni); - for (var i = 0; i < ni; i++) { - var nj = self[xname][i].length; - self[sxname][i] = new Array(nj); - self[syname][i] = new Array(nj); - for (var j = 0; j < nj; j++) { - var nk = self[xname][i][j].length; - self[sxname][i][j] = new Array(nk); - self[syname][i][j] = new Array(nk); - for (var k = 0; k < nk; k++) { - var _c = this.map_to_screen(self[xname][i][j][k], self[yname][i][j][k]), sx = _c[0], sy = _c[1]; - self[sxname][i][j][k] = sx; - self[syname][i][j][k] = sy; - } - } - } - } - } - }; - MultiPolygonsView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - return MultiPolygonsView; - }(glyph_1.GlyphView)); - exports.MultiPolygonsView = MultiPolygonsView; - var MultiPolygons = /** @class */ (function (_super) { - tslib_1.__extends(MultiPolygons, _super); - function MultiPolygons(attrs) { - return _super.call(this, attrs) || this; - } - MultiPolygons.initClass = function () { - this.prototype.type = 'MultiPolygons'; - this.prototype.default_view = MultiPolygonsView; - this.coords([['xs', 'ys']]); - this.mixins(['line', 'fill']); - }; - return MultiPolygons; - }(glyph_1.Glyph)); - exports.MultiPolygons = MultiPolygons; - MultiPolygons.initClass(); -} -, -/* models/glyphs/oval */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var ellipse_oval_1 = require(125) /* ./ellipse_oval */; - var OvalView = /** @class */ (function (_super) { - tslib_1.__extends(OvalView, _super); - function OvalView() { - return _super !== null && _super.apply(this, arguments) || this; - } - OvalView.prototype._map_data = function () { - var sw; - var n = this._x.length; - this.sw = new Float64Array(n); - if (this.model.properties.width.units == "data") - sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center'); - else - sw = this._width; - // oval drawn from bezier curves = ellipse with width reduced by 3/4 - for (var i = 0; i < n; i++) - this.sw[i] = sw[i] * 0.75; - if (this.model.properties.height.units == "data") - this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center'); - else - this.sh = this._height; - }; - return OvalView; - }(ellipse_oval_1.EllipseOvalView)); - exports.OvalView = OvalView; - var Oval = /** @class */ (function (_super) { - tslib_1.__extends(Oval, _super); - function Oval(attrs) { - return _super.call(this, attrs) || this; - } - Oval.initClass = function () { - this.prototype.type = 'Oval'; - this.prototype.default_view = OvalView; - }; - return Oval; - }(ellipse_oval_1.EllipseOval)); - exports.Oval = Oval; - Oval.initClass(); -} -, -/* models/glyphs/patch */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var PatchView = /** @class */ (function (_super) { - tslib_1.__extends(PatchView, _super); - function PatchView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PatchView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy; - if (this.visuals.fill.doit) { - this.visuals.fill.set_value(ctx); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (i == 0) { - ctx.beginPath(); - ctx.moveTo(sx[i], sy[i]); - continue; - } - else if (isNaN(sx[i] + sy[i])) { - ctx.closePath(); - ctx.fill(); - ctx.beginPath(); - continue; - } - else - ctx.lineTo(sx[i], sy[i]); - } - ctx.closePath(); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_value(ctx); - for (var _b = 0, indices_2 = indices; _b < indices_2.length; _b++) { - var i = indices_2[_b]; - if (i == 0) { - ctx.beginPath(); - ctx.moveTo(sx[i], sy[i]); - continue; - } - else if (isNaN(sx[i] + sy[i])) { - ctx.closePath(); - ctx.stroke(); - ctx.beginPath(); - continue; - } - else - ctx.lineTo(sx[i], sy[i]); - } - ctx.closePath(); - return ctx.stroke(); - } - }; - PatchView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - return PatchView; - }(xy_glyph_1.XYGlyphView)); - exports.PatchView = PatchView; - var Patch = /** @class */ (function (_super) { - tslib_1.__extends(Patch, _super); - function Patch(attrs) { - return _super.call(this, attrs) || this; - } - Patch.initClass = function () { - this.prototype.type = 'Patch'; - this.prototype.default_view = PatchView; - this.mixins(['line', 'fill']); - }; - return Patch; - }(xy_glyph_1.XYGlyph)); - exports.Patch = Patch; - Patch.initClass(); -} -, -/* models/glyphs/patches */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - var array_1 = require(24) /* ../../core/util/array */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var types_1 = require(46) /* ../../core/util/types */; - var hittest = require(9) /* ../../core/hittest */; - var PatchesView = /** @class */ (function (_super) { - tslib_1.__extends(PatchesView, _super); - function PatchesView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PatchesView.prototype._build_discontinuous_object = function (nanned_qs) { - // _s is this.xs, this.ys, this.sxs, this.sys - // an object of n 1-d arrays in either data or screen units - // - // Each 1-d array gets broken to an array of arrays split - // on any NaNs - // - // So: - // { 0: [x11, x12], - // 1: [x21, x22, x23], - // 2: [x31, NaN, x32] - // } - // becomes - // { 0: [[x11, x12]], - // 1: [[x21, x22, x23]], - // 2: [[x31],[x32]] - // } - var ds = []; - for (var i = 0, end = nanned_qs.length; i < end; i++) { - ds[i] = []; - var qs = array_1.copy(nanned_qs[i]); - while (qs.length > 0) { - var nan_index = array_1.find_last_index(qs, function (q) { return types_1.isStrictNaN(q); }); - var qs_part = void 0; - if (nan_index >= 0) - qs_part = qs.splice(nan_index); - else { - qs_part = qs; - qs = []; - } - var denanned = qs_part.filter(function (q) { return !types_1.isStrictNaN(q); }); - ds[i].push(denanned); - } - } - return ds; - }; - PatchesView.prototype._index_data = function () { - var xss = this._build_discontinuous_object(this._xs); // XXX - var yss = this._build_discontinuous_object(this._ys); // XXX - var points = []; - for (var i = 0, end = this._xs.length; i < end; i++) { - for (var j = 0, endj = xss[i].length; j < endj; j++) { - var xs = xss[i][j]; - var ys = yss[i][j]; - if (xs.length == 0) - continue; - points.push({ - minX: array_1.min(xs), - minY: array_1.min(ys), - maxX: array_1.max(xs), - maxY: array_1.max(ys), - i: i, - }); - } - } - return new spatial_1.SpatialIndex(points); - }; - PatchesView.prototype._mask_data = function () { - var xr = this.renderer.plot_view.frame.x_ranges.default; - var _a = [xr.min, xr.max], x0 = _a[0], x1 = _a[1]; - var yr = this.renderer.plot_view.frame.y_ranges.default; - var _b = [yr.min, yr.max], y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var indices = this.index.indices(bbox); - // TODO (bev) this should be under test - return indices.sort(function (a, b) { return a - b; }); - }; - PatchesView.prototype._render = function (ctx, indices, _a) { - var sxs = _a.sxs, sys = _a.sys; - // this.sxss and this.syss are used by _hit_point and sxc, syc - // This is the earliest we can build them, and only build them once - this.sxss = this._build_discontinuous_object(sxs); // XXX - this.syss = this._build_discontinuous_object(sys); // XXX - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - var _b = [sxs[i], sys[i]], sx = _b[0], sy = _b[1]; - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - for (var j = 0, end = sx.length; j < end; j++) { - if (j == 0) { - ctx.beginPath(); - ctx.moveTo(sx[j], sy[j]); - continue; - } - else if (isNaN(sx[j] + sy[j])) { - ctx.closePath(); - ctx.fill(); - ctx.beginPath(); - continue; - } - else - ctx.lineTo(sx[j], sy[j]); - } - ctx.closePath(); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - for (var j = 0, end = sx.length; j < end; j++) { - if (j == 0) { - ctx.beginPath(); - ctx.moveTo(sx[j], sy[j]); - continue; - } - else if (isNaN(sx[j] + sy[j])) { - ctx.closePath(); - ctx.stroke(); - ctx.beginPath(); - continue; - } - else - ctx.lineTo(sx[j], sy[j]); - } - ctx.closePath(); - ctx.stroke(); - } - } - }; - PatchesView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y }); - var hits = []; - for (var i = 0, end = candidates.length; i < end; i++) { - var idx = candidates[i]; - var sxs = this.sxss[idx]; - var sys = this.syss[idx]; - for (var j = 0, endj = sxs.length; j < endj; j++) { - if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) { - hits.push(idx); - } - } - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - PatchesView.prototype._get_snap_coord = function (array) { - return arrayable_1.sum(array) / array.length; - }; - PatchesView.prototype.scenterx = function (i, sx, sy) { - if (this.sxss[i].length == 1) { - // We don't have discontinuous objects so we're ok - return this._get_snap_coord(this.sxs[i]); - } - else { - // We have discontinuous objects, so we need to find which - // one we're in, we can use point_in_poly again - var sxs = this.sxss[i]; - var sys = this.syss[i]; - for (var j = 0, end = sxs.length; j < end; j++) { - if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) - return this._get_snap_coord(sxs[j]); - } - } - throw new Error("unreachable code"); - }; - PatchesView.prototype.scentery = function (i, sx, sy) { - if (this.syss[i].length == 1) { - // We don't have discontinuous objects so we're ok - return this._get_snap_coord(this.sys[i]); - } - else { - // We have discontinuous objects, so we need to find which - // one we're in, we can use point_in_poly again - var sxs = this.sxss[i]; - var sys = this.syss[i]; - for (var j = 0, end = sxs.length; j < end; j++) { - if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) - return this._get_snap_coord(sys[j]); - } - } - throw new Error("unreachable code"); - }; - PatchesView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - return PatchesView; - }(glyph_1.GlyphView)); - exports.PatchesView = PatchesView; - var Patches = /** @class */ (function (_super) { - tslib_1.__extends(Patches, _super); - function Patches(attrs) { - return _super.call(this, attrs) || this; - } - Patches.initClass = function () { - this.prototype.type = 'Patches'; - this.prototype.default_view = PatchesView; - this.coords([['xs', 'ys']]); - this.mixins(['line', 'fill']); - }; - return Patches; - }(glyph_1.Glyph)); - exports.Patches = Patches; - Patches.initClass(); -} -, -/* models/glyphs/quad */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_1 = require(121) /* ./box */; - var QuadView = /** @class */ (function (_super) { - tslib_1.__extends(QuadView, _super); - function QuadView() { - return _super !== null && _super.apply(this, arguments) || this; - } - QuadView.prototype.get_anchor_point = function (anchor, i, _spt) { - var left = Math.min(this.sleft[i], this.sright[i]); - var right = Math.max(this.sright[i], this.sleft[i]); - var top = Math.min(this.stop[i], this.sbottom[i]); // screen coordinates !!! - var bottom = Math.max(this.sbottom[i], this.stop[i]); // - switch (anchor) { - case "top_left": return { x: left, y: top }; - case "top_center": return { x: (left + right) / 2, y: top }; - case "top_right": return { x: right, y: top }; - case "center_right": return { x: right, y: (top + bottom) / 2 }; - case "bottom_right": return { x: right, y: bottom }; - case "bottom_center": return { x: (left + right) / 2, y: bottom }; - case "bottom_left": return { x: left, y: bottom }; - case "center_left": return { x: left, y: (top + bottom) / 2 }; - case "center": return { x: (left + right) / 2, y: (top + bottom) / 2 }; - default: return null; - } - }; - QuadView.prototype.scenterx = function (i) { - return (this.sleft[i] + this.sright[i]) / 2; - }; - QuadView.prototype.scentery = function (i) { - return (this.stop[i] + this.sbottom[i]) / 2; - }; - QuadView.prototype._index_data = function () { - return this._index_box(this._right.length); - }; - QuadView.prototype._lrtb = function (i) { - var l = this._left[i]; - var r = this._right[i]; - var t = this._top[i]; - var b = this._bottom[i]; - return [l, r, t, b]; - }; - return QuadView; - }(box_1.BoxView)); - exports.QuadView = QuadView; - var Quad = /** @class */ (function (_super) { - tslib_1.__extends(Quad, _super); - function Quad(attrs) { - return _super.call(this, attrs) || this; - } - Quad.initClass = function () { - this.prototype.type = 'Quad'; - this.prototype.default_view = QuadView; - this.coords([['right', 'bottom'], ['left', 'top']]); - }; - return Quad; - }(box_1.Box)); - exports.Quad = Quad; - Quad.initClass(); -} -, -/* models/glyphs/quadratic */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - // Formula from: http://pomax.nihongoresources.com/pages/bezier/ - // - // if segment is quadratic bezier do: - // for both directions do: - // if control between start and end, compute linear bounding box - // otherwise, compute - // bound = u(1-t)^2 + 2v(1-t)t + wt^2 - // (with t = ((u-v) / (u-2v+w)), with {u = start, v = control, w = end}) - // if control precedes start, min = bound, otherwise max = bound - function _qbb(u, v, w) { - if (v == (u + w) / 2) - return [u, w]; - else { - var t = (u - v) / ((u - (2 * v)) + w); - var bd = (u * Math.pow((1 - t), 2)) + (2 * v * (1 - t) * t) + (w * Math.pow(t, 2)); - return [Math.min(u, w, bd), Math.max(u, w, bd)]; - } - } - var QuadraticView = /** @class */ (function (_super) { - tslib_1.__extends(QuadraticView, _super); - function QuadraticView() { - return _super !== null && _super.apply(this, arguments) || this; - } - QuadraticView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._x0.length; i < end; i++) { - if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx[i] + this._cy[i])) - continue; - var _a = _qbb(this._x0[i], this._cx[i], this._x1[i]), x0 = _a[0], x1 = _a[1]; - var _b = _qbb(this._y0[i], this._cy[i], this._y1[i]), y0 = _b[0], y1 = _b[1]; - points.push({ minX: x0, minY: y0, maxX: x1, maxY: y1, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - QuadraticView.prototype._render = function (ctx, indices, _a) { - var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1, scx = _a.scx, scy = _a.scy; - if (this.visuals.line.doit) { - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx[i] + scy[i])) - continue; - ctx.beginPath(); - ctx.moveTo(sx0[i], sy0[i]); - ctx.quadraticCurveTo(scx[i], scy[i], sx1[i], sy1[i]); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - QuadraticView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - QuadraticView.prototype.scenterx = function () { - throw new Error("not implemented"); - }; - QuadraticView.prototype.scentery = function () { - throw new Error("not implemented"); - }; - return QuadraticView; - }(glyph_1.GlyphView)); - exports.QuadraticView = QuadraticView; - var Quadratic = /** @class */ (function (_super) { - tslib_1.__extends(Quadratic, _super); - function Quadratic(attrs) { - return _super.call(this, attrs) || this; - } - Quadratic.initClass = function () { - this.prototype.type = 'Quadratic'; - this.prototype.default_view = QuadraticView; - this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx', 'cy']]); - this.mixins(['line']); - }; - return Quadratic; - }(glyph_1.Glyph)); - exports.Quadratic = Quadratic; - Quadratic.initClass(); -} -, -/* models/glyphs/ray */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var p = require(18) /* ../../core/properties */; - var RayView = /** @class */ (function (_super) { - tslib_1.__extends(RayView, _super); - function RayView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RayView.prototype._map_data = function () { - if (this.model.properties.length.units == "data") - this.slength = this.sdist(this.renderer.xscale, this._x, this._length); - else - this.slength = this._length; - }; - RayView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, slength = _a.slength, _angle = _a._angle; - if (this.visuals.line.doit) { - var width = this.renderer.plot_view.frame._width.value; - var height = this.renderer.plot_view.frame._height.value; - var inf_len = 2 * (width + height); - for (var i = 0, end = slength.length; i < end; i++) { - if (slength[i] == 0) - slength[i] = inf_len; - } - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _angle[i] + slength[i])) - continue; - ctx.translate(sx[i], sy[i]); - ctx.rotate(_angle[i]); - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.lineTo(slength[i], 0); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - ctx.rotate(-_angle[i]); - ctx.translate(-sx[i], -sy[i]); - } - } - }; - RayView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - return RayView; - }(xy_glyph_1.XYGlyphView)); - exports.RayView = RayView; - var Ray = /** @class */ (function (_super) { - tslib_1.__extends(Ray, _super); - function Ray(attrs) { - return _super.call(this, attrs) || this; - } - Ray.initClass = function () { - this.prototype.type = 'Ray'; - this.prototype.default_view = RayView; - this.mixins(['line']); - this.define({ - length: [p.DistanceSpec], - angle: [p.AngleSpec], - }); - }; - return Ray; - }(xy_glyph_1.XYGlyph)); - exports.Ray = Ray; - Ray.initClass(); -} -, -/* models/glyphs/rect */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var center_rotatable_1 = require(122) /* ./center_rotatable */; - var utils_1 = require(147) /* ./utils */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var RectView = /** @class */ (function (_super) { - tslib_1.__extends(RectView, _super); - function RectView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RectView.prototype._set_data = function () { - this.max_w2 = 0; - if (this.model.properties.width.units == "data") - this.max_w2 = this.max_width / 2; - this.max_h2 = 0; - if (this.model.properties.height.units == "data") - this.max_h2 = this.max_height / 2; - }; - RectView.prototype._map_data = function () { - var _a, _b; - if (this.model.properties.width.units == "data") - _a = this._map_dist_corner_for_data_side_length(this._x, this._width, this.renderer.xscale), this.sw = _a[0], this.sx0 = _a[1]; - else { - this.sw = this._width; - var n_1 = this.sx.length; - this.sx0 = new Float64Array(n_1); - for (var i = 0; i < n_1; i++) - this.sx0[i] = this.sx[i] - this.sw[i] / 2; - } - if (this.model.properties.height.units == "data") - _b = this._map_dist_corner_for_data_side_length(this._y, this._height, this.renderer.yscale), this.sh = _b[0], this.sy1 = _b[1]; - else { - this.sh = this._height; - var n_2 = this.sy.length; - this.sy1 = new Float64Array(n_2); - for (var i = 0; i < n_2; i++) - this.sy1[i] = this.sy[i] - this.sh[i] / 2; - } - var n = this.sw.length; - this.ssemi_diag = new Float64Array(n); - for (var i = 0; i < n; i++) - this.ssemi_diag[i] = Math.sqrt((this.sw[i] / 2 * this.sw[i]) / 2 + (this.sh[i] / 2 * this.sh[i]) / 2); - }; - RectView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sx0 = _a.sx0, sy1 = _a.sy1, sw = _a.sw, sh = _a.sh, _angle = _a._angle; - if (this.visuals.fill.doit) { - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i])) - continue; - //no need to test the return value, we call fillRect for every glyph anyway - this.visuals.fill.set_vectorize(ctx, i); - if (_angle[i]) { - ctx.translate(sx[i], sy[i]); - ctx.rotate(_angle[i]); - ctx.fillRect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]); - ctx.rotate(-_angle[i]); - ctx.translate(-sx[i], -sy[i]); - } - else - ctx.fillRect(sx0[i], sy1[i], sw[i], sh[i]); - } - } - if (this.visuals.line.doit) { - ctx.beginPath(); - for (var _b = 0, indices_2 = indices; _b < indices_2.length; _b++) { - var i = indices_2[_b]; - if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i])) - continue; - // fillRect does not fill zero-height or -width rects, but rect(...) - // does seem to stroke them (1px wide or tall). Explicitly ignore rects - // with zero width or height to be consistent - if (sw[i] == 0 || sh[i] == 0) - continue; - if (_angle[i]) { - ctx.translate(sx[i], sy[i]); - ctx.rotate(_angle[i]); - ctx.rect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]); - ctx.rotate(-_angle[i]); - ctx.translate(-sx[i], -sy[i]); - } - else - ctx.rect(sx0[i], sy1[i], sw[i], sh[i]); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - ctx.beginPath(); - } - ctx.stroke(); - } - }; - RectView.prototype._hit_rect = function (geometry) { - return this._hit_rect_against_index(geometry); - }; - RectView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - var scenter_x = []; - for (var i = 0, end = this.sx0.length; i < end; i++) { - scenter_x.push(this.sx0[i] + this.sw[i] / 2); - } - var scenter_y = []; - for (var i = 0, end = this.sy1.length; i < end; i++) { - scenter_y.push(this.sy1[i] + this.sh[i] / 2); - } - var max_x2_ddist = arrayable_1.max(this._ddist(0, scenter_x, this.ssemi_diag)); - var max_y2_ddist = arrayable_1.max(this._ddist(1, scenter_y, this.ssemi_diag)); - var x0 = x - max_x2_ddist; - var x1 = x + max_x2_ddist; - var y0 = y - max_y2_ddist; - var y1 = y + max_y2_ddist; - var hits = []; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - for (var _i = 0, _a = this.index.indices(bbox); _i < _a.length; _i++) { - var i = _a[_i]; - var height_in = void 0, width_in = void 0; - if (this._angle[i]) { - var s = Math.sin(-this._angle[i]); - var c = Math.cos(-this._angle[i]); - var px = c * (sx - this.sx[i]) - s * (sy - this.sy[i]) + this.sx[i]; - var py = s * (sx - this.sx[i]) + c * (sy - this.sy[i]) + this.sy[i]; - sx = px; - sy = py; - width_in = Math.abs(this.sx[i] - sx) <= this.sw[i] / 2; - height_in = Math.abs(this.sy[i] - sy) <= this.sh[i] / 2; - } - else { - width_in = (sx - this.sx0[i] <= this.sw[i]) && (sx - this.sx0[i] >= 0); - height_in = (sy - this.sy1[i] <= this.sh[i]) && (sy - this.sy1[i] >= 0); - } - if (height_in && width_in) - hits.push(i); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - RectView.prototype._map_dist_corner_for_data_side_length = function (coord, side_length, scale) { - var n = coord.length; - var pt0 = new Float64Array(n); - var pt1 = new Float64Array(n); - for (var i = 0; i < n; i++) { - pt0[i] = Number(coord[i]) - side_length[i] / 2; - pt1[i] = Number(coord[i]) + side_length[i] / 2; - } - var spt0 = scale.v_compute(pt0); - var spt1 = scale.v_compute(pt1); - var sside_length = this.sdist(scale, pt0, side_length, 'edge', this.model.dilate); - var spt_corner = spt0; - for (var i = 0, end = spt0.length; i < end; i++) { - if (spt0[i] != spt1[i]) { - spt_corner = spt0[i] < spt1[i] ? spt0 : spt1; - break; - } - } - return [sside_length, spt_corner]; - }; - RectView.prototype._ddist = function (dim, spts, spans) { - var scale = dim == 0 ? this.renderer.xscale : this.renderer.yscale; - var spt0 = spts; - var m = spt0.length; - var spt1 = new Float64Array(m); - for (var i = 0; i < m; i++) - spt1[i] = spt0[i] + spans[i]; - var pt0 = scale.v_invert(spt0); - var pt1 = scale.v_invert(spt1); - var n = pt0.length; - var ddist = new Float64Array(n); - for (var i = 0; i < n; i++) - ddist[i] = Math.abs(pt1[i] - pt0[i]); - return ddist; - }; - RectView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - RectView.prototype._bounds = function (_a) { - var minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY; - return { - minX: minX - this.max_w2, - maxX: maxX + this.max_w2, - minY: minY - this.max_h2, - maxY: maxY + this.max_h2, - }; - }; - return RectView; - }(center_rotatable_1.CenterRotatableView)); - exports.RectView = RectView; - var Rect = /** @class */ (function (_super) { - tslib_1.__extends(Rect, _super); - function Rect(attrs) { - return _super.call(this, attrs) || this; - } - Rect.initClass = function () { - this.prototype.type = 'Rect'; - this.prototype.default_view = RectView; - this.define({ - dilate: [p.Boolean, false], - }); - }; - return Rect; - }(center_rotatable_1.CenterRotatable)); - exports.Rect = Rect; - Rect.initClass(); -} -, -/* models/glyphs/segment */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var hittest = require(9) /* ../../core/hittest */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var utils_1 = require(147) /* ./utils */; - var SegmentView = /** @class */ (function (_super) { - tslib_1.__extends(SegmentView, _super); - function SegmentView() { - return _super !== null && _super.apply(this, arguments) || this; - } - SegmentView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._x0.length; i < end; i++) { - var x0 = this._x0[i]; - var x1 = this._x1[i]; - var y0 = this._y0[i]; - var y1 = this._y1[i]; - if (!isNaN(x0 + x1 + y0 + y1)) { - points.push({ - minX: Math.min(x0, x1), - minY: Math.min(y0, y1), - maxX: Math.max(x0, x1), - maxY: Math.max(y0, y1), - i: i, - }); - } - } - return new spatial_1.SpatialIndex(points); - }; - SegmentView.prototype._render = function (ctx, indices, _a) { - var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1; - if (this.visuals.line.doit) { - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i])) - continue; - ctx.beginPath(); - ctx.moveTo(sx0[i], sy0[i]); - ctx.lineTo(sx1[i], sy1[i]); - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - SegmentView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var point = { x: sx, y: sy }; - var hits = []; - var lw_voffset = 2; // FIXME: Use maximum of segments line_width/2 instead of magic constant 2 - var _a = this.renderer.xscale.r_invert(sx - lw_voffset, sx + lw_voffset), minX = _a[0], maxX = _a[1]; - var _b = this.renderer.yscale.r_invert(sy - lw_voffset, sy + lw_voffset), minY = _b[0], maxY = _b[1]; - var candidates = this.index.indices({ minX: minX, minY: minY, maxX: maxX, maxY: maxY }); - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var i = candidates_1[_i]; - var threshold2 = Math.pow(Math.max(2, this.visuals.line.cache_select('line_width', i) / 2), 2); - var p0 = { x: this.sx0[i], y: this.sy0[i] }; - var p1 = { x: this.sx1[i], y: this.sy1[i] }; - var dist2 = hittest.dist_to_segment_squared(point, p0, p1); - if (dist2 < threshold2) - hits.push(i); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - SegmentView.prototype._hit_span = function (geometry) { - var _a, _b; - var _c = this.renderer.plot_view.frame.bbox.ranges, hr = _c[0], vr = _c[1]; - var sx = geometry.sx, sy = geometry.sy; - var v0; - var v1; - var val; - if (geometry.direction == 'v') { - val = this.renderer.yscale.invert(sy); - _a = [this._y0, this._y1], v0 = _a[0], v1 = _a[1]; - } - else { - val = this.renderer.xscale.invert(sx); - _b = [this._x0, this._x1], v0 = _b[0], v1 = _b[1]; - } - var hits = []; - var _d = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _d[0], maxX = _d[1]; - var _e = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _e[0], maxY = _e[1]; - var candidates = this.index.indices({ minX: minX, minY: minY, maxX: maxX, maxY: maxY }); - for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { - var i = candidates_2[_i]; - if ((v0[i] <= val && val <= v1[i]) || (v1[i] <= val && val <= v0[i])) - hits.push(i); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - SegmentView.prototype.scenterx = function (i) { - return (this.sx0[i] + this.sx1[i]) / 2; - }; - SegmentView.prototype.scentery = function (i) { - return (this.sy0[i] + this.sy1[i]) / 2; - }; - SegmentView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - return SegmentView; - }(glyph_1.GlyphView)); - exports.SegmentView = SegmentView; - var Segment = /** @class */ (function (_super) { - tslib_1.__extends(Segment, _super); - function Segment(attrs) { - return _super.call(this, attrs) || this; - } - Segment.initClass = function () { - this.prototype.type = 'Segment'; - this.prototype.default_view = SegmentView; - this.coords([['x0', 'y0'], ['x1', 'y1']]); - this.mixins(['line']); - }; - return Segment; - }(glyph_1.Glyph)); - exports.Segment = Segment; - Segment.initClass(); -} -, -/* models/glyphs/step */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var p = require(18) /* ../../core/properties */; - var StepView = /** @class */ (function (_super) { - tslib_1.__extends(StepView, _super); - function StepView() { - return _super !== null && _super.apply(this, arguments) || this; - } - StepView.prototype._render = function (ctx, indices, _a) { - var _b, _c, _d, _e, _f, _g; - var sx = _a.sx, sy = _a.sy; - var drawing = false; - var last_index = null; - this.visuals.line.set_value(ctx); - var L = indices.length; - if (L < 2) - return; - ctx.beginPath(); - ctx.moveTo(sx[0], sy[0]); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - var x1 = void 0, x2 = void 0; - var y1 = void 0, y2 = void 0; - switch (this.model.mode) { - case "before": { - _b = [sx[i - 1], sy[i]], x1 = _b[0], y1 = _b[1]; - _c = [sx[i], sy[i]], x2 = _c[0], y2 = _c[1]; - break; - } - case "after": { - _d = [sx[i], sy[i - 1]], x1 = _d[0], y1 = _d[1]; - _e = [sx[i], sy[i]], x2 = _e[0], y2 = _e[1]; - break; - } - case "center": { - var xm = (sx[i - 1] + sx[i]) / 2; - _f = [xm, sy[i - 1]], x1 = _f[0], y1 = _f[1]; - _g = [xm, sy[i]], x2 = _g[0], y2 = _g[1]; - break; - } - default: - throw new Error("unexpected"); - } - if (drawing) { - if (!isFinite(sx[i] + sy[i])) { - ctx.stroke(); - ctx.beginPath(); - drawing = false; - last_index = i; - continue; - } - if (last_index != null && i - last_index > 1) { - ctx.stroke(); - drawing = false; - } - } - if (drawing) { - ctx.lineTo(x1, y1); - ctx.lineTo(x2, y2); - } - else { - ctx.beginPath(); - ctx.moveTo(sx[i], sy[i]); - drawing = true; - } - last_index = i; - } - ctx.lineTo(sx[L - 1], sy[L - 1]); - ctx.stroke(); - }; - StepView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_line_legend(this.visuals, ctx, bbox, index); - }; - return StepView; - }(xy_glyph_1.XYGlyphView)); - exports.StepView = StepView; - var Step = /** @class */ (function (_super) { - tslib_1.__extends(Step, _super); - function Step(attrs) { - return _super.call(this, attrs) || this; - } - Step.initClass = function () { - this.prototype.type = 'Step'; - this.prototype.default_view = StepView; - this.mixins(['line']); - this.define({ - mode: [p.StepMode, "before"], - }); - }; - return Step; - }(xy_glyph_1.XYGlyph)); - exports.Step = Step; - Step.initClass(); -} -, -/* models/glyphs/text */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var text_1 = require(43) /* ../../core/util/text */; - var TextView = /** @class */ (function (_super) { - tslib_1.__extends(TextView, _super); - function TextView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TextView.prototype._rotate_point = function (x, y, xoff, yoff, angle) { - var sxr = (x - xoff) * Math.cos(angle) - (y - yoff) * Math.sin(angle) + xoff; - var syr = (x - xoff) * Math.sin(angle) + (y - yoff) * Math.cos(angle) + yoff; - return [sxr, syr]; - }; - TextView.prototype._text_bounds = function (x0, y0, width, height) { - var xvals = [x0, x0 + width, x0 + width, x0, x0]; - var yvals = [y0, y0, y0 - height, y0 - height, y0]; - return [xvals, yvals]; - }; - TextView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, _x_offset = _a._x_offset, _y_offset = _a._y_offset, _angle = _a._angle, _text = _a._text; - this._sys = []; - this._sxs = []; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _x_offset[i] + _y_offset[i] + _angle[i]) || _text[i] == null) - continue; - this._sxs[i] = []; - this._sys[i] = []; - if (this.visuals.text.doit) { - var text = "" + _text[i]; - ctx.save(); - ctx.translate(sx[i] + _x_offset[i], sy[i] + _y_offset[i]); - ctx.rotate(_angle[i]); - this.visuals.text.set_vectorize(ctx, i); - var font = this.visuals.text.cache_select("font", i); - var height = text_1.measure_font(font).height; - var line_height = this.visuals.text.text_line_height.value() * height; - if (text.indexOf("\n") == -1) { - ctx.fillText(text, 0, 0); - var x0 = sx[i] + _x_offset[i]; - var y0 = sy[i] + _y_offset[i]; - var width = ctx.measureText(text).width; - var _b = this._text_bounds(x0, y0, width, line_height), xvalues = _b[0], yvalues = _b[1]; - this._sxs[i].push(xvalues); - this._sys[i].push(yvalues); - } - else { - var lines = text.split("\n"); - var block_height = line_height * lines.length; - var baseline = this.visuals.text.cache_select("text_baseline", i); - var y = void 0; - switch (baseline) { - case "top": { - y = 0; - break; - } - case "middle": { - y = (-block_height / 2) + (line_height / 2); - break; - } - case "bottom": { - y = -block_height + line_height; - break; - } - default: { - y = 0; - console.warn("'" + baseline + "' baseline not supported with multi line text"); - } - } - for (var _c = 0, lines_1 = lines; _c < lines_1.length; _c++) { - var line = lines_1[_c]; - ctx.fillText(line, 0, y); - var x0 = sx[i] + _x_offset[i]; - var y0 = y + sy[i] + _y_offset[i]; - var width = ctx.measureText(line).width; - var _d = this._text_bounds(x0, y0, width, line_height), xvalues = _d[0], yvalues = _d[1]; - this._sxs[i].push(xvalues); - this._sys[i].push(yvalues); - y += line_height; - } - } - ctx.restore(); - } - } - }; - TextView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var hits = []; - for (var i = 0; i < this._sxs.length; i++) { - var sxs = this._sxs[i]; - var sys = this._sys[i]; - var n = sxs.length; - for (var j = 0, endj = n; j < endj; j++) { - var _a = this._rotate_point(sx, sy, sxs[n - 1][0], sys[n - 1][0], -this._angle[i]), sxr = _a[0], syr = _a[1]; - if (hittest.point_in_poly(sxr, syr, sxs[j], sys[j])) { - hits.push(i); - } - } - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - TextView.prototype._scenterxy = function (i) { - var sx0 = this._sxs[i][0][0]; - var sy0 = this._sys[i][0][0]; - var sxc = (this._sxs[i][0][2] + sx0) / 2; - var syc = (this._sys[i][0][2] + sy0) / 2; - var _a = this._rotate_point(sxc, syc, sx0, sy0, this._angle[i]), sxcr = _a[0], sycr = _a[1]; - return { x: sxcr, y: sycr }; - }; - TextView.prototype.scenterx = function (i) { - return this._scenterxy(i).x; - }; - TextView.prototype.scentery = function (i) { - return this._scenterxy(i).y; - }; - return TextView; - }(xy_glyph_1.XYGlyphView)); - exports.TextView = TextView; - var Text = /** @class */ (function (_super) { - tslib_1.__extends(Text, _super); - function Text(attrs) { - return _super.call(this, attrs) || this; - } - Text.initClass = function () { - this.prototype.type = 'Text'; - this.prototype.default_view = TextView; - this.mixins(['text']); - this.define({ - text: [p.NullStringSpec, { field: "text" }], - angle: [p.AngleSpec, 0], - x_offset: [p.NumberSpec, 0], - y_offset: [p.NumberSpec, 0], - }); - }; - return Text; - }(xy_glyph_1.XYGlyph)); - exports.Text = Text; - Text.initClass(); -} -, -/* models/glyphs/utils */ function _(require, module, exports) { - var hittest = require(9) /* ../../core/hittest */; - function generic_line_legend(visuals, ctx, _a, index) { - var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1; - ctx.save(); - ctx.beginPath(); - ctx.moveTo(x0, (y0 + y1) / 2); - ctx.lineTo(x1, (y0 + y1) / 2); - if (visuals.line.doit) { - visuals.line.set_vectorize(ctx, index); - ctx.stroke(); - } - ctx.restore(); - } - exports.generic_line_legend = generic_line_legend; - function generic_area_legend(visuals, ctx, _a, index) { - var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1; - var w = Math.abs(x1 - x0); - var dw = w * 0.1; - var h = Math.abs(y1 - y0); - var dh = h * 0.1; - var sx0 = x0 + dw; - var sx1 = x1 - dw; - var sy0 = y0 + dh; - var sy1 = y1 - dh; - if (visuals.fill.doit) { - visuals.fill.set_vectorize(ctx, index); - ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0); - } - if (visuals.line.doit) { - ctx.beginPath(); - ctx.rect(sx0, sy0, sx1 - sx0, sy1 - sy0); - visuals.line.set_vectorize(ctx, index); - ctx.stroke(); - } - } - exports.generic_area_legend = generic_area_legend; - function line_interpolation(renderer, geometry, x2, y2, x3, y3) { - var _a, _b, _c, _d, _e, _f; - var sx = geometry.sx, sy = geometry.sy; - var x0, x1; - var y0, y1; - if (geometry.type == 'point') { - // The +/- adjustments here are to dilate the hit point into a virtual "segment" to use below - _a = renderer.yscale.r_invert(sy - 1, sy + 1), y0 = _a[0], y1 = _a[1]; - _b = renderer.xscale.r_invert(sx - 1, sx + 1), x0 = _b[0], x1 = _b[1]; - } - else { - // The +/- adjustments here are to handle cases such as purely horizontal or vertical lines - if (geometry.direction == 'v') { - _c = renderer.yscale.r_invert(sy, sy), y0 = _c[0], y1 = _c[1]; - _d = [Math.min(x2 - 1, x3 - 1), Math.max(x2 + 1, x3 + 1)], x0 = _d[0], x1 = _d[1]; - } - else { - _e = renderer.xscale.r_invert(sx, sx), x0 = _e[0], x1 = _e[1]; - _f = [Math.min(y2 - 1, y3 - 1), Math.max(y2 + 1, y3 + 1)], y0 = _f[0], y1 = _f[1]; - } - } - var _g = hittest.check_2_segments_intersect(x0, y0, x1, y1, x2, y2, x3, y3), x = _g.x, y = _g.y; - return [x, y]; // XXX: null is not handled at use sites - } - exports.line_interpolation = line_interpolation; -} -, -/* models/glyphs/vbar */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_1 = require(121) /* ./box */; - var p = require(18) /* ../../core/properties */; - var VBarView = /** @class */ (function (_super) { - tslib_1.__extends(VBarView, _super); - function VBarView() { - return _super !== null && _super.apply(this, arguments) || this; - } - VBarView.prototype.scenterx = function (i) { - return this.sx[i]; - }; - VBarView.prototype.scentery = function (i) { - return (this.stop[i] + this.sbottom[i]) / 2; - }; - VBarView.prototype._index_data = function () { - return this._index_box(this._x.length); - }; - VBarView.prototype._lrtb = function (i) { - var l = this._x[i] - (this._width[i] / 2); - var r = this._x[i] + (this._width[i] / 2); - var t = Math.max(this._top[i], this._bottom[i]); - var b = Math.min(this._top[i], this._bottom[i]); - return [l, r, t, b]; - }; - VBarView.prototype._map_data = function () { - this.sx = this.renderer.xscale.v_compute(this._x); - this.sw = this.sdist(this.renderer.xscale, this._x, this._width, "center"); - this.stop = this.renderer.yscale.v_compute(this._top); - this.sbottom = this.renderer.yscale.v_compute(this._bottom); - var n = this.sx.length; - this.sleft = new Float64Array(n); - this.sright = new Float64Array(n); - for (var i = 0; i < n; i++) { - this.sleft[i] = this.sx[i] - this.sw[i] / 2; - this.sright[i] = this.sx[i] + this.sw[i] / 2; - } - this._clamp_viewport(); - }; - return VBarView; - }(box_1.BoxView)); - exports.VBarView = VBarView; - var VBar = /** @class */ (function (_super) { - tslib_1.__extends(VBar, _super); - function VBar(attrs) { - return _super.call(this, attrs) || this; - } - VBar.initClass = function () { - this.prototype.type = 'VBar'; - this.prototype.default_view = VBarView; - this.coords([['x', 'bottom']]); - this.define({ - width: [p.DistanceSpec], - top: [p.CoordinateSpec], - }); - this.override({ - bottom: 0, - }); - }; - return VBar; - }(box_1.Box)); - exports.VBar = VBar; - VBar.initClass(); -} -, -/* models/glyphs/wedge */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ./xy_glyph */; - var utils_1 = require(147) /* ./utils */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var math_1 = require(34) /* ../../core/util/math */; - var WedgeView = /** @class */ (function (_super) { - tslib_1.__extends(WedgeView, _super); - function WedgeView() { - return _super !== null && _super.apply(this, arguments) || this; - } - WedgeView.prototype._map_data = function () { - if (this.model.properties.radius.units == "data") - this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius); - else - this.sradius = this._radius; - }; - WedgeView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, sradius = _a.sradius, _start_angle = _a._start_angle, _end_angle = _a._end_angle; - var direction = this.model.properties.direction.value(); - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i])) - continue; - ctx.beginPath(); - ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction); - ctx.lineTo(sx[i], sy[i]); - ctx.closePath(); - if (this.visuals.fill.doit) { - this.visuals.fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (this.visuals.line.doit) { - this.visuals.line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - }; - WedgeView.prototype._hit_point = function (geometry) { - var _a, _b, _c, _d; - var dist, sx0, sx1, sy0, sy1, x0, x1, y0, y1; - var sx = geometry.sx, sy = geometry.sy; - var x = this.renderer.xscale.invert(sx); - var y = this.renderer.yscale.invert(sy); - // check diameter first - var max_diameter = 2 * this.max_radius; - if (this.model.properties.radius.units === "data") { - x0 = x - max_diameter; - x1 = x + max_diameter; - y0 = y - max_diameter; - y1 = y + max_diameter; - } - else { - sx0 = sx - max_diameter; - sx1 = sx + max_diameter; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - sy0 = sy - max_diameter; - sy1 = sy + max_diameter; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - } - var candidates = []; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - for (var _i = 0, _e = this.index.indices(bbox); _i < _e.length; _i++) { - var i = _e[_i]; - var r2 = Math.pow(this.sradius[i], 2); - _c = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _c[0], sx1 = _c[1]; - _d = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _d[0], sy1 = _d[1]; - dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2); - if (dist <= r2) { - candidates.push([i, dist]); - } - } - var direction = this.model.properties.direction.value(); - var hits = []; - for (var _f = 0, candidates_1 = candidates; _f < candidates_1.length; _f++) { - var _g = candidates_1[_f], i = _g[0], dist_1 = _g[1]; - // NOTE: minus the angle because JS uses non-mathy convention for angles - var angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]); - if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) { - hits.push([i, dist_1]); - } - } - return hittest.create_hit_test_result_from_hits(hits); - }; - WedgeView.prototype.draw_legend_for_index = function (ctx, bbox, index) { - utils_1.generic_area_legend(this.visuals, ctx, bbox, index); - }; - WedgeView.prototype._scenterxy = function (i) { - var r = this.sradius[i] / 2; - var a = (this._start_angle[i] + this._end_angle[i]) / 2; - return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) }; - }; - WedgeView.prototype.scenterx = function (i) { - return this._scenterxy(i).x; - }; - WedgeView.prototype.scentery = function (i) { - return this._scenterxy(i).y; - }; - return WedgeView; - }(xy_glyph_1.XYGlyphView)); - exports.WedgeView = WedgeView; - var Wedge = /** @class */ (function (_super) { - tslib_1.__extends(Wedge, _super); - function Wedge(attrs) { - return _super.call(this, attrs) || this; - } - Wedge.initClass = function () { - this.prototype.type = 'Wedge'; - this.prototype.default_view = WedgeView; - this.mixins(['line', 'fill']); - this.define({ - direction: [p.Direction, 'anticlock'], - radius: [p.DistanceSpec], - start_angle: [p.AngleSpec], - end_angle: [p.AngleSpec], - }); - }; - return Wedge; - }(xy_glyph_1.XYGlyph)); - exports.Wedge = Wedge; - Wedge.initClass(); -} -, -/* models/glyphs/xy_glyph */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var spatial_1 = require(39) /* ../../core/util/spatial */; - var glyph_1 = require(126) /* ./glyph */; - var XYGlyphView = /** @class */ (function (_super) { - tslib_1.__extends(XYGlyphView, _super); - function XYGlyphView() { - return _super !== null && _super.apply(this, arguments) || this; - } - XYGlyphView.prototype._index_data = function () { - var points = []; - for (var i = 0, end = this._x.length; i < end; i++) { - var x = this._x[i]; - var y = this._y[i]; - if (isNaN(x + y) || !isFinite(x + y)) - continue; - points.push({ minX: x, minY: y, maxX: x, maxY: y, i: i }); - } - return new spatial_1.SpatialIndex(points); - }; - XYGlyphView.prototype.scenterx = function (i) { - return this.sx[i]; - }; - XYGlyphView.prototype.scentery = function (i) { - return this.sy[i]; - }; - return XYGlyphView; - }(glyph_1.GlyphView)); - exports.XYGlyphView = XYGlyphView; - var XYGlyph = /** @class */ (function (_super) { - tslib_1.__extends(XYGlyph, _super); - function XYGlyph(attrs) { - return _super.call(this, attrs) || this; - } - XYGlyph.initClass = function () { - this.prototype.type = "XYGlyph"; - this.coords([['x', 'y']]); - }; - return XYGlyph; - }(glyph_1.Glyph)); - exports.XYGlyph = XYGlyph; - XYGlyph.initClass(); -} -, -/* models/graphs/graph_hit_test_policy */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var array_1 = require(24) /* ../../core/util/array */; - var hittest_1 = require(9) /* ../../core/hittest */; - var GraphHitTestPolicy = /** @class */ (function (_super) { - tslib_1.__extends(GraphHitTestPolicy, _super); - function GraphHitTestPolicy(attrs) { - return _super.call(this, attrs) || this; - } - GraphHitTestPolicy.initClass = function () { - this.prototype.type = "GraphHitTestPolicy"; - }; - GraphHitTestPolicy.prototype._hit_test_nodes = function (geometry, graph_view) { - if (!graph_view.model.visible) - return null; - var hit_test_result = graph_view.node_view.glyph.hit_test(geometry); - if (hit_test_result == null) - return null; - else - return graph_view.node_view.model.view.convert_selection_from_subset(hit_test_result); - }; - GraphHitTestPolicy.prototype._hit_test_edges = function (geometry, graph_view) { - if (!graph_view.model.visible) - return null; - var hit_test_result = graph_view.edge_view.glyph.hit_test(geometry); - if (hit_test_result == null) - return null; - else - return graph_view.edge_view.model.view.convert_selection_from_subset(hit_test_result); - }; - return GraphHitTestPolicy; - }(model_1.Model)); - exports.GraphHitTestPolicy = GraphHitTestPolicy; - var NodesOnly = /** @class */ (function (_super) { - tslib_1.__extends(NodesOnly, _super); - function NodesOnly(attrs) { - return _super.call(this, attrs) || this; - } - NodesOnly.initClass = function () { - this.prototype.type = 'NodesOnly'; - }; - NodesOnly.prototype.hit_test = function (geometry, graph_view) { - return this._hit_test_nodes(geometry, graph_view); - }; - NodesOnly.prototype.do_selection = function (hit_test_result, graph, final, append) { - if (hit_test_result == null) - return false; - var node_selection = graph.node_renderer.data_source.selected; - node_selection.update(hit_test_result, final, append); - graph.node_renderer.data_source._select.emit(); - return !node_selection.is_empty(); - }; - NodesOnly.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) { - if (hit_test_result == null) - return false; - var node_inspection = graph_view.model.get_selection_manager().get_or_create_inspector(graph_view.node_view.model); - node_inspection.update(hit_test_result, final, append); - // silently set inspected attr to avoid triggering data_source.change event and rerender - graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true }); - graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry: geometry }]); - return !node_inspection.is_empty(); - }; - return NodesOnly; - }(GraphHitTestPolicy)); - exports.NodesOnly = NodesOnly; - NodesOnly.initClass(); - var NodesAndLinkedEdges = /** @class */ (function (_super) { - tslib_1.__extends(NodesAndLinkedEdges, _super); - function NodesAndLinkedEdges(attrs) { - return _super.call(this, attrs) || this; - } - NodesAndLinkedEdges.initClass = function () { - this.prototype.type = 'NodesAndLinkedEdges'; - }; - NodesAndLinkedEdges.prototype.hit_test = function (geometry, graph_view) { - return this._hit_test_nodes(geometry, graph_view); - }; - NodesAndLinkedEdges.prototype.get_linked_edges = function (node_source, edge_source, mode) { - var node_indices = []; - if (mode == 'selection') { - node_indices = node_source.selected.indices.map(function (i) { return node_source.data.index[i]; }); - } - else if (mode == 'inspection') { - node_indices = node_source.inspected.indices.map(function (i) { return node_source.data.index[i]; }); - } - var edge_indices = []; - for (var i = 0; i < edge_source.data.start.length; i++) { - if (array_1.contains(node_indices, edge_source.data.start[i]) || array_1.contains(node_indices, edge_source.data.end[i])) - edge_indices.push(i); - } - var linked_edges = hittest_1.create_empty_hit_test_result(); - for (var _i = 0, edge_indices_1 = edge_indices; _i < edge_indices_1.length; _i++) { - var i = edge_indices_1[_i]; - linked_edges.multiline_indices[i] = [0]; //currently only supports 2-element multilines, so this is all of it - } - linked_edges.indices = edge_indices; - return linked_edges; - }; - NodesAndLinkedEdges.prototype.do_selection = function (hit_test_result, graph, final, append) { - if (hit_test_result == null) - return false; - var node_selection = graph.node_renderer.data_source.selected; - node_selection.update(hit_test_result, final, append); - var edge_selection = graph.edge_renderer.data_source.selected; - var linked_edges_selection = this.get_linked_edges(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection'); - edge_selection.update(linked_edges_selection, final, append); - graph.node_renderer.data_source._select.emit(); - return !node_selection.is_empty(); - }; - NodesAndLinkedEdges.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) { - if (hit_test_result == null) - return false; - var node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model); - node_inspection.update(hit_test_result, final, append); - graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true }); - var edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model); - var linked_edges = this.get_linked_edges(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection'); - edge_inspection.update(linked_edges, final, append); - //silently set inspected attr to avoid triggering data_source.change event and rerender - graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true }); - graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry: geometry }]); - return !node_inspection.is_empty(); - }; - return NodesAndLinkedEdges; - }(GraphHitTestPolicy)); - exports.NodesAndLinkedEdges = NodesAndLinkedEdges; - NodesAndLinkedEdges.initClass(); - var EdgesAndLinkedNodes = /** @class */ (function (_super) { - tslib_1.__extends(EdgesAndLinkedNodes, _super); - function EdgesAndLinkedNodes(attrs) { - return _super.call(this, attrs) || this; - } - EdgesAndLinkedNodes.initClass = function () { - this.prototype.type = 'EdgesAndLinkedNodes'; - }; - EdgesAndLinkedNodes.prototype.hit_test = function (geometry, graph_view) { - return this._hit_test_edges(geometry, graph_view); - }; - EdgesAndLinkedNodes.prototype.get_linked_nodes = function (node_source, edge_source, mode) { - var edge_indices = []; - if (mode == 'selection') - edge_indices = edge_source.selected.indices; - else if (mode == 'inspection') - edge_indices = edge_source.inspected.indices; - var nodes = []; - for (var _i = 0, edge_indices_2 = edge_indices; _i < edge_indices_2.length; _i++) { - var i = edge_indices_2[_i]; - nodes.push(edge_source.data.start[i]); - nodes.push(edge_source.data.end[i]); - } - var node_indices = array_1.uniq(nodes).map(function (i) { return arrayable_1.indexOf(node_source.data.index, i); }); - var linked_nodes = hittest_1.create_empty_hit_test_result(); - linked_nodes.indices = node_indices; - return linked_nodes; - }; - EdgesAndLinkedNodes.prototype.do_selection = function (hit_test_result, graph, final, append) { - if (hit_test_result == null) - return false; - var edge_selection = graph.edge_renderer.data_source.selected; - edge_selection.update(hit_test_result, final, append); - var node_selection = graph.node_renderer.data_source.selected; - var linked_nodes = this.get_linked_nodes(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection'); - node_selection.update(linked_nodes, final, append); - graph.edge_renderer.data_source._select.emit(); - return !edge_selection.is_empty(); - }; - EdgesAndLinkedNodes.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) { - if (hit_test_result == null) - return false; - var edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model); - edge_inspection.update(hit_test_result, final, append); - graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true }); - var node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model); - var linked_nodes = this.get_linked_nodes(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection'); - node_inspection.update(linked_nodes, final, append); - // silently set inspected attr to avoid triggering data_source.change event and rerender - graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true }); - graph_view.edge_view.model.data_source.inspect.emit([graph_view.edge_view, { geometry: geometry }]); - return !edge_inspection.is_empty(); - }; - return EdgesAndLinkedNodes; - }(GraphHitTestPolicy)); - exports.EdgesAndLinkedNodes = EdgesAndLinkedNodes; - EdgesAndLinkedNodes.initClass(); -} -, -/* models/graphs/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(151) /* ./graph_hit_test_policy */, exports); - tslib_1.__exportStar(require(153) /* ./layout_provider */, exports); - tslib_1.__exportStar(require(154) /* ./static_layout_provider */, exports); -} -, -/* models/graphs/layout_provider */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var LayoutProvider = /** @class */ (function (_super) { - tslib_1.__extends(LayoutProvider, _super); - function LayoutProvider(attrs) { - return _super.call(this, attrs) || this; - } - LayoutProvider.initClass = function () { - this.prototype.type = "LayoutProvider"; - }; - return LayoutProvider; - }(model_1.Model)); - exports.LayoutProvider = LayoutProvider; - LayoutProvider.initClass(); -} -, -/* models/graphs/static_layout_provider */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_provider_1 = require(153) /* ./layout_provider */; - var p = require(18) /* ../../core/properties */; - var StaticLayoutProvider = /** @class */ (function (_super) { - tslib_1.__extends(StaticLayoutProvider, _super); - function StaticLayoutProvider(attrs) { - return _super.call(this, attrs) || this; - } - StaticLayoutProvider.initClass = function () { - this.prototype.type = "StaticLayoutProvider"; - this.define({ - graph_layout: [p.Any, {}], - }); - }; - StaticLayoutProvider.prototype.get_node_coordinates = function (node_source) { - var xs = []; - var ys = []; - var index = node_source.data.index; - for (var i = 0, end = index.length; i < end; i++) { - var point = this.graph_layout[index[i]]; - var _a = point != null ? point : [NaN, NaN], x = _a[0], y = _a[1]; - xs.push(x); - ys.push(y); - } - return [xs, ys]; - }; - StaticLayoutProvider.prototype.get_edge_coordinates = function (edge_source) { - var _a, _b; - var xs = []; - var ys = []; - var starts = edge_source.data.start; - var ends = edge_source.data.end; - var has_paths = (edge_source.data.xs != null) && (edge_source.data.ys != null); - for (var i = 0, endi = starts.length; i < endi; i++) { - var in_layout = (this.graph_layout[starts[i]] != null) && (this.graph_layout[ends[i]] != null); - if (has_paths && in_layout) { - xs.push(edge_source.data.xs[i]); - ys.push(edge_source.data.ys[i]); - } - else { - var end = void 0, start = void 0; - if (in_layout) - _a = [this.graph_layout[starts[i]], this.graph_layout[ends[i]]], start = _a[0], end = _a[1]; - else - _b = [[NaN, NaN], [NaN, NaN]], start = _b[0], end = _b[1]; - xs.push([start[0], end[0]]); - ys.push([start[1], end[1]]); - } - } - return [xs, ys]; - }; - return StaticLayoutProvider; - }(layout_provider_1.LayoutProvider)); - exports.StaticLayoutProvider = StaticLayoutProvider; - StaticLayoutProvider.initClass(); -} -, -/* models/grids/grid */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var guide_renderer_1 = require(195) /* ../renderers/guide_renderer */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var GridView = /** @class */ (function (_super) { - tslib_1.__extends(GridView, _super); - function GridView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(GridView.prototype, "_x_range_name", { - get: function () { - return this.model.x_range_name; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(GridView.prototype, "_y_range_name", { - get: function () { - return this.model.y_range_name; - }, - enumerable: true, - configurable: true - }); - GridView.prototype.render = function () { - if (!this.model.visible) - return; - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - this._draw_regions(ctx); - this._draw_minor_grids(ctx); - this._draw_grids(ctx); - ctx.restore(); - }; - GridView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.request_render(); }); - }; - GridView.prototype._draw_regions = function (ctx) { - if (!this.visuals.band_fill.doit) - return; - var _a = this.grid_coords('major', false), xs = _a[0], ys = _a[1]; - this.visuals.band_fill.set_value(ctx); - for (var i = 0; i < xs.length - 1; i++) { - if (i % 2 == 1) { - var _b = this.plot_view.map_to_screen(xs[i], ys[i], this._x_range_name, this._y_range_name), sx0 = _b[0], sy0 = _b[1]; - var _c = this.plot_view.map_to_screen(xs[i + 1], ys[i + 1], this._x_range_name, this._y_range_name), sx1 = _c[0], sy1 = _c[1]; - ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]); - } - } - }; - GridView.prototype._draw_grids = function (ctx) { - if (!this.visuals.grid_line.doit) - return; - var _a = this.grid_coords('major'), xs = _a[0], ys = _a[1]; - this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys); - }; - GridView.prototype._draw_minor_grids = function (ctx) { - if (!this.visuals.minor_grid_line.doit) - return; - var _a = this.grid_coords('minor'), xs = _a[0], ys = _a[1]; - this._draw_grid_helper(ctx, this.visuals.minor_grid_line, xs, ys); - }; - GridView.prototype._draw_grid_helper = function (ctx, visuals, xs, ys) { - visuals.set_value(ctx); - for (var i = 0; i < xs.length; i++) { - var _a = this.plot_view.map_to_screen(xs[i], ys[i], this._x_range_name, this._y_range_name), sx = _a[0], sy = _a[1]; - ctx.beginPath(); - ctx.moveTo(Math.round(sx[0]), Math.round(sy[0])); - for (var i_1 = 1; i_1 < sx.length; i_1++) - ctx.lineTo(Math.round(sx[i_1]), Math.round(sy[i_1])); - ctx.stroke(); - } - }; - // {{{ TODO: state - GridView.prototype.ranges = function () { - var i = this.model.dimension; - var j = (i + 1) % 2; - var frame = this.plot_view.frame; - var ranges = [ - frame.x_ranges[this.model.x_range_name], - frame.y_ranges[this.model.y_range_name], - ]; - return [ranges[i], ranges[j]]; - }; - GridView.prototype.computed_bounds = function () { - var _a; - var range = this.ranges()[0]; - var user_bounds = this.model.bounds; - var range_bounds = [range.min, range.max]; - var start; - var end; - if (types_1.isArray(user_bounds)) { - start = Math.min(user_bounds[0], user_bounds[1]); - end = Math.max(user_bounds[0], user_bounds[1]); - if (start < range_bounds[0]) - start = range_bounds[0]; - // XXX: - //else if (start > range_bounds[1]) - // start = null - if (end > range_bounds[1]) - end = range_bounds[1]; - // XXX: - //else if (end < range_bounds[0]) - // end = null - } - else { - start = range_bounds[0], end = range_bounds[1]; - for (var _i = 0, _b = this.plot_view.axis_views; _i < _b.length; _i++) { - var axis_view = _b[_i]; - if (axis_view.dimension == this.model.dimension - && axis_view.model.x_range_name == this.model.x_range_name - && axis_view.model.y_range_name == this.model.y_range_name) { - _a = axis_view.computed_bounds, start = _a[0], end = _a[1]; - } - } - } - return [start, end]; - }; - GridView.prototype.grid_coords = function (location, exclude_ends) { - var _a; - if (exclude_ends === void 0) { - exclude_ends = true; - } - var i = this.model.dimension; - var j = (i + 1) % 2; - var _b = this.ranges(), range = _b[0], cross_range = _b[1]; - var _c = this.computed_bounds(), start = _c[0], end = _c[1]; - _a = [Math.min(start, end), Math.max(start, end)], start = _a[0], end = _a[1]; - // TODO: (bev) using cross_range.min for cross_loc is a bit of a cheat. Since we - // currently only support "straight line" grids, this should be OK for now. If - // we ever want to support "curved" grids, e.g. for some projections, we may - // have to communicate more than just a single cross location. - var ticks = this.model.ticker.get_ticks(start, end, range, cross_range.min, {})[location]; - var min = range.min; - var max = range.max; - var cmin = cross_range.min; - var cmax = cross_range.max; - var coords = [[], []]; - if (!exclude_ends) { - if (ticks[0] != min) - ticks.splice(0, 0, min); - if (ticks[ticks.length - 1] != max) - ticks.push(max); - } - for (var ii = 0; ii < ticks.length; ii++) { - if ((ticks[ii] == min || ticks[ii] == max) && exclude_ends) - continue; - var dim_i = []; - var dim_j = []; - var N = 2; - for (var n = 0; n < N; n++) { - var loc = cmin + (cmax - cmin) / (N - 1) * n; - dim_i.push(ticks[ii]); - dim_j.push(loc); - } - coords[i].push(dim_i); - coords[j].push(dim_j); - } - return coords; - }; - return GridView; - }(guide_renderer_1.GuideRendererView)); - exports.GridView = GridView; - var Grid = /** @class */ (function (_super) { - tslib_1.__extends(Grid, _super); - function Grid(attrs) { - return _super.call(this, attrs) || this; - } - Grid.initClass = function () { - this.prototype.type = "Grid"; - this.prototype.default_view = GridView; - this.mixins(['line:grid_', 'line:minor_grid_', 'fill:band_']); - this.define({ - bounds: [p.Any, 'auto'], - dimension: [p.Any, 0], - ticker: [p.Instance], - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - level: "underlay", - band_fill_color: null, - band_fill_alpha: 0, - grid_line_color: '#e5e5e5', - minor_grid_line_color: null, - }); - }; - return Grid; - }(guide_renderer_1.GuideRenderer)); - exports.Grid = Grid; - Grid.initClass(); -} -, -/* models/grids/index */ function _(require, module, exports) { - var grid_1 = require(155) /* ./grid */; - exports.Grid = grid_1.Grid; -} -, -/* models/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(69) /* ./annotations */, exports); - tslib_1.__exportStar(require(86) /* ./axes */, exports); - tslib_1.__exportStar(require(92) /* ./callbacks */, exports); - tslib_1.__exportStar(require(96) /* ./canvas */, exports); - tslib_1.__exportStar(require(99) /* ./expressions */, exports); - tslib_1.__exportStar(require(105) /* ./filters */, exports); - tslib_1.__exportStar(require(111) /* ./formatters */, exports); - tslib_1.__exportStar(require(133) /* ./glyphs */, exports); - tslib_1.__exportStar(require(152) /* ./graphs */, exports); - tslib_1.__exportStar(require(156) /* ./grids */, exports); - tslib_1.__exportStar(require(162) /* ./layouts */, exports); - tslib_1.__exportStar(require(173) /* ./mappers */, exports); - tslib_1.__exportStar(require(284) /* ./transforms */, exports); - tslib_1.__exportStar(require(178) /* ./markers */, exports); - tslib_1.__exportStar(require(183) /* ./plots */, exports); - tslib_1.__exportStar(require(189) /* ./ranges */, exports); - tslib_1.__exportStar(require(196) /* ./renderers */, exports); - tslib_1.__exportStar(require(199) /* ./scales */, exports); - tslib_1.__exportStar(require(203) /* ./selections */, exports); - tslib_1.__exportStar(require(212) /* ./sources */, exports); - tslib_1.__exportStar(require(224) /* ./tickers */, exports); - tslib_1.__exportStar(require(234) /* ./tiles */, exports); - tslib_1.__exportStar(require(270) /* ./tools */, exports); -} -, -/* models/layouts/box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_dom_1 = require(163) /* ./layout_dom */; - var p = require(18) /* ../../core/properties */; - var BoxView = /** @class */ (function (_super) { - tslib_1.__extends(BoxView, _super); - function BoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.children.change, function () { return _this.rebuild(); }); - }; - Object.defineProperty(BoxView.prototype, "child_models", { - get: function () { - return this.model.children; - }, - enumerable: true, - configurable: true - }); - return BoxView; - }(layout_dom_1.LayoutDOMView)); - exports.BoxView = BoxView; - var Box = /** @class */ (function (_super) { - tslib_1.__extends(Box, _super); - function Box(attrs) { - return _super.call(this, attrs) || this; - } - Box.initClass = function () { - this.prototype.type = "Box"; - this.define({ - children: [p.Array, []], - spacing: [p.Number, 0], - }); - }; - return Box; - }(layout_dom_1.LayoutDOM)); - exports.Box = Box; - Box.initClass(); -} -, -/* models/layouts/column */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_1 = require(158) /* ./box */; - var grid_1 = require(11) /* ../../core/layout/grid */; - var p = require(18) /* ../../core/properties */; - var ColumnView = /** @class */ (function (_super) { - tslib_1.__extends(ColumnView, _super); - function ColumnView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ColumnView.prototype._update_layout = function () { - var items = this.child_views.map(function (child) { return child.layout; }); - this.layout = new grid_1.Column(items); - this.layout.rows = this.model.rows; - this.layout.spacing = [this.model.spacing, 0]; - this.layout.set_sizing(this.box_sizing()); - }; - return ColumnView; - }(box_1.BoxView)); - exports.ColumnView = ColumnView; - var Column = /** @class */ (function (_super) { - tslib_1.__extends(Column, _super); - function Column(attrs) { - return _super.call(this, attrs) || this; - } - Column.initClass = function () { - this.prototype.type = "Column"; - this.prototype.default_view = ColumnView; - this.define({ - rows: [p.Any, "auto"], - }); - }; - return Column; - }(box_1.Box)); - exports.Column = Column; - Column.initClass(); -} -, -/* models/layouts/grid_box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_dom_1 = require(163) /* ./layout_dom */; - var grid_1 = require(11) /* ../../core/layout/grid */; - var p = require(18) /* ../../core/properties */; - var GridBoxView = /** @class */ (function (_super) { - tslib_1.__extends(GridBoxView, _super); - function GridBoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - GridBoxView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.children.change, function () { return _this.rebuild(); }); - }; - Object.defineProperty(GridBoxView.prototype, "child_models", { - get: function () { - return this.model.children.map(function (_a) { - var child = _a[0]; - return child; - }); - }, - enumerable: true, - configurable: true - }); - GridBoxView.prototype._update_layout = function () { - this.layout = new grid_1.Grid(); - this.layout.rows = this.model.rows; - this.layout.cols = this.model.cols; - this.layout.spacing = this.model.spacing; - for (var _i = 0, _a = this.model.children; _i < _a.length; _i++) { - var _b = _a[_i], child = _b[0], row = _b[1], col = _b[2], row_span = _b[3], col_span = _b[4]; - var child_view = this._child_views[child.id]; - this.layout.items.push({ layout: child_view.layout, row: row, col: col, row_span: row_span, col_span: col_span }); - } - this.layout.set_sizing(this.box_sizing()); - }; - return GridBoxView; - }(layout_dom_1.LayoutDOMView)); - exports.GridBoxView = GridBoxView; - var GridBox = /** @class */ (function (_super) { - tslib_1.__extends(GridBox, _super); - function GridBox(attrs) { - return _super.call(this, attrs) || this; - } - GridBox.initClass = function () { - this.prototype.type = "GridBox"; - this.prototype.default_view = GridBoxView; - this.define({ - children: [p.Array, []], - rows: [p.Any, "auto"], - cols: [p.Any, "auto"], - spacing: [p.Any, 0], - }); - }; - return GridBox; - }(layout_dom_1.LayoutDOM)); - exports.GridBox = GridBox; - GridBox.initClass(); -} -, -/* models/layouts/html_box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_dom_1 = require(163) /* ../layouts/layout_dom */; - var layout_1 = require(13) /* ../../core/layout */; - var HTMLBoxView = /** @class */ (function (_super) { - tslib_1.__extends(HTMLBoxView, _super); - function HTMLBoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(HTMLBoxView.prototype, "child_models", { - get: function () { - return []; - }, - enumerable: true, - configurable: true - }); - HTMLBoxView.prototype._update_layout = function () { - this.layout = new layout_1.ContentBox(this.el); - this.layout.set_sizing(this.box_sizing()); - }; - return HTMLBoxView; - }(layout_dom_1.LayoutDOMView)); - exports.HTMLBoxView = HTMLBoxView; - var HTMLBox = /** @class */ (function (_super) { - tslib_1.__extends(HTMLBox, _super); - function HTMLBox(attrs) { - return _super.call(this, attrs) || this; - } - HTMLBox.initClass = function () { - this.prototype.type = "HTMLBox"; - }; - return HTMLBox; - }(layout_dom_1.LayoutDOM)); - exports.HTMLBox = HTMLBox; - HTMLBox.initClass(); -} -, -/* models/layouts/index */ function _(require, module, exports) { - var box_1 = require(158) /* ./box */; - exports.Box = box_1.Box; - var column_1 = require(159) /* ./column */; - exports.Column = column_1.Column; - var grid_box_1 = require(160) /* ./grid_box */; - exports.GridBox = grid_box_1.GridBox; - var html_box_1 = require(161) /* ./html_box */; - exports.HTMLBox = html_box_1.HTMLBox; - var layout_dom_1 = require(163) /* ./layout_dom */; - exports.LayoutDOM = layout_dom_1.LayoutDOM; - var row_1 = require(164) /* ./row */; - exports.Row = row_1.Row; - var spacer_1 = require(165) /* ./spacer */; - exports.Spacer = spacer_1.Spacer; - var tabs_1 = require(166) /* ./tabs */; - exports.Panel = tabs_1.Panel; - exports.Tabs = tabs_1.Tabs; - var widget_box_1 = require(167) /* ./widget_box */; - exports.WidgetBox = widget_box_1.WidgetBox; -} -, -/* models/layouts/layout_dom */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var dom_1 = require(5) /* ../../core/dom */; - var logging_1 = require(17) /* ../../core/logging */; - var types_1 = require(46) /* ../../core/util/types */; - var p = require(18) /* ../../core/properties */; - var build_views_1 = require(4) /* ../../core/build_views */; - var dom_view_1 = require(6) /* ../../core/dom_view */; - var LayoutDOMView = /** @class */ (function (_super) { - tslib_1.__extends(LayoutDOMView, _super); - function LayoutDOMView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._idle_notified = false; - _this._offset_parent = null; - _this._viewport = {}; - return _this; - } - LayoutDOMView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.el.style.position = this.is_root ? "relative" : "absolute"; - this._child_views = {}; - this.build_child_views(); - }; - LayoutDOMView.prototype.remove = function () { - for (var _i = 0, _a = this.child_views; _i < _a.length; _i++) { - var child_view = _a[_i]; - child_view.remove(); - } - this._child_views = {}; - _super.prototype.remove.call(this); - }; - LayoutDOMView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - if (this.is_root) { - this._on_resize = function () { return _this.resize_layout(); }; - window.addEventListener("resize", this._on_resize); - this._parent_observer = setInterval(function () { - var offset_parent = _this.el.offsetParent; - if (_this._offset_parent != offset_parent) { - _this._offset_parent = offset_parent; - if (offset_parent != null) { - _this.compute_viewport(); - _this.invalidate_layout(); - } - } - }, 250); - } - var p = this.model.properties; - this.on_change([ - p.width, p.height, - p.min_width, p.min_height, - p.max_width, p.max_height, - p.margin, - p.width_policy, p.height_policy, p.sizing_mode, - p.aspect_ratio, - p.visible, - p.background, - ], function () { return _this.invalidate_layout(); }); - this.on_change([ - p.css_classes, - ], function () { return _this.invalidate_render(); }); - }; - LayoutDOMView.prototype.disconnect_signals = function () { - if (this._parent_observer != null) - clearTimeout(this._parent_observer); - if (this._on_resize != null) - window.removeEventListener("resize", this._on_resize); - _super.prototype.disconnect_signals.call(this); - }; - LayoutDOMView.prototype.css_classes = function () { - return _super.prototype.css_classes.call(this).concat(this.model.css_classes); - }; - Object.defineProperty(LayoutDOMView.prototype, "child_views", { - get: function () { - var _this = this; - return this.child_models.map(function (child) { return _this._child_views[child.id]; }); - }, - enumerable: true, - configurable: true - }); - LayoutDOMView.prototype.build_child_views = function () { - build_views_1.build_views(this._child_views, this.child_models, { parent: this }); - }; - LayoutDOMView.prototype.render = function () { - var _a; - _super.prototype.render.call(this); - dom_1.empty(this.el); // XXX: this should be in super - var background = this.model.background; - this.el.style.backgroundColor = background != null ? background : ""; - (_a = dom_1.classes(this.el).clear()).add.apply(_a, this.css_classes()); - for (var _i = 0, _b = this.child_views; _i < _b.length; _i++) { - var child_view = _b[_i]; - this.el.appendChild(child_view.el); - child_view.render(); - } - }; - LayoutDOMView.prototype.update_layout = function () { - for (var _i = 0, _a = this.child_views; _i < _a.length; _i++) { - var child_view = _a[_i]; - child_view.update_layout(); - } - this._update_layout(); - }; - LayoutDOMView.prototype.update_position = function () { - this.el.style.display = this.model.visible ? "block" : "none"; - var margin = this.is_root ? this.layout.sizing.margin : undefined; - dom_1.position(this.el, this.layout.bbox, margin); - for (var _i = 0, _a = this.child_views; _i < _a.length; _i++) { - var child_view = _a[_i]; - child_view.update_position(); - } - }; - LayoutDOMView.prototype.after_layout = function () { - for (var _i = 0, _a = this.child_views; _i < _a.length; _i++) { - var child_view = _a[_i]; - child_view.after_layout(); - } - this._has_finished = true; - }; - LayoutDOMView.prototype.compute_viewport = function () { - this._viewport = this._viewport_size(); - }; - LayoutDOMView.prototype.renderTo = function (element) { - element.appendChild(this.el); - this._offset_parent = this.el.offsetParent; - this.compute_viewport(); - this.build(); - }; - LayoutDOMView.prototype.build = function () { - this.assert_root(); - this.render(); - this.update_layout(); - this.compute_layout(); - return this; - }; - LayoutDOMView.prototype.rebuild = function () { - this.build_child_views(); - this.invalidate_render(); - }; - LayoutDOMView.prototype.compute_layout = function () { - var start = Date.now(); - this.layout.compute(this._viewport); - this.update_position(); - this.after_layout(); - logging_1.logger.debug("layout computed in " + (Date.now() - start) + " ms"); - this.notify_finished(); - }; - LayoutDOMView.prototype.resize_layout = function () { - this.root.compute_viewport(); - this.root.compute_layout(); - }; - LayoutDOMView.prototype.invalidate_layout = function () { - this.root.update_layout(); - this.root.compute_layout(); - }; - LayoutDOMView.prototype.invalidate_render = function () { - this.render(); - this.invalidate_layout(); - }; - LayoutDOMView.prototype.has_finished = function () { - if (!_super.prototype.has_finished.call(this)) - return false; - for (var _i = 0, _a = this.child_views; _i < _a.length; _i++) { - var child_view = _a[_i]; - if (!child_view.has_finished()) - return false; - } - return true; - }; - LayoutDOMView.prototype.notify_finished = function () { - if (!this.is_root) - this.root.notify_finished(); - else { - if (!this._idle_notified && this.has_finished()) { - if (this.model.document != null) { - this._idle_notified = true; - this.model.document.notify_idle(this.model); - } - } - } - }; - LayoutDOMView.prototype._width_policy = function () { - return this.model.width != null ? "fixed" : "fit"; - }; - LayoutDOMView.prototype._height_policy = function () { - return this.model.height != null ? "fixed" : "fit"; - }; - LayoutDOMView.prototype.box_sizing = function () { - var _a = this.model, width_policy = _a.width_policy, height_policy = _a.height_policy, aspect_ratio = _a.aspect_ratio; - if (width_policy == "auto") - width_policy = this._width_policy(); - if (height_policy == "auto") - height_policy = this._height_policy(); - var sizing_mode = this.model.sizing_mode; - if (sizing_mode != null) { - if (sizing_mode == "fixed") - width_policy = height_policy = "fixed"; - else if (sizing_mode == "stretch_both") - width_policy = height_policy = "max"; - else if (sizing_mode == "stretch_width") - width_policy = "max"; - else if (sizing_mode == "stretch_height") - height_policy = "max"; - else { - if (aspect_ratio == null) - aspect_ratio = "auto"; - switch (sizing_mode) { - case "scale_width": - width_policy = "max"; - height_policy = "min"; - break; - case "scale_height": - width_policy = "min"; - height_policy = "max"; - break; - case "scale_both": - width_policy = "max"; - height_policy = "max"; - break; - default: - throw new Error("unreachable"); - } - } - } - var sizing = { width_policy: width_policy, height_policy: height_policy }; - var _b = this.model, min_width = _b.min_width, min_height = _b.min_height; - if (min_width != null) - sizing.min_width = min_width; - if (min_height != null) - sizing.min_height = min_height; - var _c = this.model, width = _c.width, height = _c.height; - if (width != null) - sizing.width = width; - if (height != null) - sizing.height = height; - var _d = this.model, max_width = _d.max_width, max_height = _d.max_height; - if (max_width != null) - sizing.max_width = max_width; - if (max_height != null) - sizing.max_height = max_height; - if (aspect_ratio == "auto" && width != null && height != null) - sizing.aspect = width / height; - else if (types_1.isNumber(aspect_ratio)) - sizing.aspect = aspect_ratio; - var margin = this.model.margin; - if (margin != null) { - if (types_1.isNumber(margin)) - sizing.margin = { top: margin, right: margin, bottom: margin, left: margin }; - else if (margin.length == 2) { - var vertical = margin[0], horizontal = margin[1]; - sizing.margin = { top: vertical, right: horizontal, bottom: vertical, left: horizontal }; - } - else { - var top_1 = margin[0], right = margin[1], bottom = margin[2], left = margin[3]; - sizing.margin = { top: top_1, right: right, bottom: bottom, left: left }; - } - } - sizing.visible = this.model.visible; - var align = this.model.align; - if (types_1.isArray(align)) - sizing.halign = align[0], sizing.valign = align[1]; - else - sizing.halign = sizing.valign = align; - return sizing; - }; - LayoutDOMView.prototype._viewport_size = function () { - var _this = this; - return dom_1.undisplayed(this.el, function () { - var measuring = _this.el; - while (measuring = measuring.parentElement) { - // .bk-root element doesn't bring any value - if (measuring.classList.contains("bk-root")) - continue; - // we reached element, so use viewport size - if (measuring == document.body) { - var _a = dom_1.extents(document.body).margin, left_1 = _a.left, right_1 = _a.right, top_2 = _a.top, bottom_1 = _a.bottom; - var width_1 = Math.ceil(document.documentElement.clientWidth - left_1 - right_1); - var height_1 = Math.ceil(document.documentElement.clientHeight - top_2 - bottom_1); - return { width: width_1, height: height_1 }; - } - // stop on first element with sensible dimensions - var _b = dom_1.extents(measuring).padding, left = _b.left, right = _b.right, top_3 = _b.top, bottom = _b.bottom; - var _c = measuring.getBoundingClientRect(), width = _c.width, height = _c.height; - var inner_width = Math.ceil(width - left - right); - var inner_height = Math.ceil(height - top_3 - bottom); - if (inner_width > 0 || inner_height > 0) - return { - width: inner_width > 0 ? inner_width : undefined, - height: inner_height > 0 ? inner_height : undefined, - }; - } - // this element is detached from DOM - return {}; - }); - }; - LayoutDOMView.prototype.serializable_state = function () { - return tslib_1.__assign({}, _super.prototype.serializable_state.call(this), { bbox: this.layout.bbox.rect, children: this.child_views.map(function (child) { return child.serializable_state(); }) }); - }; - return LayoutDOMView; - }(dom_view_1.DOMView)); - exports.LayoutDOMView = LayoutDOMView; - var LayoutDOM = /** @class */ (function (_super) { - tslib_1.__extends(LayoutDOM, _super); - function LayoutDOM(attrs) { - return _super.call(this, attrs) || this; - } - LayoutDOM.initClass = function () { - this.prototype.type = "LayoutDOM"; - this.define({ - width: [p.Number, null], - height: [p.Number, null], - min_width: [p.Number, null], - min_height: [p.Number, null], - max_width: [p.Number, null], - max_height: [p.Number, null], - margin: [p.Any, [0, 0, 0, 0]], - width_policy: [p.Any, "auto"], - height_policy: [p.Any, "auto"], - aspect_ratio: [p.Any, null], - sizing_mode: [p.SizingMode, null], - visible: [p.Boolean, true], - disabled: [p.Boolean, false], - align: [p.Any, "start"], - background: [p.Color, null], - css_classes: [p.Array, []], - }); - }; - return LayoutDOM; - }(model_1.Model)); - exports.LayoutDOM = LayoutDOM; - LayoutDOM.initClass(); -} -, -/* models/layouts/row */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_1 = require(158) /* ./box */; - var grid_1 = require(11) /* ../../core/layout/grid */; - var p = require(18) /* ../../core/properties */; - var RowView = /** @class */ (function (_super) { - tslib_1.__extends(RowView, _super); - function RowView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RowView.prototype._update_layout = function () { - var items = this.child_views.map(function (child) { return child.layout; }); - this.layout = new grid_1.Row(items); - this.layout.cols = this.model.cols; - this.layout.spacing = [0, this.model.spacing]; - this.layout.set_sizing(this.box_sizing()); - }; - return RowView; - }(box_1.BoxView)); - exports.RowView = RowView; - var Row = /** @class */ (function (_super) { - tslib_1.__extends(Row, _super); - function Row(attrs) { - return _super.call(this, attrs) || this; - } - Row.initClass = function () { - this.prototype.type = "Row"; - this.prototype.default_view = RowView; - this.define({ - cols: [p.Any, "auto"], - }); - }; - return Row; - }(box_1.Box)); - exports.Row = Row; - Row.initClass(); -} -, -/* models/layouts/spacer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_dom_1 = require(163) /* ./layout_dom */; - var layout_1 = require(13) /* ../../core/layout */; - var SpacerView = /** @class */ (function (_super) { - tslib_1.__extends(SpacerView, _super); - function SpacerView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(SpacerView.prototype, "child_models", { - get: function () { - return []; - }, - enumerable: true, - configurable: true - }); - SpacerView.prototype._update_layout = function () { - this.layout = new layout_1.LayoutItem(); - this.layout.set_sizing(this.box_sizing()); - }; - return SpacerView; - }(layout_dom_1.LayoutDOMView)); - exports.SpacerView = SpacerView; - var Spacer = /** @class */ (function (_super) { - tslib_1.__extends(Spacer, _super); - function Spacer(attrs) { - return _super.call(this, attrs) || this; - } - Spacer.initClass = function () { - this.prototype.type = "Spacer"; - this.prototype.default_view = SpacerView; - }; - return Spacer; - }(layout_dom_1.LayoutDOM)); - exports.Spacer = Spacer; - Spacer.initClass(); -} -, -/* models/layouts/tabs */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var layout_1 = require(13) /* ../../core/layout */; - var dom_1 = require(5) /* ../../core/dom */; - var array_1 = require(24) /* ../../core/util/array */; - var p = require(18) /* ../../core/properties */; - var layout_dom_1 = require(163) /* ./layout_dom */; - var model_1 = require(62) /* ../../model */; - var TabsView = /** @class */ (function (_super) { - tslib_1.__extends(TabsView, _super); - function TabsView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TabsView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.tabs.change, function () { return _this.rebuild(); }); - this.connect(this.model.properties.active.change, function () { return _this.on_active_change(); }); - }; - Object.defineProperty(TabsView.prototype, "child_models", { - get: function () { - return this.model.tabs.map(function (tab) { return tab.child; }); - }, - enumerable: true, - configurable: true - }); - TabsView.prototype._update_layout = function () { - var loc = this.model.tabs_location; - var vertical = loc == "above" || loc == "below"; - // XXX: this is a hack, this should be handled by "fit" policy in grid layout - var _a = this, scroll_el = _a.scroll_el, headers_el = _a.headers_el; - this.header = new /** @class */ (function (_super) { - tslib_1.__extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - class_1.prototype._measure = function (viewport) { - var min_headers = 3; - var scroll = dom_1.size(scroll_el); - var headers = dom_1.children(headers_el).slice(0, min_headers).map(function (el) { return dom_1.size(el); }); - var _a = _super.prototype._measure.call(this, viewport), width = _a.width, height = _a.height; - if (vertical) { - var min_width = scroll.width + array_1.sum(headers.map(function (size) { return size.width; })); - return { width: viewport.width != Infinity ? viewport.width : min_width, height: height }; - } - else { - var min_height = scroll.height + array_1.sum(headers.map(function (size) { return size.height; })); - return { width: width, height: viewport.height != Infinity ? viewport.height : min_height }; - } - }; - return class_1; - }(layout_1.ContentBox))(this.header_el); - if (vertical) - this.header.set_sizing({ width_policy: "fit", height_policy: "fixed" }); - else - this.header.set_sizing({ width_policy: "fixed", height_policy: "fit" }); - var row = 1; - var col = 1; - switch (loc) { - case "above": - row -= 1; - break; - case "below": - row += 1; - break; - case "left": - col -= 1; - break; - case "right": - col += 1; - break; - } - var header = { layout: this.header, row: row, col: col }; - var panels = this.child_views.map(function (child_view) { - return { layout: child_view.layout, row: 1, col: 1 }; - }); - this.layout = new layout_1.Grid([header].concat(panels)); - this.layout.set_sizing(this.box_sizing()); - }; - TabsView.prototype.update_position = function () { - _super.prototype.update_position.call(this); - this.header_el.style.position = "absolute"; // XXX: do it in position() - dom_1.position(this.header_el, this.header.bbox); - var loc = this.model.tabs_location; - var vertical = loc == "above" || loc == "below"; - var scroll_el_size = dom_1.size(this.scroll_el); - var headers_el_size = dom_1.scroll_size(this.headers_el); - if (vertical) { - var width = this.header.bbox.width; - if (headers_el_size.width > width) { - this.wrapper_el.style.maxWidth = width - scroll_el_size.width + "px"; - dom_1.display(this.scroll_el); - } - else { - this.wrapper_el.style.maxWidth = ""; - dom_1.undisplay(this.scroll_el); - } - } - else { - var height = this.header.bbox.height; - if (headers_el_size.height > height) { - this.wrapper_el.style.maxHeight = height - scroll_el_size.height + "px"; - dom_1.display(this.scroll_el); - } - else { - this.wrapper_el.style.maxHeight = ""; - dom_1.undisplay(this.scroll_el); - } - } - var child_views = this.child_views; - for (var _i = 0, child_views_1 = child_views; _i < child_views_1.length; _i++) { - var child_view = child_views_1[_i]; - dom_1.hide(child_view.el); - } - var tab = child_views[this.model.active]; - if (tab != null) - dom_1.show(tab.el); - }; - TabsView.prototype.render = function () { - var _this = this; - _super.prototype.render.call(this); - var active = this.model.active; - var loc = this.model.tabs_location; - var vertical = loc == "above" || loc == "below"; - var location = "bk-" + loc; - var headers = this.model.tabs.map(function (tab, i) { - var el = dom_1.div({ class: ["bk-tab", i == active ? "bk-active" : null] }, tab.title); - el.addEventListener("click", function (event) { - if (event.target == event.currentTarget) - _this.change_active(i); - }); - if (tab.closable) { - var close_el = dom_1.div({ class: "bk-close" }); - close_el.addEventListener("click", function (event) { - if (event.target == event.currentTarget) { - _this.model.tabs = array_1.remove_at(_this.model.tabs, i); - var ntabs = _this.model.tabs.length; - if (_this.model.active > ntabs - 1) - _this.model.active = ntabs - 1; - } - }); - el.appendChild(close_el); - } - return el; - }); - this.headers_el = dom_1.div({ class: ["bk-headers"] }, headers); - this.wrapper_el = dom_1.div({ class: "bk-headers-wrapper" }, this.headers_el); - var left_el = dom_1.div({ class: ["bk-btn", "bk-btn-default"], disabled: "" }, dom_1.div({ class: ["bk-caret", "bk-left"] })); - var right_el = dom_1.div({ class: ["bk-btn", "bk-btn-default"] }, dom_1.div({ class: ["bk-caret", "bk-right"] })); - var scroll_index = 0; - var do_scroll = function (dir) { - return function () { - var ntabs = _this.model.tabs.length; - if (dir == "left") - scroll_index = Math.max(scroll_index - 1, 0); - else - scroll_index = Math.min(scroll_index + 1, ntabs - 1); - if (scroll_index == 0) - left_el.setAttribute("disabled", ""); - else - left_el.removeAttribute("disabled"); - if (scroll_index == ntabs - 1) - right_el.setAttribute("disabled", ""); - else - right_el.removeAttribute("disabled"); - var sizes = dom_1.children(_this.headers_el) - .slice(0, scroll_index) - .map(function (el) { return el.getBoundingClientRect(); }); - if (vertical) { - var left = -array_1.sum(sizes.map(function (size) { return size.width; })); - _this.headers_el.style.left = left + "px"; - } - else { - var top_1 = -array_1.sum(sizes.map(function (size) { return size.height; })); - _this.headers_el.style.top = top_1 + "px"; - } - }; - }; - left_el.addEventListener("click", do_scroll("left")); - right_el.addEventListener("click", do_scroll("right")); - this.scroll_el = dom_1.div({ class: "bk-btn-group" }, left_el, right_el); - this.header_el = dom_1.div({ class: ["bk-tabs-header", location] }, this.scroll_el, this.wrapper_el); - this.el.appendChild(this.header_el); - }; - TabsView.prototype.change_active = function (i) { - if (i != this.model.active) { - this.model.active = i; - if (this.model.callback != null) - this.model.callback.execute(this.model); - } - }; - TabsView.prototype.on_active_change = function () { - var i = this.model.active; - var headers = dom_1.children(this.headers_el); - for (var _i = 0, headers_1 = headers; _i < headers_1.length; _i++) { - var el = headers_1[_i]; - el.classList.remove("bk-active"); - } - headers[i].classList.add("bk-active"); - var child_views = this.child_views; - for (var _a = 0, child_views_2 = child_views; _a < child_views_2.length; _a++) { - var child_view = child_views_2[_a]; - dom_1.hide(child_view.el); - } - dom_1.show(child_views[i].el); - }; - return TabsView; - }(layout_dom_1.LayoutDOMView)); - exports.TabsView = TabsView; - var Tabs = /** @class */ (function (_super) { - tslib_1.__extends(Tabs, _super); - function Tabs(attrs) { - return _super.call(this, attrs) || this; - } - Tabs.initClass = function () { - this.prototype.type = "Tabs"; - this.prototype.default_view = TabsView; - this.define({ - tabs: [p.Array, []], - tabs_location: [p.Location, "above"], - active: [p.Number, 0], - callback: [p.Any], - }); - }; - return Tabs; - }(layout_dom_1.LayoutDOM)); - exports.Tabs = Tabs; - Tabs.initClass(); - var Panel = /** @class */ (function (_super) { - tslib_1.__extends(Panel, _super); - function Panel(attrs) { - return _super.call(this, attrs) || this; - } - Panel.initClass = function () { - this.prototype.type = "Panel"; - this.define({ - title: [p.String, ""], - child: [p.Instance], - closable: [p.Boolean, false], - }); - }; - return Panel; - }(model_1.Model)); - exports.Panel = Panel; - Panel.initClass(); -} -, -/* models/layouts/widget_box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var column_1 = require(159) /* ./column */; - var WidgetBoxView = /** @class */ (function (_super) { - tslib_1.__extends(WidgetBoxView, _super); - function WidgetBoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return WidgetBoxView; - }(column_1.ColumnView)); - exports.WidgetBoxView = WidgetBoxView; - var WidgetBox = /** @class */ (function (_super) { - tslib_1.__extends(WidgetBox, _super); - function WidgetBox(attrs) { - return _super.call(this, attrs) || this; - } - WidgetBox.initClass = function () { - this.prototype.type = "WidgetBox"; - this.prototype.default_view = WidgetBoxView; - }; - return WidgetBox; - }(column_1.Column)); - exports.WidgetBox = WidgetBox; - WidgetBox.initClass(); -} -, -/* models/mappers/categorical_color_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var categorical_mapper_1 = require(169) /* ./categorical_mapper */; - var color_mapper_1 = require(171) /* ./color_mapper */; - var p = require(18) /* ../../core/properties */; - var CategoricalColorMapper = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalColorMapper, _super); - function CategoricalColorMapper(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalColorMapper.initClass = function () { - this.prototype.type = "CategoricalColorMapper"; - this.define({ - factors: [p.Array], - start: [p.Number, 0], - end: [p.Number], - }); - }; - CategoricalColorMapper.prototype._v_compute = function (data, values, palette, _a) { - var nan_color = _a.nan_color; - categorical_mapper_1.cat_v_compute(data, this.factors, palette, values, this.start, this.end, nan_color); - }; - return CategoricalColorMapper; - }(color_mapper_1.ColorMapper)); - exports.CategoricalColorMapper = CategoricalColorMapper; - CategoricalColorMapper.initClass(); -} -, -/* models/mappers/categorical_mapper */ function _(require, module, exports) { - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var types_1 = require(46) /* ../../core/util/types */; - function _cat_equals(a, b) { - if (a.length != b.length) - return false; - for (var i = 0, end = a.length; i < end; i++) { - if (a[i] !== b[i]) - return false; - } - return true; - } - exports._cat_equals = _cat_equals; - function cat_v_compute(data, factors, targets, values, start, end, extra_value) { - var _loop_1 = function (i, N) { - var d = data[i]; - var key = void 0; - if (types_1.isString(d)) - key = arrayable_1.index_of(factors, d); - else { - if (start != null) { - if (end != null) - d = d.slice(start, end); - else - d = d.slice(start); - } - else if (end != null) - d = d.slice(0, end); - if (d.length == 1) - key = arrayable_1.index_of(factors, d[0]); - else - key = arrayable_1.find_index(factors, function (x) { return _cat_equals(x, d); }); - } - var value = void 0; - if (key < 0 || key >= targets.length) - value = extra_value; - else - value = targets[key]; - values[i] = value; - }; - for (var i = 0, N = data.length; i < N; i++) { - _loop_1(i, N); - } - } - exports.cat_v_compute = cat_v_compute; -} -, -/* models/mappers/categorical_marker_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var categorical_mapper_1 = require(169) /* ./categorical_mapper */; - var mapper_1 = require(176) /* ./mapper */; - var p = require(18) /* ../../core/properties */; - var CategoricalMarkerMapper = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalMarkerMapper, _super); - function CategoricalMarkerMapper(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalMarkerMapper.initClass = function () { - this.prototype.type = "CategoricalMarkerMapper"; - this.define({ - factors: [p.Array], - markers: [p.Array], - start: [p.Number, 0], - end: [p.Number], - default_value: [p.MarkerType, "circle"], - }); - }; - CategoricalMarkerMapper.prototype.v_compute = function (xs) { - var values = new Array(xs.length); - categorical_mapper_1.cat_v_compute(xs, this.factors, this.markers, values, this.start, this.end, this.default_value); - return values; - }; - return CategoricalMarkerMapper; - }(mapper_1.Mapper)); - exports.CategoricalMarkerMapper = CategoricalMarkerMapper; - CategoricalMarkerMapper.initClass(); -} -, -/* models/mappers/color_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mapper_1 = require(176) /* ./mapper */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var color_1 = require(30) /* ../../core/util/color */; - var compat_1 = require(31) /* ../../core/util/compat */; - function _convert_color(color) { - if (types_1.isNumber(color)) - return color; - if (color[0] != "#") - color = color_1.color2hex(color); - if (color.length != 9) - color = color + 'ff'; - return parseInt(color.slice(1), 16); - } - exports._convert_color = _convert_color; - function _convert_palette(palette) { - var new_palette = new Uint32Array(palette.length); - for (var i = 0, end = palette.length; i < end; i++) - new_palette[i] = _convert_color(palette[i]); - return new_palette; - } - exports._convert_palette = _convert_palette; - function _uint32_to_rgba(values) { - if (compat_1.is_little_endian) { - var view = new DataView(values.buffer); - for (var i = 0, end = values.length; i < end; i++) - view.setUint32(i * 4, values[i]); - } - return new Uint8Array(values.buffer); - } - exports._uint32_to_rgba = _uint32_to_rgba; - var ColorMapper = /** @class */ (function (_super) { - tslib_1.__extends(ColorMapper, _super); - function ColorMapper(attrs) { - return _super.call(this, attrs) || this; - } - ColorMapper.initClass = function () { - this.prototype.type = "ColorMapper"; - this.define({ - palette: [p.Any], - nan_color: [p.Color, "gray"], - }); - }; - ColorMapper.prototype.v_compute = function (xs) { - var values = new Array(xs.length); - this._v_compute(xs, values, this.palette, this._colors(function (c) { return c; })); - return values; - }; - Object.defineProperty(ColorMapper.prototype, "rgba_mapper", { - get: function () { - var self = this; - var palette = _convert_palette(this.palette); - var colors = this._colors(_convert_color); - return { - v_compute: function (xs) { - var values = new Uint32Array(xs.length); - self._v_compute(xs, values, palette, colors); - return _uint32_to_rgba(values); - }, - }; - }, - enumerable: true, - configurable: true - }); - ColorMapper.prototype._colors = function (conv) { - return { nan_color: conv(this.nan_color) }; - }; - return ColorMapper; - }(mapper_1.Mapper)); - exports.ColorMapper = ColorMapper; - ColorMapper.initClass(); -} -, -/* models/mappers/continuous_color_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var color_mapper_1 = require(171) /* ./color_mapper */; - var p = require(18) /* ../../core/properties */; - var ContinuousColorMapper = /** @class */ (function (_super) { - tslib_1.__extends(ContinuousColorMapper, _super); - function ContinuousColorMapper(attrs) { - return _super.call(this, attrs) || this; - } - ContinuousColorMapper.initClass = function () { - this.prototype.type = "ContinuousColorMapper"; - this.define({ - high: [p.Number], - low: [p.Number], - high_color: [p.Color], - low_color: [p.Color], - }); - }; - ContinuousColorMapper.prototype._colors = function (conv) { - return tslib_1.__assign({}, _super.prototype._colors.call(this, conv), { low_color: this.low_color != null ? conv(this.low_color) : undefined, high_color: this.high_color != null ? conv(this.high_color) : undefined }); - }; - return ContinuousColorMapper; - }(color_mapper_1.ColorMapper)); - exports.ContinuousColorMapper = ContinuousColorMapper; - ContinuousColorMapper.initClass(); -} -, -/* models/mappers/index */ function _(require, module, exports) { - var categorical_color_mapper_1 = require(168) /* ./categorical_color_mapper */; - exports.CategoricalColorMapper = categorical_color_mapper_1.CategoricalColorMapper; - var categorical_marker_mapper_1 = require(170) /* ./categorical_marker_mapper */; - exports.CategoricalMarkerMapper = categorical_marker_mapper_1.CategoricalMarkerMapper; - var continuous_color_mapper_1 = require(172) /* ./continuous_color_mapper */; - exports.ContinuousColorMapper = continuous_color_mapper_1.ContinuousColorMapper; - var color_mapper_1 = require(171) /* ./color_mapper */; - exports.ColorMapper = color_mapper_1.ColorMapper; - var linear_color_mapper_1 = require(174) /* ./linear_color_mapper */; - exports.LinearColorMapper = linear_color_mapper_1.LinearColorMapper; - var log_color_mapper_1 = require(175) /* ./log_color_mapper */; - exports.LogColorMapper = log_color_mapper_1.LogColorMapper; -} -, -/* models/mappers/linear_color_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_color_mapper_1 = require(172) /* ./continuous_color_mapper */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var LinearColorMapper = /** @class */ (function (_super) { - tslib_1.__extends(LinearColorMapper, _super); - function LinearColorMapper(attrs) { - return _super.call(this, attrs) || this; - } - LinearColorMapper.initClass = function () { - this.prototype.type = "LinearColorMapper"; - }; - LinearColorMapper.prototype._v_compute = function (data, values, palette, colors) { - var nan_color = colors.nan_color, low_color = colors.low_color, high_color = colors.high_color; - var low = this.low != null ? this.low : arrayable_1.min(data); - var high = this.high != null ? this.high : arrayable_1.max(data); - var max_key = palette.length - 1; - var norm_factor = 1 / (high - low); - var normed_interval = 1 / palette.length; - for (var i = 0, end = data.length; i < end; i++) { - var d = data[i]; - if (isNaN(d)) { - values[i] = nan_color; - continue; - } - // This handles the edge case where d == high, since the code below maps - // values exactly equal to high to palette.length, which is greater than - // max_key - if (d == high) { - values[i] = palette[max_key]; - continue; - } - var normed_d = (d - low) * norm_factor; - var key = Math.floor(normed_d / normed_interval); - if (key < 0) - values[i] = low_color != null ? low_color : palette[0]; - else if (key > max_key) - values[i] = high_color != null ? high_color : palette[max_key]; - else - values[i] = palette[key]; - } - }; - return LinearColorMapper; - }(continuous_color_mapper_1.ContinuousColorMapper)); - exports.LinearColorMapper = LinearColorMapper; - LinearColorMapper.initClass(); -} -, -/* models/mappers/log_color_mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_color_mapper_1 = require(172) /* ./continuous_color_mapper */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - // Math.log1p() is not supported by any version of IE, so let's use a polyfill based on - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p. - var log1p = Math.log1p != null ? Math.log1p : function (x) { return Math.log(1 + x); }; - var LogColorMapper = /** @class */ (function (_super) { - tslib_1.__extends(LogColorMapper, _super); - function LogColorMapper(attrs) { - return _super.call(this, attrs) || this; - } - LogColorMapper.initClass = function () { - this.prototype.type = "LogColorMapper"; - }; - LogColorMapper.prototype._v_compute = function (data, values, palette, colors) { - var nan_color = colors.nan_color, low_color = colors.low_color, high_color = colors.high_color; - var n = palette.length; - var low = this.low != null ? this.low : arrayable_1.min(data); - var high = this.high != null ? this.high : arrayable_1.max(data); - var scale = n / (log1p(high) - log1p(low)); // subtract the low offset - var max_key = palette.length - 1; - for (var i = 0, end = data.length; i < end; i++) { - var d = data[i]; - // Check NaN - if (isNaN(d)) { - values[i] = nan_color; - continue; - } - if (d > high) { - values[i] = high_color != null ? high_color : palette[max_key]; - continue; - } - // This handles the edge case where d == high, since the code below maps - // values exactly equal to high to palette.length, which is greater than - // max_key - if (d == high) { - values[i] = palette[max_key]; - continue; - } - if (d < low) { - values[i] = low_color != null ? low_color : palette[0]; - continue; - } - // Get the key - var log = log1p(d) - log1p(low); // subtract the low offset - var key = Math.floor(log * scale); - // Deal with upper bound - if (key > max_key) - key = max_key; - values[i] = palette[key]; - } - }; - return LogColorMapper; - }(continuous_color_mapper_1.ContinuousColorMapper)); - exports.LogColorMapper = LogColorMapper; - LogColorMapper.initClass(); -} -, -/* models/mappers/mapper */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transform_1 = require(289) /* ../transforms/transform */; - var Mapper = /** @class */ (function (_super) { - tslib_1.__extends(Mapper, _super); - function Mapper(attrs) { - return _super.call(this, attrs) || this; - } - Mapper.initClass = function () { - this.prototype.type = "Mapper"; - }; - Mapper.prototype.compute = function (_x) { - // If it's just a single value, then a mapper doesn't really make sense. - throw new Error("mapping single values is not supported"); - }; - return Mapper; - }(transform_1.Transform)); - exports.Mapper = Mapper; - Mapper.initClass(); -} -, -/* models/markers/defs */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var marker_1 = require(179) /* ./marker */; - var SQ3 = Math.sqrt(3); - function _one_line(ctx, r) { - ctx.moveTo(-r, 0); - ctx.lineTo(r, 0); - } - function _one_x(ctx, r) { - ctx.moveTo(-r, r); - ctx.lineTo(r, -r); - ctx.moveTo(-r, -r); - ctx.lineTo(r, r); - } - function _one_cross(ctx, r) { - ctx.moveTo(0, r); - ctx.lineTo(0, -r); - ctx.moveTo(-r, 0); - ctx.lineTo(r, 0); - } - function _one_diamond(ctx, r) { - ctx.moveTo(0, r); - ctx.lineTo(r / 1.5, 0); - ctx.lineTo(0, -r); - ctx.lineTo(-r / 1.5, 0); - ctx.closePath(); - } - function _one_hex(ctx, r) { - var r2 = r / 2; - var h = SQ3 * r2; - ctx.moveTo(r, 0); - ctx.lineTo(r2, -h); - ctx.lineTo(-r2, -h); - ctx.lineTo(-r, 0); - ctx.lineTo(-r2, h); - ctx.lineTo(r2, h); - ctx.closePath(); - } - function _one_tri(ctx, r) { - var h = r * SQ3; - var a = h / 3; - ctx.moveTo(-r, a); - ctx.lineTo(r, a); - ctx.lineTo(0, a - h); - ctx.closePath(); - } - function asterisk(ctx, i, r, line, _fill) { - var r2 = r * 0.65; - _one_cross(ctx, r); - _one_x(ctx, r2); - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function circle(ctx, i, r, line, fill) { - ctx.arc(0, 0, r, 0, 2 * Math.PI, false); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function circle_cross(ctx, i, r, line, fill) { - ctx.arc(0, 0, r, 0, 2 * Math.PI, false); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - _one_cross(ctx, r); - ctx.stroke(); - } - } - function circle_x(ctx, i, r, line, fill) { - ctx.arc(0, 0, r, 0, 2 * Math.PI, false); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - _one_x(ctx, r); - ctx.stroke(); - } - } - function cross(ctx, i, r, line, _fill) { - _one_cross(ctx, r); - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function diamond(ctx, i, r, line, fill) { - _one_diamond(ctx, r); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function diamond_cross(ctx, i, r, line, fill) { - _one_diamond(ctx, r); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - _one_cross(ctx, r); - ctx.stroke(); - } - } - function hex(ctx, i, r, line, fill) { - _one_hex(ctx, r); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function inverted_triangle(ctx, i, r, line, fill) { - ctx.rotate(Math.PI); - _one_tri(ctx, r); - ctx.rotate(-Math.PI); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function square(ctx, i, r, line, fill) { - var size = 2 * r; - ctx.rect(-r, -r, size, size); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function square_cross(ctx, i, r, line, fill) { - var size = 2 * r; - ctx.rect(-r, -r, size, size); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - _one_cross(ctx, r); - ctx.stroke(); - } - } - function square_x(ctx, i, r, line, fill) { - var size = 2 * r; - ctx.rect(-r, -r, size, size); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - _one_x(ctx, r); - ctx.stroke(); - } - } - function triangle(ctx, i, r, line, fill) { - _one_tri(ctx, r); - if (fill.doit) { - fill.set_vectorize(ctx, i); - ctx.fill(); - } - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function dash(ctx, i, r, line, _fill) { - _one_line(ctx, r); - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function x(ctx, i, r, line, _fill) { - _one_x(ctx, r); - if (line.doit) { - line.set_vectorize(ctx, i); - ctx.stroke(); - } - } - function _mk_model(type, f) { - var view = /** @class */ (function (_super) { - tslib_1.__extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - class_1.initClass = function () { - this.prototype._render_one = f; - }; - return class_1; - }(marker_1.MarkerView)); - view.initClass(); - var model = /** @class */ (function (_super) { - tslib_1.__extends(class_2, _super); - function class_2() { - return _super !== null && _super.apply(this, arguments) || this; - } - class_2.initClass = function () { - this.prototype.default_view = view; - this.prototype.type = type; - }; - return class_2; - }(marker_1.Marker)); - model.initClass(); - return model; - } - // markers are final, so no need to export views - exports.Asterisk = _mk_model('Asterisk', asterisk); - exports.CircleCross = _mk_model('CircleCross', circle_cross); - exports.CircleX = _mk_model('CircleX', circle_x); - exports.Cross = _mk_model('Cross', cross); - exports.Dash = _mk_model('Dash', dash); - exports.Diamond = _mk_model('Diamond', diamond); - exports.DiamondCross = _mk_model('DiamondCross', diamond_cross); - exports.Hex = _mk_model('Hex', hex); - exports.InvertedTriangle = _mk_model('InvertedTriangle', inverted_triangle); - exports.Square = _mk_model('Square', square); - exports.SquareCross = _mk_model('SquareCross', square_cross); - exports.SquareX = _mk_model('SquareX', square_x); - exports.Triangle = _mk_model('Triangle', triangle); - exports.X = _mk_model('X', x); - exports.marker_funcs = { - asterisk: asterisk, - circle: circle, - circle_cross: circle_cross, - circle_x: circle_x, - cross: cross, - diamond: diamond, - diamond_cross: diamond_cross, - hex: hex, - inverted_triangle: inverted_triangle, - square: square, - square_cross: square_cross, - square_x: square_x, - triangle: triangle, - dash: dash, - x: x, - }; -} -, -/* models/markers/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(177) /* ./defs */, exports); - var marker_1 = require(179) /* ./marker */; - exports.Marker = marker_1.Marker; - var scatter_1 = require(180) /* ./scatter */; - exports.Scatter = scatter_1.Scatter; -} -, -/* models/markers/marker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var xy_glyph_1 = require(150) /* ../glyphs/xy_glyph */; - var hittest = require(9) /* ../../core/hittest */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var MarkerView = /** @class */ (function (_super) { - tslib_1.__extends(MarkerView, _super); - function MarkerView() { - return _super !== null && _super.apply(this, arguments) || this; - } - MarkerView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, _size = _a._size, _angle = _a._angle; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i])) - continue; - var r = _size[i] / 2; - ctx.beginPath(); - ctx.translate(sx[i], sy[i]); - if (_angle[i]) - ctx.rotate(_angle[i]); - this._render_one(ctx, i, r, this.visuals.line, this.visuals.fill); - if (_angle[i]) - ctx.rotate(-_angle[i]); - ctx.translate(-sx[i], -sy[i]); - } - }; - MarkerView.prototype._mask_data = function () { - // dilate the inner screen region by max_size and map back to data space for use in - // spatial query - var hr = this.renderer.plot_view.frame.bbox.h_range; - var sx0 = hr.start - this.max_size; - var sx1 = hr.end + this.max_size; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var vr = this.renderer.plot_view.frame.bbox.v_range; - var sy0 = vr.start - this.max_size; - var sy1 = vr.end + this.max_size; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - return this.index.indices(bbox); - }; - MarkerView.prototype._hit_point = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - var sx0 = sx - this.max_size; - var sx1 = sx + this.max_size; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var sy0 = sy - this.max_size; - var sy1 = sy + this.max_size; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var candidates = this.index.indices(bbox); - var hits = []; - for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { - var i = candidates_1[_i]; - var s2 = this._size[i] / 2; - var dist = Math.abs(this.sx[i] - sx) + Math.abs(this.sy[i] - sy); - if (Math.abs(this.sx[i] - sx) <= s2 && Math.abs(this.sy[i] - sy) <= s2) { - hits.push([i, dist]); - } - } - return hittest.create_hit_test_result_from_hits(hits); - }; - MarkerView.prototype._hit_span = function (geometry) { - var _a, _b; - var sx = geometry.sx, sy = geometry.sy; - var _c = this.bounds(), minX = _c.minX, minY = _c.minY, maxX = _c.maxX, maxY = _c.maxY; - var result = hittest.create_empty_hit_test_result(); - var x0, x1; - var y0, y1; - if (geometry.direction == 'h') { - y0 = minY; - y1 = maxY; - var ms = this.max_size / 2; - var sx0 = sx - ms; - var sx1 = sx + ms; - _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - } - else { - x0 = minX; - x1 = maxX; - var ms = this.max_size / 2; - var sy0 = sy - ms; - var sy1 = sy + ms; - _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - } - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var hits = this.index.indices(bbox); - result.indices = hits; - return result; - }; - MarkerView.prototype._hit_rect = function (geometry) { - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]); - var result = hittest.create_empty_hit_test_result(); - result.indices = this.index.indices(bbox); - return result; - }; - MarkerView.prototype._hit_poly = function (geometry) { - var sx = geometry.sx, sy = geometry.sy; - // TODO (bev) use spatial index to pare candidate list - var candidates = array_1.range(0, this.sx.length); - var hits = []; - for (var i = 0, end = candidates.length; i < end; i++) { - var idx = candidates[i]; - if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) - hits.push(idx); - } - var result = hittest.create_empty_hit_test_result(); - result.indices = hits; - return result; - }; - MarkerView.prototype.draw_legend_for_index = function (ctx, _a, index) { - var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1; - // using objects like this seems a little wonky, since the keys are coerced to - // stings, but it works - var len = index + 1; - var sx = new Array(len); - sx[index] = (x0 + x1) / 2; - var sy = new Array(len); - sy[index] = (y0 + y1) / 2; - var size = new Array(len); - size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4; - var angle = new Array(len); - angle[index] = 0; // don't attempt to match glyph angle - this._render(ctx, [index], { sx: sx, sy: sy, _size: size, _angle: angle }); // XXX - }; - return MarkerView; - }(xy_glyph_1.XYGlyphView)); - exports.MarkerView = MarkerView; - var Marker = /** @class */ (function (_super) { - tslib_1.__extends(Marker, _super); - function Marker(attrs) { - return _super.call(this, attrs) || this; - } - Marker.initClass = function () { - this.mixins(['line', 'fill']); - this.define({ - size: [p.DistanceSpec, { units: "screen", value: 4 }], - angle: [p.AngleSpec, 0], - }); - }; - return Marker; - }(xy_glyph_1.XYGlyph)); - exports.Marker = Marker; - Marker.initClass(); -} -, -/* models/markers/scatter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var marker_1 = require(179) /* ./marker */; - var defs_1 = require(177) /* ./defs */; - var p = require(18) /* ../../core/properties */; - var ScatterView = /** @class */ (function (_super) { - tslib_1.__extends(ScatterView, _super); - function ScatterView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ScatterView.prototype._render = function (ctx, indices, _a) { - var sx = _a.sx, sy = _a.sy, _size = _a._size, _angle = _a._angle, _marker = _a._marker; - for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) { - var i = indices_1[_i]; - if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]) || _marker[i] == null) - continue; - var r = _size[i] / 2; - ctx.beginPath(); - ctx.translate(sx[i], sy[i]); - if (_angle[i]) - ctx.rotate(_angle[i]); - defs_1.marker_funcs[_marker[i]](ctx, i, r, this.visuals.line, this.visuals.fill); - if (_angle[i]) - ctx.rotate(-_angle[i]); - ctx.translate(-sx[i], -sy[i]); - } - }; - ScatterView.prototype.draw_legend_for_index = function (ctx, _a, index) { - var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1; - // using objects like this seems a little wonky, since the keys are coerced to - // stings, but it works - var len = index + 1; - var sx = new Array(len); - sx[index] = (x0 + x1) / 2; - var sy = new Array(len); - sy[index] = (y0 + y1) / 2; - var size = new Array(len); - size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4; - var angle = new Array(len); - angle[index] = 0; // don't attempt to match glyph angle - var marker = new Array(len); - marker[index] = this._marker[index]; - this._render(ctx, [index], { sx: sx, sy: sy, _size: size, _angle: angle, _marker: marker }); // XXX - }; - return ScatterView; - }(marker_1.MarkerView)); - exports.ScatterView = ScatterView; - var Scatter = /** @class */ (function (_super) { - tslib_1.__extends(Scatter, _super); - function Scatter(attrs) { - return _super.call(this, attrs) || this; - } - Scatter.initClass = function () { - this.prototype.type = 'Scatter'; - this.prototype.default_view = ScatterView; - this.define({ - marker: [p.MarkerSpec, { value: "circle" }], - }); - }; - return Scatter; - }(marker_1.Marker)); - exports.Scatter = Scatter; - Scatter.initClass(); -} -, -/* models/plots/gmap_plot */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var logging_1 = require(17) /* ../../core/logging */; - var plot_1 = require(184) /* ./plot */; - var p = require(18) /* ../../core/properties */; - var model_1 = require(62) /* ../../model */; - var range1d_1 = require(191) /* ../ranges/range1d */; - var gmap_plot_canvas_1 = require(182) /* ./gmap_plot_canvas */; - exports.GMapPlotView = gmap_plot_canvas_1.GMapPlotView; - var MapOptions = /** @class */ (function (_super) { - tslib_1.__extends(MapOptions, _super); - function MapOptions(attrs) { - return _super.call(this, attrs) || this; - } - MapOptions.initClass = function () { - this.prototype.type = "MapOptions"; - this.define({ - lat: [p.Number], - lng: [p.Number], - zoom: [p.Number, 12], - }); - }; - return MapOptions; - }(model_1.Model)); - exports.MapOptions = MapOptions; - MapOptions.initClass(); - var GMapOptions = /** @class */ (function (_super) { - tslib_1.__extends(GMapOptions, _super); - function GMapOptions(attrs) { - return _super.call(this, attrs) || this; - } - GMapOptions.initClass = function () { - this.prototype.type = "GMapOptions"; - this.define({ - map_type: [p.String, "roadmap"], - scale_control: [p.Boolean, false], - styles: [p.String], - tilt: [p.Int, 45], - }); - }; - return GMapOptions; - }(MapOptions)); - exports.GMapOptions = GMapOptions; - GMapOptions.initClass(); - var GMapPlot = /** @class */ (function (_super) { - tslib_1.__extends(GMapPlot, _super); - function GMapPlot(attrs) { - return _super.call(this, attrs) || this; - } - GMapPlot.initClass = function () { - this.prototype.type = "GMapPlot"; - this.prototype.default_view = gmap_plot_canvas_1.GMapPlotView; - // This seems to be necessary so that everything can initialize. - // Feels very clumsy, but I'm not sure how the properties system wants - // to handle something like this situation. - this.define({ - map_options: [p.Instance], - api_key: [p.String], - }); - this.override({ - x_range: function () { return new range1d_1.Range1d(); }, - y_range: function () { return new range1d_1.Range1d(); }, - }); - }; - GMapPlot.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.use_map = true; - if (!this.api_key) - logging_1.logger.error("api_key is required. See https://developers.google.com/maps/documentation/javascript/get-api-key for more information on how to obtain your own."); - }; - return GMapPlot; - }(plot_1.Plot)); - exports.GMapPlot = GMapPlot; - GMapPlot.initClass(); -} -, -/* models/plots/gmap_plot_canvas */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var signaling_1 = require(22) /* ../../core/signaling */; - var projections_1 = require(36) /* ../../core/util/projections */; - var plot_canvas_1 = require(185) /* ./plot_canvas */; - var gmaps_ready = new signaling_1.Signal0({}, "gmaps_ready"); - var load_google_api = function (api_key) { - window._bokeh_gmaps_callback = function () { return gmaps_ready.emit(); }; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = "https://maps.googleapis.com/maps/api/js?key=" + api_key + "&callback=_bokeh_gmaps_callback"; - document.body.appendChild(script); - }; - var GMapPlotView = /** @class */ (function (_super) { - tslib_1.__extends(GMapPlotView, _super); - function GMapPlotView() { - return _super !== null && _super.apply(this, arguments) || this; - } - GMapPlotView.prototype.initialize = function () { - var _this = this; - this.pause(); - _super.prototype.initialize.call(this); - this._tiles_loaded = false; - this.zoom_count = 0; - var _a = this.model.map_options, zoom = _a.zoom, lat = _a.lat, lng = _a.lng; - this.initial_zoom = zoom; - this.initial_lat = lat; - this.initial_lng = lng; - this.canvas_view.map_el.style.position = "absolute"; - if (typeof google === "undefined" || google.maps == null) { - if (typeof window._bokeh_gmaps_callback === "undefined") { - load_google_api(this.model.api_key); - } - gmaps_ready.connect(function () { return _this.request_render(); }); - } - this.unpause(); - }; - GMapPlotView.prototype.update_range = function (range_info) { - // RESET ------------------------- - if (range_info == null) { - this.map.setCenter({ lat: this.initial_lat, lng: this.initial_lng }); - this.map.setOptions({ zoom: this.initial_zoom }); - _super.prototype.update_range.call(this, null); - // PAN ---------------------------- - } - else if (range_info.sdx != null || range_info.sdy != null) { - this.map.panBy(range_info.sdx || 0, range_info.sdy || 0); - _super.prototype.update_range.call(this, range_info); - // ZOOM --------------------------- - } - else if (range_info.factor != null) { - // The zoom count decreases the sensitivity of the zoom. (We could make this user configurable) - var zoom_change = void 0; - if (this.zoom_count !== 10) { - this.zoom_count += 1; - return; - } - this.zoom_count = 0; - this.pause(); - _super.prototype.update_range.call(this, range_info); - if (range_info.factor < 0) - zoom_change = -1; - else - zoom_change = 1; - var old_map_zoom = this.map.getZoom(); - var new_map_zoom = old_map_zoom + zoom_change; - // Zooming out too far causes problems - if (new_map_zoom >= 2) { - this.map.setZoom(new_map_zoom); - // Check we haven't gone out of bounds, and if we have undo the zoom - var _a = this._get_projected_bounds(), proj_xstart = _a[0], proj_xend = _a[1]; - if (proj_xend - proj_xstart < 0) { - this.map.setZoom(old_map_zoom); - } - } - this.unpause(); - } - // Finally re-center - this._set_bokeh_ranges(); - }; - GMapPlotView.prototype._build_map = function () { - var _this = this; - var maps = google.maps; - this.map_types = { - satellite: maps.MapTypeId.SATELLITE, - terrain: maps.MapTypeId.TERRAIN, - roadmap: maps.MapTypeId.ROADMAP, - hybrid: maps.MapTypeId.HYBRID, - }; - var mo = this.model.map_options; - var map_options = { - center: new maps.LatLng(mo.lat, mo.lng), - zoom: mo.zoom, - disableDefaultUI: true, - mapTypeId: this.map_types[mo.map_type], - scaleControl: mo.scale_control, - tilt: mo.tilt, - }; - if (mo.styles != null) - map_options.styles = JSON.parse(mo.styles); - // create the map with above options in div - this.map = new maps.Map(this.canvas_view.map_el, map_options); - // update bokeh ranges whenever the map idles, which should be after most UI action - maps.event.addListener(this.map, 'idle', function () { return _this._set_bokeh_ranges(); }); - // also need an event when bounds change so that map resizes trigger renders too - maps.event.addListener(this.map, 'bounds_changed', function () { return _this._set_bokeh_ranges(); }); - maps.event.addListenerOnce(this.map, 'tilesloaded', function () { return _this._render_finished(); }); - // wire up listeners so that changes to properties are reflected - this.connect(this.model.properties.map_options.change, function () { return _this._update_options(); }); - this.connect(this.model.map_options.properties.styles.change, function () { return _this._update_styles(); }); - this.connect(this.model.map_options.properties.lat.change, function () { return _this._update_center('lat'); }); - this.connect(this.model.map_options.properties.lng.change, function () { return _this._update_center('lng'); }); - this.connect(this.model.map_options.properties.zoom.change, function () { return _this._update_zoom(); }); - this.connect(this.model.map_options.properties.map_type.change, function () { return _this._update_map_type(); }); - this.connect(this.model.map_options.properties.scale_control.change, function () { return _this._update_scale_control(); }); - this.connect(this.model.map_options.properties.tilt.change, function () { return _this._update_tilt(); }); - }; - GMapPlotView.prototype._render_finished = function () { - this._tiles_loaded = true; - this.notify_finished(); - }; - GMapPlotView.prototype.has_finished = function () { - return _super.prototype.has_finished.call(this) && this._tiles_loaded === true; - }; - GMapPlotView.prototype._get_latlon_bounds = function () { - var bounds = this.map.getBounds(); - var top_right = bounds.getNorthEast(); - var bottom_left = bounds.getSouthWest(); - var xstart = bottom_left.lng(); - var xend = top_right.lng(); - var ystart = bottom_left.lat(); - var yend = top_right.lat(); - return [xstart, xend, ystart, yend]; - }; - GMapPlotView.prototype._get_projected_bounds = function () { - var _a = this._get_latlon_bounds(), xstart = _a[0], xend = _a[1], ystart = _a[2], yend = _a[3]; - var _b = projections_1.wgs84_mercator.forward([xstart, ystart]), proj_xstart = _b[0], proj_ystart = _b[1]; - var _c = projections_1.wgs84_mercator.forward([xend, yend]), proj_xend = _c[0], proj_yend = _c[1]; - return [proj_xstart, proj_xend, proj_ystart, proj_yend]; - }; - GMapPlotView.prototype._set_bokeh_ranges = function () { - var _a = this._get_projected_bounds(), proj_xstart = _a[0], proj_xend = _a[1], proj_ystart = _a[2], proj_yend = _a[3]; - this.frame.x_range.setv({ start: proj_xstart, end: proj_xend }); - this.frame.y_range.setv({ start: proj_ystart, end: proj_yend }); - }; - GMapPlotView.prototype._update_center = function (fld) { - var c = this.map.getCenter().toJSON(); - c[fld] = this.model.map_options[fld]; - this.map.setCenter(c); - this._set_bokeh_ranges(); - }; - GMapPlotView.prototype._update_map_type = function () { - this.map.setOptions({ mapTypeId: this.map_types[this.model.map_options.map_type] }); - }; - GMapPlotView.prototype._update_scale_control = function () { - this.map.setOptions({ scaleControl: this.model.map_options.scale_control }); - }; - GMapPlotView.prototype._update_tilt = function () { - this.map.setOptions({ tilt: this.model.map_options.tilt }); - }; - GMapPlotView.prototype._update_options = function () { - this._update_styles(); - this._update_center('lat'); - this._update_center('lng'); - this._update_zoom(); - this._update_map_type(); - }; - GMapPlotView.prototype._update_styles = function () { - this.map.setOptions({ styles: JSON.parse(this.model.map_options.styles) }); - }; - GMapPlotView.prototype._update_zoom = function () { - this.map.setOptions({ zoom: this.model.map_options.zoom }); - this._set_bokeh_ranges(); - }; - // this method is expected and called by PlotView.render - GMapPlotView.prototype._map_hook = function (_ctx, frame_box) { - var left = frame_box[0], top = frame_box[1], width = frame_box[2], height = frame_box[3]; - this.canvas_view.map_el.style.top = top + "px"; - this.canvas_view.map_el.style.left = left + "px"; - this.canvas_view.map_el.style.width = width + "px"; - this.canvas_view.map_el.style.height = height + "px"; - if (this.map == null && typeof google !== "undefined" && google.maps != null) - this._build_map(); - }; - // this overrides the standard _paint_empty to make the inner canvas transparent - GMapPlotView.prototype._paint_empty = function (ctx, frame_box) { - var ow = this.layout._width.value; - var oh = this.layout._height.value; - var left = frame_box[0], top = frame_box[1], iw = frame_box[2], ih = frame_box[3]; - ctx.clearRect(0, 0, ow, oh); - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.lineTo(0, oh); - ctx.lineTo(ow, oh); - ctx.lineTo(ow, 0); - ctx.lineTo(0, 0); - ctx.moveTo(left, top); - ctx.lineTo(left + iw, top); - ctx.lineTo(left + iw, top + ih); - ctx.lineTo(left, top + ih); - ctx.lineTo(left, top); - ctx.closePath(); - if (this.model.border_fill_color != null) { - ctx.fillStyle = this.model.border_fill_color; - ctx.fill(); - } - }; - return GMapPlotView; - }(plot_canvas_1.PlotView)); - exports.GMapPlotView = GMapPlotView; -} -, -/* models/plots/index */ function _(require, module, exports) { - var gmap_plot_1 = require(181) /* ./gmap_plot */; - exports.MapOptions = gmap_plot_1.MapOptions; - var gmap_plot_2 = require(181) /* ./gmap_plot */; - exports.GMapOptions = gmap_plot_2.GMapOptions; - var gmap_plot_3 = require(181) /* ./gmap_plot */; - exports.GMapPlot = gmap_plot_3.GMapPlot; - var plot_1 = require(184) /* ./plot */; - exports.Plot = plot_1.Plot; -} -, -/* models/plots/plot */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../core/properties */; - var signaling_1 = require(22) /* ../../core/signaling */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var types_1 = require(46) /* ../../core/util/types */; - var layout_dom_1 = require(163) /* ../layouts/layout_dom */; - var title_1 = require(78) /* ../annotations/title */; - var linear_scale_1 = require(200) /* ../scales/linear_scale */; - var toolbar_1 = require(278) /* ../tools/toolbar */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var glyph_renderer_1 = require(193) /* ../renderers/glyph_renderer */; - var data_range1d_1 = require(187) /* ../ranges/data_range1d */; - var plot_canvas_1 = require(185) /* ./plot_canvas */; - exports.PlotView = plot_canvas_1.PlotView; - var Plot = /** @class */ (function (_super) { - tslib_1.__extends(Plot, _super); - function Plot(attrs) { - return _super.call(this, attrs) || this; - } - Plot.initClass = function () { - this.prototype.type = "Plot"; - this.prototype.default_view = plot_canvas_1.PlotView; - this.mixins(["line:outline_", "fill:background_", "fill:border_"]); - this.define({ - toolbar: [p.Instance, function () { return new toolbar_1.Toolbar(); }], - toolbar_location: [p.Location, 'right'], - toolbar_sticky: [p.Boolean, true], - plot_width: [p.Number, 600], - plot_height: [p.Number, 600], - frame_width: [p.Number, null], - frame_height: [p.Number, null], - title: [p.Any, function () { return new title_1.Title({ text: "" }); }], - title_location: [p.Location, 'above'], - above: [p.Array, []], - below: [p.Array, []], - left: [p.Array, []], - right: [p.Array, []], - center: [p.Array, []], - renderers: [p.Array, []], - x_range: [p.Instance, function () { return new data_range1d_1.DataRange1d(); }], - extra_x_ranges: [p.Any, {}], - y_range: [p.Instance, function () { return new data_range1d_1.DataRange1d(); }], - extra_y_ranges: [p.Any, {}], - x_scale: [p.Instance, function () { return new linear_scale_1.LinearScale(); }], - y_scale: [p.Instance, function () { return new linear_scale_1.LinearScale(); }], - lod_factor: [p.Number, 10], - lod_interval: [p.Number, 300], - lod_threshold: [p.Number, 2000], - lod_timeout: [p.Number, 500], - hidpi: [p.Boolean, true], - output_backend: [p.OutputBackend, "canvas"], - min_border: [p.Number, 5], - min_border_top: [p.Number, null], - min_border_left: [p.Number, null], - min_border_bottom: [p.Number, null], - min_border_right: [p.Number, null], - inner_width: [p.Number], - inner_height: [p.Number], - outer_width: [p.Number], - outer_height: [p.Number], - match_aspect: [p.Boolean, false], - aspect_scale: [p.Number, 1], - }); - this.override({ - outline_line_color: "#e5e5e5", - border_fill_color: "#ffffff", - background_fill_color: "#ffffff", - }); - }; - Object.defineProperty(Plot.prototype, "width", { - get: function () { - var width = this.getv("width"); - return width != null ? width : this.plot_width; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Plot.prototype, "height", { - get: function () { - var height = this.getv("height"); - return height != null ? height : this.plot_height; - }, - enumerable: true, - configurable: true - }); - Plot.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.reset = new signaling_1.Signal0(this, "reset"); - for (var _i = 0, _a = object_1.values(this.extra_x_ranges).concat(this.x_range); _i < _a.length; _i++) { - var xr = _a[_i]; - var plots = xr.plots; - if (types_1.isArray(plots)) { - plots = plots.concat(this); - xr.setv({ plots: plots }, { silent: true }); - } - } - for (var _b = 0, _c = object_1.values(this.extra_y_ranges).concat(this.y_range); _b < _c.length; _b++) { - var yr = _c[_b]; - var plots = yr.plots; - if (types_1.isArray(plots)) { - plots = plots.concat(this); - yr.setv({ plots: plots }, { silent: true }); - } - } - }; - Plot.prototype.add_layout = function (renderer, side) { - if (side === void 0) { - side = "center"; - } - var side_renderers = this.getv(side); - side_renderers.push(renderer /* XXX */); - }; - Plot.prototype.remove_layout = function (renderer) { - var del = function (items) { - array_1.remove_by(items, function (item) { return item == renderer; }); - }; - del(this.left); - del(this.right); - del(this.above); - del(this.below); - del(this.center); - }; - Plot.prototype.add_renderers = function () { - var renderers = []; - for (var _i = 0; _i < arguments.length; _i++) { - renderers[_i] = arguments[_i]; - } - this.renderers = this.renderers.concat(renderers); - }; - Plot.prototype.add_glyph = function (glyph, source, extra_attrs) { - if (source === void 0) { - source = new column_data_source_1.ColumnDataSource(); - } - if (extra_attrs === void 0) { - extra_attrs = {}; - } - var attrs = tslib_1.__assign({}, extra_attrs, { data_source: source, glyph: glyph }); - var renderer = new glyph_renderer_1.GlyphRenderer(attrs); - this.add_renderers(renderer); - return renderer; - }; - Plot.prototype.add_tools = function () { - var tools = []; - for (var _i = 0; _i < arguments.length; _i++) { - tools[_i] = arguments[_i]; - } - this.toolbar.tools = this.toolbar.tools.concat(tools); - }; - Object.defineProperty(Plot.prototype, "panels", { - get: function () { - return this.side_panels.concat(this.center); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Plot.prototype, "side_panels", { - get: function () { - var _a = this, above = _a.above, below = _a.below, left = _a.left, right = _a.right; - return array_1.concat([above, below, left, right]); - }, - enumerable: true, - configurable: true - }); - return Plot; - }(layout_dom_1.LayoutDOM)); - exports.Plot = Plot; - Plot.initClass(); -} -, -/* models/plots/plot_canvas */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var cartesian_frame_1 = require(95) /* ../canvas/cartesian_frame */; - var canvas_1 = require(94) /* ../canvas/canvas */; - var data_range1d_1 = require(187) /* ../ranges/data_range1d */; - var glyph_renderer_1 = require(193) /* ../renderers/glyph_renderer */; - var layout_dom_1 = require(163) /* ../layouts/layout_dom */; - var title_1 = require(78) /* ../annotations/title */; - var axis_1 = require(82) /* ../axes/axis */; - var toolbar_panel_1 = require(79) /* ../annotations/toolbar_panel */; - var bokeh_events_1 = require(3) /* ../../core/bokeh_events */; - var signaling_1 = require(22) /* ../../core/signaling */; - var build_views_1 = require(4) /* ../../core/build_views */; - var visuals_1 = require(51) /* ../../core/visuals */; - var logging_1 = require(17) /* ../../core/logging */; - var throttle_1 = require(44) /* ../../core/util/throttle */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var layout_1 = require(13) /* ../../core/layout */; - var alignments_1 = require(10) /* ../../core/layout/alignments */; - var side_panel_1 = require(15) /* ../../core/layout/side_panel */; - var grid_1 = require(11) /* ../../core/layout/grid */; - var bbox_1 = require(27) /* ../../core/util/bbox */; - var global_gl = null; - var PlotLayout = /** @class */ (function (_super) { - tslib_1.__extends(PlotLayout, _super); - function PlotLayout() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.min_border = { left: 0, top: 0, right: 0, bottom: 0 }; - return _this; - } - PlotLayout.prototype._measure = function (viewport) { - var _this = this; - viewport = new layout_1.Sizeable(viewport).bounded_to(this.sizing.size); - var left_hint = this.left_panel.measure({ width: 0, height: viewport.height }); - var left = Math.max(left_hint.width, this.min_border.left); - var right_hint = this.right_panel.measure({ width: 0, height: viewport.height }); - var right = Math.max(right_hint.width, this.min_border.right); - var top_hint = this.top_panel.measure({ width: viewport.width, height: 0 }); - var top = Math.max(top_hint.height, this.min_border.top); - var bottom_hint = this.bottom_panel.measure({ width: viewport.width, height: 0 }); - var bottom = Math.max(bottom_hint.height, this.min_border.bottom); - var center_viewport = new layout_1.Sizeable(viewport).shrink_by({ left: left, right: right, top: top, bottom: bottom }); - var center = this.center_panel.measure(center_viewport); - var width = left + center.width + right; - var height = top + center.height + bottom; - var align = (function () { - var _a = _this.center_panel.sizing, width_policy = _a.width_policy, height_policy = _a.height_policy; - return width_policy != "fixed" && height_policy != "fixed"; - })(); - return { width: width, height: height, inner: { left: left, right: right, top: top, bottom: bottom }, align: align }; - }; - PlotLayout.prototype._set_geometry = function (outer, inner) { - _super.prototype._set_geometry.call(this, outer, inner); - this.center_panel.set_geometry(inner); - var left_hint = this.left_panel.measure({ width: 0, height: outer.height }); - var right_hint = this.right_panel.measure({ width: 0, height: outer.height }); - var top_hint = this.top_panel.measure({ width: outer.width, height: 0 }); - var bottom_hint = this.bottom_panel.measure({ width: outer.width, height: 0 }); - var left = inner.left, top = inner.top, right = inner.right, bottom = inner.bottom; - this.top_panel.set_geometry(new bbox_1.BBox({ left: left, right: right, bottom: top, height: top_hint.height })); - this.bottom_panel.set_geometry(new bbox_1.BBox({ left: left, right: right, top: bottom, height: bottom_hint.height })); - this.left_panel.set_geometry(new bbox_1.BBox({ top: top, bottom: bottom, right: left, width: left_hint.width })); - this.right_panel.set_geometry(new bbox_1.BBox({ top: top, bottom: bottom, left: right, width: right_hint.width })); - }; - return PlotLayout; - }(layout_1.Layoutable)); - exports.PlotLayout = PlotLayout; - var PlotView = /** @class */ (function (_super) { - tslib_1.__extends(PlotView, _super); - function PlotView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._outer_bbox = new bbox_1.BBox(); - _this._inner_bbox = new bbox_1.BBox(); - _this._needs_paint = true; - _this._needs_layout = false; - return _this; - } - Object.defineProperty(PlotView.prototype, "canvas_overlays", { - get: function () { - return this.canvas_view.overlays_el; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PlotView.prototype, "canvas_events", { - get: function () { - return this.canvas_view.events_el; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PlotView.prototype, "is_paused", { - get: function () { - return this._is_paused != null && this._is_paused !== 0; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PlotView.prototype, "child_models", { - get: function () { - return []; - }, - enumerable: true, - configurable: true - }); - PlotView.prototype.pause = function () { - if (this._is_paused == null) - this._is_paused = 1; - else - this._is_paused += 1; - }; - PlotView.prototype.unpause = function (no_render) { - if (no_render === void 0) { - no_render = false; - } - if (this._is_paused == null) - throw new Error("wasn't paused"); - this._is_paused -= 1; - if (this._is_paused == 0 && !no_render) - this.request_paint(); - }; - // TODO: this needs to be removed - PlotView.prototype.request_render = function () { - this.request_paint(); - }; - PlotView.prototype.request_paint = function () { - if (!this.is_paused) - this.throttled_paint(); - }; - PlotView.prototype.request_layout = function () { - this._needs_layout = true; - this.request_paint(); - }; - PlotView.prototype.reset = function () { - this.clear_state(); - this.reset_range(); - this.reset_selection(); - this.model.trigger_event(new bokeh_events_1.Reset()); - }; - PlotView.prototype.remove = function () { - this.ui_event_bus.destroy(); - build_views_1.remove_views(this.renderer_views); - build_views_1.remove_views(this.tool_views); - this.canvas_view.remove(); - _super.prototype.remove.call(this); - }; - PlotView.prototype.render = function () { - _super.prototype.render.call(this); - this.el.appendChild(this.canvas_view.el); - this.canvas_view.render(); - }; - PlotView.prototype.initialize = function () { - var _this = this; - this.pause(); - _super.prototype.initialize.call(this); - this.force_paint = new signaling_1.Signal0(this, "force_paint"); - this.state_changed = new signaling_1.Signal0(this, "state_changed"); - this.lod_started = false; - this.visuals = new visuals_1.Visuals(this.model); // XXX - this._initial_state_info = { - selection: {}, - dimensions: { width: 0, height: 0 }, - }; - this.visibility_callbacks = []; - this.state = { history: [], index: -1 }; - this.canvas = new canvas_1.Canvas({ - map: this.model.use_map || false, - use_hidpi: this.model.hidpi, - output_backend: this.model.output_backend, - }); - this.frame = new cartesian_frame_1.CartesianFrame(this.model.x_scale, this.model.y_scale, this.model.x_range, this.model.y_range, this.model.extra_x_ranges, this.model.extra_y_ranges); - this.canvas_view = new this.canvas.default_view({ model: this.canvas, parent: this }); - // If requested, try enabling webgl - if (this.model.output_backend == "webgl") - this.init_webgl(); - this.throttled_paint = throttle_1.throttle((function () { return _this.force_paint.emit(); }), 15); // TODO (bev) configurable - // XXX: lazy value import to avoid touching window - var UIEvents = require(23) /* ../../core/ui_events */.UIEvents; - this.ui_event_bus = new UIEvents(this, this.model.toolbar, this.canvas_view.events_el); - var _a = this.model, title_location = _a.title_location, title = _a.title; - if (title_location != null && title != null) { - this._title = title instanceof title_1.Title ? title : new title_1.Title({ text: title }); - } - var _b = this.model, toolbar_location = _b.toolbar_location, toolbar = _b.toolbar; - if (toolbar_location != null && toolbar != null) { - this._toolbar = new toolbar_panel_1.ToolbarPanel({ toolbar: toolbar }); - toolbar.toolbar_location = toolbar_location; - } - this.renderer_views = {}; - this.tool_views = {}; - this.build_renderer_views(); - this.build_tool_views(); - this.update_dataranges(); - this.unpause(true); - logging_1.logger.debug("PlotView initialized"); - }; - PlotView.prototype._width_policy = function () { - return this.model.frame_width == null ? _super.prototype._width_policy.call(this) : "min"; - }; - PlotView.prototype._height_policy = function () { - return this.model.frame_height == null ? _super.prototype._height_policy.call(this) : "min"; - }; - PlotView.prototype._update_layout = function () { - var _this = this; - this.layout = new PlotLayout(); - this.layout.set_sizing(this.box_sizing()); - var _a = this.model, frame_width = _a.frame_width, frame_height = _a.frame_height; - this.layout.center_panel = this.frame; - this.layout.center_panel.set_sizing(tslib_1.__assign({}, (frame_width != null ? { width_policy: "fixed", width: frame_width } : { width_policy: "fit" }), (frame_height != null ? { height_policy: "fixed", height: frame_height } : { height_policy: "fit" }))); - var above = array_1.copy(this.model.above); - var below = array_1.copy(this.model.below); - var left = array_1.copy(this.model.left); - var right = array_1.copy(this.model.right); - var get_side = function (side) { - switch (side) { - case "above": return above; - case "below": return below; - case "left": return left; - case "right": return right; - } - }; - var _b = this.model, title_location = _b.title_location, title = _b.title; - if (title_location != null && title != null) { - get_side(title_location).push(this._title); - } - var _c = this.model, toolbar_location = _c.toolbar_location, toolbar = _c.toolbar; - if (toolbar_location != null && toolbar != null) { - var panels = get_side(toolbar_location); - var push_toolbar = true; - if (this.model.toolbar_sticky) { - for (var i = 0; i < panels.length; i++) { - var panel = panels[i]; - if (panel instanceof title_1.Title) { - if (toolbar_location == "above" || toolbar_location == "below") - panels[i] = [panel, this._toolbar]; - else - panels[i] = [this._toolbar, panel]; - push_toolbar = false; - break; - } - } - } - if (push_toolbar) - panels.push(this._toolbar); - } - var set_layout = function (side, model) { - var view = _this.renderer_views[model.id]; - return view.layout = new side_panel_1.SidePanel(side, view); - }; - var set_layouts = function (side, panels) { - var horizontal = side == "above" || side == "below"; - var layouts = []; - for (var _i = 0, panels_1 = panels; _i < panels_1.length; _i++) { - var panel = panels_1[_i]; - if (types_1.isArray(panel)) { - var items = panel.map(function (subpanel) { - var _a; - var item = set_layout(side, subpanel); - if (subpanel instanceof toolbar_panel_1.ToolbarPanel) { - var dim = horizontal ? "width_policy" : "height_policy"; - item.set_sizing(tslib_1.__assign({}, item.sizing, (_a = {}, _a[dim] = "min", _a))); - } - return item; - }); - var layout = void 0; - if (horizontal) { - layout = new grid_1.Row(items); - layout.set_sizing({ width_policy: "max", height_policy: "min" }); - } - else { - layout = new grid_1.Column(items); - layout.set_sizing({ width_policy: "min", height_policy: "max" }); - } - layout.absolute = true; - layouts.push(layout); - } - else - layouts.push(set_layout(side, panel)); - } - return layouts; - }; - var min_border = this.model.min_border != null ? this.model.min_border : 0; - this.layout.min_border = { - left: this.model.min_border_left != null ? this.model.min_border_left : min_border, - top: this.model.min_border_top != null ? this.model.min_border_top : min_border, - right: this.model.min_border_right != null ? this.model.min_border_right : min_border, - bottom: this.model.min_border_bottom != null ? this.model.min_border_bottom : min_border, - }; - var top_panel = new alignments_1.VStack(); - var bottom_panel = new alignments_1.VStack(); - var left_panel = new alignments_1.HStack(); - var right_panel = new alignments_1.HStack(); - top_panel.children = array_1.reversed(set_layouts("above", above)); - bottom_panel.children = set_layouts("below", below); - left_panel.children = array_1.reversed(set_layouts("left", left)); - right_panel.children = set_layouts("right", right); - top_panel.set_sizing({ width_policy: "fit", height_policy: "min" /*, min_height: this.layout.min_border.top*/ }); - bottom_panel.set_sizing({ width_policy: "fit", height_policy: "min" /*, min_height: this.layout.min_width.bottom*/ }); - left_panel.set_sizing({ width_policy: "min", height_policy: "fit" /*, min_width: this.layout.min_width.left*/ }); - right_panel.set_sizing({ width_policy: "min", height_policy: "fit" /*, min_width: this.layout.min_width.right*/ }); - this.layout.top_panel = top_panel; - this.layout.bottom_panel = bottom_panel; - this.layout.left_panel = left_panel; - this.layout.right_panel = right_panel; - }; - Object.defineProperty(PlotView.prototype, "axis_views", { - get: function () { - var views = []; - for (var id in this.renderer_views) { - var child_view = this.renderer_views[id]; - if (child_view instanceof axis_1.AxisView) - views.push(child_view); - } - return views; - }, - enumerable: true, - configurable: true - }); - PlotView.prototype.set_cursor = function (cursor) { - if (cursor === void 0) { - cursor = "default"; - } - this.canvas_view.el.style.cursor = cursor; - }; - PlotView.prototype.set_toolbar_visibility = function (visible) { - for (var _i = 0, _a = this.visibility_callbacks; _i < _a.length; _i++) { - var callback = _a[_i]; - callback(visible); - } - }; - PlotView.prototype.init_webgl = function () { - // We use a global invisible canvas and gl context. By having a global context, - // we avoid the limitation of max 16 contexts that most browsers have. - if (global_gl == null) { - var canvas = document.createElement('canvas'); - var opts = { premultipliedAlpha: true }; - var ctx = canvas.getContext("webgl", opts) || canvas.getContext("experimental-webgl", opts); - // If WebGL is available, we store a reference to the gl canvas on - // the ctx object, because that's what gets passed everywhere. - if (ctx != null) - global_gl = { canvas: canvas, ctx: ctx }; - } - if (global_gl != null) - this.gl = global_gl; - else - logging_1.logger.warn('WebGL is not supported, falling back to 2D canvas.'); - }; - PlotView.prototype.prepare_webgl = function (ratio, frame_box) { - // Prepare WebGL for a drawing pass - if (this.gl != null) { - var canvas = this.canvas_view.get_canvas_element(); - // Sync canvas size - this.gl.canvas.width = canvas.width; - this.gl.canvas.height = canvas.height; - // Prepare GL for drawing - var gl = this.gl.ctx; - gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT || gl.DEPTH_BUFFER_BIT); - // Clipping - gl.enable(gl.SCISSOR_TEST); - var sx = frame_box[0], sy = frame_box[1], w = frame_box[2], h = frame_box[3]; - var _a = this.canvas_view.bbox, xview = _a.xview, yview = _a.yview; - var vx = xview.compute(sx); - var vy = yview.compute(sy + h); - gl.scissor(ratio * vx, ratio * vy, ratio * w, ratio * h); // lower left corner, width, height - // Setup blending - gl.enable(gl.BLEND); - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE); // premultipliedAlpha == true - } - }; - //gl.blendFuncSeparate(gl.ONE_MINUS_DST_ALPHA, gl.DST_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE) # Without premultipliedAlpha == false - PlotView.prototype.blit_webgl = function (ratio) { - // This should be called when the ctx has no state except the HIDPI transform - var ctx = this.canvas_view.ctx; - if (this.gl != null) { - // Blit gl canvas into the 2D canvas. To do 1-on-1 blitting, we need - // to remove the hidpi transform, then blit, then restore. - // ctx.globalCompositeOperation = "source-over" -> OK; is the default - logging_1.logger.debug('drawing with WebGL'); - ctx.restore(); - ctx.drawImage(this.gl.canvas, 0, 0); - // Set back hidpi transform - ctx.save(); - ctx.scale(ratio, ratio); - ctx.translate(0.5, 0.5); - } - }; - PlotView.prototype.update_dataranges = function () { - // Update any DataRange1ds here - var bounds = {}; - var log_bounds = {}; - var calculate_log_bounds = false; - for (var _i = 0, _a = object_1.values(this.frame.x_ranges).concat(object_1.values(this.frame.y_ranges)); _i < _a.length; _i++) { - var r_1 = _a[_i]; - if (r_1 instanceof data_range1d_1.DataRange1d) { - if (r_1.scale_hint == "log") - calculate_log_bounds = true; - } - } - for (var id in this.renderer_views) { - var view = this.renderer_views[id]; - if (view instanceof glyph_renderer_1.GlyphRendererView) { - var bds = view.glyph.bounds(); - if (bds != null) - bounds[id] = bds; - if (calculate_log_bounds) { - var log_bds = view.glyph.log_bounds(); - if (log_bds != null) - log_bounds[id] = log_bds; - } - } - } - var follow_enabled = false; - var has_bounds = false; - var _b = this.frame.bbox, width = _b.width, height = _b.height; - var r; - if (this.model.match_aspect !== false && width != 0 && height != 0) - r = (1 / this.model.aspect_scale) * (width / height); - for (var _c = 0, _d = object_1.values(this.frame.x_ranges); _c < _d.length; _c++) { - var xr = _d[_c]; - if (xr instanceof data_range1d_1.DataRange1d) { - var bounds_to_use = xr.scale_hint == "log" ? log_bounds : bounds; - xr.update(bounds_to_use, 0, this.model.id, r); - if (xr.follow) { - follow_enabled = true; - } - } - if (xr.bounds != null) - has_bounds = true; - } - for (var _e = 0, _f = object_1.values(this.frame.y_ranges); _e < _f.length; _e++) { - var yr = _f[_e]; - if (yr instanceof data_range1d_1.DataRange1d) { - var bounds_to_use = yr.scale_hint == "log" ? log_bounds : bounds; - yr.update(bounds_to_use, 1, this.model.id, r); - if (yr.follow) { - follow_enabled = true; - } - } - if (yr.bounds != null) - has_bounds = true; - } - if (follow_enabled && has_bounds) { - logging_1.logger.warn('Follow enabled so bounds are unset.'); - for (var _g = 0, _h = object_1.values(this.frame.x_ranges); _g < _h.length; _g++) { - var xr = _h[_g]; - xr.bounds = null; - } - for (var _j = 0, _k = object_1.values(this.frame.y_ranges); _j < _k.length; _j++) { - var yr = _k[_j]; - yr.bounds = null; - } - } - this.range_update_timestamp = Date.now(); - }; - PlotView.prototype.map_to_screen = function (x, y, x_name, y_name) { - if (x_name === void 0) { - x_name = "default"; - } - if (y_name === void 0) { - y_name = "default"; - } - return this.frame.map_to_screen(x, y, x_name, y_name); - }; - PlotView.prototype.push_state = function (type, new_info) { - var _a = this.state, history = _a.history, index = _a.index; - var prev_info = history[index] != null ? history[index].info : {}; - var info = tslib_1.__assign({}, this._initial_state_info, prev_info, new_info); - this.state.history = this.state.history.slice(0, this.state.index + 1); - this.state.history.push({ type: type, info: info }); - this.state.index = this.state.history.length - 1; - this.state_changed.emit(); - }; - PlotView.prototype.clear_state = function () { - this.state = { history: [], index: -1 }; - this.state_changed.emit(); - }; - PlotView.prototype.can_undo = function () { - return this.state.index >= 0; - }; - PlotView.prototype.can_redo = function () { - return this.state.index < this.state.history.length - 1; - }; - PlotView.prototype.undo = function () { - if (this.can_undo()) { - this.state.index -= 1; - this._do_state_change(this.state.index); - this.state_changed.emit(); - } - }; - PlotView.prototype.redo = function () { - if (this.can_redo()) { - this.state.index += 1; - this._do_state_change(this.state.index); - this.state_changed.emit(); - } - }; - PlotView.prototype._do_state_change = function (index) { - var info = this.state.history[index] != null ? this.state.history[index].info : this._initial_state_info; - if (info.range != null) - this.update_range(info.range); - if (info.selection != null) - this.update_selection(info.selection); - }; - PlotView.prototype.get_selection = function () { - var selection = {}; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (renderer instanceof glyph_renderer_1.GlyphRenderer) { - var selected = renderer.data_source.selected; - selection[renderer.id] = selected; - } - } - return selection; - }; - PlotView.prototype.update_selection = function (selection) { - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (!(renderer instanceof glyph_renderer_1.GlyphRenderer)) - continue; - var ds = renderer.data_source; - if (selection != null) { - if (selection[renderer.id] != null) - ds.selected.update(selection[renderer.id], true, false); - } - else - ds.selection_manager.clear(); - } - }; - PlotView.prototype.reset_selection = function () { - this.update_selection(null); - }; - PlotView.prototype._update_ranges_together = function (range_info_iter) { - // Get weight needed to scale the diff of the range to honor interval limits - var weight = 1.0; - for (var _i = 0, range_info_iter_1 = range_info_iter; _i < range_info_iter_1.length; _i++) { - var _a = range_info_iter_1[_i], rng = _a[0], range_info = _a[1]; - weight = Math.min(weight, this._get_weight_to_constrain_interval(rng, range_info)); - } - // Apply shared weight to all ranges - if (weight < 1) { - for (var _b = 0, range_info_iter_2 = range_info_iter; _b < range_info_iter_2.length; _b++) { - var _c = range_info_iter_2[_b], rng = _c[0], range_info = _c[1]; - range_info.start = weight * range_info.start + (1 - weight) * rng.start; - range_info.end = weight * range_info.end + (1 - weight) * rng.end; - } - } - }; - PlotView.prototype._update_ranges_individually = function (range_info_iter, is_panning, is_scrolling, maintain_focus) { - var hit_bound = false; - for (var _i = 0, range_info_iter_3 = range_info_iter; _i < range_info_iter_3.length; _i++) { - var _a = range_info_iter_3[_i], rng = _a[0], range_info = _a[1]; - // Limit range interval first. Note that for scroll events, - // the interval has already been limited for all ranges simultaneously - if (!is_scrolling) { - var weight = this._get_weight_to_constrain_interval(rng, range_info); - if (weight < 1) { - range_info.start = weight * range_info.start + (1 - weight) * rng.start; - range_info.end = weight * range_info.end + (1 - weight) * rng.end; - } - } - // Prevent range from going outside limits - // Also ensure that range keeps the same delta when panning/scrolling - if (rng.bounds != null && rng.bounds != "auto") { // check `auto` for type-checking purpose - var _b = rng.bounds, min = _b[0], max = _b[1]; - var new_interval = Math.abs(range_info.end - range_info.start); - if (rng.is_reversed) { - if (min != null) { - if (min >= range_info.end) { - hit_bound = true; - range_info.end = min; - if (is_panning || is_scrolling) { - range_info.start = min + new_interval; - } - } - } - if (max != null) { - if (max <= range_info.start) { - hit_bound = true; - range_info.start = max; - if (is_panning || is_scrolling) { - range_info.end = max - new_interval; - } - } - } - } - else { - if (min != null) { - if (min >= range_info.start) { - hit_bound = true; - range_info.start = min; - if (is_panning || is_scrolling) { - range_info.end = min + new_interval; - } - } - } - if (max != null) { - if (max <= range_info.end) { - hit_bound = true; - range_info.end = max; - if (is_panning || is_scrolling) { - range_info.start = max - new_interval; - } - } - } - } - } - } - // Cancel the event when hitting a bound while scrolling. This ensures that - // the scroll-zoom tool maintains its focus position. Setting `maintain_focus` - // to false results in a more "gliding" behavior, allowing one to - // zoom out more smoothly, at the cost of losing the focus position. - if (is_scrolling && hit_bound && maintain_focus) - return; - for (var _c = 0, range_info_iter_4 = range_info_iter; _c < range_info_iter_4.length; _c++) { - var _d = range_info_iter_4[_c], rng = _d[0], range_info = _d[1]; - rng.have_updated_interactively = true; - if (rng.start != range_info.start || rng.end != range_info.end) - rng.setv(range_info); - } - }; - PlotView.prototype._get_weight_to_constrain_interval = function (rng, range_info) { - // Get the weight by which a range-update can be applied - // to still honor the interval limits (including the implicit - // max interval imposed by the bounds) - var min_interval = rng.min_interval; - var max_interval = rng.max_interval; - // Express bounds as a max_interval. By doing this, the application of - // bounds and interval limits can be applied independent from each-other. - if (rng.bounds != null && rng.bounds != "auto") { // check `auto` for type-checking purpose - var _a = rng.bounds, min = _a[0], max = _a[1]; - if (min != null && max != null) { - var max_interval2 = Math.abs(max - min); - max_interval = max_interval != null ? Math.min(max_interval, max_interval2) : max_interval2; - } - } - var weight = 1.0; - if (min_interval != null || max_interval != null) { - var old_interval = Math.abs(rng.end - rng.start); - var new_interval = Math.abs(range_info.end - range_info.start); - if (min_interval > 0 && new_interval < min_interval) { - weight = (old_interval - min_interval) / (old_interval - new_interval); - } - if (max_interval > 0 && new_interval > max_interval) { - weight = (max_interval - old_interval) / (new_interval - old_interval); - } - weight = Math.max(0.0, Math.min(1.0, weight)); - } - return weight; - }; - PlotView.prototype.update_range = function (range_info, is_panning, is_scrolling, maintain_focus) { - if (is_panning === void 0) { - is_panning = false; - } - if (is_scrolling === void 0) { - is_scrolling = false; - } - if (maintain_focus === void 0) { - maintain_focus = true; - } - this.pause(); - var _a = this.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges; - if (range_info == null) { - for (var name_1 in x_ranges) { - var rng = x_ranges[name_1]; - rng.reset(); - } - for (var name_2 in y_ranges) { - var rng = y_ranges[name_2]; - rng.reset(); - } - this.update_dataranges(); - } - else { - var range_info_iter = []; - for (var name_3 in x_ranges) { - var rng = x_ranges[name_3]; - range_info_iter.push([rng, range_info.xrs[name_3]]); - } - for (var name_4 in y_ranges) { - var rng = y_ranges[name_4]; - range_info_iter.push([rng, range_info.yrs[name_4]]); - } - if (is_scrolling) { - this._update_ranges_together(range_info_iter); // apply interval bounds while keeping aspect - } - this._update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus); - } - this.unpause(); - }; - PlotView.prototype.reset_range = function () { - this.update_range(null); - }; - PlotView.prototype._invalidate_layout = function () { - var _this = this; - var needs_layout = function () { - for (var _i = 0, _a = _this.model.side_panels; _i < _a.length; _i++) { - var panel = _a[_i]; - var view = _this.renderer_views[panel.id]; - if (view.layout.has_size_changed()) - return true; - } - return false; - }; - if (needs_layout()) - this.root.compute_layout(); - }; - PlotView.prototype.build_renderer_views = function () { - var _a, _b, _c, _d, _e, _f, _g; - this.computed_renderers = []; - (_a = this.computed_renderers).push.apply(_a, this.model.above); - (_b = this.computed_renderers).push.apply(_b, this.model.below); - (_c = this.computed_renderers).push.apply(_c, this.model.left); - (_d = this.computed_renderers).push.apply(_d, this.model.right); - (_e = this.computed_renderers).push.apply(_e, this.model.center); - (_f = this.computed_renderers).push.apply(_f, this.model.renderers); - if (this._title != null) - this.computed_renderers.push(this._title); - if (this._toolbar != null) - this.computed_renderers.push(this._toolbar); - for (var _i = 0, _h = this.model.toolbar.tools; _i < _h.length; _i++) { - var tool = _h[_i]; - if (tool.overlay != null) - this.computed_renderers.push(tool.overlay); - (_g = this.computed_renderers).push.apply(_g, tool.synthetic_renderers); - } - build_views_1.build_views(this.renderer_views, this.computed_renderers, { parent: this }); - }; - PlotView.prototype.get_renderer_views = function () { - var _this = this; - return this.computed_renderers.map(function (r) { return _this.renderer_views[r.id]; }); - }; - PlotView.prototype.build_tool_views = function () { - var _this = this; - var tool_models = this.model.toolbar.tools; - var new_tool_views = build_views_1.build_views(this.tool_views, tool_models, { parent: this }); - new_tool_views.map(function (tool_view) { return _this.ui_event_bus.register_tool(tool_view); }); - }; - PlotView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.force_paint, function () { return _this.repaint(); }); - var _a = this.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges; - for (var name_5 in x_ranges) { - var rng = x_ranges[name_5]; - this.connect(rng.change, function () { _this._needs_layout = true; _this.request_paint(); }); - } - for (var name_6 in y_ranges) { - var rng = y_ranges[name_6]; - this.connect(rng.change, function () { _this._needs_layout = true; _this.request_paint(); }); - } - this.connect(this.model.properties.renderers.change, function () { return _this.build_renderer_views(); }); - this.connect(this.model.toolbar.properties.tools.change, function () { _this.build_renderer_views(); _this.build_tool_views(); }); - this.connect(this.model.change, function () { return _this.request_paint(); }); - this.connect(this.model.reset, function () { return _this.reset(); }); - }; - PlotView.prototype.set_initial_range = function () { - // check for good values for ranges before setting initial range - var good_vals = true; - var _a = this.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges; - var xrs = {}; - var yrs = {}; - for (var name_7 in x_ranges) { - var _b = x_ranges[name_7], start = _b.start, end = _b.end; - if (start == null || end == null || types_1.isStrictNaN(start + end)) { - good_vals = false; - break; - } - xrs[name_7] = { start: start, end: end }; - } - if (good_vals) { - for (var name_8 in y_ranges) { - var _c = y_ranges[name_8], start = _c.start, end = _c.end; - if (start == null || end == null || types_1.isStrictNaN(start + end)) { - good_vals = false; - break; - } - yrs[name_8] = { start: start, end: end }; - } - } - if (good_vals) { - this._initial_state_info.range = { xrs: xrs, yrs: yrs }; - logging_1.logger.debug("initial ranges set"); - } - else - logging_1.logger.warn('could not set initial ranges'); - }; - PlotView.prototype.has_finished = function () { - if (!_super.prototype.has_finished.call(this)) - return false; - for (var id in this.renderer_views) { - var view = this.renderer_views[id]; - if (!view.has_finished()) - return false; - } - return true; - }; - PlotView.prototype.after_layout = function () { - _super.prototype.after_layout.call(this); - this._needs_layout = false; - this.model.setv({ - inner_width: Math.round(this.frame._width.value), - inner_height: Math.round(this.frame._height.value), - outer_width: Math.round(this.layout._width.value), - outer_height: Math.round(this.layout._height.value), - }, { no_change: true }); - if (this.model.match_aspect !== false) { - this.pause(); - this.update_dataranges(); - this.unpause(true); - } - if (!this._outer_bbox.equals(this.layout.bbox)) { - var _a = this.layout.bbox, width = _a.width, height = _a.height; - this.canvas_view.prepare_canvas(width, height); - this._outer_bbox = this.layout.bbox; - this._needs_paint = true; - } - if (!this._inner_bbox.equals(this.frame.inner_bbox)) { - this._inner_bbox = this.layout.inner_bbox; - this._needs_paint = true; - } - if (this._needs_paint) { - // XXX: can't be this.request_paint(), because it would trigger back-and-forth - // layout recomputing feedback loop between plots. Plots are also much more - // responsive this way, especially in interactive mode. - this._needs_paint = false; - this.paint(); - } - }; - PlotView.prototype.repaint = function () { - if (this._needs_layout) - this._invalidate_layout(); - this.paint(); - }; - PlotView.prototype.paint = function () { - var _this = this; - if (this.is_paused) - return; - logging_1.logger.trace("PlotView.paint() for " + this.model.id); - var document = this.model.document; - if (document != null) { - var interactive_duration = document.interactive_duration(); - if (interactive_duration >= 0 && interactive_duration < this.model.lod_interval) { - setTimeout(function () { - if (document.interactive_duration() > _this.model.lod_timeout) { - document.interactive_stop(_this.model); - } - _this.request_paint(); - }, this.model.lod_timeout); - } - else - document.interactive_stop(this.model); - } - for (var id in this.renderer_views) { - var v = this.renderer_views[id]; - if (this.range_update_timestamp == null || - (v instanceof glyph_renderer_1.GlyphRendererView && v.set_data_timestamp > this.range_update_timestamp)) { - this.update_dataranges(); - break; - } - } - var ctx = this.canvas_view.ctx; - var ratio = this.canvas.pixel_ratio; - // Set hidpi-transform - ctx.save(); // Save default state, do *after* getting ratio, cause setting canvas.width resets transforms - ctx.scale(ratio, ratio); - ctx.translate(0.5, 0.5); - var frame_box = [ - this.frame._left.value, - this.frame._top.value, - this.frame._width.value, - this.frame._height.value, - ]; - this._map_hook(ctx, frame_box); - this._paint_empty(ctx, frame_box); - this.prepare_webgl(ratio, frame_box); - ctx.save(); - if (this.visuals.outline_line.doit) { - this.visuals.outline_line.set_value(ctx); - var x0 = frame_box[0], y0 = frame_box[1], w = frame_box[2], h = frame_box[3]; - // XXX: shrink outline region by 1px to make right and bottom lines visible - // if they are on the edge of the canvas. - if (x0 + w == this.layout._width.value) { - w -= 1; - } - if (y0 + h == this.layout._height.value) { - h -= 1; - } - ctx.strokeRect(x0, y0, w, h); - } - ctx.restore(); - this._paint_levels(ctx, ['image', 'underlay', 'glyph'], frame_box, true); - this.blit_webgl(ratio); - this._paint_levels(ctx, ['annotation'], frame_box, false); - this._paint_levels(ctx, ['overlay'], frame_box, false); - if (this._initial_state_info.range == null) - this.set_initial_range(); - ctx.restore(); // Restore to default state - }; - PlotView.prototype._paint_levels = function (ctx, levels, clip_region, global_clip) { - ctx.save(); - if (global_clip) { - ctx.beginPath(); - ctx.rect.apply(ctx, clip_region); - ctx.clip(); - } - for (var _i = 0, levels_1 = levels; _i < levels_1.length; _i++) { - var level = levels_1[_i]; - for (var _a = 0, _b = this.computed_renderers; _a < _b.length; _a++) { - var renderer = _b[_a]; - if (renderer.level != level) - continue; - var renderer_view = this.renderer_views[renderer.id]; - if (!global_clip && renderer_view.needs_clip) { - ctx.save(); - ctx.beginPath(); - ctx.rect.apply(ctx, clip_region); - ctx.clip(); - } - renderer_view.render(); - if (!global_clip && renderer_view.needs_clip) { - ctx.restore(); - } - } - } - ctx.restore(); - }; - PlotView.prototype._map_hook = function (_ctx, _frame_box) { }; - PlotView.prototype._paint_empty = function (ctx, frame_box) { - var _a = [0, 0, this.layout._width.value, this.layout._height.value], cx = _a[0], cy = _a[1], cw = _a[2], ch = _a[3]; - var fx = frame_box[0], fy = frame_box[1], fw = frame_box[2], fh = frame_box[3]; - ctx.clearRect(cx, cy, cw, ch); - if (this.visuals.border_fill.doit) { - this.visuals.border_fill.set_value(ctx); - ctx.fillRect(cx, cy, cw, ch); - ctx.clearRect(fx, fy, fw, fh); - } - if (this.visuals.background_fill.doit) { - this.visuals.background_fill.set_value(ctx); - ctx.fillRect(fx, fy, fw, fh); - } - }; - PlotView.prototype.save = function (name) { - switch (this.model.output_backend) { - case "canvas": - case "webgl": { - var canvas = this.canvas_view.get_canvas_element(); - if (canvas.msToBlob != null) { - var blob = canvas.msToBlob(); - window.navigator.msSaveBlob(blob, name); - } - else { - var link = document.createElement('a'); - link.href = canvas.toDataURL('image/png'); - link.download = name + ".png"; - link.target = "_blank"; - link.dispatchEvent(new MouseEvent('click')); - } - break; - } - case "svg": { - var ctx = this.canvas_view._ctx; - var svg = ctx.getSerializedSvg(true); - var svgblob = new Blob([svg], { type: 'text/plain' }); - var downloadLink = document.createElement("a"); - downloadLink.download = name + ".svg"; - downloadLink.innerHTML = "Download svg"; - downloadLink.href = window.URL.createObjectURL(svgblob); - downloadLink.onclick = function (event) { return document.body.removeChild(event.target); }; - downloadLink.style.display = "none"; - document.body.appendChild(downloadLink); - downloadLink.click(); - break; - } - } - }; - PlotView.prototype.serializable_state = function () { - var _a = _super.prototype.serializable_state.call(this), children = _a.children, state = tslib_1.__rest(_a, ["children"]); - var renderers = this.get_renderer_views() - .map(function (view) { return view.serializable_state(); }) - .filter(function (item) { return "bbox" in item; }); - return tslib_1.__assign({}, state, { children: children.concat(renderers) }); // XXX - }; - return PlotView; - }(layout_dom_1.LayoutDOMView)); - exports.PlotView = PlotView; -} -, -/* models/ranges/data_range */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var range_1 = require(190) /* ./range */; - var p = require(18) /* ../../core/properties */; - var DataRange = /** @class */ (function (_super) { - tslib_1.__extends(DataRange, _super); - function DataRange(attrs) { - return _super.call(this, attrs) || this; - } - DataRange.initClass = function () { - this.prototype.type = "DataRange"; - this.define({ - names: [p.Array, []], - renderers: [p.Array, []], - }); - }; - return DataRange; - }(range_1.Range)); - exports.DataRange = DataRange; - DataRange.initClass(); -} -, -/* models/ranges/data_range1d */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var data_range_1 = require(186) /* ./data_range */; - var glyph_renderer_1 = require(193) /* ../renderers/glyph_renderer */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var bbox = require(27) /* ../../core/util/bbox */; - var array_1 = require(24) /* ../../core/util/array */; - var DataRange1d = /** @class */ (function (_super) { - tslib_1.__extends(DataRange1d, _super); - function DataRange1d(attrs) { - var _this = _super.call(this, attrs) || this; - _this._plot_bounds = {}; - _this.have_updated_interactively = false; - return _this; - } - DataRange1d.initClass = function () { - this.prototype.type = "DataRange1d"; - this.define({ - start: [p.Number], - end: [p.Number], - range_padding: [p.Number, 0.1], - range_padding_units: [p.PaddingUnits, "percent"], - flipped: [p.Boolean, false], - follow: [p.StartEnd,], - follow_interval: [p.Number], - default_span: [p.Number, 2], - }); - this.internal({ - scale_hint: [p.String, 'auto'], - }); - }; - DataRange1d.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._initial_start = this.start; - this._initial_end = this.end; - this._initial_range_padding = this.range_padding; - this._initial_range_padding_units = this.range_padding_units; - this._initial_follow = this.follow; - this._initial_follow_interval = this.follow_interval; - this._initial_default_span = this.default_span; - }; - Object.defineProperty(DataRange1d.prototype, "min", { - get: function () { - return Math.min(this.start, this.end); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DataRange1d.prototype, "max", { - get: function () { - return Math.max(this.start, this.end); - }, - enumerable: true, - configurable: true - }); - DataRange1d.prototype.computed_renderers = function () { - // TODO (bev) check that renderers actually configured with this range - var names = this.names; - var renderers = this.renderers; - if (renderers.length == 0) { - for (var _i = 0, _a = this.plots; _i < _a.length; _i++) { - var plot = _a[_i]; - var rs = plot.renderers.filter(function (r) { return r instanceof glyph_renderer_1.GlyphRenderer; }); - renderers = renderers.concat(rs); - } - } - if (names.length > 0) - renderers = renderers.filter(function (r) { return array_1.includes(names, r.name); }); - logging_1.logger.debug("computed " + renderers.length + " renderers for DataRange1d " + this.id); - for (var _b = 0, renderers_1 = renderers; _b < renderers_1.length; _b++) { - var r = renderers_1[_b]; - logging_1.logger.trace(" - " + r.type + " " + r.id); - } - return renderers; - }; - /*protected*/ DataRange1d.prototype._compute_plot_bounds = function (renderers, bounds) { - var result = bbox.empty(); - for (var _i = 0, renderers_2 = renderers; _i < renderers_2.length; _i++) { - var r = renderers_2[_i]; - if (bounds[r.id] != null) - result = bbox.union(result, bounds[r.id]); - } - return result; - }; - DataRange1d.prototype.adjust_bounds_for_aspect = function (bounds, ratio) { - var result = bbox.empty(); - var width = bounds.maxX - bounds.minX; - if (width <= 0) { - width = 1.0; - } - var height = bounds.maxY - bounds.minY; - if (height <= 0) { - height = 1.0; - } - var xcenter = 0.5 * (bounds.maxX + bounds.minX); - var ycenter = 0.5 * (bounds.maxY + bounds.minY); - if (width < ratio * height) { - width = ratio * height; - } - else { - height = width / ratio; - } - result.maxX = xcenter + 0.5 * width; - result.minX = xcenter - 0.5 * width; - result.maxY = ycenter + 0.5 * height; - result.minY = ycenter - 0.5 * height; - return result; - }; - /*protected*/ DataRange1d.prototype._compute_min_max = function (plot_bounds, dimension) { - var _a, _b; - var overall = bbox.empty(); - for (var k in plot_bounds) { - var v = plot_bounds[k]; - overall = bbox.union(overall, v); - } - var min, max; - if (dimension == 0) - _a = [overall.minX, overall.maxX], min = _a[0], max = _a[1]; - else - _b = [overall.minY, overall.maxY], min = _b[0], max = _b[1]; - return [min, max]; - }; - /*protected*/ DataRange1d.prototype._compute_range = function (min, max) { - var _a; - var range_padding = this.range_padding; // XXX: ? 0 - var start, end; - if (this.scale_hint == "log") { - if (isNaN(min) || !isFinite(min) || min <= 0) { - if (isNaN(max) || !isFinite(max) || max <= 0) - min = 0.1; - else - min = max / 100; - logging_1.logger.warn("could not determine minimum data value for log axis, DataRange1d using value " + min); - } - if (isNaN(max) || !isFinite(max) || max <= 0) { - if (isNaN(min) || !isFinite(min) || min <= 0) - max = 10; - else - max = min * 100; - logging_1.logger.warn("could not determine maximum data value for log axis, DataRange1d using value " + max); - } - var center = void 0, span = void 0; - if (max == min) { - span = this.default_span + 0.001; - center = Math.log(min) / Math.log(10); - } - else { - var log_min = void 0, log_max = void 0; - if (this.range_padding_units == "percent") { - log_min = Math.log(min) / Math.log(10); - log_max = Math.log(max) / Math.log(10); - span = (log_max - log_min) * (1 + range_padding); - } - else { - log_min = Math.log(min - range_padding) / Math.log(10); - log_max = Math.log(max + range_padding) / Math.log(10); - span = log_max - log_min; - } - center = (log_min + log_max) / 2.0; - } - start = Math.pow(10, center - span / 2.0); - end = Math.pow(10, center + span / 2.0); - } - else { - var span = void 0; - if (max == min) - span = this.default_span; - else { - if (this.range_padding_units == "percent") - span = (max - min) * (1 + range_padding); - else - span = (max - min) + 2 * range_padding; - } - var center = (max + min) / 2.0; - start = center - span / 2.0; - end = center + span / 2.0; - } - var follow_sign = +1; - if (this.flipped) { - _a = [end, start], start = _a[0], end = _a[1]; - follow_sign = -1; - } - var follow_interval = this.follow_interval; - if (follow_interval != null && Math.abs(start - end) > follow_interval) { - if (this.follow == 'start') - end = start + follow_sign * follow_interval; - else if (this.follow == 'end') - start = end - follow_sign * follow_interval; - } - return [start, end]; - }; - DataRange1d.prototype.update = function (bounds, dimension, bounds_id, ratio) { - if (this.have_updated_interactively) - return; - var renderers = this.computed_renderers(); - // update the raw data bounds for all renderers we care about - var total_bounds = this._compute_plot_bounds(renderers, bounds); - if (ratio != null) - total_bounds = this.adjust_bounds_for_aspect(total_bounds, ratio); - this._plot_bounds[bounds_id] = total_bounds; - // compute the min/mix for our specified dimension - var _a = this._compute_min_max(this._plot_bounds, dimension), min = _a[0], max = _a[1]; - // derive start, end from bounds and data range config - var _b = this._compute_range(min, max), start = _b[0], end = _b[1]; - if (this._initial_start != null) { - if (this.scale_hint == "log") { - if (this._initial_start > 0) - start = this._initial_start; - } - else - start = this._initial_start; - } - if (this._initial_end != null) { - if (this.scale_hint == "log") { - if (this._initial_end > 0) - end = this._initial_end; - } - else - end = this._initial_end; - } - // only trigger updates when there are changes - var _c = [this.start, this.end], _start = _c[0], _end = _c[1]; - if (start != _start || end != _end) { - var new_range = {}; - if (start != _start) - new_range.start = start; - if (end != _end) - new_range.end = end; - this.setv(new_range); - } - if (this.bounds == 'auto') - this.setv({ bounds: [start, end] }, { silent: true }); - this.change.emit(); - }; - DataRange1d.prototype.reset = function () { - this.have_updated_interactively = false; - // change events silenced as PlotView.update_dataranges triggers property callbacks - this.setv({ - range_padding: this._initial_range_padding, - range_padding_units: this._initial_range_padding_units, - follow: this._initial_follow, - follow_interval: this._initial_follow_interval, - default_span: this._initial_default_span, - }, { silent: true }); - this.change.emit(); - }; - return DataRange1d; - }(data_range_1.DataRange)); - exports.DataRange1d = DataRange1d; - DataRange1d.initClass(); -} -, -/* models/ranges/factor_range */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var range_1 = require(190) /* ./range */; - var p = require(18) /* ../../core/properties */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - function map_one_level(factors, padding, offset) { - if (offset === void 0) { - offset = 0; - } - var mapping = {}; - for (var i = 0; i < factors.length; i++) { - var factor = factors[i]; - if (factor in mapping) - throw new Error("duplicate factor or subfactor: " + factor); - else - mapping[factor] = { value: 0.5 + i * (1 + padding) + offset }; - } - return [mapping, (factors.length - 1) * padding]; - } - exports.map_one_level = map_one_level; - function map_two_levels(factors, outer_pad, factor_pad, offset) { - if (offset === void 0) { - offset = 0; - } - var mapping = {}; - var tops = {}; - var tops_order = []; - for (var _i = 0, factors_1 = factors; _i < factors_1.length; _i++) { - var _a = factors_1[_i], f0 = _a[0], f1 = _a[1]; - if (!(f0 in tops)) { - tops[f0] = []; - tops_order.push(f0); - } - tops[f0].push(f1); - } - var suboffset = offset; - var total_subpad = 0; - var _loop_1 = function (f0) { - var n = tops[f0].length; - var _a = map_one_level(tops[f0], factor_pad, suboffset), submap = _a[0], subpad = _a[1]; - total_subpad += subpad; - var subtot = array_1.sum(tops[f0].map(function (f1) { return submap[f1].value; })); - mapping[f0] = { value: subtot / n, mapping: submap }; - suboffset += n + outer_pad + subpad; - }; - for (var _b = 0, tops_order_1 = tops_order; _b < tops_order_1.length; _b++) { - var f0 = tops_order_1[_b]; - _loop_1(f0); - } - return [mapping, tops_order, (tops_order.length - 1) * outer_pad + total_subpad]; - } - exports.map_two_levels = map_two_levels; - function map_three_levels(factors, outer_pad, inner_pad, factor_pad, offset) { - if (offset === void 0) { - offset = 0; - } - var mapping = {}; - var tops = {}; - var tops_order = []; - for (var _i = 0, factors_2 = factors; _i < factors_2.length; _i++) { - var _a = factors_2[_i], f0 = _a[0], f1 = _a[1], f2 = _a[2]; - if (!(f0 in tops)) { - tops[f0] = []; - tops_order.push(f0); - } - tops[f0].push([f1, f2]); - } - var mids_order = []; - var suboffset = offset; - var total_subpad = 0; - var _loop_2 = function (f0) { - var n = tops[f0].length; - var _a = map_two_levels(tops[f0], inner_pad, factor_pad, suboffset), submap = _a[0], submids_order = _a[1], subpad = _a[2]; - for (var _i = 0, submids_order_1 = submids_order; _i < submids_order_1.length; _i++) { - var f1 = submids_order_1[_i]; - mids_order.push([f0, f1]); - } - total_subpad += subpad; - var subtot = array_1.sum(tops[f0].map(function (_a) { - var f1 = _a[0]; - return submap[f1].value; - })); - mapping[f0] = { value: subtot / n, mapping: submap }; - suboffset += n + outer_pad + subpad; - }; - for (var _b = 0, tops_order_2 = tops_order; _b < tops_order_2.length; _b++) { - var f0 = tops_order_2[_b]; - _loop_2(f0); - } - return [mapping, tops_order, mids_order, (tops_order.length - 1) * outer_pad + total_subpad]; - } - exports.map_three_levels = map_three_levels; - var FactorRange = /** @class */ (function (_super) { - tslib_1.__extends(FactorRange, _super); - function FactorRange(attrs) { - return _super.call(this, attrs) || this; - } - FactorRange.initClass = function () { - this.prototype.type = "FactorRange"; - this.define({ - factors: [p.Array, []], - factor_padding: [p.Number, 0], - subgroup_padding: [p.Number, 0.8], - group_padding: [p.Number, 1.4], - range_padding: [p.Number, 0], - range_padding_units: [p.PaddingUnits, "percent"], - start: [p.Number], - end: [p.Number], - }); - this.internal({ - levels: [p.Number], - mids: [p.Array], - tops: [p.Array], - tops_groups: [p.Array], - }); - }; - Object.defineProperty(FactorRange.prototype, "min", { - get: function () { - return this.start; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FactorRange.prototype, "max", { - get: function () { - return this.end; - }, - enumerable: true, - configurable: true - }); - FactorRange.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._init(true); - }; - FactorRange.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.properties.factors.change, function () { return _this.reset(); }); - this.connect(this.properties.factor_padding.change, function () { return _this.reset(); }); - this.connect(this.properties.group_padding.change, function () { return _this.reset(); }); - this.connect(this.properties.subgroup_padding.change, function () { return _this.reset(); }); - this.connect(this.properties.range_padding.change, function () { return _this.reset(); }); - this.connect(this.properties.range_padding_units.change, function () { return _this.reset(); }); - }; - FactorRange.prototype.reset = function () { - this._init(false); - this.change.emit(); - }; - FactorRange.prototype._lookup = function (x) { - if (x.length == 1) { - var m = this._mapping; - if (!m.hasOwnProperty(x[0])) { - return NaN; - } - return m[x[0]].value; - } - else if (x.length == 2) { - var m = this._mapping; - if (!m.hasOwnProperty(x[0]) || !m[x[0]].mapping.hasOwnProperty(x[1])) { - return NaN; - } - return m[x[0]].mapping[x[1]].value; - } - else if (x.length == 3) { - var m = this._mapping; - if (!m.hasOwnProperty(x[0]) || !m[x[0]].mapping.hasOwnProperty(x[1]) || !m[x[0]].mapping[x[1]].mapping.hasOwnProperty(x[2])) { - return NaN; - } - return m[x[0]].mapping[x[1]].mapping[x[2]].value; - } - else - throw new Error("unreachable code"); - }; - // convert a string factor into a synthetic coordinate - FactorRange.prototype.synthetic = function (x) { - if (types_1.isNumber(x)) - return x; - if (types_1.isString(x)) - return this._lookup([x]); - var offset = 0; - var off = x[x.length - 1]; - if (types_1.isNumber(off)) { - offset = off; - x = x.slice(0, -1); - } - return this._lookup(x) + offset; - }; - // convert an array of string factors into synthetic coordinates - FactorRange.prototype.v_synthetic = function (xs) { - var _this = this; - return arrayable_1.map(xs, function (x) { return _this.synthetic(x); }); - }; - FactorRange.prototype._init = function (silent) { - var _a, _b, _c; - var levels; - var inside_padding; - if (array_1.every(this.factors, types_1.isString)) { - levels = 1; - _a = map_one_level(this.factors, this.factor_padding), this._mapping = _a[0], inside_padding = _a[1]; - } - else if (array_1.every(this.factors, function (x) { return types_1.isArray(x) && x.length == 2 && types_1.isString(x[0]) && types_1.isString(x[1]); })) { - levels = 2; - _b = map_two_levels(this.factors, this.group_padding, this.factor_padding), this._mapping = _b[0], this.tops = _b[1], inside_padding = _b[2]; - } - else if (array_1.every(this.factors, function (x) { return types_1.isArray(x) && x.length == 3 && types_1.isString(x[0]) && types_1.isString(x[1]) && types_1.isString(x[2]); })) { - levels = 3; - _c = map_three_levels(this.factors, this.group_padding, this.subgroup_padding, this.factor_padding), this._mapping = _c[0], this.tops = _c[1], this.mids = _c[2], inside_padding = _c[3]; - } - else - throw new Error("???"); - var start = 0; - var end = this.factors.length + inside_padding; - if (this.range_padding_units == "percent") { - var half_span = (end - start) * this.range_padding / 2; - start -= half_span; - end += half_span; - } - else { - start -= this.range_padding; - end += this.range_padding; - } - this.setv({ start: start, end: end, levels: levels }, { silent: silent }); - if (this.bounds == "auto") - this.setv({ bounds: [start, end] }, { silent: true }); - }; - return FactorRange; - }(range_1.Range)); - exports.FactorRange = FactorRange; - FactorRange.initClass(); -} -, -/* models/ranges/index */ function _(require, module, exports) { - var data_range_1 = require(186) /* ./data_range */; - exports.DataRange = data_range_1.DataRange; - var data_range1d_1 = require(187) /* ./data_range1d */; - exports.DataRange1d = data_range1d_1.DataRange1d; - var factor_range_1 = require(188) /* ./factor_range */; - exports.FactorRange = factor_range_1.FactorRange; - var range_1 = require(190) /* ./range */; - exports.Range = range_1.Range; - var range1d_1 = require(191) /* ./range1d */; - exports.Range1d = range1d_1.Range1d; -} -, -/* models/ranges/range */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var Range = /** @class */ (function (_super) { - tslib_1.__extends(Range, _super); - function Range(attrs) { - var _this = _super.call(this, attrs) || this; - _this.have_updated_interactively = false; - return _this; - } - Range.initClass = function () { - this.prototype.type = "Range"; - this.define({ - callback: [p.Any], - bounds: [p.Any], - min_interval: [p.Any], - max_interval: [p.Any], - }); - this.internal({ - plots: [p.Array, []], - }); - }; - Range.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.change, function () { return _this._emit_callback(); }); - }; - Range.prototype._emit_callback = function () { - if (this.callback != null) { - if (types_1.isFunction(this.callback)) - this.callback(this); - else - this.callback.execute(this, {}); - } - }; - Object.defineProperty(Range.prototype, "is_reversed", { - get: function () { - return this.start > this.end; - }, - enumerable: true, - configurable: true - }); - return Range; - }(model_1.Model)); - exports.Range = Range; - Range.initClass(); -} -, -/* models/ranges/range1d */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var range_1 = require(190) /* ./range */; - var p = require(18) /* ../../core/properties */; - var Range1d = /** @class */ (function (_super) { - tslib_1.__extends(Range1d, _super); - function Range1d(attrs) { - return _super.call(this, attrs) || this; - } - Range1d.initClass = function () { - this.prototype.type = "Range1d"; - this.define({ - start: [p.Number, 0], - end: [p.Number, 1], - reset_start: [p.Number], - reset_end: [p.Number], - }); - }; - Range1d.prototype._set_auto_bounds = function () { - if (this.bounds == 'auto') { - var min = Math.min(this.reset_start, this.reset_end); - var max = Math.max(this.reset_start, this.reset_end); - this.setv({ bounds: [min, max] }, { silent: true }); - } - }; - Range1d.prototype.initialize = function () { - _super.prototype.initialize.call(this); - if (this.reset_start == null) { - this.reset_start = this.start; - } - if (this.reset_end == null) { - this.reset_end = this.end; - } - this._set_auto_bounds(); - }; - Object.defineProperty(Range1d.prototype, "min", { - get: function () { - return Math.min(this.start, this.end); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Range1d.prototype, "max", { - get: function () { - return Math.max(this.start, this.end); - }, - enumerable: true, - configurable: true - }); - Range1d.prototype.reset = function () { - this._set_auto_bounds(); - if (this.start != this.reset_start || this.end != this.reset_end) - this.setv({ start: this.reset_start, end: this.reset_end }); - else - this.change.emit(); - }; - return Range1d; - }(range_1.Range)); - exports.Range1d = Range1d; - Range1d.initClass(); -} -, -/* models/renderers/data_renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var renderer_1 = require(197) /* ./renderer */; - var p = require(18) /* ../../core/properties */; - var DataRendererView = /** @class */ (function (_super) { - tslib_1.__extends(DataRendererView, _super); - function DataRendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return DataRendererView; - }(renderer_1.RendererView)); - exports.DataRendererView = DataRendererView; - var DataRenderer = /** @class */ (function (_super) { - tslib_1.__extends(DataRenderer, _super); - function DataRenderer(attrs) { - return _super.call(this, attrs) || this; - } - DataRenderer.initClass = function () { - this.prototype.type = "DataRenderer"; - this.define({ - x_range_name: [p.String, 'default'], - y_range_name: [p.String, 'default'], - }); - this.override({ - level: 'glyph', - }); - }; - return DataRenderer; - }(renderer_1.Renderer)); - exports.DataRenderer = DataRenderer; - DataRenderer.initClass(); -} -, -/* models/renderers/glyph_renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var data_renderer_1 = require(192) /* ./data_renderer */; - var line_1 = require(134) /* ../glyphs/line */; - var cds_view_1 = require(207) /* ../sources/cds_view */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var arrayable_1 = require(25) /* ../../core/util/arrayable */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var selection_defaults = { - fill: {}, - line: {}, - }; - var decimated_defaults = { - fill: { fill_alpha: 0.3, fill_color: "grey" }, - line: { line_alpha: 0.3, line_color: "grey" }, - }; - var nonselection_defaults = { - fill: { fill_alpha: 0.2 }, - line: {}, - }; - var GlyphRendererView = /** @class */ (function (_super) { - tslib_1.__extends(GlyphRendererView, _super); - function GlyphRendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - GlyphRendererView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - var base_glyph = this.model.glyph; - var has_fill = array_1.includes(base_glyph.mixins, "fill"); - var has_line = array_1.includes(base_glyph.mixins, "line"); - var glyph_attrs = object_1.clone(base_glyph.attributes); - delete glyph_attrs.id; - function mk_glyph(defaults) { - var attrs = object_1.clone(glyph_attrs); - if (has_fill) - object_1.extend(attrs, defaults.fill); - if (has_line) - object_1.extend(attrs, defaults.line); - return new base_glyph.constructor(attrs); - } - this.glyph = this.build_glyph_view(base_glyph); - var selection_glyph = this.model.selection_glyph; - if (selection_glyph == null) - selection_glyph = mk_glyph({ fill: {}, line: {} }); - else if (selection_glyph === "auto") - selection_glyph = mk_glyph(selection_defaults); - this.selection_glyph = this.build_glyph_view(selection_glyph); - var nonselection_glyph = this.model.nonselection_glyph; - if ((nonselection_glyph == null)) - nonselection_glyph = mk_glyph({ fill: {}, line: {} }); - else if (nonselection_glyph === "auto") - nonselection_glyph = mk_glyph(nonselection_defaults); - this.nonselection_glyph = this.build_glyph_view(nonselection_glyph); - var hover_glyph = this.model.hover_glyph; - if (hover_glyph != null) - this.hover_glyph = this.build_glyph_view(hover_glyph); - var muted_glyph = this.model.muted_glyph; - if (muted_glyph != null) - this.muted_glyph = this.build_glyph_view(muted_glyph); - var decimated_glyph = mk_glyph(decimated_defaults); - this.decimated_glyph = this.build_glyph_view(decimated_glyph); - this.xscale = this.plot_view.frame.xscales[this.model.x_range_name]; - this.yscale = this.plot_view.frame.yscales[this.model.y_range_name]; - this.set_data(false); - }; - GlyphRendererView.prototype.build_glyph_view = function (model) { - return new model.default_view({ model: model, parent: this }); // XXX - }; - GlyphRendererView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.request_render(); }); - this.connect(this.model.glyph.change, function () { return _this.set_data(); }); - this.connect(this.model.data_source.change, function () { return _this.set_data(); }); - this.connect(this.model.data_source.streaming, function () { return _this.set_data(); }); - this.connect(this.model.data_source.patching, function (indices /* XXX: WHY? */) { return _this.set_data(true, indices); }); - this.connect(this.model.data_source.selected.change, function () { return _this.request_render(); }); - this.connect(this.model.data_source._select, function () { return _this.request_render(); }); - if (this.hover_glyph != null) - this.connect(this.model.data_source.inspect, function () { return _this.request_render(); }); - this.connect(this.model.properties.view.change, function () { return _this.set_data(); }); - this.connect(this.model.view.change, function () { return _this.set_data(); }); - var _a = this.plot_view.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges; - for (var name_1 in x_ranges) { - var rng = x_ranges[name_1]; - if (rng instanceof factor_range_1.FactorRange) - this.connect(rng.change, function () { return _this.set_data(); }); - } - for (var name_2 in y_ranges) { - var rng = y_ranges[name_2]; - if (rng instanceof factor_range_1.FactorRange) - this.connect(rng.change, function () { return _this.set_data(); }); - } - this.connect(this.model.glyph.transformchange, function () { return _this.set_data(); }); - }; - GlyphRendererView.prototype.have_selection_glyphs = function () { - return this.selection_glyph != null && this.nonselection_glyph != null; - }; - // in case of partial updates like patching, the list of indices that actually - // changed may be passed as the "indices" parameter to afford any optional optimizations - GlyphRendererView.prototype.set_data = function (request_render, indices) { - if (request_render === void 0) { - request_render = true; - } - if (indices === void 0) { - indices = null; - } - var t0 = Date.now(); - var source = this.model.data_source; - this.all_indices = this.model.view.indices; - // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call - // mapping functions on the base Renderer class - this.glyph.model.setv({ x_range_name: this.model.x_range_name, - y_range_name: this.model.y_range_name }, { silent: true }); - this.glyph.set_data(source, this.all_indices, indices); - this.glyph.set_visuals(source); - this.decimated_glyph.set_visuals(source); - if (this.have_selection_glyphs()) { - this.selection_glyph.set_visuals(source); - this.nonselection_glyph.set_visuals(source); - } - if (this.hover_glyph != null) - this.hover_glyph.set_visuals(source); - if (this.muted_glyph != null) - this.muted_glyph.set_visuals(source); - var lod_factor = this.plot_model.lod_factor; - this.decimated = []; - for (var i = 0, end = Math.floor(this.all_indices.length / lod_factor); i < end; i++) { - this.decimated.push(i * lod_factor); - } - var dt = Date.now() - t0; - logging_1.logger.debug(this.glyph.model.type + " GlyphRenderer (" + this.model.id + "): set_data finished in " + dt + "ms"); - this.set_data_timestamp = Date.now(); - if (request_render) - this.request_render(); - }; - GlyphRendererView.prototype.render = function () { - var _this = this; - if (!this.model.visible) - return; - var t0 = Date.now(); - var glsupport = this.glyph.glglyph; - this.glyph.map_data(); - var dtmap = Date.now() - t0; - var tmask = Date.now(); - // all_indices is in full data space, indices is converted to subset space - // either by mask_data (that uses the spatial index) or manually - var indices = this.glyph.mask_data(this.all_indices); - if (indices.length === this.all_indices.length) { - indices = array_1.range(0, this.all_indices.length); - } - var dtmask = Date.now() - tmask; - var ctx = this.plot_view.canvas_view.ctx; - ctx.save(); - // selected is in full set space - var selected = this.model.data_source.selected; - var selected_full_indices; - if (!selected || selected.is_empty()) { - selected_full_indices = []; - } - else { - if (this.glyph instanceof line_1.LineView && selected.selected_glyph === this.glyph.model) { - selected_full_indices = this.model.view.convert_indices_from_subset(indices); - } - else { - selected_full_indices = selected.indices; - } - } - // inspected is in full set space - var inspected = this.model.data_source.inspected; - var inspected_full_indices; - if (!inspected || (inspected.length === 0)) { - inspected_full_indices = []; - } - else { - if (inspected['0d'].glyph) { - inspected_full_indices = this.model.view.convert_indices_from_subset(indices); - } - else if (inspected['1d'].indices.length > 0) { - inspected_full_indices = inspected['1d'].indices; - } - else { - inspected_full_indices = ((function () { - var result = []; - for (var _i = 0, _a = Object.keys(inspected["2d"].indices); _i < _a.length; _i++) { - var i = _a[_i]; - result.push(parseInt(i)); - } - return result; - })()); - } - } - // inspected is transformed to subset space - var inspected_subset_indices = ((function () { - var result = []; - for (var _i = 0, indices_2 = indices; _i < indices_2.length; _i++) { - var i = indices_2[_i]; - if (array_1.includes(inspected_full_indices, _this.all_indices[i])) - result.push(i); - } - return result; - })()); - var lod_threshold = this.plot_model.lod_threshold; - var glyph; - var nonselection_glyph; - var selection_glyph; - if ((this.model.document != null ? this.model.document.interactive_duration() > 0 : false) - && !glsupport && lod_threshold != null && this.all_indices.length > lod_threshold) { - // Render decimated during interaction if too many elements and not using GL - indices = this.decimated; - glyph = this.decimated_glyph; - nonselection_glyph = this.decimated_glyph; - selection_glyph = this.selection_glyph; - } - else { - glyph = this.model.muted && this.muted_glyph != null ? this.muted_glyph : this.glyph; - nonselection_glyph = this.nonselection_glyph; - selection_glyph = this.selection_glyph; - } - if (this.hover_glyph != null && inspected_subset_indices.length) - indices = array_1.difference(indices, inspected_subset_indices); - // Render with no selection - var dtselect = null; - var trender; - if (!(selected_full_indices.length && this.have_selection_glyphs())) { - trender = Date.now(); - if (this.glyph instanceof line_1.LineView) { - if (this.hover_glyph && inspected_subset_indices.length) - this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph); - else - glyph.render(ctx, this.all_indices, this.glyph); - } - else { - glyph.render(ctx, indices, this.glyph); - if (this.hover_glyph && inspected_subset_indices.length) - this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph); - } - // Render with selection - } - else { - // reset the selection mask - var tselect = Date.now(); - var selected_mask = {}; - for (var _i = 0, selected_full_indices_1 = selected_full_indices; _i < selected_full_indices_1.length; _i++) { - var i = selected_full_indices_1[_i]; - selected_mask[i] = true; - } - // intersect/different selection with render mask - var selected_subset_indices = new Array(); - var nonselected_subset_indices = new Array(); - // now, selected is changed to subset space, except for Line glyph - if (this.glyph instanceof line_1.LineView) { - for (var _a = 0, _b = this.all_indices; _a < _b.length; _a++) { - var i = _b[_a]; - if (selected_mask[i] != null) - selected_subset_indices.push(i); - else - nonselected_subset_indices.push(i); - } - } - else { - for (var _c = 0, indices_1 = indices; _c < indices_1.length; _c++) { - var i = indices_1[_c]; - if (selected_mask[this.all_indices[i]] != null) - selected_subset_indices.push(i); - else - nonselected_subset_indices.push(i); - } - } - dtselect = Date.now() - tselect; - trender = Date.now(); - nonselection_glyph.render(ctx, nonselected_subset_indices, this.glyph); - selection_glyph.render(ctx, selected_subset_indices, this.glyph); - if (this.hover_glyph != null) { - if (this.glyph instanceof line_1.LineView) - this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph); - else - this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph); - } - } - var dtrender = Date.now() - trender; - this.last_dtrender = dtrender; - var dttot = Date.now() - t0; - logging_1.logger.debug(this.glyph.model.type + " GlyphRenderer (" + this.model.id + "): render finished in " + dttot + "ms"); - logging_1.logger.trace(" - map_data finished in : " + dtmap + "ms"); - logging_1.logger.trace(" - mask_data finished in : " + dtmask + "ms"); - if (dtselect != null) { - logging_1.logger.trace(" - selection mask finished in : " + dtselect + "ms"); - } - logging_1.logger.trace(" - glyph renders finished in : " + dtrender + "ms"); - return ctx.restore(); - }; - GlyphRendererView.prototype.draw_legend = function (ctx, x0, x1, y0, y1, field, label, index) { - if (index == null) - index = this.model.get_reference_point(field, label); - this.glyph.draw_legend_for_index(ctx, { x0: x0, x1: x1, y0: y0, y1: y1 }, index); - }; - GlyphRendererView.prototype.hit_test = function (geometry) { - if (!this.model.visible) - return null; - var hit_test_result = this.glyph.hit_test(geometry); - // glyphs that don't have hit-testing implemented will return null - if (hit_test_result == null) - return null; - return this.model.view.convert_selection_from_subset(hit_test_result); - }; - return GlyphRendererView; - }(data_renderer_1.DataRendererView)); - exports.GlyphRendererView = GlyphRendererView; - var GlyphRenderer = /** @class */ (function (_super) { - tslib_1.__extends(GlyphRenderer, _super); - function GlyphRenderer(attrs) { - return _super.call(this, attrs) || this; - } - GlyphRenderer.initClass = function () { - this.prototype.type = 'GlyphRenderer'; - this.prototype.default_view = GlyphRendererView; - this.define({ - data_source: [p.Instance], - view: [p.Instance, function () { return new cds_view_1.CDSView(); }], - glyph: [p.Instance], - hover_glyph: [p.Instance], - nonselection_glyph: [p.Any, 'auto'], - selection_glyph: [p.Any, 'auto'], - muted_glyph: [p.Instance], - muted: [p.Boolean, false], - }); - }; - GlyphRenderer.prototype.initialize = function () { - _super.prototype.initialize.call(this); - if (this.view.source == null) { - this.view.source = this.data_source; - this.view.compute_indices(); - } - }; - GlyphRenderer.prototype.get_reference_point = function (field, value) { - var index = 0; - if (field != null) { - var data = this.data_source.get_column(field); - if (data != null) { - var i = arrayable_1.indexOf(data, value); - if (i != -1) - index = i; - } - } - return index; - }; - GlyphRenderer.prototype.get_selection_manager = function () { - return this.data_source.selection_manager; - }; - return GlyphRenderer; - }(data_renderer_1.DataRenderer)); - exports.GlyphRenderer = GlyphRenderer; - GlyphRenderer.initClass(); -} -, -/* models/renderers/graph_renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var data_renderer_1 = require(192) /* ./data_renderer */; - var graph_hit_test_policy_1 = require(151) /* ../graphs/graph_hit_test_policy */; - var p = require(18) /* ../../core/properties */; - var build_views_1 = require(4) /* ../../core/build_views */; - var GraphRendererView = /** @class */ (function (_super) { - tslib_1.__extends(GraphRendererView, _super); - function GraphRendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - GraphRendererView.prototype.initialize = function () { - var _a; - _super.prototype.initialize.call(this); - this.xscale = this.plot_view.frame.xscales.default; - this.yscale = this.plot_view.frame.yscales.default; - this._renderer_views = {}; - _a = build_views_1.build_views(this._renderer_views, [this.model.node_renderer, this.model.edge_renderer], { parent: this.parent }), this.node_view = _a[0], this.edge_view = _a[1]; - this.set_data(); - }; - GraphRendererView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.layout_provider.change, function () { return _this.set_data(); }); - this.connect(this.model.node_renderer.data_source._select, function () { return _this.set_data(); }); - this.connect(this.model.node_renderer.data_source.inspect, function () { return _this.set_data(); }); - this.connect(this.model.node_renderer.data_source.change, function () { return _this.set_data(); }); - this.connect(this.model.edge_renderer.data_source._select, function () { return _this.set_data(); }); - this.connect(this.model.edge_renderer.data_source.inspect, function () { return _this.set_data(); }); - this.connect(this.model.edge_renderer.data_source.change, function () { return _this.set_data(); }); - var _a = this.plot_view.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges; - for (var name_1 in x_ranges) { - var rng = x_ranges[name_1]; - this.connect(rng.change, function () { return _this.set_data(); }); - } - for (var name_2 in y_ranges) { - var rng = y_ranges[name_2]; - this.connect(rng.change, function () { return _this.set_data(); }); - } - }; - GraphRendererView.prototype.set_data = function (request_render) { - var _a, _b; - if (request_render === void 0) { - request_render = true; - } - // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call - // mapping functions on the base Renderer class - this.node_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true }); - this.edge_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true }); - // XXX - var node_glyph = this.node_view.glyph; - _a = this.model.layout_provider.get_node_coordinates(this.model.node_renderer.data_source), node_glyph._x = _a[0], node_glyph._y = _a[1]; - var edge_glyph = this.edge_view.glyph; - _b = this.model.layout_provider.get_edge_coordinates(this.model.edge_renderer.data_source), edge_glyph._xs = _b[0], edge_glyph._ys = _b[1]; - node_glyph.index_data(); - edge_glyph.index_data(); - if (request_render) - this.request_render(); - }; - GraphRendererView.prototype.render = function () { - this.edge_view.render(); - this.node_view.render(); - }; - return GraphRendererView; - }(data_renderer_1.DataRendererView)); - exports.GraphRendererView = GraphRendererView; - var GraphRenderer = /** @class */ (function (_super) { - tslib_1.__extends(GraphRenderer, _super); - function GraphRenderer(attrs) { - return _super.call(this, attrs) || this; - } - GraphRenderer.initClass = function () { - this.prototype.type = 'GraphRenderer'; - this.prototype.default_view = GraphRendererView; - this.define({ - layout_provider: [p.Instance], - node_renderer: [p.Instance], - edge_renderer: [p.Instance], - selection_policy: [p.Instance, function () { return new graph_hit_test_policy_1.NodesOnly(); }], - inspection_policy: [p.Instance, function () { return new graph_hit_test_policy_1.NodesOnly(); }], - }); - }; - GraphRenderer.prototype.get_selection_manager = function () { - return this.node_renderer.data_source.selection_manager; - }; - return GraphRenderer; - }(data_renderer_1.DataRenderer)); - exports.GraphRenderer = GraphRenderer; - GraphRenderer.initClass(); -} -, -/* models/renderers/guide_renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var renderer_1 = require(197) /* ./renderer */; - var GuideRendererView = /** @class */ (function (_super) { - tslib_1.__extends(GuideRendererView, _super); - function GuideRendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return GuideRendererView; - }(renderer_1.RendererView)); - exports.GuideRendererView = GuideRendererView; - var GuideRenderer = /** @class */ (function (_super) { - tslib_1.__extends(GuideRenderer, _super); - function GuideRenderer(attrs) { - return _super.call(this, attrs) || this; - } - GuideRenderer.initClass = function () { - this.prototype.type = "GuideRenderer"; - this.override({ - level: "overlay", - }); - }; - return GuideRenderer; - }(renderer_1.Renderer)); - exports.GuideRenderer = GuideRenderer; - GuideRenderer.initClass(); -} -, -/* models/renderers/index */ function _(require, module, exports) { - var glyph_renderer_1 = require(193) /* ./glyph_renderer */; - exports.GlyphRenderer = glyph_renderer_1.GlyphRenderer; - var graph_renderer_1 = require(194) /* ./graph_renderer */; - exports.GraphRenderer = graph_renderer_1.GraphRenderer; - var guide_renderer_1 = require(195) /* ./guide_renderer */; - exports.GuideRenderer = guide_renderer_1.GuideRenderer; - var renderer_1 = require(197) /* ./renderer */; - exports.Renderer = renderer_1.Renderer; -} -, -/* models/renderers/renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_view_1 = require(6) /* ../../core/dom_view */; - var visuals = require(51) /* ../../core/visuals */; - var p = require(18) /* ../../core/properties */; - var model_1 = require(62) /* ../../model */; - // This shouldn't be a DOMView, but annotations create a mess. - var RendererView = /** @class */ (function (_super) { - tslib_1.__extends(RendererView, _super); - function RendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RendererView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.visuals = new visuals.Visuals(this.model); - this._has_finished = true; // XXX: should be in render() but subclasses don't respect super() - }; - Object.defineProperty(RendererView.prototype, "plot_view", { - get: function () { - return this.parent; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RendererView.prototype, "plot_model", { - get: function () { - return this.parent.model; - }, - enumerable: true, - configurable: true - }); - RendererView.prototype.request_render = function () { - this.plot_view.request_render(); - }; - RendererView.prototype.map_to_screen = function (x, y) { - return this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name); - }; - Object.defineProperty(RendererView.prototype, "needs_clip", { - get: function () { - return false; - }, - enumerable: true, - configurable: true - }); - RendererView.prototype.notify_finished = function () { - this.plot_view.notify_finished(); - }; - return RendererView; - }(dom_view_1.DOMView)); - exports.RendererView = RendererView; - var Renderer = /** @class */ (function (_super) { - tslib_1.__extends(Renderer, _super); - function Renderer(attrs) { - return _super.call(this, attrs) || this; - } - Renderer.initClass = function () { - this.prototype.type = "Renderer"; - this.define({ - level: [p.RenderLevel], - visible: [p.Boolean, true], - }); - }; - return Renderer; - }(model_1.Model)); - exports.Renderer = Renderer; - Renderer.initClass(); -} -, -/* models/scales/categorical_scale */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var linear_scale_1 = require(200) /* ./linear_scale */; - var CategoricalScale = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalScale, _super); - function CategoricalScale(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalScale.initClass = function () { - this.prototype.type = "CategoricalScale"; - }; - CategoricalScale.prototype.compute = function (x) { - return _super.prototype.compute.call(this, this.source_range.synthetic(x)); - }; - CategoricalScale.prototype.v_compute = function (xs) { - return _super.prototype.v_compute.call(this, this.source_range.v_synthetic(xs)); - }; - return CategoricalScale; - }(linear_scale_1.LinearScale)); - exports.CategoricalScale = CategoricalScale; - CategoricalScale.initClass(); -} -, -/* models/scales/index */ function _(require, module, exports) { - var categorical_scale_1 = require(198) /* ./categorical_scale */; - exports.CategoricalScale = categorical_scale_1.CategoricalScale; - var linear_scale_1 = require(200) /* ./linear_scale */; - exports.LinearScale = linear_scale_1.LinearScale; - var log_scale_1 = require(201) /* ./log_scale */; - exports.LogScale = log_scale_1.LogScale; - var scale_1 = require(202) /* ./scale */; - exports.Scale = scale_1.Scale; -} -, -/* models/scales/linear_scale */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var scale_1 = require(202) /* ./scale */; - var LinearScale = /** @class */ (function (_super) { - tslib_1.__extends(LinearScale, _super); - function LinearScale(attrs) { - return _super.call(this, attrs) || this; - } - LinearScale.initClass = function () { - this.prototype.type = "LinearScale"; - }; - LinearScale.prototype.compute = function (x) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1]; - return factor * x + offset; - }; - LinearScale.prototype.v_compute = function (xs) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1]; - var result = new Float64Array(xs.length); - for (var i = 0; i < xs.length; i++) - result[i] = factor * xs[i] + offset; - return result; - }; - LinearScale.prototype.invert = function (xprime) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1]; - return (xprime - offset) / factor; - }; - LinearScale.prototype.v_invert = function (xprimes) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1]; - var result = new Float64Array(xprimes.length); - for (var i = 0; i < xprimes.length; i++) - result[i] = (xprimes[i] - offset) / factor; - return result; - }; - /*protected*/ LinearScale.prototype._compute_state = function () { - // - // (t1 - t0) (t1 - t0) - // --------- * x - --------- * s0 + t0 - // (s1 - s0) (s1 - s0) - // - // [ factor ] [ offset ] - // - var source_start = this.source_range.start; - var source_end = this.source_range.end; - var target_start = this.target_range.start; - var target_end = this.target_range.end; - var factor = (target_end - target_start) / (source_end - source_start); - var offset = -(factor * source_start) + target_start; - return [factor, offset]; - }; - return LinearScale; - }(scale_1.Scale)); - exports.LinearScale = LinearScale; - LinearScale.initClass(); -} -, -/* models/scales/log_scale */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var scale_1 = require(202) /* ./scale */; - var LogScale = /** @class */ (function (_super) { - tslib_1.__extends(LogScale, _super); - function LogScale(attrs) { - return _super.call(this, attrs) || this; - } - LogScale.initClass = function () { - this.prototype.type = "LogScale"; - }; - LogScale.prototype.compute = function (x) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3]; - var value; - if (inter_factor == 0) - value = 0; - else { - var _x = (Math.log(x) - inter_offset) / inter_factor; - if (isFinite(_x)) - value = _x * factor + offset; - else - value = NaN; - } - return value; - }; - LogScale.prototype.v_compute = function (xs) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3]; - var result = new Float64Array(xs.length); - if (inter_factor == 0) { - for (var i = 0; i < xs.length; i++) - result[i] = 0; - } - else { - for (var i = 0; i < xs.length; i++) { - var _x = (Math.log(xs[i]) - inter_offset) / inter_factor; - var value = void 0; - if (isFinite(_x)) - value = _x * factor + offset; - else - value = NaN; - result[i] = value; - } - } - return result; - }; - LogScale.prototype.invert = function (xprime) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3]; - var value = (xprime - offset) / factor; - return Math.exp(inter_factor * value + inter_offset); - }; - LogScale.prototype.v_invert = function (xprimes) { - var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3]; - var result = new Float64Array(xprimes.length); - for (var i = 0; i < xprimes.length; i++) { - var value = (xprimes[i] - offset) / factor; - result[i] = Math.exp(inter_factor * value + inter_offset); - } - return result; - }; - LogScale.prototype._get_safe_factor = function (orig_start, orig_end) { - var _a; - var start = orig_start < 0 ? 0 : orig_start; - var end = orig_end < 0 ? 0 : orig_end; - if (start == end) { - if (start == 0) - _a = [1, 10], start = _a[0], end = _a[1]; - else { - var log_val = Math.log(start) / Math.log(10); - start = Math.pow(10, Math.floor(log_val)); - if (Math.ceil(log_val) != Math.floor(log_val)) - end = Math.pow(10, Math.ceil(log_val)); - else - end = Math.pow(10, Math.ceil(log_val) + 1); - } - } - return [start, end]; - }; - /*protected*/ LogScale.prototype._compute_state = function () { - var source_start = this.source_range.start; - var source_end = this.source_range.end; - var target_start = this.target_range.start; - var target_end = this.target_range.end; - var screen_range = target_end - target_start; - var _a = this._get_safe_factor(source_start, source_end), start = _a[0], end = _a[1]; - var inter_factor; - var inter_offset; - if (start == 0) { - inter_factor = Math.log(end); - inter_offset = 0; - } - else { - inter_factor = Math.log(end) - Math.log(start); - inter_offset = Math.log(start); - } - var factor = screen_range; - var offset = target_start; - return [factor, offset, inter_factor, inter_offset]; - }; - return LogScale; - }(scale_1.Scale)); - exports.LogScale = LogScale; - LogScale.initClass(); -} -, -/* models/scales/scale */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transforms_1 = require(284) /* ../transforms */; - var p = require(18) /* ../../core/properties */; - var Scale = /** @class */ (function (_super) { - tslib_1.__extends(Scale, _super); - function Scale(attrs) { - return _super.call(this, attrs) || this; - } - Scale.initClass = function () { - this.prototype.type = "Scale"; - this.internal({ - source_range: [p.Any], - target_range: [p.Any], - }); - }; - Scale.prototype.r_compute = function (x0, x1) { - if (this.target_range.is_reversed) - return [this.compute(x1), this.compute(x0)]; - else - return [this.compute(x0), this.compute(x1)]; - }; - Scale.prototype.r_invert = function (sx0, sx1) { - if (this.target_range.is_reversed) - return [this.invert(sx1), this.invert(sx0)]; - else - return [this.invert(sx0), this.invert(sx1)]; - }; - return Scale; - }(transforms_1.Transform)); - exports.Scale = Scale; - Scale.initClass(); -} -, -/* models/selections/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(204) /* ./interaction_policy */, exports); - var selection_1 = require(205) /* ./selection */; - exports.Selection = selection_1.Selection; -} -, -/* models/selections/interaction_policy */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var SelectionPolicy = /** @class */ (function (_super) { - tslib_1.__extends(SelectionPolicy, _super); - function SelectionPolicy() { - return _super !== null && _super.apply(this, arguments) || this; - } - SelectionPolicy.prototype.do_selection = function (hit_test_result, source, final, append) { - if (hit_test_result === null) { - return false; - } - else { - source.selected.update(hit_test_result, final, append); - source._select.emit(); - return !source.selected.is_empty(); - } - }; - return SelectionPolicy; - }(model_1.Model)); - exports.SelectionPolicy = SelectionPolicy; - SelectionPolicy.prototype.type = "SelectionPolicy"; - var IntersectRenderers = /** @class */ (function (_super) { - tslib_1.__extends(IntersectRenderers, _super); - function IntersectRenderers() { - return _super !== null && _super.apply(this, arguments) || this; - } - IntersectRenderers.prototype.hit_test = function (geometry, renderer_views) { - var hit_test_result_renderers = []; - for (var _i = 0, renderer_views_1 = renderer_views; _i < renderer_views_1.length; _i++) { - var r = renderer_views_1[_i]; - var result = r.hit_test(geometry); - if (result !== null) - hit_test_result_renderers.push(result); - } - if (hit_test_result_renderers.length > 0) { - var hit_test_result = hit_test_result_renderers[0]; - for (var _a = 0, hit_test_result_renderers_1 = hit_test_result_renderers; _a < hit_test_result_renderers_1.length; _a++) { - var hit_test_result_other = hit_test_result_renderers_1[_a]; - hit_test_result.update_through_intersection(hit_test_result_other); - } - return hit_test_result; - } - else { - return null; - } - }; - return IntersectRenderers; - }(SelectionPolicy)); - exports.IntersectRenderers = IntersectRenderers; - IntersectRenderers.prototype.type = "IntersectRenderers"; - var UnionRenderers = /** @class */ (function (_super) { - tslib_1.__extends(UnionRenderers, _super); - function UnionRenderers() { - return _super !== null && _super.apply(this, arguments) || this; - } - UnionRenderers.prototype.hit_test = function (geometry, renderer_views) { - var hit_test_result_renderers = []; - for (var _i = 0, renderer_views_2 = renderer_views; _i < renderer_views_2.length; _i++) { - var r = renderer_views_2[_i]; - var result = r.hit_test(geometry); - if (result !== null) - hit_test_result_renderers.push(result); - } - if (hit_test_result_renderers.length > 0) { - var hit_test_result = hit_test_result_renderers[0]; - for (var _a = 0, hit_test_result_renderers_2 = hit_test_result_renderers; _a < hit_test_result_renderers_2.length; _a++) { - var hit_test_result_other = hit_test_result_renderers_2[_a]; - hit_test_result.update_through_union(hit_test_result_other); - } - return hit_test_result; - } - else { - return null; - } - }; - return UnionRenderers; - }(SelectionPolicy)); - exports.UnionRenderers = UnionRenderers; - UnionRenderers.prototype.type = "UnionRenderers"; -} -, -/* models/selections/selection */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var Selection = /** @class */ (function (_super) { - tslib_1.__extends(Selection, _super); - function Selection(attrs) { - return _super.call(this, attrs) || this; - } - Selection.initClass = function () { - this.prototype.type = "Selection"; - this.define({ - indices: [p.Array, []], - line_indices: [p.Array, []], - multiline_indices: [p.Any, {}], - }); - this.internal({ - final: [p.Boolean], - selected_glyphs: [p.Array, []], - get_view: [p.Any], - image_indices: [p.Array, []], - }); - }; - Selection.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this['0d'] = { glyph: null, indices: [], flag: false, get_view: function () { return null; } }; - this['2d'] = { indices: {} }; - this['1d'] = { indices: this.indices }; - this.get_view = function () { return null; }; - this.connect(this.properties.indices.change, function () { - return _this['1d'].indices = _this.indices; - }); - this.connect(this.properties.line_indices.change, function () { - _this['0d'].indices = _this.line_indices; - if (_this.line_indices.length == 0) - _this['0d'].flag = false; - else - _this['0d'].flag = true; - }); - this.connect(this.properties.selected_glyphs.change, function () { - return _this['0d'].glyph = _this.selected_glyph; - }); - this.connect(this.properties.get_view.change, function () { - return _this['0d'].get_view = _this.get_view; - }); - this.connect(this.properties.multiline_indices.change, function () { - return _this['2d'].indices = _this.multiline_indices; - }); - }; - Object.defineProperty(Selection.prototype, "selected_glyph", { - get: function () { - if (this.selected_glyphs.length > 0) - return this.selected_glyphs[0]; - else - return null; - }, - enumerable: true, - configurable: true - }); - Selection.prototype.add_to_selected_glyphs = function (glyph) { - this.selected_glyphs.push(glyph); - }; - Selection.prototype.update = function (selection, final, append) { - this.final = final; - if (append) - this.update_through_union(selection); - else { - this.indices = selection.indices; - this.line_indices = selection.line_indices; - this.selected_glyphs = selection.selected_glyphs; - this.get_view = selection.get_view; - this.multiline_indices = selection.multiline_indices; - this.image_indices = selection.image_indices; - } - }; - Selection.prototype.clear = function () { - this.final = true; - this.indices = []; - this.line_indices = []; - this.multiline_indices = {}; - this.get_view = function () { return null; }; - this.selected_glyphs = []; - }; - Selection.prototype.is_empty = function () { - return this.indices.length == 0 && this.line_indices.length == 0 && this.image_indices.length == 0; - }; - Selection.prototype.update_through_union = function (other) { - this.indices = array_1.union(other.indices, this.indices); - this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs); - this.line_indices = array_1.union(other.line_indices, this.line_indices); - if (!this.get_view()) - this.get_view = other.get_view; - this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices); - }; - Selection.prototype.update_through_intersection = function (other) { - this.indices = array_1.intersection(other.indices, this.indices); - // TODO: think through and fix any logic below - this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs); - this.line_indices = array_1.union(other.line_indices, this.line_indices); - if (!this.get_view()) - this.get_view = other.get_view; - this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices); - }; - return Selection; - }(model_1.Model)); - exports.Selection = Selection; - Selection.initClass(); -} -, -/* models/sources/ajax_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var remote_data_source_1 = require(213) /* ./remote_data_source */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var AjaxDataSource = /** @class */ (function (_super) { - tslib_1.__extends(AjaxDataSource, _super); - function AjaxDataSource(attrs) { - var _this = _super.call(this, attrs) || this; - _this.initialized = false; - return _this; - } - AjaxDataSource.initClass = function () { - this.prototype.type = 'AjaxDataSource'; - this.define({ - content_type: [p.String, 'application/json'], - http_headers: [p.Any, {}], - method: [p.HTTPMethod, 'POST'], - if_modified: [p.Boolean, false], - }); - }; - AjaxDataSource.prototype.destroy = function () { - if (this.interval != null) - clearInterval(this.interval); - _super.prototype.destroy.call(this); - }; - AjaxDataSource.prototype.setup = function () { - var _this = this; - if (!this.initialized) { - this.initialized = true; - this.get_data(this.mode); - if (this.polling_interval) { - var callback = function () { return _this.get_data(_this.mode, _this.max_size, _this.if_modified); }; - this.interval = setInterval(callback, this.polling_interval); - } - } - }; - AjaxDataSource.prototype.get_data = function (mode, max_size, _if_modified) { - var _this = this; - if (max_size === void 0) { - max_size = 0; - } - if (_if_modified === void 0) { - _if_modified = false; - } - var xhr = this.prepare_request(); - // TODO: if_modified - xhr.addEventListener("load", function () { return _this.do_load(xhr, mode, max_size); }); - xhr.addEventListener("error", function () { return _this.do_error(xhr); }); - xhr.send(); - }; - AjaxDataSource.prototype.prepare_request = function () { - var xhr = new XMLHttpRequest(); - xhr.open(this.method, this.data_url, true); - xhr.withCredentials = false; - xhr.setRequestHeader("Content-Type", this.content_type); - var http_headers = this.http_headers; - for (var name_1 in http_headers) { - var value = http_headers[name_1]; - xhr.setRequestHeader(name_1, value); - } - return xhr; - }; - AjaxDataSource.prototype.do_load = function (xhr, mode, max_size) { - if (xhr.status === 200) { - var raw_data = JSON.parse(xhr.responseText); - this.load_data(raw_data, mode, max_size); - } - }; - AjaxDataSource.prototype.do_error = function (xhr) { - logging_1.logger.error("Failed to fetch JSON from " + this.data_url + " with code " + xhr.status); - }; - return AjaxDataSource; - }(remote_data_source_1.RemoteDataSource)); - exports.AjaxDataSource = AjaxDataSource; - AjaxDataSource.initClass(); -} -, -/* models/sources/cds_view */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var p = require(18) /* ../../core/properties */; - var selection_1 = require(205) /* ../selections/selection */; - var array_1 = require(24) /* ../../core/util/array */; - var columnar_data_source_1 = require(209) /* ./columnar_data_source */; - var CDSView = /** @class */ (function (_super) { - tslib_1.__extends(CDSView, _super); - function CDSView(attrs) { - return _super.call(this, attrs) || this; - } - CDSView.initClass = function () { - this.prototype.type = 'CDSView'; - this.define({ - filters: [p.Array, []], - source: [p.Instance], - }); - this.internal({ - indices: [p.Array, []], - indices_map: [p.Any, {}], - }); - }; - CDSView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.compute_indices(); - }; - CDSView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.properties.filters.change, function () { - _this.compute_indices(); - _this.change.emit(); - }); - var connect_listeners = function () { - var fn = function () { return _this.compute_indices(); }; - if (_this.source != null) { - _this.connect(_this.source.change, fn); - if (_this.source instanceof columnar_data_source_1.ColumnarDataSource) { - _this.connect(_this.source.streaming, fn); - _this.connect(_this.source.patching, fn); - } - } - }; - var initialized = this.source != null; - if (initialized) - connect_listeners(); - else { - this.connect(this.properties.source.change, function () { - if (!initialized) { - connect_listeners(); - initialized = true; - } - }); - } - }; - CDSView.prototype.compute_indices = function () { - var _this = this; - var indices = this.filters.map(function (filter) { return filter.compute_indices(_this.source); }) - .filter(function (indices) { return indices != null; }); - if (indices.length > 0) - this.indices = array_1.intersection.apply(this, indices); - else if (this.source instanceof columnar_data_source_1.ColumnarDataSource) - this.indices = this.source.get_indices(); - this.indices_map_to_subset(); - }; - CDSView.prototype.indices_map_to_subset = function () { - this.indices_map = {}; - for (var i = 0; i < this.indices.length; i++) { - this.indices_map[this.indices[i]] = i; - } - }; - CDSView.prototype.convert_selection_from_subset = function (selection_subset) { - var _this = this; - var selection_full = new selection_1.Selection(); - selection_full.update_through_union(selection_subset); - var indices_1d = selection_subset.indices.map(function (i) { return _this.indices[i]; }); - selection_full.indices = indices_1d; - selection_full.image_indices = selection_subset.image_indices; - return selection_full; - }; - CDSView.prototype.convert_selection_to_subset = function (selection_full) { - var _this = this; - var selection_subset = new selection_1.Selection(); - selection_subset.update_through_union(selection_full); - var indices_1d = selection_full.indices.map(function (i) { return _this.indices_map[i]; }); - selection_subset.indices = indices_1d; - selection_subset.image_indices = selection_full.image_indices; - return selection_subset; - }; - CDSView.prototype.convert_indices_from_subset = function (indices) { - var _this = this; - return indices.map(function (i) { return _this.indices[i]; }); - }; - return CDSView; - }(model_1.Model)); - exports.CDSView = CDSView; - CDSView.initClass(); -} -, -/* models/sources/column_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var columnar_data_source_1 = require(209) /* ./columnar_data_source */; - var has_props_1 = require(8) /* ../../core/has_props */; - var p = require(18) /* ../../core/properties */; - var data_structures_1 = require(32) /* ../../core/util/data_structures */; - var serialization_1 = require(38) /* ../../core/util/serialization */; - var types_1 = require(46) /* ../../core/util/types */; - var typed_array = require(45) /* ../../core/util/typed_array */; - var object_1 = require(35) /* ../../core/util/object */; - var events_1 = require(53) /* ../../document/events */; - //exported for testing - function stream_to_column(col, new_col, rollover) { - if (types_1.isArray(col)) { - var result = col.concat(new_col); - if (rollover != null && result.length > rollover) - return result.slice(-rollover); - else - return result; - } - else if (types_1.isTypedArray(col)) { - var total_len = col.length + new_col.length; - // handle rollover case for typed arrays - if (rollover != null && total_len > rollover) { - var start = total_len - rollover; - var end = col.length; - // resize col if it is shorter than the rollover length - var result = void 0; - if (col.length < rollover) { - result = new (col.constructor)(rollover); - result.set(col, 0); - } - else - result = col; - // shift values in original col to accommodate new_col - for (var i = start, endi = end; i < endi; i++) { - result[i - start] = result[i]; - } - // update end values in col with new_col - for (var i = 0, endi = new_col.length; i < endi; i++) { - result[i + (end - start)] = new_col[i]; - } - return result; - } - else { - var tmp = new (col.constructor)(new_col); - return typed_array.concat(col, tmp); - } - } - else - throw new Error("unsupported array types"); - } - exports.stream_to_column = stream_to_column; - // exported for testing - function slice(ind, length) { - var start, step, stop; - if (types_1.isNumber(ind)) { - start = ind; - stop = ind + 1; - step = 1; - } - else { - start = ind.start != null ? ind.start : 0; - stop = ind.stop != null ? ind.stop : length; - step = ind.step != null ? ind.step : 1; - } - return [start, stop, step]; - } - exports.slice = slice; - // exported for testing - function patch_to_column(col, patch, shapes) { - var patched = new data_structures_1.Set(); - var patched_range = false; - for (var _i = 0, patch_1 = patch; _i < patch_1.length; _i++) { - var _a = patch_1[_i], ind = _a[0], val = _a[1]; - // make the single index case look like the length-3 multi-index case - var item = void 0, shape = void 0; - var index = void 0; - var value = void 0; - if (types_1.isArray(ind)) { - var i = ind[0]; - patched.add(i); - shape = shapes[i]; - item = col[i]; - value = val; - // this is basically like NumPy's "newaxis", inserting an empty dimension - // makes length 2 and 3 multi-index cases uniform, so that the same code - // can handle both - if (ind.length === 2) { - shape = [1, shape[0]]; - index = [ind[0], 0, ind[1]]; - } - else - index = ind; - } - else { - if (types_1.isNumber(ind)) { - value = [val]; - patched.add(ind); - } - else { - value = val; - patched_range = true; - } - index = [0, 0, ind]; - shape = [1, col.length]; - item = col; - } - // now this one nested loop handles all cases - var flat_index = 0; - var _b = slice(index[1], shape[0]), istart = _b[0], istop = _b[1], istep = _b[2]; - var _c = slice(index[2], shape[1]), jstart = _c[0], jstop = _c[1], jstep = _c[2]; - for (var i = istart; i < istop; i += istep) { - for (var j = jstart; j < jstop; j += jstep) { - if (patched_range) { - patched.add(j); - } - item[(i * shape[1]) + j] = value[flat_index]; - flat_index++; - } - } - } - return patched; - } - exports.patch_to_column = patch_to_column; - var ColumnDataSource = /** @class */ (function (_super) { - tslib_1.__extends(ColumnDataSource, _super); - function ColumnDataSource(attrs) { - return _super.call(this, attrs) || this; - } - ColumnDataSource.initClass = function () { - this.prototype.type = 'ColumnDataSource'; - this.define({ - data: [p.Any, {}], - }); - }; - ColumnDataSource.prototype.initialize = function () { - var _a; - _super.prototype.initialize.call(this); - _a = serialization_1.decode_column_data(this.data), this.data = _a[0], this._shapes = _a[1]; - }; - ColumnDataSource.prototype.attributes_as_json = function (include_defaults, value_to_json) { - if (include_defaults === void 0) { - include_defaults = true; - } - if (value_to_json === void 0) { - value_to_json = ColumnDataSource._value_to_json; - } - var attrs = {}; - var obj = this.serializable_attributes(); - for (var _i = 0, _a = object_1.keys(obj); _i < _a.length; _i++) { - var key = _a[_i]; - var value = obj[key]; - if (key === 'data') - value = serialization_1.encode_column_data(value, this._shapes); - if (include_defaults) - attrs[key] = value; - else if (key in this._set_after_defaults) - attrs[key] = value; - } - return value_to_json("attributes", attrs, this); - }; - ColumnDataSource._value_to_json = function (key, value, optional_parent_object) { - if (types_1.isPlainObject(value) && key === 'data') - return serialization_1.encode_column_data(value, optional_parent_object._shapes); // XXX: unknown vs. any - else - return has_props_1.HasProps._value_to_json(key, value, optional_parent_object); - }; - ColumnDataSource.prototype.stream = function (new_data, rollover, setter_id) { - var data = this.data; - for (var k in new_data) { - data[k] = stream_to_column(data[k], new_data[k], rollover); - } - this.setv({ data: data }, { silent: true }); - this.streaming.emit(); - if (this.document != null) { - var hint = new events_1.ColumnsStreamedEvent(this.document, this.ref(), new_data, rollover); - this.document._notify_change(this, 'data', null, null, { setter_id: setter_id, hint: hint }); - } - }; - ColumnDataSource.prototype.patch = function (patches, setter_id) { - var data = this.data; - var patched = new data_structures_1.Set(); - for (var k in patches) { - var patch = patches[k]; - patched = patched.union(patch_to_column(data[k], patch, this._shapes[k])); - } - this.setv({ data: data }, { silent: true }); - this.patching.emit(patched.values); - if (this.document != null) { - var hint = new events_1.ColumnsPatchedEvent(this.document, this.ref(), patches); - this.document._notify_change(this, 'data', null, null, { setter_id: setter_id, hint: hint }); - } - }; - return ColumnDataSource; - }(columnar_data_source_1.ColumnarDataSource)); - exports.ColumnDataSource = ColumnDataSource; - ColumnDataSource.initClass(); -} -, -/* models/sources/columnar_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var data_source_1 = require(210) /* ./data_source */; - var signaling_1 = require(22) /* ../../core/signaling */; - var logging_1 = require(17) /* ../../core/logging */; - var selection_manager_1 = require(20) /* ../../core/selection_manager */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var selection_1 = require(205) /* ../selections/selection */; - var interaction_policy_1 = require(204) /* ../selections/interaction_policy */; - var ColumnarDataSource = /** @class */ (function (_super) { - tslib_1.__extends(ColumnarDataSource, _super); - function ColumnarDataSource(attrs) { - return _super.call(this, attrs) || this; - } - ColumnarDataSource.prototype.get_array = function (key) { - var column = this.data[key]; - if (column == null) - this.data[key] = column = []; - else if (!types_1.isArray(column)) - this.data[key] = column = Array.from(column); - return column; - }; - ColumnarDataSource.initClass = function () { - this.prototype.type = 'ColumnarDataSource'; - this.define({ - selection_policy: [p.Instance, function () { return new interaction_policy_1.UnionRenderers(); }], - }); - this.internal({ - selection_manager: [p.Instance, function (self) { return new selection_manager_1.SelectionManager({ source: self }); }], - inspected: [p.Instance, function () { return new selection_1.Selection(); }], - _shapes: [p.Any, {}], - }); - }; - ColumnarDataSource.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._select = new signaling_1.Signal0(this, "select"); - this.inspect = new signaling_1.Signal(this, "inspect"); // XXX: <[indices, tool, renderer-view, source, data], this> - this.streaming = new signaling_1.Signal0(this, "streaming"); - this.patching = new signaling_1.Signal(this, "patching"); - }; - ColumnarDataSource.prototype.get_column = function (colname) { - var column = this.data[colname]; - return column != null ? column : null; - }; - ColumnarDataSource.prototype.columns = function () { - // return the column names in this data source - return object_1.keys(this.data); - }; - ColumnarDataSource.prototype.get_length = function (soft) { - if (soft === void 0) { - soft = true; - } - var lengths = array_1.uniq(object_1.values(this.data).map(function (v) { return v.length; })); - switch (lengths.length) { - case 0: { - return null; // XXX: don't guess, treat on case-by-case basis - } - case 1: { - return lengths[0]; - } - default: { - var msg = "data source has columns of inconsistent lengths"; - if (soft) { - logging_1.logger.warn(msg); - return lengths.sort()[0]; - } - else - throw new Error(msg); - } - } - }; - ColumnarDataSource.prototype.get_indices = function () { - var length = this.get_length(); - return array_1.range(0, length != null ? length : 1); - //TODO: returns [0] when no data, should it? - }; - ColumnarDataSource.prototype.clear = function () { - var empty = {}; - for (var _i = 0, _a = this.columns(); _i < _a.length; _i++) { - var col = _a[_i]; - empty[col] = new this.data[col].constructor; - } - this.data = empty; - }; - return ColumnarDataSource; - }(data_source_1.DataSource)); - exports.ColumnarDataSource = ColumnarDataSource; - ColumnarDataSource.initClass(); -} -, -/* models/sources/data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var selection_1 = require(205) /* ../selections/selection */; - var p = require(18) /* ../../core/properties */; - var DataSource = /** @class */ (function (_super) { - tslib_1.__extends(DataSource, _super); - function DataSource(attrs) { - return _super.call(this, attrs) || this; - } - DataSource.initClass = function () { - this.prototype.type = "DataSource"; - this.define({ - selected: [p.Instance, function () { return new selection_1.Selection(); }], - callback: [p.Any], - }); - }; - DataSource.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.selected.change, function () { - if (_this.callback != null) - _this.callback.execute(_this); - }); - }; - return DataSource; - }(model_1.Model)); - exports.DataSource = DataSource; - DataSource.initClass(); -} -, -/* models/sources/geojson_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var columnar_data_source_1 = require(209) /* ./columnar_data_source */; - var logging_1 = require(17) /* ../../core/logging */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var GeoJSONDataSource = /** @class */ (function (_super) { - tslib_1.__extends(GeoJSONDataSource, _super); - function GeoJSONDataSource(attrs) { - return _super.call(this, attrs) || this; - } - GeoJSONDataSource.initClass = function () { - this.prototype.type = 'GeoJSONDataSource'; - this.define({ - geojson: [p.Any], - }); - this.internal({ - data: [p.Any, {}], - }); - }; - GeoJSONDataSource.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._update_data(); - }; - GeoJSONDataSource.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.properties.geojson.change, function () { return _this._update_data(); }); - }; - GeoJSONDataSource.prototype._update_data = function () { - this.data = this.geojson_to_column_data(); - }; - GeoJSONDataSource.prototype._get_new_list_array = function (length) { - return array_1.range(0, length).map(function (_i) { return []; }); - }; - GeoJSONDataSource.prototype._get_new_nan_array = function (length) { - return array_1.range(0, length).map(function (_i) { return NaN; }); - }; - GeoJSONDataSource.prototype._add_properties = function (item, data, i, item_count) { - var properties = item.properties || {}; - for (var property in properties) { - if (!data.hasOwnProperty(property)) - data[property] = this._get_new_nan_array(item_count); - data[property][i] = properties[property]; - } - }; - GeoJSONDataSource.prototype._add_geometry = function (geometry, data, i) { - function orNaN(v) { - return v != null ? v : NaN; - } - function flatten(acc, item) { - return acc.concat([[NaN, NaN, NaN]]).concat(item); - } - switch (geometry.type) { - case "Point": { - var _a = geometry.coordinates, x = _a[0], y = _a[1], z = _a[2]; - data.x[i] = x; - data.y[i] = y; - data.z[i] = orNaN(z); - break; - } - case "LineString": { - var coordinates = geometry.coordinates; - for (var j = 0; j < coordinates.length; j++) { - var _b = coordinates[j], x = _b[0], y = _b[1], z = _b[2]; - data.xs[i][j] = x; - data.ys[i][j] = y; - data.zs[i][j] = orNaN(z); - } - break; - } - case "Polygon": { - if (geometry.coordinates.length > 1) - logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.'); - var exterior_ring = geometry.coordinates[0]; - for (var j = 0; j < exterior_ring.length; j++) { - var _c = exterior_ring[j], x = _c[0], y = _c[1], z = _c[2]; - data.xs[i][j] = x; - data.ys[i][j] = y; - data.zs[i][j] = orNaN(z); - } - break; - } - case "MultiPoint": { - logging_1.logger.warn('MultiPoint not supported in Bokeh'); - break; - } - case "MultiLineString": { - var coordinates = geometry.coordinates.reduce(flatten); - for (var j = 0; j < coordinates.length; j++) { - var _d = coordinates[j], x = _d[0], y = _d[1], z = _d[2]; - data.xs[i][j] = x; - data.ys[i][j] = y; - data.zs[i][j] = orNaN(z); - } - break; - } - case "MultiPolygon": { - var exterior_rings = []; - for (var _e = 0, _f = geometry.coordinates; _e < _f.length; _e++) { - var polygon = _f[_e]; - if (polygon.length > 1) - logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.'); - exterior_rings.push(polygon[0]); - } - var coordinates = exterior_rings.reduce(flatten); - for (var j = 0; j < coordinates.length; j++) { - var _g = coordinates[j], x = _g[0], y = _g[1], z = _g[2]; - data.xs[i][j] = x; - data.ys[i][j] = y; - data.zs[i][j] = orNaN(z); - } - break; - } - default: - throw new Error("Invalid GeoJSON geometry type: " + geometry.type); - } - }; - GeoJSONDataSource.prototype.geojson_to_column_data = function () { - var geojson = JSON.parse(this.geojson); - var items; - switch (geojson.type) { - case "GeometryCollection": { - if (geojson.geometries == null) - throw new Error('No geometries found in GeometryCollection'); - if (geojson.geometries.length === 0) - throw new Error('geojson.geometries must have one or more items'); - items = geojson.geometries; - break; - } - case "FeatureCollection": { - if (geojson.features == null) - throw new Error('No features found in FeaturesCollection'); - if (geojson.features.length == 0) - throw new Error('geojson.features must have one or more items'); - items = geojson.features; - break; - } - default: - throw new Error('Bokeh only supports type GeometryCollection and FeatureCollection at top level'); - } - var item_count = 0; - for (var _a = 0, items_1 = items; _a < items_1.length; _a++) { - var item = items_1[_a]; - var geometry = item.type === 'Feature' ? item.geometry : item; - if (geometry.type == 'GeometryCollection') - item_count += geometry.geometries.length; - else - item_count += 1; - } - var data = { - x: this._get_new_nan_array(item_count), - y: this._get_new_nan_array(item_count), - z: this._get_new_nan_array(item_count), - xs: this._get_new_list_array(item_count), - ys: this._get_new_list_array(item_count), - zs: this._get_new_list_array(item_count), - }; - var arr_index = 0; - for (var _b = 0, items_2 = items; _b < items_2.length; _b++) { - var item = items_2[_b]; - var geometry = item.type == 'Feature' ? item.geometry : item; - if (geometry.type == "GeometryCollection") { - for (var _c = 0, _d = geometry.geometries; _c < _d.length; _c++) { - var g = _d[_c]; - this._add_geometry(g, data, arr_index); - if (item.type === 'Feature') - this._add_properties(item, data, arr_index, item_count); - arr_index += 1; - } - } - else { - this._add_geometry(geometry, data, arr_index); - if (item.type === 'Feature') - this._add_properties(item, data, arr_index, item_count); - arr_index += 1; - } - } - return data; - }; - return GeoJSONDataSource; - }(columnar_data_source_1.ColumnarDataSource)); - exports.GeoJSONDataSource = GeoJSONDataSource; - GeoJSONDataSource.initClass(); -} -, -/* models/sources/index */ function _(require, module, exports) { - var server_sent_data_source_1 = require(214) /* ./server_sent_data_source */; - exports.ServerSentDataSource = server_sent_data_source_1.ServerSentDataSource; - var ajax_data_source_1 = require(206) /* ./ajax_data_source */; - exports.AjaxDataSource = ajax_data_source_1.AjaxDataSource; - var column_data_source_1 = require(208) /* ./column_data_source */; - exports.ColumnDataSource = column_data_source_1.ColumnDataSource; - var columnar_data_source_1 = require(209) /* ./columnar_data_source */; - exports.ColumnarDataSource = columnar_data_source_1.ColumnarDataSource; - var cds_view_1 = require(207) /* ./cds_view */; - exports.CDSView = cds_view_1.CDSView; - var data_source_1 = require(210) /* ./data_source */; - exports.DataSource = data_source_1.DataSource; - var geojson_data_source_1 = require(211) /* ./geojson_data_source */; - exports.GeoJSONDataSource = geojson_data_source_1.GeoJSONDataSource; - var remote_data_source_1 = require(213) /* ./remote_data_source */; - exports.RemoteDataSource = remote_data_source_1.RemoteDataSource; -} -, -/* models/sources/remote_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var web_data_source_1 = require(215) /* ./web_data_source */; - var p = require(18) /* ../../core/properties */; - var RemoteDataSource = /** @class */ (function (_super) { - tslib_1.__extends(RemoteDataSource, _super); - function RemoteDataSource(attrs) { - return _super.call(this, attrs) || this; - } - RemoteDataSource.prototype.get_column = function (colname) { - var column = this.data[colname]; - return column != null ? column : []; - }; - RemoteDataSource.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.setup(); - }; - RemoteDataSource.initClass = function () { - this.prototype.type = 'RemoteDataSource'; - this.define({ - polling_interval: [p.Number], - }); - }; - return RemoteDataSource; - }(web_data_source_1.WebDataSource)); - exports.RemoteDataSource = RemoteDataSource; - RemoteDataSource.initClass(); -} -, -/* models/sources/server_sent_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var web_data_source_1 = require(215) /* ./web_data_source */; - var ServerSentDataSource = /** @class */ (function (_super) { - tslib_1.__extends(ServerSentDataSource, _super); - function ServerSentDataSource(attrs) { - var _this = _super.call(this, attrs) || this; - _this.initialized = false; - return _this; - } - ServerSentDataSource.initClass = function () { - this.prototype.type = 'ServerSentDataSource'; - }; - ServerSentDataSource.prototype.destroy = function () { - _super.prototype.destroy.call(this); - }; - ServerSentDataSource.prototype.setup = function () { - var _this = this; - if (!this.initialized) { - this.initialized = true; - var source = new EventSource(this.data_url); - source.onmessage = function (event) { - _this.load_data(JSON.parse(event.data), _this.mode, _this.max_size); - }; - } - }; - return ServerSentDataSource; - }(web_data_source_1.WebDataSource)); - exports.ServerSentDataSource = ServerSentDataSource; - ServerSentDataSource.initClass(); -} -, -/* models/sources/web_data_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var column_data_source_1 = require(208) /* ./column_data_source */; - var p = require(18) /* ../../core/properties */; - var WebDataSource = /** @class */ (function (_super) { - tslib_1.__extends(WebDataSource, _super); - function WebDataSource(attrs) { - return _super.call(this, attrs) || this; - } - WebDataSource.prototype.get_column = function (colname) { - var column = this.data[colname]; - return column != null ? column : []; - }; - WebDataSource.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.setup(); - }; - WebDataSource.prototype.load_data = function (raw_data, mode, max_size) { - var adapter = this.adapter; - var data; - if (adapter != null) - data = adapter.execute(this, { response: raw_data }); - else - data = raw_data; - switch (mode) { - case "replace": { - this.data = data; - break; - } - case "append": { - var original_data = this.data; - for (var _i = 0, _a = this.columns(); _i < _a.length; _i++) { - var column = _a[_i]; - // XXX: support typed arrays - var old_col = Array.from(original_data[column]); - var new_col = Array.from(data[column]); - data[column] = old_col.concat(new_col).slice(-max_size); - } - this.data = data; - break; - } - } - }; - WebDataSource.initClass = function () { - this.prototype.type = 'WebDataSource'; - this.define({ - mode: [p.UpdateMode, 'replace'], - max_size: [p.Number], - adapter: [p.Any, null], - data_url: [p.String], - }); - }; - return WebDataSource; - }(column_data_source_1.ColumnDataSource)); - exports.WebDataSource = WebDataSource; - WebDataSource.initClass(); -} -, -/* models/tickers/adaptive_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_ticker_1 = require(220) /* ./continuous_ticker */; - var array_1 = require(24) /* ../../core/util/array */; - var p = require(18) /* ../../core/properties */; - // Forces a number x into a specified range [min_val, max_val]. - function clamp(x, min_val, max_val) { - return Math.max(min_val, Math.min(max_val, x)); - } - // A log function with an optional base. - function log(x, base) { - if (base === void 0) { - base = Math.E; - } - return Math.log(x) / Math.log(base); - } - var AdaptiveTicker = /** @class */ (function (_super) { - tslib_1.__extends(AdaptiveTicker, _super); - function AdaptiveTicker(attrs) { - return _super.call(this, attrs) || this; - } - AdaptiveTicker.initClass = function () { - this.prototype.type = "AdaptiveTicker"; - this.define({ - base: [p.Number, 10.0], - mantissas: [p.Array, [1, 2, 5]], - min_interval: [p.Number, 0.0], - max_interval: [p.Number], - }); - }; - // These arguments control the range of possible intervals. The interval I - // returned by get_interval() will be the one that most closely matches the - // desired number of ticks, subject to the following constraints: - // I = (M * B^N), where - // M is a member of mantissas, - // B is base, - // and N is an integer; - // and min_interval <= I <= max_interval. - AdaptiveTicker.prototype.initialize = function () { - _super.prototype.initialize.call(this); - var prefix_mantissa = array_1.nth(this.mantissas, -1) / this.base; - var suffix_mantissa = array_1.nth(this.mantissas, 0) * this.base; - this.extended_mantissas = [prefix_mantissa].concat(this.mantissas, [suffix_mantissa]); - this.base_factor = this.get_min_interval() === 0.0 ? 1.0 : this.get_min_interval(); - }; - AdaptiveTicker.prototype.get_interval = function (data_low, data_high, desired_n_ticks) { - var data_range = data_high - data_low; - var ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks); - var interval_exponent = Math.floor(log(ideal_interval / this.base_factor, this.base)); - var ideal_magnitude = Math.pow(this.base, interval_exponent) * this.base_factor; - // An untested optimization. - // const ideal_mantissa = ideal_interval / ideal_magnitude - // index = sorted_index(this.extended_mantissas, ideal_mantissa) - // candidate_mantissas = this.extended_mantissas[index..index + 1] - var candidate_mantissas = this.extended_mantissas; - var errors = candidate_mantissas.map(function (mantissa) { - return Math.abs(desired_n_ticks - (data_range / (mantissa * ideal_magnitude))); - }); - var best_mantissa = candidate_mantissas[array_1.argmin(errors)]; - var interval = best_mantissa * ideal_magnitude; - return clamp(interval, this.get_min_interval(), this.get_max_interval()); - }; - return AdaptiveTicker; - }(continuous_ticker_1.ContinuousTicker)); - exports.AdaptiveTicker = AdaptiveTicker; - AdaptiveTicker.initClass(); -} -, -/* models/tickers/basic_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var adaptive_ticker_1 = require(216) /* ./adaptive_ticker */; - var BasicTicker = /** @class */ (function (_super) { - tslib_1.__extends(BasicTicker, _super); - function BasicTicker(attrs) { - return _super.call(this, attrs) || this; - } - BasicTicker.initClass = function () { - this.prototype.type = "BasicTicker"; - }; - return BasicTicker; - }(adaptive_ticker_1.AdaptiveTicker)); - exports.BasicTicker = BasicTicker; - BasicTicker.initClass(); -} -, -/* models/tickers/categorical_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var ticker_1 = require(229) /* ./ticker */; - var CategoricalTicker = /** @class */ (function (_super) { - tslib_1.__extends(CategoricalTicker, _super); - function CategoricalTicker(attrs) { - return _super.call(this, attrs) || this; - } - CategoricalTicker.initClass = function () { - this.prototype.type = "CategoricalTicker"; - }; - CategoricalTicker.prototype.get_ticks = function (start, end, range, _cross_loc, _) { - var majors = this._collect(range.factors, range, start, end); - var tops = this._collect(range.tops || [], range, start, end); - var mids = this._collect(range.mids || [], range, start, end); - return { - major: majors, - minor: [], - tops: tops, - mids: mids, - }; - }; - CategoricalTicker.prototype._collect = function (factors, range, start, end) { - var result = []; - for (var _i = 0, factors_1 = factors; _i < factors_1.length; _i++) { - var factor = factors_1[_i]; - var coord = range.synthetic(factor); - if (coord > start && coord < end) - result.push(factor); - } - return result; - }; - return CategoricalTicker; - }(ticker_1.Ticker)); - exports.CategoricalTicker = CategoricalTicker; - CategoricalTicker.initClass(); -} -, -/* models/tickers/composite_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_ticker_1 = require(220) /* ./continuous_ticker */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var object_1 = require(35) /* ../../core/util/object */; - var CompositeTicker = /** @class */ (function (_super) { - tslib_1.__extends(CompositeTicker, _super); - function CompositeTicker(attrs) { - return _super.call(this, attrs) || this; - } - CompositeTicker.initClass = function () { - this.prototype.type = "CompositeTicker"; - this.define({ - tickers: [p.Array, []], - }); - }; - Object.defineProperty(CompositeTicker.prototype, "min_intervals", { - // The tickers should be in order of increasing interval size; specifically, - // if S comes before T, then it should be the case that - // S.get_max_interval() < T.get_min_interval(). - // FIXME Enforce this automatically. - get: function () { - return this.tickers.map(function (ticker) { return ticker.get_min_interval(); }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CompositeTicker.prototype, "max_intervals", { - get: function () { - return this.tickers.map(function (ticker) { return ticker.get_max_interval(); }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CompositeTicker.prototype, "min_interval", { - get: function () { - return this.min_intervals[0]; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CompositeTicker.prototype, "max_interval", { - get: function () { - return this.max_intervals[0]; - }, - enumerable: true, - configurable: true - }); - CompositeTicker.prototype.get_best_ticker = function (data_low, data_high, desired_n_ticks) { - var data_range = data_high - data_low; - var ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks); - var ticker_ndxs = [ - array_1.sorted_index(this.min_intervals, ideal_interval) - 1, - array_1.sorted_index(this.max_intervals, ideal_interval), - ]; - var intervals = [ - this.min_intervals[ticker_ndxs[0]], - this.max_intervals[ticker_ndxs[1]], - ]; - var errors = intervals.map(function (interval) { - return Math.abs(desired_n_ticks - (data_range / interval)); - }); - var best_ticker; - if (object_1.isEmpty(errors.filter(function (e) { return !isNaN(e); }))) { - // this can happen if the data isn't loaded yet, we just default to the first scale - best_ticker = this.tickers[0]; - } - else { - var best_index = array_1.argmin(errors); - var best_ticker_ndx = ticker_ndxs[best_index]; - best_ticker = this.tickers[best_ticker_ndx]; - } - return best_ticker; - }; - CompositeTicker.prototype.get_interval = function (data_low, data_high, desired_n_ticks) { - var best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks); - return best_ticker.get_interval(data_low, data_high, desired_n_ticks); - }; - CompositeTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) { - var best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks); - return best_ticker.get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks); - }; - return CompositeTicker; - }(continuous_ticker_1.ContinuousTicker)); - exports.CompositeTicker = CompositeTicker; - CompositeTicker.initClass(); -} -, -/* models/tickers/continuous_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var ticker_1 = require(229) /* ./ticker */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var ContinuousTicker = /** @class */ (function (_super) { - tslib_1.__extends(ContinuousTicker, _super); - function ContinuousTicker(attrs) { - return _super.call(this, attrs) || this; - } - ContinuousTicker.initClass = function () { - this.prototype.type = "ContinuousTicker"; - this.define({ - num_minor_ticks: [p.Number, 5], - desired_num_ticks: [p.Number, 6], - }); - }; - ContinuousTicker.prototype.get_ticks = function (data_low, data_high, _range, cross_loc, _) { - return this.get_ticks_no_defaults(data_low, data_high, cross_loc, this.desired_num_ticks); - }; - // The version of get_ticks() that does the work (and the version that - // should be overridden in subclasses). - ContinuousTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, desired_n_ticks) { - var interval = this.get_interval(data_low, data_high, desired_n_ticks); - var start_factor = Math.floor(data_low / interval); - var end_factor = Math.ceil(data_high / interval); - var factors; - if (types_1.isStrictNaN(start_factor) || types_1.isStrictNaN(end_factor)) - factors = []; - else - factors = array_1.range(start_factor, end_factor + 1); - var ticks = factors.map(function (factor) { return factor * interval; }) - .filter(function (tick) { return data_low <= tick && tick <= data_high; }); - var num_minor_ticks = this.num_minor_ticks; - var minor_ticks = []; - if (num_minor_ticks > 0 && ticks.length > 0) { - var minor_interval_1 = interval / num_minor_ticks; - var minor_offsets = array_1.range(0, num_minor_ticks).map(function (i) { return i * minor_interval_1; }); - for (var _i = 0, _a = minor_offsets.slice(1); _i < _a.length; _i++) { - var x = _a[_i]; - var mt = ticks[0] - x; - if (data_low <= mt && mt <= data_high) { - minor_ticks.push(mt); - } - } - for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) { - var tick = ticks_1[_b]; - for (var _c = 0, minor_offsets_1 = minor_offsets; _c < minor_offsets_1.length; _c++) { - var x = minor_offsets_1[_c]; - var mt = tick + x; - if (data_low <= mt && mt <= data_high) { - minor_ticks.push(mt); - } - } - } - } - return { - major: ticks, - minor: minor_ticks, - }; - }; - // Returns the smallest interval that can be returned by get_interval(). - ContinuousTicker.prototype.get_min_interval = function () { - return this.min_interval; - }; - // Returns the largest interval that can be returned by get_interval(). - ContinuousTicker.prototype.get_max_interval = function () { - return this.max_interval != null ? this.max_interval : Infinity; - }; - // Returns the interval size that would produce exactly the number of - // desired ticks. (In general we won't use exactly this interval, because - // we want the ticks to be round numbers.) - ContinuousTicker.prototype.get_ideal_interval = function (data_low, data_high, desired_n_ticks) { - var data_range = data_high - data_low; - return data_range / desired_n_ticks; - }; - return ContinuousTicker; - }(ticker_1.Ticker)); - exports.ContinuousTicker = ContinuousTicker; - ContinuousTicker.initClass(); -} -, -/* models/tickers/datetime_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var array_1 = require(24) /* ../../core/util/array */; - var adaptive_ticker_1 = require(216) /* ./adaptive_ticker */; - var composite_ticker_1 = require(219) /* ./composite_ticker */; - var days_ticker_1 = require(222) /* ./days_ticker */; - var months_ticker_1 = require(227) /* ./months_ticker */; - var years_ticker_1 = require(231) /* ./years_ticker */; - var util_1 = require(230) /* ./util */; - var DatetimeTicker = /** @class */ (function (_super) { - tslib_1.__extends(DatetimeTicker, _super); - function DatetimeTicker(attrs) { - return _super.call(this, attrs) || this; - } - DatetimeTicker.initClass = function () { - this.prototype.type = "DatetimeTicker"; - this.override({ - num_minor_ticks: 0, - tickers: function () { - return [ - // Sub-second. - new adaptive_ticker_1.AdaptiveTicker({ - mantissas: [1, 2, 5], - base: 10, - min_interval: 0, - max_interval: 500 * util_1.ONE_MILLI, - num_minor_ticks: 0, - }), - // Seconds, minutes. - new adaptive_ticker_1.AdaptiveTicker({ - mantissas: [1, 2, 5, 10, 15, 20, 30], - base: 60, - min_interval: util_1.ONE_SECOND, - max_interval: 30 * util_1.ONE_MINUTE, - num_minor_ticks: 0, - }), - // Hours. - new adaptive_ticker_1.AdaptiveTicker({ - mantissas: [1, 2, 4, 6, 8, 12], - base: 24.0, - min_interval: util_1.ONE_HOUR, - max_interval: 12 * util_1.ONE_HOUR, - num_minor_ticks: 0, - }), - // Days. - new days_ticker_1.DaysTicker({ days: array_1.range(1, 32) }), - new days_ticker_1.DaysTicker({ days: array_1.range(1, 31, 3) }), - new days_ticker_1.DaysTicker({ days: [1, 8, 15, 22] }), - new days_ticker_1.DaysTicker({ days: [1, 15] }), - // Months. - new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 1) }), - new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 2) }), - new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 4) }), - new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 6) }), - // Years - new years_ticker_1.YearsTicker({}), - ]; - }, - }); - }; - return DatetimeTicker; - }(composite_ticker_1.CompositeTicker)); - exports.DatetimeTicker = DatetimeTicker; - DatetimeTicker.initClass(); -} -, -/* models/tickers/days_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var single_interval_ticker_1 = require(228) /* ./single_interval_ticker */; - var util_1 = require(230) /* ./util */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - // Given a start and end time in millis, returns the shortest array of - // consecutive months (as Dates) that surrounds both times. - function date_range_by_month(start_time, end_time) { - var start_date = util_1.last_month_no_later_than(new Date(start_time)); - var end_date = util_1.last_month_no_later_than(new Date(end_time)); - // XXX This is not a reliable technique in general, but it should be - // safe when the day of the month is 1. (The problem case is this: - // Mar 31 -> Apr 31, which becomes May 1.) - end_date.setUTCMonth(end_date.getUTCMonth() + 1); - var dates = []; - var date = start_date; - while (true) { - dates.push(util_1.copy_date(date)); - date.setUTCMonth(date.getUTCMonth() + 1); - if (date > end_date) - break; - } - return dates; - } - var DaysTicker = /** @class */ (function (_super) { - tslib_1.__extends(DaysTicker, _super); - function DaysTicker(attrs) { - return _super.call(this, attrs) || this; - } - DaysTicker.initClass = function () { - this.prototype.type = "DaysTicker"; - this.define({ - days: [p.Array, []], - }); - this.override({ - num_minor_ticks: 0, - }); - }; - DaysTicker.prototype.initialize = function () { - _super.prototype.initialize.call(this); - var days = this.days; - if (days.length > 1) - this.interval = (days[1] - days[0]) * util_1.ONE_DAY; - else - this.interval = 31 * util_1.ONE_DAY; - }; - DaysTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, _desired_n_ticks) { - var month_dates = date_range_by_month(data_low, data_high); - var days = this.days; - var days_of_month = function (month_date, interval) { - var current_month = month_date.getUTCMonth(); - var dates = []; - for (var _i = 0, days_1 = days; _i < days_1.length; _i++) { - var day = days_1[_i]; - var day_date = util_1.copy_date(month_date); - day_date.setUTCDate(day); - // We can't use all of the values in this.days, because they may not - // fall within the current month. In fact, if, e.g., our month is 28 days - // and we're marking every third day, we don't want day 28 to show up - // because it'll be right next to the 1st of the next month. So we - // make sure we have a bit of room before we include a day. - // TODO (bev) The above description does not exactly work because JS Date - // is broken and will happily consider "Feb 28 + 3*ONE_DAY" to have month "2" - var future_date = new Date(day_date.getTime() + (interval / 2)); - if (future_date.getUTCMonth() == current_month) - dates.push(day_date); - } - return dates; - }; - var interval = this.interval; - var day_dates = array_1.concat(month_dates.map(function (date) { return days_of_month(date, interval); })); - var all_ticks = day_dates.map(function (day_date) { return day_date.getTime(); }); - var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }); - return { - major: ticks_in_range, - minor: [], - }; - }; - return DaysTicker; - }(single_interval_ticker_1.SingleIntervalTicker)); - exports.DaysTicker = DaysTicker; - DaysTicker.initClass(); -} -, -/* models/tickers/fixed_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_ticker_1 = require(220) /* ./continuous_ticker */; - var p = require(18) /* ../../core/properties */; - var FixedTicker = /** @class */ (function (_super) { - tslib_1.__extends(FixedTicker, _super); - function FixedTicker(attrs) { - var _this = _super.call(this, attrs) || this; - _this.min_interval = 0; - _this.max_interval = 0; - return _this; - } - FixedTicker.initClass = function () { - this.prototype.type = "FixedTicker"; - this.define({ - ticks: [p.Array, []], - minor_ticks: [p.Array, []], - }); - }; - FixedTicker.prototype.get_ticks_no_defaults = function (_data_low, _data_high, _cross_loc, _desired_n_ticks) { - return { - major: this.ticks, - minor: this.minor_ticks, - }; - }; - // XXX: whatever, because FixedTicker needs to fullfill the interface somehow - FixedTicker.prototype.get_interval = function (_data_low, _data_high, _desired_n_ticks) { - return 0; - }; - return FixedTicker; - }(continuous_ticker_1.ContinuousTicker)); - exports.FixedTicker = FixedTicker; - FixedTicker.initClass(); -} -, -/* models/tickers/index */ function _(require, module, exports) { - var adaptive_ticker_1 = require(216) /* ./adaptive_ticker */; - exports.AdaptiveTicker = adaptive_ticker_1.AdaptiveTicker; - var basic_ticker_1 = require(217) /* ./basic_ticker */; - exports.BasicTicker = basic_ticker_1.BasicTicker; - var categorical_ticker_1 = require(218) /* ./categorical_ticker */; - exports.CategoricalTicker = categorical_ticker_1.CategoricalTicker; - var composite_ticker_1 = require(219) /* ./composite_ticker */; - exports.CompositeTicker = composite_ticker_1.CompositeTicker; - var continuous_ticker_1 = require(220) /* ./continuous_ticker */; - exports.ContinuousTicker = continuous_ticker_1.ContinuousTicker; - var datetime_ticker_1 = require(221) /* ./datetime_ticker */; - exports.DatetimeTicker = datetime_ticker_1.DatetimeTicker; - var days_ticker_1 = require(222) /* ./days_ticker */; - exports.DaysTicker = days_ticker_1.DaysTicker; - var fixed_ticker_1 = require(223) /* ./fixed_ticker */; - exports.FixedTicker = fixed_ticker_1.FixedTicker; - var log_ticker_1 = require(225) /* ./log_ticker */; - exports.LogTicker = log_ticker_1.LogTicker; - var mercator_ticker_1 = require(226) /* ./mercator_ticker */; - exports.MercatorTicker = mercator_ticker_1.MercatorTicker; - var months_ticker_1 = require(227) /* ./months_ticker */; - exports.MonthsTicker = months_ticker_1.MonthsTicker; - var single_interval_ticker_1 = require(228) /* ./single_interval_ticker */; - exports.SingleIntervalTicker = single_interval_ticker_1.SingleIntervalTicker; - var ticker_1 = require(229) /* ./ticker */; - exports.Ticker = ticker_1.Ticker; - var years_ticker_1 = require(231) /* ./years_ticker */; - exports.YearsTicker = years_ticker_1.YearsTicker; -} -, -/* models/tickers/log_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var adaptive_ticker_1 = require(216) /* ./adaptive_ticker */; - var array_1 = require(24) /* ../../core/util/array */; - var LogTicker = /** @class */ (function (_super) { - tslib_1.__extends(LogTicker, _super); - function LogTicker(attrs) { - return _super.call(this, attrs) || this; - } - LogTicker.initClass = function () { - this.prototype.type = "LogTicker"; - this.override({ - mantissas: [1, 5], - }); - }; - LogTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, desired_n_ticks) { - var num_minor_ticks = this.num_minor_ticks; - var minor_ticks = []; - var base = this.base; - var log_low = Math.log(data_low) / Math.log(base); - var log_high = Math.log(data_high) / Math.log(base); - var log_interval = log_high - log_low; - var ticks; - if (!isFinite(log_interval)) { - ticks = []; - } - else if (log_interval < 2) { // treat as linear ticker - var interval_1 = this.get_interval(data_low, data_high, desired_n_ticks); - var start_factor = Math.floor(data_low / interval_1); - var end_factor = Math.ceil(data_high / interval_1); - ticks = array_1.range(start_factor, end_factor + 1) - .filter(function (factor) { return factor != 0; }) - .map(function (factor) { return factor * interval_1; }) - .filter(function (tick) { return data_low <= tick && tick <= data_high; }); - if (num_minor_ticks > 0 && ticks.length > 0) { - var minor_interval_1 = interval_1 / num_minor_ticks; - var minor_offsets = array_1.range(0, num_minor_ticks).map(function (i) { return i * minor_interval_1; }); - for (var _i = 0, _a = minor_offsets.slice(1); _i < _a.length; _i++) { - var x = _a[_i]; - minor_ticks.push(ticks[0] - x); - } - for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) { - var tick = ticks_1[_b]; - for (var _c = 0, minor_offsets_1 = minor_offsets; _c < minor_offsets_1.length; _c++) { - var x = minor_offsets_1[_c]; - minor_ticks.push(tick + x); - } - } - } - } - else { - var startlog = Math.ceil(log_low * 0.999999); - var endlog = Math.floor(log_high * 1.000001); - var interval = Math.ceil((endlog - startlog) / 9.0); - ticks = array_1.range(startlog - 1, endlog + 1, interval) - .map(function (i) { return Math.pow(base, i); }); - if (num_minor_ticks > 0 && ticks.length > 0) { - var minor_interval_2 = Math.pow(base, interval) / num_minor_ticks; - var minor_offsets = array_1.range(1, num_minor_ticks + 1).map(function (i) { return i * minor_interval_2; }); - for (var _d = 0, minor_offsets_2 = minor_offsets; _d < minor_offsets_2.length; _d++) { - var x = minor_offsets_2[_d]; - minor_ticks.push(ticks[0] / x); - } - minor_ticks.push(ticks[0]); - for (var _e = 0, ticks_2 = ticks; _e < ticks_2.length; _e++) { - var tick = ticks_2[_e]; - for (var _f = 0, minor_offsets_3 = minor_offsets; _f < minor_offsets_3.length; _f++) { - var x = minor_offsets_3[_f]; - minor_ticks.push(tick * x); - } - } - } - } - return { - major: ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }), - minor: minor_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }), - }; - }; - return LogTicker; - }(adaptive_ticker_1.AdaptiveTicker)); - exports.LogTicker = LogTicker; - LogTicker.initClass(); -} -, -/* models/tickers/mercator_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var basic_ticker_1 = require(217) /* ./basic_ticker */; - var p = require(18) /* ../../core/properties */; - var projections_1 = require(36) /* ../../core/util/projections */; - var MercatorTicker = /** @class */ (function (_super) { - tslib_1.__extends(MercatorTicker, _super); - function MercatorTicker(attrs) { - return _super.call(this, attrs) || this; - } - MercatorTicker.initClass = function () { - this.prototype.type = "MercatorTicker"; - this.define({ - dimension: [p.LatLon], - }); - }; - MercatorTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) { - var _a, _b, _c, _d, _e; - if (this.dimension == null) { - throw new Error("MercatorTicker.dimension not configured"); - } - _a = projections_1.clip_mercator(data_low, data_high, this.dimension), data_low = _a[0], data_high = _a[1]; - var proj_low, proj_high, proj_cross_loc; - if (this.dimension === "lon") { - _b = projections_1.wgs84_mercator.inverse([data_low, cross_loc]), proj_low = _b[0], proj_cross_loc = _b[1]; - _c = projections_1.wgs84_mercator.inverse([data_high, cross_loc]), proj_high = _c[0], proj_cross_loc = _c[1]; - } - else { - _d = projections_1.wgs84_mercator.inverse([cross_loc, data_low]), proj_cross_loc = _d[0], proj_low = _d[1]; - _e = projections_1.wgs84_mercator.inverse([cross_loc, data_high]), proj_cross_loc = _e[0], proj_high = _e[1]; - } - var proj_ticks = _super.prototype.get_ticks_no_defaults.call(this, proj_low, proj_high, cross_loc, desired_n_ticks); - var major = []; - var minor = []; - if (this.dimension === "lon") { - for (var _i = 0, _f = proj_ticks.major; _i < _f.length; _i++) { - var tick = _f[_i]; - if (projections_1.in_bounds(tick, 'lon')) { - var lon = projections_1.wgs84_mercator.forward([tick, proj_cross_loc])[0]; - major.push(lon); - } - } - for (var _g = 0, _h = proj_ticks.minor; _g < _h.length; _g++) { - var tick = _h[_g]; - if (projections_1.in_bounds(tick, 'lon')) { - var lon = projections_1.wgs84_mercator.forward([tick, proj_cross_loc])[0]; - minor.push(lon); - } - } - } - else { - for (var _j = 0, _k = proj_ticks.major; _j < _k.length; _j++) { - var tick = _k[_j]; - if (projections_1.in_bounds(tick, 'lat')) { - var _l = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]), lat = _l[1]; - major.push(lat); - } - } - for (var _m = 0, _o = proj_ticks.minor; _m < _o.length; _m++) { - var tick = _o[_m]; - if (projections_1.in_bounds(tick, 'lat')) { - var _p = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]), lat = _p[1]; - minor.push(lat); - } - } - } - return { major: major, minor: minor }; - }; - return MercatorTicker; - }(basic_ticker_1.BasicTicker)); - exports.MercatorTicker = MercatorTicker; - MercatorTicker.initClass(); -} -, -/* models/tickers/months_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var single_interval_ticker_1 = require(228) /* ./single_interval_ticker */; - var util_1 = require(230) /* ./util */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - // Given a start and end time in millis, returns the shortest array of - // consecutive years (as Dates) that surrounds both times. - function date_range_by_year(start_time, end_time) { - var start_date = util_1.last_year_no_later_than(new Date(start_time)); - var end_date = util_1.last_year_no_later_than(new Date(end_time)); - end_date.setUTCFullYear(end_date.getUTCFullYear() + 1); - var dates = []; - var date = start_date; - while (true) { - dates.push(util_1.copy_date(date)); - date.setUTCFullYear(date.getUTCFullYear() + 1); - if (date > end_date) - break; - } - return dates; - } - var MonthsTicker = /** @class */ (function (_super) { - tslib_1.__extends(MonthsTicker, _super); - function MonthsTicker(attrs) { - return _super.call(this, attrs) || this; - } - MonthsTicker.initClass = function () { - this.prototype.type = "MonthsTicker"; - this.define({ - months: [p.Array, []], - }); - }; - MonthsTicker.prototype.initialize = function () { - _super.prototype.initialize.call(this); - var months = this.months; - if (months.length > 1) - this.interval = (months[1] - months[0]) * util_1.ONE_MONTH; - else - this.interval = 12 * util_1.ONE_MONTH; - }; - MonthsTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, _desired_n_ticks) { - var year_dates = date_range_by_year(data_low, data_high); - var months = this.months; - var months_of_year = function (year_date) { - return months.map(function (month) { - var month_date = util_1.copy_date(year_date); - month_date.setUTCMonth(month); - return month_date; - }); - }; - var month_dates = array_1.concat(year_dates.map(months_of_year)); - var all_ticks = month_dates.map(function (month_date) { return month_date.getTime(); }); - var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }); - return { - major: ticks_in_range, - minor: [], - }; - }; - return MonthsTicker; - }(single_interval_ticker_1.SingleIntervalTicker)); - exports.MonthsTicker = MonthsTicker; - MonthsTicker.initClass(); -} -, -/* models/tickers/single_interval_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var continuous_ticker_1 = require(220) /* ./continuous_ticker */; - var p = require(18) /* ../../core/properties */; - var SingleIntervalTicker = /** @class */ (function (_super) { - tslib_1.__extends(SingleIntervalTicker, _super); - function SingleIntervalTicker(attrs) { - return _super.call(this, attrs) || this; - } - SingleIntervalTicker.initClass = function () { - this.prototype.type = "SingleIntervalTicker"; - this.define({ - interval: [p.Number], - }); - }; - SingleIntervalTicker.prototype.get_interval = function (_data_low, _data_high, _n_desired_ticks) { - return this.interval; - }; - Object.defineProperty(SingleIntervalTicker.prototype, "min_interval", { - get: function () { - return this.interval; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SingleIntervalTicker.prototype, "max_interval", { - get: function () { - return this.interval; - }, - enumerable: true, - configurable: true - }); - return SingleIntervalTicker; - }(continuous_ticker_1.ContinuousTicker)); - exports.SingleIntervalTicker = SingleIntervalTicker; - SingleIntervalTicker.initClass(); -} -, -/* models/tickers/ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var Ticker = /** @class */ (function (_super) { - tslib_1.__extends(Ticker, _super); - function Ticker(attrs) { - return _super.call(this, attrs) || this; - } - Ticker.initClass = function () { - this.prototype.type = "Ticker"; - }; - return Ticker; - }(model_1.Model)); - exports.Ticker = Ticker; - Ticker.initClass(); -} -, -/* models/tickers/util */ function _(require, module, exports) { - // Some time constants, in milliseconds. - exports.ONE_MILLI = 1.0; - exports.ONE_SECOND = 1000.0; - exports.ONE_MINUTE = 60.0 * exports.ONE_SECOND; - exports.ONE_HOUR = 60 * exports.ONE_MINUTE; - exports.ONE_DAY = 24 * exports.ONE_HOUR; - exports.ONE_MONTH = 30 * exports.ONE_DAY; // An approximation, obviously. - exports.ONE_YEAR = 365 * exports.ONE_DAY; - // --------------------------------------------------------------------------- - // Date/time utility functions - // --------------------------------------------------------------------------- - // Makes a copy of a date object. - function copy_date(date) { - return new Date(date.getTime()); - } - exports.copy_date = copy_date; - // Rounds a date down to the month. - function last_month_no_later_than(date) { - var new_date = copy_date(date); - new_date.setUTCDate(1); - new_date.setUTCHours(0); - new_date.setUTCMinutes(0); - new_date.setUTCSeconds(0); - new_date.setUTCMilliseconds(0); - return new_date; - } - exports.last_month_no_later_than = last_month_no_later_than; - // Rounds a date down to the year. - function last_year_no_later_than(date) { - var new_date = last_month_no_later_than(date); - new_date.setUTCMonth(0); - return new_date; - } - exports.last_year_no_later_than = last_year_no_later_than; -} -, -/* models/tickers/years_ticker */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var basic_ticker_1 = require(217) /* ./basic_ticker */; - var single_interval_ticker_1 = require(228) /* ./single_interval_ticker */; - var util_1 = require(230) /* ./util */; - var YearsTicker = /** @class */ (function (_super) { - tslib_1.__extends(YearsTicker, _super); - function YearsTicker(attrs) { - return _super.call(this, attrs) || this; - } - YearsTicker.initClass = function () { - this.prototype.type = "YearsTicker"; - }; - YearsTicker.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.interval = util_1.ONE_YEAR; - this.basic_ticker = new basic_ticker_1.BasicTicker({ num_minor_ticks: 0 }); - }; - YearsTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) { - var start_year = util_1.last_year_no_later_than(new Date(data_low)).getUTCFullYear(); - var end_year = util_1.last_year_no_later_than(new Date(data_high)).getUTCFullYear(); - var years = this.basic_ticker.get_ticks_no_defaults(start_year, end_year, cross_loc, desired_n_ticks).major; - var all_ticks = years.map(function (year) { return Date.UTC(year, 0, 1); }); - var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }); - return { - major: ticks_in_range, - minor: [], - }; - }; - return YearsTicker; - }(single_interval_ticker_1.SingleIntervalTicker)); - exports.YearsTicker = YearsTicker; - YearsTicker.initClass(); -} -, -/* models/tiles/bbox_tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mercator_tile_source_1 = require(235) /* ./mercator_tile_source */; - var p = require(18) /* ../../core/properties */; - var BBoxTileSource = /** @class */ (function (_super) { - tslib_1.__extends(BBoxTileSource, _super); - function BBoxTileSource(attrs) { - return _super.call(this, attrs) || this; - } - BBoxTileSource.initClass = function () { - this.prototype.type = 'BBoxTileSource'; - this.define({ - use_latlon: [p.Boolean, false], - }); - }; - BBoxTileSource.prototype.get_image_url = function (x, y, z) { - var _a, _b; - var image_url = this.string_lookup_replace(this.url, this.extra_url_vars); - var xmax, xmin, ymax, ymin; - if (this.use_latlon) - _a = this.get_tile_geographic_bounds(x, y, z), xmin = _a[0], ymin = _a[1], xmax = _a[2], ymax = _a[3]; - else - _b = this.get_tile_meter_bounds(x, y, z), xmin = _b[0], ymin = _b[1], xmax = _b[2], ymax = _b[3]; - return image_url.replace("{XMIN}", xmin.toString()) - .replace("{YMIN}", ymin.toString()) - .replace("{XMAX}", xmax.toString()) - .replace("{YMAX}", ymax.toString()); - }; - return BBoxTileSource; - }(mercator_tile_source_1.MercatorTileSource)); - exports.BBoxTileSource = BBoxTileSource; - BBoxTileSource.initClass(); -} -, -/* models/tiles/image_pool */ function _(require, module, exports) { - var types_1 = require(46) /* ../../core/util/types */; - var ImagePool = /** @class */ (function () { - function ImagePool() { - this.images = []; - } - ImagePool.prototype.pop = function () { - var img = this.images.pop(); - return img != null ? img : new Image(); - }; - ImagePool.prototype.push = function (img) { - var _a; - if (this.images.length > 50) - return; - if (types_1.isArray(img)) - (_a = this.images).push.apply(_a, img); - else - this.images.push(img); - }; - return ImagePool; - }()); - exports.ImagePool = ImagePool; -} -, -/* models/tiles/index */ function _(require, module, exports) { - var bbox_tile_source_1 = require(232) /* ./bbox_tile_source */; - exports.BBoxTileSource = bbox_tile_source_1.BBoxTileSource; - var mercator_tile_source_1 = require(235) /* ./mercator_tile_source */; - exports.MercatorTileSource = mercator_tile_source_1.MercatorTileSource; - var quadkey_tile_source_1 = require(236) /* ./quadkey_tile_source */; - exports.QUADKEYTileSource = quadkey_tile_source_1.QUADKEYTileSource; - var tile_renderer_1 = require(237) /* ./tile_renderer */; - exports.TileRenderer = tile_renderer_1.TileRenderer; - var tile_source_1 = require(238) /* ./tile_source */; - exports.TileSource = tile_source_1.TileSource; - var tms_tile_source_1 = require(240) /* ./tms_tile_source */; - exports.TMSTileSource = tms_tile_source_1.TMSTileSource; - var wmts_tile_source_1 = require(241) /* ./wmts_tile_source */; - exports.WMTSTileSource = wmts_tile_source_1.WMTSTileSource; -} -, -/* models/tiles/mercator_tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var tile_source_1 = require(238) /* ./tile_source */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var tile_utils_1 = require(239) /* ./tile_utils */; - var MercatorTileSource = /** @class */ (function (_super) { - tslib_1.__extends(MercatorTileSource, _super); - function MercatorTileSource(attrs) { - return _super.call(this, attrs) || this; - } - MercatorTileSource.initClass = function () { - this.prototype.type = 'MercatorTileSource'; - this.define({ - snap_to_zoom: [p.Boolean, false], - wrap_around: [p.Boolean, true], - }); - this.override({ - x_origin_offset: 20037508.34, - y_origin_offset: 20037508.34, - initial_resolution: 156543.03392804097, - }); - }; - MercatorTileSource.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this._resolutions = array_1.range(this.min_zoom, this.max_zoom + 1).map(function (z) { return _this.get_resolution(z); }); - }; - MercatorTileSource.prototype._computed_initial_resolution = function () { - if (this.initial_resolution != null) - return this.initial_resolution; - else { - // TODO testing 2015-11-17, if this codepath is used it seems - // to use 100% cpu and wedge Chrome - return (2 * Math.PI * 6378137) / this.tile_size; - } - }; - MercatorTileSource.prototype.is_valid_tile = function (x, y, z) { - if (!this.wrap_around) { - if (x < 0 || x >= Math.pow(2, z)) - return false; - } - if (y < 0 || y >= Math.pow(2, z)) - return false; - return true; - }; - MercatorTileSource.prototype.parent_by_tile_xyz = function (x, y, z) { - var quadkey = this.tile_xyz_to_quadkey(x, y, z); - var parent_quadkey = quadkey.substring(0, quadkey.length - 1); - return this.quadkey_to_tile_xyz(parent_quadkey); - }; - MercatorTileSource.prototype.get_resolution = function (level) { - return this._computed_initial_resolution() / Math.pow(2, level); - }; - MercatorTileSource.prototype.get_resolution_by_extent = function (extent, height, width) { - var x_rs = (extent[2] - extent[0]) / width; - var y_rs = (extent[3] - extent[1]) / height; - return [x_rs, y_rs]; - }; - MercatorTileSource.prototype.get_level_by_extent = function (extent, height, width) { - var x_rs = (extent[2] - extent[0]) / width; - var y_rs = (extent[3] - extent[1]) / height; - var resolution = Math.max(x_rs, y_rs); - var i = 0; - for (var _i = 0, _a = this._resolutions; _i < _a.length; _i++) { - var r = _a[_i]; - if (resolution > r) { - if (i == 0) - return 0; - if (i > 0) - return i - 1; - } - i += 1; - } - // otherwise return the highest available resolution - return (i - 1); - }; - MercatorTileSource.prototype.get_closest_level_by_extent = function (extent, height, width) { - var x_rs = (extent[2] - extent[0]) / width; - var y_rs = (extent[3] - extent[1]) / height; - var resolution = Math.max(x_rs, y_rs); - var closest = this._resolutions.reduce(function (previous, current) { - if (Math.abs(current - resolution) < Math.abs(previous - resolution)) - return current; - else - return previous; - }); - return this._resolutions.indexOf(closest); - }; - MercatorTileSource.prototype.snap_to_zoom_level = function (extent, height, width, level) { - var xmin = extent[0], ymin = extent[1], xmax = extent[2], ymax = extent[3]; - var desired_res = this._resolutions[level]; - var desired_x_delta = width * desired_res; - var desired_y_delta = height * desired_res; - if (!this.snap_to_zoom) { - var xscale = (xmax - xmin) / desired_x_delta; - var yscale = (ymax - ymin) / desired_y_delta; - if (xscale > yscale) { - desired_x_delta = (xmax - xmin); - desired_y_delta = desired_y_delta * xscale; - } - else { - desired_x_delta = desired_x_delta * yscale; - desired_y_delta = (ymax - ymin); - } - } - var x_adjust = (desired_x_delta - (xmax - xmin)) / 2; - var y_adjust = (desired_y_delta - (ymax - ymin)) / 2; - return [xmin - x_adjust, ymin - y_adjust, xmax + x_adjust, ymax + y_adjust]; - }; - MercatorTileSource.prototype.tms_to_wmts = function (x, y, z) { - 'Note this works both ways'; - return [x, Math.pow(2, z) - 1 - y, z]; - }; - MercatorTileSource.prototype.wmts_to_tms = function (x, y, z) { - 'Note this works both ways'; - return [x, Math.pow(2, z) - 1 - y, z]; - }; - MercatorTileSource.prototype.pixels_to_meters = function (px, py, level) { - var res = this.get_resolution(level); - var mx = (px * res) - this.x_origin_offset; - var my = (py * res) - this.y_origin_offset; - return [mx, my]; - }; - MercatorTileSource.prototype.meters_to_pixels = function (mx, my, level) { - var res = this.get_resolution(level); - var px = (mx + this.x_origin_offset) / res; - var py = (my + this.y_origin_offset) / res; - return [px, py]; - }; - MercatorTileSource.prototype.pixels_to_tile = function (px, py) { - var tx = Math.ceil(px / this.tile_size); - tx = tx === 0 ? tx : tx - 1; - var ty = Math.max(Math.ceil(py / this.tile_size) - 1, 0); - return [tx, ty]; - }; - MercatorTileSource.prototype.pixels_to_raster = function (px, py, level) { - var mapSize = this.tile_size << level; - return [px, mapSize - py]; - }; - MercatorTileSource.prototype.meters_to_tile = function (mx, my, level) { - var _a = this.meters_to_pixels(mx, my, level), px = _a[0], py = _a[1]; - return this.pixels_to_tile(px, py); - }; - MercatorTileSource.prototype.get_tile_meter_bounds = function (tx, ty, level) { - // expects tms styles coordinates (bottom-left origin) - var _a = this.pixels_to_meters(tx * this.tile_size, ty * this.tile_size, level), xmin = _a[0], ymin = _a[1]; - var _b = this.pixels_to_meters((tx + 1) * this.tile_size, (ty + 1) * this.tile_size, level), xmax = _b[0], ymax = _b[1]; - return [xmin, ymin, xmax, ymax]; - }; - MercatorTileSource.prototype.get_tile_geographic_bounds = function (tx, ty, level) { - var bounds = this.get_tile_meter_bounds(tx, ty, level); - var _a = tile_utils_1.meters_extent_to_geographic(bounds), minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3]; - return [minLon, minLat, maxLon, maxLat]; - }; - MercatorTileSource.prototype.get_tiles_by_extent = function (extent, level, tile_border) { - if (tile_border === void 0) { - tile_border = 1; - } - // unpack extent and convert to tile coordinates - var xmin = extent[0], ymin = extent[1], xmax = extent[2], ymax = extent[3]; - var _a = this.meters_to_tile(xmin, ymin, level), txmin = _a[0], tymin = _a[1]; - var _b = this.meters_to_tile(xmax, ymax, level), txmax = _b[0], tymax = _b[1]; - // add tiles which border - txmin -= tile_border; - tymin -= tile_border; - txmax += tile_border; - tymax += tile_border; - var tiles = []; - for (var ty = tymax; ty >= tymin; ty--) { - for (var tx = txmin; tx <= txmax; tx++) { - if (this.is_valid_tile(tx, ty, level)) - tiles.push([tx, ty, level, this.get_tile_meter_bounds(tx, ty, level)]); - } - } - this.sort_tiles_from_center(tiles, [txmin, tymin, txmax, tymax]); - return tiles; - }; - MercatorTileSource.prototype.quadkey_to_tile_xyz = function (quadKey) { - /** - * Computes tile x, y and z values based on quadKey. - */ - var tileX = 0; - var tileY = 0; - var tileZ = quadKey.length; - for (var i = tileZ; i > 0; i--) { - var value = quadKey.charAt(tileZ - i); - var mask = 1 << (i - 1); - switch (value) { - case '0': - continue; - case '1': - tileX |= mask; - break; - case '2': - tileY |= mask; - break; - case '3': - tileX |= mask; - tileY |= mask; - break; - default: - throw new TypeError("Invalid Quadkey: " + quadKey); - } - } - return [tileX, tileY, tileZ]; - }; - MercatorTileSource.prototype.tile_xyz_to_quadkey = function (x, y, z) { - /* - * Computes quadkey value based on tile x, y and z values. - */ - var quadkey = ""; - for (var i = z; i > 0; i--) { - var mask = 1 << (i - 1); - var digit = 0; - if ((x & mask) !== 0) { - digit += 1; - } - if ((y & mask) !== 0) { - digit += 2; - } - quadkey += digit.toString(); - } - return quadkey; - }; - MercatorTileSource.prototype.children_by_tile_xyz = function (x, y, z) { - var quadkey = this.tile_xyz_to_quadkey(x, y, z); - var child_tile_xyz = []; - for (var i = 0; i <= 3; i++) { - var _a = this.quadkey_to_tile_xyz(quadkey + i.toString()), x_1 = _a[0], y_1 = _a[1], z_1 = _a[2]; - var b = this.get_tile_meter_bounds(x_1, y_1, z_1); - child_tile_xyz.push([x_1, y_1, z_1, b]); - } - return child_tile_xyz; - }; - MercatorTileSource.prototype.get_closest_parent_by_tile_xyz = function (x, y, z) { - var _a, _b, _c; - var world_x = this.calculate_world_x_by_tile_xyz(x, y, z); - _a = this.normalize_xyz(x, y, z), x = _a[0], y = _a[1], z = _a[2]; - var quadkey = this.tile_xyz_to_quadkey(x, y, z); - while (quadkey.length > 0) { - quadkey = quadkey.substring(0, quadkey.length - 1); - _b = this.quadkey_to_tile_xyz(quadkey), x = _b[0], y = _b[1], z = _b[2]; - _c = this.denormalize_xyz(x, y, z, world_x), x = _c[0], y = _c[1], z = _c[2]; - if (this.tile_xyz_to_key(x, y, z) in this.tiles) - return [x, y, z]; - } - return [0, 0, 0]; - }; - MercatorTileSource.prototype.normalize_xyz = function (x, y, z) { - if (this.wrap_around) { - var tile_count = Math.pow(2, z); - return [((x % tile_count) + tile_count) % tile_count, y, z]; - } - else { - return [x, y, z]; - } - }; - MercatorTileSource.prototype.denormalize_xyz = function (x, y, z, world_x) { - return [x + (world_x * Math.pow(2, z)), y, z]; - }; - MercatorTileSource.prototype.denormalize_meters = function (meters_x, meters_y, _level, world_x) { - return [meters_x + (world_x * 2 * Math.PI * 6378137), meters_y]; - }; - MercatorTileSource.prototype.calculate_world_x_by_tile_xyz = function (x, _y, z) { - return Math.floor(x / Math.pow(2, z)); - }; - return MercatorTileSource; - }(tile_source_1.TileSource)); - exports.MercatorTileSource = MercatorTileSource; - MercatorTileSource.initClass(); -} -, -/* models/tiles/quadkey_tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mercator_tile_source_1 = require(235) /* ./mercator_tile_source */; - var QUADKEYTileSource = /** @class */ (function (_super) { - tslib_1.__extends(QUADKEYTileSource, _super); - function QUADKEYTileSource(attrs) { - return _super.call(this, attrs) || this; - } - QUADKEYTileSource.initClass = function () { - this.prototype.type = 'QUADKEYTileSource'; - }; - QUADKEYTileSource.prototype.get_image_url = function (x, y, z) { - var image_url = this.string_lookup_replace(this.url, this.extra_url_vars); - var _a = this.tms_to_wmts(x, y, z), wx = _a[0], wy = _a[1], wz = _a[2]; - var quadKey = this.tile_xyz_to_quadkey(wx, wy, wz); - return image_url.replace("{Q}", quadKey); - }; - return QUADKEYTileSource; - }(mercator_tile_source_1.MercatorTileSource)); - exports.QUADKEYTileSource = QUADKEYTileSource; - QUADKEYTileSource.initClass(); -} -, -/* models/tiles/tile_renderer */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var image_pool_1 = require(233) /* ./image_pool */; - var wmts_tile_source_1 = require(241) /* ./wmts_tile_source */; - var data_renderer_1 = require(192) /* ../renderers/data_renderer */; - var range1d_1 = require(191) /* ../ranges/range1d */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var selection_manager_1 = require(20) /* ../../core/selection_manager */; - var column_data_source_1 = require(208) /* ../sources/column_data_source */; - var TileRendererView = /** @class */ (function (_super) { - tslib_1.__extends(TileRendererView, _super); - function TileRendererView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TileRendererView.prototype.initialize = function () { - this._tiles = []; - _super.prototype.initialize.call(this); - }; - TileRendererView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.change, function () { return _this.request_render(); }); - this.connect(this.model.tile_source.change, function () { return _this.request_render(); }); - }; - TileRendererView.prototype.get_extent = function () { - return [this.x_range.start, this.y_range.start, this.x_range.end, this.y_range.end]; - }; - Object.defineProperty(TileRendererView.prototype, "map_plot", { - get: function () { - return this.plot_model; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TileRendererView.prototype, "map_canvas", { - get: function () { - return this.plot_view.canvas_view.ctx; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TileRendererView.prototype, "map_frame", { - get: function () { - return this.plot_view.frame; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TileRendererView.prototype, "x_range", { - get: function () { - return this.map_plot.x_range; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TileRendererView.prototype, "y_range", { - get: function () { - return this.map_plot.y_range; - }, - enumerable: true, - configurable: true - }); - TileRendererView.prototype._set_data = function () { - this.pool = new image_pool_1.ImagePool(); - this.extent = this.get_extent(); - this._last_height = undefined; - this._last_width = undefined; - }; - TileRendererView.prototype._update_attribution = function () { - if (this.attribution_el != null) - dom_1.removeElement(this.attribution_el); - var attribution = this.model.tile_source.attribution; - if (types_1.isString(attribution) && attribution.length > 0) { - var _a = this.plot_view, layout = _a.layout, frame = _a.frame; - var offset_right = layout._width.value - frame._right.value; - var offset_bottom = layout._height.value - frame._bottom.value; - var max_width = frame._width.value; - this.attribution_el = dom_1.div({ - class: 'bk-tile-attribution', - style: { - position: "absolute", - right: offset_right + "px", - bottom: offset_bottom + "px", - 'max-width': max_width - 4 /*padding*/ + "px", - padding: "2px", - 'background-color': 'rgba(255,255,255,0.5)', - 'font-size': '7pt', - 'line-height': '1.05', - 'white-space': 'nowrap', - overflow: 'hidden', - 'text-overflow': 'ellipsis', - }, - }); - var overlays = this.plot_view.canvas_view.events_el; - overlays.appendChild(this.attribution_el); - this.attribution_el.innerHTML = attribution; - this.attribution_el.title = this.attribution_el.textContent.replace(/\s*\n\s*/g, " "); - } - }; - TileRendererView.prototype._map_data = function () { - this.initial_extent = this.get_extent(); - var zoom_level = this.model.tile_source.get_level_by_extent(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value); - var new_extent = this.model.tile_source.snap_to_zoom_level(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level); - this.x_range.start = new_extent[0]; - this.y_range.start = new_extent[1]; - this.x_range.end = new_extent[2]; - this.y_range.end = new_extent[3]; - if (this.x_range instanceof range1d_1.Range1d) { - this.x_range.reset_start = new_extent[0]; - this.x_range.reset_end = new_extent[2]; - } - if (this.y_range instanceof range1d_1.Range1d) { - this.y_range.reset_start = new_extent[1]; - this.y_range.reset_end = new_extent[3]; - } - this._update_attribution(); - }; - TileRendererView.prototype._on_tile_load = function (tile_data, e) { - tile_data.img = e.target; - tile_data.loaded = true; - this.request_render(); - }; - TileRendererView.prototype._on_tile_cache_load = function (tile_data, e) { - tile_data.img = e.target; - tile_data.loaded = true; - tile_data.finished = true; - this.notify_finished(); - }; - TileRendererView.prototype._on_tile_error = function (tile_data) { - tile_data.finished = true; - }; - TileRendererView.prototype._create_tile = function (x, y, z, bounds, cache_only) { - if (cache_only === void 0) { - cache_only = false; - } - var _a = this.model.tile_source.normalize_xyz(x, y, z), nx = _a[0], ny = _a[1], nz = _a[2]; - var img = this.pool.pop(); - var tile = { - img: img, - tile_coords: [x, y, z], - normalized_coords: [nx, ny, nz], - quadkey: this.model.tile_source.tile_xyz_to_quadkey(x, y, z), - cache_key: this.model.tile_source.tile_xyz_to_key(x, y, z), - bounds: bounds, - loaded: false, - finished: false, - x_coord: bounds[0], - y_coord: bounds[3], - }; - img.onload = cache_only ? this._on_tile_cache_load.bind(this, tile) : this._on_tile_load.bind(this, tile); - img.onerror = this._on_tile_error.bind(this, tile); - img.alt = ''; - img.src = this.model.tile_source.get_image_url(nx, ny, nz); - this.model.tile_source.tiles[tile.cache_key] = tile; - this._tiles.push(tile); - }; - TileRendererView.prototype._enforce_aspect_ratio = function () { - // brute force way of handling resize or sizing_mode event ------------------------------------------------------------- - if ((this._last_height !== this.map_frame._height.value) || (this._last_width !== this.map_frame._width.value)) { - var extent = this.get_extent(); - var zoom_level = this.model.tile_source.get_level_by_extent(extent, this.map_frame._height.value, this.map_frame._width.value); - var new_extent = this.model.tile_source.snap_to_zoom_level(extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level); - this.x_range.setv({ start: new_extent[0], end: new_extent[2] }); - this.y_range.setv({ start: new_extent[1], end: new_extent[3] }); - this.extent = new_extent; - this._last_height = this.map_frame._height.value; - this._last_width = this.map_frame._width.value; - } - }; - TileRendererView.prototype.has_finished = function () { - if (!_super.prototype.has_finished.call(this)) { - return false; - } - if (this._tiles.length === 0) { - return false; - } - for (var _i = 0, _a = this._tiles; _i < _a.length; _i++) { - var tile = _a[_i]; - if (!tile.finished) { - return false; - } - } - return true; - }; - TileRendererView.prototype.render = function () { - if (this.map_initialized == null) { - this._set_data(); - this._map_data(); - this.map_initialized = true; - } - this._enforce_aspect_ratio(); - this._update(); - if (this.prefetch_timer != null) { - clearTimeout(this.prefetch_timer); - } - this.prefetch_timer = setTimeout(this._prefetch_tiles.bind(this), 500); - if (this.has_finished()) { - this.notify_finished(); - } - }; - TileRendererView.prototype._draw_tile = function (tile_key) { - var tile_obj = this.model.tile_source.tiles[tile_key]; - if (tile_obj != null) { - var _a = this.plot_view.map_to_screen([tile_obj.bounds[0]], [tile_obj.bounds[3]]), sxmin = _a[0][0], symin = _a[1][0]; // XXX: TS #20623 - var _b = this.plot_view.map_to_screen([tile_obj.bounds[2]], [tile_obj.bounds[1]]), sxmax = _b[0][0], symax = _b[1][0]; // - var sw = sxmax - sxmin; - var sh = symax - symin; - var sx = sxmin; - var sy = symin; - var old_smoothing = this.map_canvas.getImageSmoothingEnabled(); - this.map_canvas.setImageSmoothingEnabled(this.model.smoothing); - this.map_canvas.drawImage(tile_obj.img, sx, sy, sw, sh); - this.map_canvas.setImageSmoothingEnabled(old_smoothing); - tile_obj.finished = true; - } - }; - TileRendererView.prototype._set_rect = function () { - var outline_width = this.plot_model.properties.outline_line_width.value(); - var l = this.map_frame._left.value + (outline_width / 2); - var t = this.map_frame._top.value + (outline_width / 2); - var w = this.map_frame._width.value - outline_width; - var h = this.map_frame._height.value - outline_width; - this.map_canvas.rect(l, t, w, h); - this.map_canvas.clip(); - }; - TileRendererView.prototype._render_tiles = function (tile_keys) { - this.map_canvas.save(); - this._set_rect(); - this.map_canvas.globalAlpha = this.model.alpha; - for (var _i = 0, tile_keys_1 = tile_keys; _i < tile_keys_1.length; _i++) { - var tile_key = tile_keys_1[_i]; - this._draw_tile(tile_key); - } - this.map_canvas.restore(); - }; - TileRendererView.prototype._prefetch_tiles = function () { - var tile_source = this.model.tile_source; - var extent = this.get_extent(); - var h = this.map_frame._height.value; - var w = this.map_frame._width.value; - var zoom_level = this.model.tile_source.get_level_by_extent(extent, h, w); - var tiles = this.model.tile_source.get_tiles_by_extent(extent, zoom_level); - for (var t = 0, end = Math.min(10, tiles.length); t < end; t++) { - var _a = tiles[t], x = _a[0], y = _a[1], z = _a[2]; - var children = this.model.tile_source.children_by_tile_xyz(x, y, z); - for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { - var c = children_1[_i]; - var cx = c[0], cy = c[1], cz = c[2], cbounds = c[3]; - if (tile_source.tile_xyz_to_key(cx, cy, cz) in tile_source.tiles) { - continue; - } - else { - this._create_tile(cx, cy, cz, cbounds, true); - } - } - } - }; - TileRendererView.prototype._fetch_tiles = function (tiles) { - for (var _i = 0, tiles_1 = tiles; _i < tiles_1.length; _i++) { - var tile = tiles_1[_i]; - var x = tile[0], y = tile[1], z = tile[2], bounds = tile[3]; - this._create_tile(x, y, z, bounds); - } - }; - TileRendererView.prototype._update = function () { - var _this = this; - var tile_source = this.model.tile_source; - var min_zoom = tile_source.min_zoom; - var max_zoom = tile_source.max_zoom; - var extent = this.get_extent(); - var zooming_out = (this.extent[2] - this.extent[0]) < (extent[2] - extent[0]); - var h = this.map_frame._height.value; - var w = this.map_frame._width.value; - var zoom_level = tile_source.get_level_by_extent(extent, h, w); - var snap_back = false; - if (zoom_level < min_zoom) { - extent = this.extent; - zoom_level = min_zoom; - snap_back = true; - } - else if (zoom_level > max_zoom) { - extent = this.extent; - zoom_level = max_zoom; - snap_back = true; - } - if (snap_back) { - this.x_range.setv({ x_range: { start: extent[0], end: extent[2] } }); - this.y_range.setv({ start: extent[1], end: extent[3] }); - this.extent = extent; - } - this.extent = extent; - var tiles = tile_source.get_tiles_by_extent(extent, zoom_level); - var need_load = []; - var cached = []; - var parents = []; - var children = []; - for (var _i = 0, tiles_2 = tiles; _i < tiles_2.length; _i++) { - var t = tiles_2[_i]; - var x = t[0], y = t[1], z = t[2]; - var key = tile_source.tile_xyz_to_key(x, y, z); - var tile = tile_source.tiles[key]; - if (tile != null && tile.loaded) { - cached.push(key); - } - else { - if (this.model.render_parents) { - var _a = tile_source.get_closest_parent_by_tile_xyz(x, y, z), px = _a[0], py = _a[1], pz = _a[2]; - var parent_key = tile_source.tile_xyz_to_key(px, py, pz); - var parent_tile = tile_source.tiles[parent_key]; - if ((parent_tile != null) && parent_tile.loaded && !array_1.includes(parents, parent_key)) { - parents.push(parent_key); - } - if (zooming_out) { - var child_tiles = tile_source.children_by_tile_xyz(x, y, z); - for (var _b = 0, child_tiles_1 = child_tiles; _b < child_tiles_1.length; _b++) { - var _c = child_tiles_1[_b], cx = _c[0], cy = _c[1], cz = _c[2]; - var child_key = tile_source.tile_xyz_to_key(cx, cy, cz); - if (child_key in tile_source.tiles) - children.push(child_key); - } - } - } - } - if (tile == null) - need_load.push(t); - } - // draw stand-in parents ---------- - this._render_tiles(parents); - this._render_tiles(children); - // draw cached ---------- - this._render_tiles(cached); - // fetch missing ------- - if (this.render_timer != null) { - clearTimeout(this.render_timer); - } - this.render_timer = setTimeout((function () { return _this._fetch_tiles(need_load); }), 65); - }; - return TileRendererView; - }(data_renderer_1.DataRendererView)); - exports.TileRendererView = TileRendererView; - var TileRenderer = /** @class */ (function (_super) { - tslib_1.__extends(TileRenderer, _super); - function TileRenderer(attrs) { - var _this = _super.call(this, attrs) || this; - // XXX: tile renderer doesn't allow selection, but needs to fulfil the APIs - _this._selection_manager = new selection_manager_1.SelectionManager({ - source: new column_data_source_1.ColumnDataSource(), - }); - return _this; - } - TileRenderer.initClass = function () { - this.prototype.type = 'TileRenderer'; - this.prototype.default_view = TileRendererView; - this.define({ - alpha: [p.Number, 1.0], - smoothing: [p.Boolean, true], - tile_source: [p.Instance, function () { return new wmts_tile_source_1.WMTSTileSource(); }], - render_parents: [p.Boolean, true], - }); - }; - TileRenderer.prototype.get_selection_manager = function () { - return this._selection_manager; - }; - return TileRenderer; - }(data_renderer_1.DataRenderer)); - exports.TileRenderer = TileRenderer; - TileRenderer.initClass(); -} -, -/* models/tiles/tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var image_pool_1 = require(233) /* ./image_pool */; - var p = require(18) /* ../../core/properties */; - var TileSource = /** @class */ (function (_super) { - tslib_1.__extends(TileSource, _super); - function TileSource(attrs) { - return _super.call(this, attrs) || this; - } - TileSource.initClass = function () { - this.prototype.type = 'TileSource'; - this.define({ - url: [p.String, ''], - tile_size: [p.Number, 256], - max_zoom: [p.Number, 30], - min_zoom: [p.Number, 0], - extra_url_vars: [p.Any, {}], - attribution: [p.String, ''], - x_origin_offset: [p.Number], - y_origin_offset: [p.Number], - initial_resolution: [p.Number], - }); - }; - TileSource.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.tiles = {}; - this.pool = new image_pool_1.ImagePool(); - this._normalize_case(); - }; - TileSource.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.change, function () { return _this._clear_cache(); }); - }; - TileSource.prototype.string_lookup_replace = function (str, lookup) { - var result_str = str; - for (var key in lookup) { - var value = lookup[key]; - result_str = result_str.replace("{" + key + "}", value); - } - return result_str; - }; - TileSource.prototype._normalize_case = function () { - /* - * Note: should probably be refactored into subclasses. - */ - var url = this.url - .replace('{x}', '{X}') - .replace('{y}', '{Y}') - .replace('{z}', '{Z}') - .replace('{q}', '{Q}') - .replace('{xmin}', '{XMIN}') - .replace('{ymin}', '{YMIN}') - .replace('{xmax}', '{XMAX}') - .replace('{ymax}', '{YMAX}'); - this.url = url; - }; - TileSource.prototype._clear_cache = function () { - this.tiles = {}; - }; - TileSource.prototype.tile_xyz_to_key = function (x, y, z) { - return x + ":" + y + ":" + z; - }; - TileSource.prototype.key_to_tile_xyz = function (key) { - var _a = key.split(':').map(function (c) { return parseInt(c); }), x = _a[0], y = _a[1], z = _a[2]; - return [x, y, z]; - }; - TileSource.prototype.sort_tiles_from_center = function (tiles, tile_extent) { - var txmin = tile_extent[0], tymin = tile_extent[1], txmax = tile_extent[2], tymax = tile_extent[3]; - var center_x = ((txmax - txmin) / 2) + txmin; - var center_y = ((tymax - tymin) / 2) + tymin; - tiles.sort(function (a, b) { - var a_distance = Math.sqrt(Math.pow(center_x - a[0], 2) + Math.pow(center_y - a[1], 2)); - var b_distance = Math.sqrt(Math.pow(center_x - b[0], 2) + Math.pow(center_y - b[1], 2)); - return a_distance - b_distance; - }); - }; - TileSource.prototype.get_image_url = function (x, y, z) { - var image_url = this.string_lookup_replace(this.url, this.extra_url_vars); - return image_url.replace("{X}", x.toString()) - .replace('{Y}', y.toString()) - .replace("{Z}", z.toString()); - }; - return TileSource; - }(model_1.Model)); - exports.TileSource = TileSource; - TileSource.initClass(); -} -, -/* models/tiles/tile_utils */ function _(require, module, exports) { - var projections_1 = require(36) /* ../../core/util/projections */; - function geographic_to_meters(xLon, yLat) { - return projections_1.wgs84_mercator.forward([xLon, yLat]); - } - exports.geographic_to_meters = geographic_to_meters; - function meters_to_geographic(mx, my) { - return projections_1.wgs84_mercator.inverse([mx, my]); - } - exports.meters_to_geographic = meters_to_geographic; - function geographic_extent_to_meters(extent) { - var g_xmin = extent[0], g_ymin = extent[1], g_xmax = extent[2], g_ymax = extent[3]; - var _a = geographic_to_meters(g_xmin, g_ymin), m_xmin = _a[0], m_ymin = _a[1]; - var _b = geographic_to_meters(g_xmax, g_ymax), m_xmax = _b[0], m_ymax = _b[1]; - return [m_xmin, m_ymin, m_xmax, m_ymax]; - } - exports.geographic_extent_to_meters = geographic_extent_to_meters; - function meters_extent_to_geographic(extent) { - var m_xmin = extent[0], m_ymin = extent[1], m_xmax = extent[2], m_ymax = extent[3]; - var _a = meters_to_geographic(m_xmin, m_ymin), g_xmin = _a[0], g_ymin = _a[1]; - var _b = meters_to_geographic(m_xmax, m_ymax), g_xmax = _b[0], g_ymax = _b[1]; - return [g_xmin, g_ymin, g_xmax, g_ymax]; - } - exports.meters_extent_to_geographic = meters_extent_to_geographic; -} -, -/* models/tiles/tms_tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mercator_tile_source_1 = require(235) /* ./mercator_tile_source */; - var TMSTileSource = /** @class */ (function (_super) { - tslib_1.__extends(TMSTileSource, _super); - function TMSTileSource(attrs) { - return _super.call(this, attrs) || this; - } - TMSTileSource.initClass = function () { - this.prototype.type = 'TMSTileSource'; - }; - TMSTileSource.prototype.get_image_url = function (x, y, z) { - var image_url = this.string_lookup_replace(this.url, this.extra_url_vars); - return image_url.replace("{X}", x.toString()) - .replace('{Y}', y.toString()) - .replace("{Z}", z.toString()); - }; - return TMSTileSource; - }(mercator_tile_source_1.MercatorTileSource)); - exports.TMSTileSource = TMSTileSource; - TMSTileSource.initClass(); -} -, -/* models/tiles/wmts_tile_source */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var mercator_tile_source_1 = require(235) /* ./mercator_tile_source */; - var WMTSTileSource = /** @class */ (function (_super) { - tslib_1.__extends(WMTSTileSource, _super); - function WMTSTileSource(attrs) { - return _super.call(this, attrs) || this; - } - WMTSTileSource.initClass = function () { - this.prototype.type = 'WMTSTileSource'; - }; - WMTSTileSource.prototype.get_image_url = function (x, y, z) { - var image_url = this.string_lookup_replace(this.url, this.extra_url_vars); - var _a = this.tms_to_wmts(x, y, z), wx = _a[0], wy = _a[1], wz = _a[2]; - return image_url.replace("{X}", wx.toString()) - .replace('{Y}', wy.toString()) - .replace("{Z}", wz.toString()); - }; - return WMTSTileSource; - }(mercator_tile_source_1.MercatorTileSource)); - exports.WMTSTileSource = WMTSTileSource; - WMTSTileSource.initClass(); -} -, -/* models/tools/actions/action_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var button_tool_1 = require(251) /* ../button_tool */; - var signaling_1 = require(22) /* ../../../core/signaling */; - var ActionToolButtonView = /** @class */ (function (_super) { - tslib_1.__extends(ActionToolButtonView, _super); - function ActionToolButtonView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionToolButtonView.prototype._clicked = function () { - this.model.do.emit(); - }; - return ActionToolButtonView; - }(button_tool_1.ButtonToolButtonView)); - exports.ActionToolButtonView = ActionToolButtonView; - var ActionToolView = /** @class */ (function (_super) { - tslib_1.__extends(ActionToolView, _super); - function ActionToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.do, function () { return _this.doit(); }); - }; - return ActionToolView; - }(button_tool_1.ButtonToolView)); - exports.ActionToolView = ActionToolView; - var ActionTool = /** @class */ (function (_super) { - tslib_1.__extends(ActionTool, _super); - function ActionTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.button_view = ActionToolButtonView; - _this.do = new signaling_1.Signal0(_this, "do"); - return _this; - } - ActionTool.initClass = function () { - this.prototype.type = "ActionTool"; - }; - return ActionTool; - }(button_tool_1.ButtonTool)); - exports.ActionTool = ActionTool; - ActionTool.initClass(); -} -, -/* models/tools/actions/custom_action */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var p = require(18) /* ../../../core/properties */; - var CustomActionButtonView = /** @class */ (function (_super) { - tslib_1.__extends(CustomActionButtonView, _super); - function CustomActionButtonView() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomActionButtonView.prototype.css_classes = function () { - return _super.prototype.css_classes.call(this).concat("bk-toolbar-button-custom-action"); - }; - return CustomActionButtonView; - }(action_tool_1.ActionToolButtonView)); - exports.CustomActionButtonView = CustomActionButtonView; - var CustomActionView = /** @class */ (function (_super) { - tslib_1.__extends(CustomActionView, _super); - function CustomActionView() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomActionView.prototype.doit = function () { - if (this.model.callback != null) - this.model.callback.execute(this.model); - }; - return CustomActionView; - }(action_tool_1.ActionToolView)); - exports.CustomActionView = CustomActionView; - var CustomAction = /** @class */ (function (_super) { - tslib_1.__extends(CustomAction, _super); - function CustomAction(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Custom Action"; - _this.button_view = CustomActionButtonView; - return _this; - } - CustomAction.initClass = function () { - this.prototype.type = "CustomAction"; - this.prototype.default_view = CustomActionView; - this.define({ - action_tooltip: [p.String, 'Perform a Custom Action'], - callback: [p.Any], - icon: [p.String,], - }); - }; - Object.defineProperty(CustomAction.prototype, "tooltip", { - get: function () { - return this.action_tooltip; - }, - enumerable: true, - configurable: true - }); - return CustomAction; - }(action_tool_1.ActionTool)); - exports.CustomAction = CustomAction; - CustomAction.initClass(); -} -, -/* models/tools/actions/help_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var p = require(18) /* ../../../core/properties */; - var HelpToolView = /** @class */ (function (_super) { - tslib_1.__extends(HelpToolView, _super); - function HelpToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - HelpToolView.prototype.doit = function () { - window.open(this.model.redirect); - }; - return HelpToolView; - }(action_tool_1.ActionToolView)); - exports.HelpToolView = HelpToolView; - var HelpTool = /** @class */ (function (_super) { - tslib_1.__extends(HelpTool, _super); - function HelpTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Help"; - _this.icon = "bk-tool-icon-help"; - return _this; - } - HelpTool.initClass = function () { - this.prototype.type = "HelpTool"; - this.prototype.default_view = HelpToolView; - this.define({ - help_tooltip: [p.String, 'Click the question mark to learn more about Bokeh plot tools.'], - redirect: [p.String, 'https://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#built-in-tools'], - }); - }; - Object.defineProperty(HelpTool.prototype, "tooltip", { - get: function () { - return this.help_tooltip; - }, - enumerable: true, - configurable: true - }); - return HelpTool; - }(action_tool_1.ActionTool)); - exports.HelpTool = HelpTool; - HelpTool.initClass(); -} -, -/* models/tools/actions/redo_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var RedoToolView = /** @class */ (function (_super) { - tslib_1.__extends(RedoToolView, _super); - function RedoToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RedoToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.plot_view.state_changed, function () { return _this.model.disabled = !_this.plot_view.can_redo(); }); - }; - RedoToolView.prototype.doit = function () { - this.plot_view.redo(); - }; - return RedoToolView; - }(action_tool_1.ActionToolView)); - exports.RedoToolView = RedoToolView; - var RedoTool = /** @class */ (function (_super) { - tslib_1.__extends(RedoTool, _super); - function RedoTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Redo"; - _this.icon = "bk-tool-icon-redo"; - return _this; - } - RedoTool.initClass = function () { - this.prototype.type = "RedoTool"; - this.prototype.default_view = RedoToolView; - this.override({ - disabled: true, - }); - }; - return RedoTool; - }(action_tool_1.ActionTool)); - exports.RedoTool = RedoTool; - RedoTool.initClass(); -} -, -/* models/tools/actions/reset_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var ResetToolView = /** @class */ (function (_super) { - tslib_1.__extends(ResetToolView, _super); - function ResetToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResetToolView.prototype.doit = function () { - this.plot_view.reset(); - }; - return ResetToolView; - }(action_tool_1.ActionToolView)); - exports.ResetToolView = ResetToolView; - var ResetTool = /** @class */ (function (_super) { - tslib_1.__extends(ResetTool, _super); - function ResetTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Reset"; - _this.icon = "bk-tool-icon-reset"; - return _this; - } - ResetTool.initClass = function () { - this.prototype.type = "ResetTool"; - this.prototype.default_view = ResetToolView; - }; - return ResetTool; - }(action_tool_1.ActionTool)); - exports.ResetTool = ResetTool; - ResetTool.initClass(); -} -, -/* models/tools/actions/save_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var SaveToolView = /** @class */ (function (_super) { - tslib_1.__extends(SaveToolView, _super); - function SaveToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - SaveToolView.prototype.doit = function () { - this.plot_view.save("bokeh_plot"); - }; - return SaveToolView; - }(action_tool_1.ActionToolView)); - exports.SaveToolView = SaveToolView; - var SaveTool = /** @class */ (function (_super) { - tslib_1.__extends(SaveTool, _super); - function SaveTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Save"; - _this.icon = "bk-tool-icon-save"; - return _this; - } - SaveTool.initClass = function () { - this.prototype.type = "SaveTool"; - this.prototype.default_view = SaveToolView; - }; - return SaveTool; - }(action_tool_1.ActionTool)); - exports.SaveTool = SaveTool; - SaveTool.initClass(); -} -, -/* models/tools/actions/undo_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var UndoToolView = /** @class */ (function (_super) { - tslib_1.__extends(UndoToolView, _super); - function UndoToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - UndoToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.plot_view.state_changed, function () { return _this.model.disabled = !_this.plot_view.can_undo(); }); - }; - UndoToolView.prototype.doit = function () { - this.plot_view.undo(); - }; - return UndoToolView; - }(action_tool_1.ActionToolView)); - exports.UndoToolView = UndoToolView; - var UndoTool = /** @class */ (function (_super) { - tslib_1.__extends(UndoTool, _super); - function UndoTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Undo"; - _this.icon = "bk-tool-icon-undo"; - return _this; - } - UndoTool.initClass = function () { - this.prototype.type = "UndoTool"; - this.prototype.default_view = UndoToolView; - this.override({ - disabled: true, - }); - }; - return UndoTool; - }(action_tool_1.ActionTool)); - exports.UndoTool = UndoTool; - UndoTool.initClass(); -} -, -/* models/tools/actions/zoom_in_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var zoom_1 = require(48) /* ../../../core/util/zoom */; - var p = require(18) /* ../../../core/properties */; - var ZoomInToolView = /** @class */ (function (_super) { - tslib_1.__extends(ZoomInToolView, _super); - function ZoomInToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ZoomInToolView.prototype.doit = function () { - var frame = this.plot_view.frame; - var dims = this.model.dimensions; - // restrict to axis configured in tool's dimensions property - var h_axis = dims == 'width' || dims == 'both'; - var v_axis = dims == 'height' || dims == 'both'; - var zoom_info = zoom_1.scale_range(frame, this.model.factor, h_axis, v_axis); - this.plot_view.push_state('zoom_out', { range: zoom_info }); - this.plot_view.update_range(zoom_info, false, true); - if (this.model.document) - this.model.document.interactive_start(this.plot_model); - }; - return ZoomInToolView; - }(action_tool_1.ActionToolView)); - exports.ZoomInToolView = ZoomInToolView; - var ZoomInTool = /** @class */ (function (_super) { - tslib_1.__extends(ZoomInTool, _super); - function ZoomInTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Zoom In"; - _this.icon = "bk-tool-icon-zoom-in"; - return _this; - } - ZoomInTool.initClass = function () { - this.prototype.type = "ZoomInTool"; - this.prototype.default_view = ZoomInToolView; - this.define({ - factor: [p.Percent, 0.1], - dimensions: [p.Dimensions, "both"], - }); - }; - Object.defineProperty(ZoomInTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimensions); - }, - enumerable: true, - configurable: true - }); - return ZoomInTool; - }(action_tool_1.ActionTool)); - exports.ZoomInTool = ZoomInTool; - ZoomInTool.initClass(); -} -, -/* models/tools/actions/zoom_out_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var action_tool_1 = require(242) /* ./action_tool */; - var zoom_1 = require(48) /* ../../../core/util/zoom */; - var p = require(18) /* ../../../core/properties */; - var ZoomOutToolView = /** @class */ (function (_super) { - tslib_1.__extends(ZoomOutToolView, _super); - function ZoomOutToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ZoomOutToolView.prototype.doit = function () { - var frame = this.plot_view.frame; - var dims = this.model.dimensions; - // restrict to axis configured in tool's dimensions property - var h_axis = dims == 'width' || dims == 'both'; - var v_axis = dims == 'height' || dims == 'both'; - // zooming out requires a negative factor to scale_range - var zoom_info = zoom_1.scale_range(frame, -this.model.factor, h_axis, v_axis); - this.plot_view.push_state('zoom_out', { range: zoom_info }); - this.plot_view.update_range(zoom_info, false, true); - if (this.model.document) - this.model.document.interactive_start(this.plot_model); - }; - return ZoomOutToolView; - }(action_tool_1.ActionToolView)); - exports.ZoomOutToolView = ZoomOutToolView; - var ZoomOutTool = /** @class */ (function (_super) { - tslib_1.__extends(ZoomOutTool, _super); - function ZoomOutTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Zoom Out"; - _this.icon = "bk-tool-icon-zoom-out"; - return _this; - } - ZoomOutTool.initClass = function () { - this.prototype.type = "ZoomOutTool"; - this.prototype.default_view = ZoomOutToolView; - this.define({ - factor: [p.Percent, 0.1], - dimensions: [p.Dimensions, "both"], - }); - }; - Object.defineProperty(ZoomOutTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimensions); - }, - enumerable: true, - configurable: true - }); - return ZoomOutTool; - }(action_tool_1.ActionTool)); - exports.ZoomOutTool = ZoomOutTool; - ZoomOutTool.initClass(); -} -, -/* models/tools/button_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_view_1 = require(6) /* ../../core/dom_view */; - var tool_1 = require(276) /* ./tool */; - var dom_1 = require(5) /* ../../core/dom */; - var p = require(18) /* ../../core/properties */; - var string_1 = require(40) /* ../../core/util/string */; - var types_1 = require(46) /* ../../core/util/types */; - var ButtonToolButtonView = /** @class */ (function (_super) { - tslib_1.__extends(ButtonToolButtonView, _super); - function ButtonToolButtonView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ButtonToolButtonView.prototype.initialize = function () { - var _this = this; - _super.prototype.initialize.call(this); - this.connect(this.model.change, function () { return _this.render(); }); - this.el.addEventListener("click", function () { return _this._clicked(); }); - this.render(); // XXX: this isn't governed by layout, for now - }; - ButtonToolButtonView.prototype.css_classes = function () { - return _super.prototype.css_classes.call(this).concat("bk-toolbar-button"); - }; - ButtonToolButtonView.prototype.render = function () { - dom_1.empty(this.el); - var icon = this.model.computed_icon; - if (types_1.isString(icon)) { - if (string_1.startsWith(icon, "data:image")) - this.el.style.backgroundImage = "url('" + icon + "')"; - else - this.el.classList.add(icon); - } - this.el.title = this.model.tooltip; - }; - return ButtonToolButtonView; - }(dom_view_1.DOMView)); - exports.ButtonToolButtonView = ButtonToolButtonView; - var ButtonToolView = /** @class */ (function (_super) { - tslib_1.__extends(ButtonToolView, _super); - function ButtonToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ButtonToolView; - }(tool_1.ToolView)); - exports.ButtonToolView = ButtonToolView; - var ButtonTool = /** @class */ (function (_super) { - tslib_1.__extends(ButtonTool, _super); - function ButtonTool(attrs) { - return _super.call(this, attrs) || this; - } - ButtonTool.initClass = function () { - this.prototype.type = "ButtonTool"; - this.internal({ - disabled: [p.Boolean, false], - }); - }; - Object.defineProperty(ButtonTool.prototype, "tooltip", { - get: function () { - return this.tool_name; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ButtonTool.prototype, "computed_icon", { - get: function () { - return this.icon; - }, - enumerable: true, - configurable: true - }); - return ButtonTool; - }(tool_1.Tool)); - exports.ButtonTool = ButtonTool; - ButtonTool.initClass(); -} -, -/* models/tools/edit/box_edit_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var edit_tool_1 = require(253) /* ./edit_tool */; - var BoxEditToolView = /** @class */ (function (_super) { - tslib_1.__extends(BoxEditToolView, _super); - function BoxEditToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxEditToolView.prototype._tap = function (ev) { - if ((this._draw_basepoint != null) || (this._basepoint != null)) - return; - var append = ev.shiftKey; - this._select_event(ev, append, this.model.renderers); - }; - BoxEditToolView.prototype._keyup = function (ev) { - if (!this.model.active || !this._mouse_in_frame) - return; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (ev.keyCode === dom_1.Keys.Backspace) { - this._delete_selected(renderer); - } - else if (ev.keyCode == dom_1.Keys.Esc) { - // Type properly once selection_manager is typed - var cds = renderer.data_source; - cds.selection_manager.clear(); - } - } - }; - BoxEditToolView.prototype._set_extent = function (_a, _b, append, emit) { - var sx0 = _a[0], sx1 = _a[1]; - var sy0 = _b[0], sy1 = _b[1]; - if (emit === void 0) { - emit = false; - } - var renderer = this.model.renderers[0]; - var frame = this.plot_view.frame; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var cds = renderer.data_source; - var xscale = frame.xscales[renderer.x_range_name]; - var yscale = frame.yscales[renderer.y_range_name]; - var _c = xscale.r_invert(sx0, sx1), x0 = _c[0], x1 = _c[1]; - var _d = yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1]; - var _e = [(x0 + x1) / 2., (y0 + y1) / 2.], x = _e[0], y = _e[1]; - var _f = [x1 - x0, y1 - y0], w = _f[0], h = _f[1]; - var _g = [glyph.x.field, glyph.y.field], xkey = _g[0], ykey = _g[1]; - var _h = [glyph.width.field, glyph.height.field], wkey = _h[0], hkey = _h[1]; - if (append) { - this._pop_glyphs(cds, this.model.num_objects); - if (xkey) - cds.get_array(xkey).push(x); - if (ykey) - cds.get_array(ykey).push(y); - if (wkey) - cds.get_array(wkey).push(w); - if (hkey) - cds.get_array(hkey).push(h); - this._pad_empty_columns(cds, [xkey, ykey, wkey, hkey]); - } - else { - var index = cds.data[xkey].length - 1; - if (xkey) - cds.data[xkey][index] = x; - if (ykey) - cds.data[ykey][index] = y; - if (wkey) - cds.data[wkey][index] = w; - if (hkey) - cds.data[hkey][index] = h; - } - this._emit_cds_changes(cds, true, false, emit); - }; - BoxEditToolView.prototype._update_box = function (ev, append, emit) { - if (append === void 0) { - append = false; - } - if (emit === void 0) { - emit = false; - } - if (this._draw_basepoint == null) - return; - var curpoint = [ev.sx, ev.sy]; - var frame = this.plot_view.frame; - var dims = this.model.dimensions; - var limits = this.model._get_dim_limits(this._draw_basepoint, curpoint, frame, dims); - if (limits != null) { - var sxlim = limits[0], sylim = limits[1]; - this._set_extent(sxlim, sylim, append, emit); - } - }; - BoxEditToolView.prototype._doubletap = function (ev) { - if (!this.model.active) - return; - if (this._draw_basepoint != null) { - this._update_box(ev, false, true); - this._draw_basepoint = null; - } - else { - this._draw_basepoint = [ev.sx, ev.sy]; - this._select_event(ev, true, this.model.renderers); - this._update_box(ev, true, false); - } - }; - BoxEditToolView.prototype._move = function (ev) { - this._update_box(ev, false, false); - }; - BoxEditToolView.prototype._pan_start = function (ev) { - if (ev.shiftKey) { - if (this._draw_basepoint != null) - return; - this._draw_basepoint = [ev.sx, ev.sy]; - this._update_box(ev, true, false); - } - else { - if (this._basepoint != null) - return; - this._select_event(ev, true, this.model.renderers); - this._basepoint = [ev.sx, ev.sy]; - } - }; - BoxEditToolView.prototype._pan = function (ev, append, emit) { - if (append === void 0) { - append = false; - } - if (emit === void 0) { - emit = false; - } - if (ev.shiftKey) { - if (this._draw_basepoint == null) - return; - this._update_box(ev, append, emit); - } - else { - if (this._basepoint == null) - return; - this._drag_points(ev, this.model.renderers); - } - }; - BoxEditToolView.prototype._pan_end = function (ev) { - this._pan(ev, false, true); - if (ev.shiftKey) { - this._draw_basepoint = null; - } - else { - this._basepoint = null; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - this._emit_cds_changes(renderer.data_source, false, true, true); - } - } - }; - return BoxEditToolView; - }(edit_tool_1.EditToolView)); - exports.BoxEditToolView = BoxEditToolView; - var BoxEditTool = /** @class */ (function (_super) { - tslib_1.__extends(BoxEditTool, _super); - function BoxEditTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Box Edit Tool"; - _this.icon = "bk-tool-icon-box-edit"; - _this.event_type = ["tap", "pan", "move"]; - _this.default_order = 1; - return _this; - } - BoxEditTool.initClass = function () { - this.prototype.type = "BoxEditTool"; - this.prototype.default_view = BoxEditToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - num_objects: [p.Int, 0], - }); - }; - return BoxEditTool; - }(edit_tool_1.EditTool)); - exports.BoxEditTool = BoxEditTool; - BoxEditTool.initClass(); -} -, -/* models/tools/edit/edit_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../../core/properties */; - var array_1 = require(24) /* ../../../core/util/array */; - var types_1 = require(46) /* ../../../core/util/types */; - var gesture_tool_1 = require(261) /* ../gestures/gesture_tool */; - var EditToolView = /** @class */ (function (_super) { - tslib_1.__extends(EditToolView, _super); - function EditToolView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._mouse_in_frame = true; - return _this; - } - EditToolView.prototype._move_enter = function (_e) { - this._mouse_in_frame = true; - }; - EditToolView.prototype._move_exit = function (_e) { - this._mouse_in_frame = false; - }; - EditToolView.prototype._map_drag = function (sx, sy, renderer) { - // Maps screen to data coordinates - var frame = this.plot_view.frame; - if (!frame.bbox.contains(sx, sy)) { - return null; - } - var x = frame.xscales[renderer.x_range_name].invert(sx); - var y = frame.yscales[renderer.y_range_name].invert(sy); - return [x, y]; - }; - EditToolView.prototype._delete_selected = function (renderer) { - // Deletes all selected rows in the ColumnDataSource - var cds = renderer.data_source; - var indices = cds.selected.indices; - indices.sort(); - for (var _i = 0, _a = cds.columns(); _i < _a.length; _i++) { - var column = _a[_i]; - var values = cds.get_array(column); - for (var index = 0; index < indices.length; index++) { - var ind = indices[index]; - values.splice(ind - index, 1); - } - } - this._emit_cds_changes(cds); - }; - EditToolView.prototype._pop_glyphs = function (cds, num_objects) { - // Pops rows in the CDS until only num_objects are left - var columns = cds.columns(); - if (!num_objects || !columns.length) - return; - for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) { - var column = columns_1[_i]; - var array = cds.get_array(column); - var drop = array.length - num_objects + 1; - if (drop < 1) - continue; - if (!types_1.isArray(array)) { - array = Array.from(array); - cds.data[column] = array; - } - array.splice(0, drop); - } - }; - EditToolView.prototype._emit_cds_changes = function (cds, redraw, clear, emit) { - if (redraw === void 0) { - redraw = true; - } - if (clear === void 0) { - clear = true; - } - if (emit === void 0) { - emit = true; - } - if (clear) - cds.selection_manager.clear(); - if (redraw) - cds.change.emit(); - if (emit) { - cds.data = cds.data; - cds.properties.data.change.emit(); - } - }; - EditToolView.prototype._drag_points = function (ev, renderers) { - if (this._basepoint == null) - return; - var _a = this._basepoint, bx = _a[0], by = _a[1]; - for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) { - var renderer = renderers_1[_i]; - var basepoint = this._map_drag(bx, by, renderer); - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null || basepoint == null) { - continue; - } - var x = point[0], y = point[1]; - var px = basepoint[0], py = basepoint[1]; - var _b = [x - px, y - py], dx = _b[0], dy = _b[1]; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var cds = renderer.data_source; - var _c = [glyph.x.field, glyph.y.field], xkey = _c[0], ykey = _c[1]; - for (var _d = 0, _f = cds.selected.indices; _d < _f.length; _d++) { - var index = _f[_d]; - if (xkey) - cds.data[xkey][index] += dx; - if (ykey) - cds.data[ykey][index] += dy; - } - cds.change.emit(); - } - this._basepoint = [ev.sx, ev.sy]; - }; - EditToolView.prototype._pad_empty_columns = function (cds, coord_columns) { - // Pad ColumnDataSource non-coordinate columns with empty_value - for (var _i = 0, _a = cds.columns(); _i < _a.length; _i++) { - var column = _a[_i]; - if (!array_1.includes(coord_columns, column)) - cds.get_array(column).push(this.model.empty_value); - } - }; - EditToolView.prototype._select_event = function (ev, append, renderers) { - // Process selection event on the supplied renderers and return selected renderers - var frame = this.plot_view.frame; - var sx = ev.sx, sy = ev.sy; - if (!frame.bbox.contains(sx, sy)) { - return []; - } - var geometry = { type: 'point', sx: sx, sy: sy }; - var selected = []; - for (var _i = 0, renderers_2 = renderers; _i < renderers_2.length; _i++) { - var renderer = renderers_2[_i]; - var sm = renderer.get_selection_manager(); - var cds = renderer.data_source; - var views = [this.plot_view.renderer_views[renderer.id]]; - var did_hit = sm.select(views, geometry, true, append); - if (did_hit) { - selected.push(renderer); - } - cds.properties.selected.change.emit(); - } - return selected; - }; - return EditToolView; - }(gesture_tool_1.GestureToolView)); - exports.EditToolView = EditToolView; - var EditTool = /** @class */ (function (_super) { - tslib_1.__extends(EditTool, _super); - function EditTool(attrs) { - return _super.call(this, attrs) || this; - } - EditTool.initClass = function () { - this.prototype.type = "EditTool"; - this.define({ - custom_icon: [p.String,], - custom_tooltip: [p.String,], - empty_value: [p.Any,], - renderers: [p.Array, []], - }); - }; - Object.defineProperty(EditTool.prototype, "tooltip", { - get: function () { - return this.custom_tooltip || this.tool_name; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EditTool.prototype, "computed_icon", { - get: function () { - return this.custom_icon || this.icon; - }, - enumerable: true, - configurable: true - }); - return EditTool; - }(gesture_tool_1.GestureTool)); - exports.EditTool = EditTool; - EditTool.initClass(); -} -, -/* models/tools/edit/freehand_draw_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var types_1 = require(46) /* ../../../core/util/types */; - var edit_tool_1 = require(253) /* ./edit_tool */; - var FreehandDrawToolView = /** @class */ (function (_super) { - tslib_1.__extends(FreehandDrawToolView, _super); - function FreehandDrawToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - FreehandDrawToolView.prototype._draw = function (ev, mode, emit) { - if (emit === void 0) { - emit = false; - } - if (!this.model.active) - return; - var renderer = this.model.renderers[0]; - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null) - return; - var x = point[0], y = point[1]; - var cds = renderer.data_source; - var glyph = renderer.glyph; - var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1]; - if (mode == 'new') { - this._pop_glyphs(cds, this.model.num_objects); - if (xkey) - cds.get_array(xkey).push([x]); - if (ykey) - cds.get_array(ykey).push([y]); - this._pad_empty_columns(cds, [xkey, ykey]); - } - else if (mode == 'add') { - if (xkey) { - var xidx = cds.data[xkey].length - 1; - var xs = cds.get_array(xkey)[xidx]; - if (!types_1.isArray(xs)) { - xs = Array.from(xs); - cds.data[xkey][xidx] = xs; - } - xs.push(x); - } - if (ykey) { - var yidx = cds.data[ykey].length - 1; - var ys = cds.get_array(ykey)[yidx]; - if (!types_1.isArray(ys)) { - ys = Array.from(ys); - cds.data[ykey][yidx] = ys; - } - ys.push(y); - } - } - this._emit_cds_changes(cds, true, true, emit); - }; - FreehandDrawToolView.prototype._pan_start = function (ev) { - this._draw(ev, 'new'); - }; - FreehandDrawToolView.prototype._pan = function (ev) { - this._draw(ev, 'add'); - }; - FreehandDrawToolView.prototype._pan_end = function (ev) { - this._draw(ev, 'add', true); - }; - FreehandDrawToolView.prototype._tap = function (ev) { - this._select_event(ev, ev.shiftKey, this.model.renderers); - }; - FreehandDrawToolView.prototype._keyup = function (ev) { - if (!this.model.active || !this._mouse_in_frame) - return; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (ev.keyCode === dom_1.Keys.Esc) { - renderer.data_source.selection_manager.clear(); - } - else if (ev.keyCode === dom_1.Keys.Backspace) { - this._delete_selected(renderer); - } - } - }; - return FreehandDrawToolView; - }(edit_tool_1.EditToolView)); - exports.FreehandDrawToolView = FreehandDrawToolView; - var FreehandDrawTool = /** @class */ (function (_super) { - tslib_1.__extends(FreehandDrawTool, _super); - function FreehandDrawTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Freehand Draw Tool"; - _this.icon = "bk-tool-icon-freehand-draw"; - _this.event_type = ["pan", "tap"]; - _this.default_order = 3; - return _this; - } - FreehandDrawTool.initClass = function () { - this.prototype.type = "FreehandDrawTool"; - this.prototype.default_view = FreehandDrawToolView; - this.define({ - num_objects: [p.Int, 0], - }); - }; - return FreehandDrawTool; - }(edit_tool_1.EditTool)); - exports.FreehandDrawTool = FreehandDrawTool; - FreehandDrawTool.initClass(); -} -, -/* models/tools/edit/point_draw_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var edit_tool_1 = require(253) /* ./edit_tool */; - var PointDrawToolView = /** @class */ (function (_super) { - tslib_1.__extends(PointDrawToolView, _super); - function PointDrawToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PointDrawToolView.prototype._tap = function (ev) { - var append = ev.shiftKey; - var renderers = this._select_event(ev, append, this.model.renderers); - if (renderers.length || !this.model.add) { - return; - } - var renderer = this.model.renderers[0]; - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null) - return; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var cds = renderer.data_source; - var _a = [glyph.x.field, glyph.y.field], xkey = _a[0], ykey = _a[1]; - var x = point[0], y = point[1]; - this._pop_glyphs(cds, this.model.num_objects); - if (xkey) - cds.get_array(xkey).push(x); - if (ykey) - cds.get_array(ykey).push(y); - this._pad_empty_columns(cds, [xkey, ykey]); - cds.change.emit(); - cds.data = cds.data; - cds.properties.data.change.emit(); - }; - PointDrawToolView.prototype._keyup = function (ev) { - if (!this.model.active || !this._mouse_in_frame) - return; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (ev.keyCode === dom_1.Keys.Backspace) { - this._delete_selected(renderer); - } - else if (ev.keyCode == dom_1.Keys.Esc) { - renderer.data_source.selection_manager.clear(); - } - } - }; - PointDrawToolView.prototype._pan_start = function (ev) { - if (!this.model.drag) - return; - this._select_event(ev, true, this.model.renderers); - this._basepoint = [ev.sx, ev.sy]; - }; - PointDrawToolView.prototype._pan = function (ev) { - if (!this.model.drag || this._basepoint == null) - return; - this._drag_points(ev, this.model.renderers); - }; - PointDrawToolView.prototype._pan_end = function (ev) { - if (!this.model.drag) - return; - this._pan(ev); - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - this._emit_cds_changes(renderer.data_source, false, true, true); - } - this._basepoint = null; - }; - return PointDrawToolView; - }(edit_tool_1.EditToolView)); - exports.PointDrawToolView = PointDrawToolView; - var PointDrawTool = /** @class */ (function (_super) { - tslib_1.__extends(PointDrawTool, _super); - function PointDrawTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Point Draw Tool"; - _this.icon = "bk-tool-icon-point-draw"; - _this.event_type = ["tap", "pan", "move"]; - _this.default_order = 2; - return _this; - } - PointDrawTool.initClass = function () { - this.prototype.type = "PointDrawTool"; - this.prototype.default_view = PointDrawToolView; - this.define({ - add: [p.Boolean, true], - drag: [p.Boolean, true], - num_objects: [p.Int, 0], - }); - }; - return PointDrawTool; - }(edit_tool_1.EditTool)); - exports.PointDrawTool = PointDrawTool; - PointDrawTool.initClass(); -} -, -/* models/tools/edit/poly_draw_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var types_1 = require(46) /* ../../../core/util/types */; - var poly_tool_1 = require(258) /* ./poly_tool */; - var PolyDrawToolView = /** @class */ (function (_super) { - tslib_1.__extends(PolyDrawToolView, _super); - function PolyDrawToolView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._drawing = false; - _this._initialized = false; - return _this; - } - PolyDrawToolView.prototype._tap = function (ev) { - if (this._drawing) - this._draw(ev, 'add', true); - else - this._select_event(ev, ev.shiftKey, this.model.renderers); - }; - PolyDrawToolView.prototype._draw = function (ev, mode, emit) { - if (emit === void 0) { - emit = false; - } - var renderer = this.model.renderers[0]; - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (!this._initialized) - this.activate(); // Ensure that activate has been called - if (point == null) - return; - var _a = this._snap_to_vertex.apply(this, [ev].concat(point)), x = _a[0], y = _a[1]; - var cds = renderer.data_source; - var glyph = renderer.glyph; - var _b = [glyph.xs.field, glyph.ys.field], xkey = _b[0], ykey = _b[1]; - if (mode == 'new') { - this._pop_glyphs(cds, this.model.num_objects); - if (xkey) - cds.get_array(xkey).push([x, x]); - if (ykey) - cds.get_array(ykey).push([y, y]); - this._pad_empty_columns(cds, [xkey, ykey]); - } - else if (mode == 'edit') { - if (xkey) { - var xs = cds.data[xkey][cds.data[xkey].length - 1]; - xs[xs.length - 1] = x; - } - if (ykey) { - var ys = cds.data[ykey][cds.data[ykey].length - 1]; - ys[ys.length - 1] = y; - } - } - else if (mode == 'add') { - if (xkey) { - var xidx = cds.data[xkey].length - 1; - var xs = cds.get_array(xkey)[xidx]; - var nx = xs[xs.length - 1]; - xs[xs.length - 1] = x; - if (!types_1.isArray(xs)) { - xs = Array.from(xs); - cds.data[xkey][xidx] = xs; - } - xs.push(nx); - } - if (ykey) { - var yidx = cds.data[ykey].length - 1; - var ys = cds.get_array(ykey)[yidx]; - var ny = ys[ys.length - 1]; - ys[ys.length - 1] = y; - if (!types_1.isArray(ys)) { - ys = Array.from(ys); - cds.data[ykey][yidx] = ys; - } - ys.push(ny); - } - } - this._emit_cds_changes(cds, true, false, emit); - }; - PolyDrawToolView.prototype._show_vertices = function () { - if (!this.model.active) { - return; - } - var xs = []; - var ys = []; - for (var i = 0; i < this.model.renderers.length; i++) { - var renderer = this.model.renderers[i]; - var cds = renderer.data_source; - var glyph = renderer.glyph; - var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1]; - if (xkey) { - for (var _i = 0, _b = cds.get_array(xkey); _i < _b.length; _i++) { - var array = _b[_i]; - Array.prototype.push.apply(xs, array); - } - } - if (ykey) { - for (var _c = 0, _d = cds.get_array(ykey); _c < _d.length; _c++) { - var array = _d[_c]; - Array.prototype.push.apply(ys, array); - } - } - if (this._drawing && (i == (this.model.renderers.length - 1))) { - // Skip currently drawn vertex - xs.splice(xs.length - 1, 1); - ys.splice(ys.length - 1, 1); - } - } - this._set_vertices(xs, ys); - }; - PolyDrawToolView.prototype._doubletap = function (ev) { - if (!this.model.active) - return; - if (this._drawing) { - this._drawing = false; - this._draw(ev, 'edit', true); - } - else { - this._drawing = true; - this._draw(ev, 'new', true); - } - }; - PolyDrawToolView.prototype._move = function (ev) { - if (this._drawing) { - this._draw(ev, 'edit'); - } - }; - PolyDrawToolView.prototype._remove = function () { - var renderer = this.model.renderers[0]; - var cds = renderer.data_source; - var glyph = renderer.glyph; - var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1]; - if (xkey) { - var xidx = cds.data[xkey].length - 1; - var xs = cds.get_array(xkey)[xidx]; - xs.splice(xs.length - 1, 1); - } - if (ykey) { - var yidx = cds.data[ykey].length - 1; - var ys = cds.get_array(ykey)[yidx]; - ys.splice(ys.length - 1, 1); - } - this._emit_cds_changes(cds); - }; - PolyDrawToolView.prototype._keyup = function (ev) { - if (!this.model.active || !this._mouse_in_frame) - return; - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - if (ev.keyCode === dom_1.Keys.Backspace) { - this._delete_selected(renderer); - } - else if (ev.keyCode == dom_1.Keys.Esc) { - if (this._drawing) { - this._remove(); - this._drawing = false; - } - renderer.data_source.selection_manager.clear(); - } - } - }; - PolyDrawToolView.prototype._pan_start = function (ev) { - if (!this.model.drag) - return; - this._select_event(ev, true, this.model.renderers); - this._basepoint = [ev.sx, ev.sy]; - }; - PolyDrawToolView.prototype._pan = function (ev) { - if (this._basepoint == null || !this.model.drag) - return; - var _a = this._basepoint, bx = _a[0], by = _a[1]; - // Process polygon/line dragging - for (var _i = 0, _b = this.model.renderers; _i < _b.length; _i++) { - var renderer = _b[_i]; - var basepoint = this._map_drag(bx, by, renderer); - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null || basepoint == null) - continue; - var cds = renderer.data_source; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var _c = [glyph.xs.field, glyph.ys.field], xkey = _c[0], ykey = _c[1]; - if (!xkey && !ykey) - continue; - var x = point[0], y = point[1]; - var px = basepoint[0], py = basepoint[1]; - var _d = [x - px, y - py], dx = _d[0], dy = _d[1]; - for (var _e = 0, _f = cds.selected.indices; _e < _f.length; _e++) { - var index = _f[_e]; - var length_1 = void 0, xs = void 0, ys = void 0; - if (xkey) - xs = cds.data[xkey][index]; - if (ykey) { - ys = cds.data[ykey][index]; - length_1 = ys.length; - } - else { - length_1 = xs.length; - } - for (var i = 0; i < length_1; i++) { - if (xs) - xs[i] += dx; - if (ys) - ys[i] += dy; - } - } - cds.change.emit(); - } - this._basepoint = [ev.sx, ev.sy]; - }; - PolyDrawToolView.prototype._pan_end = function (ev) { - if (!this.model.drag) - return; - this._pan(ev); - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - this._emit_cds_changes(renderer.data_source); - } - this._basepoint = null; - }; - PolyDrawToolView.prototype.activate = function () { - var _this = this; - if (!this.model.vertex_renderer || !this.model.active) - return; - this._show_vertices(); - if (!this._initialized) { - for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) { - var renderer = _a[_i]; - var cds = renderer.data_source; - cds.connect(cds.properties.data.change, function () { return _this._show_vertices(); }); - } - } - this._initialized = true; - }; - PolyDrawToolView.prototype.deactivate = function () { - if (this._drawing) { - this._remove(); - this._drawing = false; - } - if (this.model.vertex_renderer) - this._hide_vertices(); - }; - return PolyDrawToolView; - }(poly_tool_1.PolyToolView)); - exports.PolyDrawToolView = PolyDrawToolView; - var PolyDrawTool = /** @class */ (function (_super) { - tslib_1.__extends(PolyDrawTool, _super); - function PolyDrawTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Polygon Draw Tool"; - _this.icon = "bk-tool-icon-poly-draw"; - _this.event_type = ["pan", "tap", "move"]; - _this.default_order = 3; - return _this; - } - PolyDrawTool.initClass = function () { - this.prototype.type = "PolyDrawTool"; - this.prototype.default_view = PolyDrawToolView; - this.define({ - drag: [p.Boolean, true], - num_objects: [p.Int, 0], - }); - }; - return PolyDrawTool; - }(poly_tool_1.PolyTool)); - exports.PolyDrawTool = PolyDrawTool; - PolyDrawTool.initClass(); -} -, -/* models/tools/edit/poly_edit_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var dom_1 = require(5) /* ../../../core/dom */; - var types_1 = require(46) /* ../../../core/util/types */; - var poly_tool_1 = require(258) /* ./poly_tool */; - var PolyEditToolView = /** @class */ (function (_super) { - tslib_1.__extends(PolyEditToolView, _super); - function PolyEditToolView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._drawing = false; - return _this; - } - PolyEditToolView.prototype._doubletap = function (ev) { - if (!this.model.active) - return; - var point = this._map_drag(ev.sx, ev.sy, this.model.vertex_renderer); - if (point == null) - return; - var x = point[0], y = point[1]; - // Perform hit testing - var vertex_selected = this._select_event(ev, false, [this.model.vertex_renderer]); - var point_cds = this.model.vertex_renderer.data_source; - // Type once dataspecs are typed - var point_glyph = this.model.vertex_renderer.glyph; - var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1]; - if (vertex_selected.length && this._selected_renderer != null) { - // Insert a new point after the selected vertex and enter draw mode - var index = point_cds.selected.indices[0]; - if (this._drawing) { - this._drawing = false; - point_cds.selection_manager.clear(); - } - else { - point_cds.selected.indices = [index + 1]; - if (pxkey) - point_cds.get_array(pxkey).splice(index + 1, 0, x); - if (pykey) - point_cds.get_array(pykey).splice(index + 1, 0, y); - this._drawing = true; - } - point_cds.change.emit(); - this._emit_cds_changes(this._selected_renderer.data_source); - } - else { - this._show_vertices(ev); - } - }; - PolyEditToolView.prototype._show_vertices = function (ev) { - if (!this.model.active) - return; - var renderers = this._select_event(ev, false, this.model.renderers); - if (!renderers.length) { - this._set_vertices([], []); - this._selected_renderer = null; - this._drawing = false; - return; - } - var renderer = renderers[0]; - var glyph = renderer.glyph; - var cds = renderer.data_source; - var index = cds.selected.indices[0]; - var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1]; - var xs; - var ys; - if (xkey) { - xs = cds.data[xkey][index]; - if (!types_1.isArray(xs)) - cds.data[xkey][index] = xs = Array.from(xs); - } - else { - xs = glyph.xs.value; - } - if (ykey) { - ys = cds.data[ykey][index]; - if (!types_1.isArray(ys)) - cds.data[ykey][index] = ys = Array.from(ys); - } - else { - ys = glyph.ys.value; - } - this._selected_renderer = renderer; - this._set_vertices(xs, ys); - }; - PolyEditToolView.prototype._move = function (ev) { - var _a; - if (this._drawing && this._selected_renderer != null) { - var renderer = this.model.vertex_renderer; - var cds = renderer.data_source; - var glyph = renderer.glyph; - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null) - return; - var x = point[0], y = point[1]; - var indices = cds.selected.indices; - _a = this._snap_to_vertex(ev, x, y), x = _a[0], y = _a[1]; - cds.selected.indices = indices; - var _b = [glyph.x.field, glyph.y.field], xkey = _b[0], ykey = _b[1]; - var index = indices[0]; - if (xkey) - cds.data[xkey][index] = x; - if (ykey) - cds.data[ykey][index] = y; - cds.change.emit(); - this._selected_renderer.data_source.change.emit(); - } - }; - PolyEditToolView.prototype._tap = function (ev) { - var _a; - var renderer = this.model.vertex_renderer; - var point = this._map_drag(ev.sx, ev.sy, renderer); - if (point == null) - return; - else if (this._drawing && this._selected_renderer) { - var x = point[0], y = point[1]; - var cds = renderer.data_source; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var _b = [glyph.x.field, glyph.y.field], xkey = _b[0], ykey = _b[1]; - var indices = cds.selected.indices; - _a = this._snap_to_vertex(ev, x, y), x = _a[0], y = _a[1]; - var index = indices[0]; - cds.selected.indices = [index + 1]; - if (xkey) { - var xs = cds.get_array(xkey); - var nx = xs[index]; - xs[index] = x; - xs.splice(index + 1, 0, nx); - } - if (ykey) { - var ys = cds.get_array(ykey); - var ny = ys[index]; - ys[index] = y; - ys.splice(index + 1, 0, ny); - } - cds.change.emit(); - this._emit_cds_changes(this._selected_renderer.data_source, true, false, true); - return; - } - var append = ev.shiftKey; - this._select_event(ev, append, [renderer]); - this._select_event(ev, append, this.model.renderers); - }; - PolyEditToolView.prototype._remove_vertex = function () { - if (!this._drawing || !this._selected_renderer) - return; - var renderer = this.model.vertex_renderer; - var cds = renderer.data_source; - // Type once dataspecs are typed - var glyph = renderer.glyph; - var index = cds.selected.indices[0]; - var _a = [glyph.x.field, glyph.y.field], xkey = _a[0], ykey = _a[1]; - if (xkey) - cds.get_array(xkey).splice(index, 1); - if (ykey) - cds.get_array(ykey).splice(index, 1); - cds.change.emit(); - this._emit_cds_changes(this._selected_renderer.data_source); - }; - PolyEditToolView.prototype._pan_start = function (ev) { - this._select_event(ev, true, [this.model.vertex_renderer]); - this._basepoint = [ev.sx, ev.sy]; - }; - PolyEditToolView.prototype._pan = function (ev) { - if (this._basepoint == null) - return; - this._drag_points(ev, [this.model.vertex_renderer]); - if (this._selected_renderer) - this._selected_renderer.data_source.change.emit(); - }; - PolyEditToolView.prototype._pan_end = function (ev) { - if (this._basepoint == null) - return; - this._drag_points(ev, [this.model.vertex_renderer]); - this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true); - if (this._selected_renderer) { - this._emit_cds_changes(this._selected_renderer.data_source); - } - this._basepoint = null; - }; - PolyEditToolView.prototype._keyup = function (ev) { - if (!this.model.active || !this._mouse_in_frame) - return; - var renderers; - if (this._selected_renderer) { - renderers = [this.model.vertex_renderer]; - } - else { - renderers = this.model.renderers; - } - for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) { - var renderer = renderers_1[_i]; - if (ev.keyCode === dom_1.Keys.Backspace) { - this._delete_selected(renderer); - if (this._selected_renderer) { - this._emit_cds_changes(this._selected_renderer.data_source); - } - } - else if (ev.keyCode == dom_1.Keys.Esc) { - if (this._drawing) { - this._remove_vertex(); - this._drawing = false; - } - else if (this._selected_renderer) { - this._hide_vertices(); - } - renderer.data_source.selection_manager.clear(); - } - } - }; - PolyEditToolView.prototype.deactivate = function () { - if (!this._selected_renderer) { - return; - } - else if (this._drawing) { - this._remove_vertex(); - this._drawing = false; - } - this._hide_vertices(); - }; - return PolyEditToolView; - }(poly_tool_1.PolyToolView)); - exports.PolyEditToolView = PolyEditToolView; - var PolyEditTool = /** @class */ (function (_super) { - tslib_1.__extends(PolyEditTool, _super); - function PolyEditTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Poly Edit Tool"; - _this.icon = "bk-tool-icon-poly-edit"; - _this.event_type = ["tap", "pan", "move"]; - _this.default_order = 4; - return _this; - } - PolyEditTool.initClass = function () { - this.prototype.type = "PolyEditTool"; - this.prototype.default_view = PolyEditToolView; - }; - return PolyEditTool; - }(poly_tool_1.PolyTool)); - exports.PolyEditTool = PolyEditTool; - PolyEditTool.initClass(); -} -, -/* models/tools/edit/poly_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../../core/properties */; - var types_1 = require(46) /* ../../../core/util/types */; - var edit_tool_1 = require(253) /* ./edit_tool */; - var PolyToolView = /** @class */ (function (_super) { - tslib_1.__extends(PolyToolView, _super); - function PolyToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PolyToolView.prototype._set_vertices = function (xs, ys) { - var point_glyph = this.model.vertex_renderer.glyph; - var point_cds = this.model.vertex_renderer.data_source; - var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1]; - if (pxkey) { - if (types_1.isArray(xs)) - point_cds.data[pxkey] = xs; - else - point_glyph.x = { value: xs }; - } - if (pykey) { - if (types_1.isArray(ys)) - point_cds.data[pykey] = ys; - else - point_glyph.y = { value: ys }; - } - this._emit_cds_changes(point_cds, true, true, false); - }; - PolyToolView.prototype._hide_vertices = function () { - this._set_vertices([], []); - }; - PolyToolView.prototype._snap_to_vertex = function (ev, x, y) { - if (this.model.vertex_renderer) { - // If an existing vertex is hit snap to it - var vertex_selected = this._select_event(ev, false, [this.model.vertex_renderer]); - var point_ds = this.model.vertex_renderer.data_source; - // Type once dataspecs are typed - var point_glyph = this.model.vertex_renderer.glyph; - var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1]; - if (vertex_selected.length) { - var index = point_ds.selected.indices[0]; - if (pxkey) - x = point_ds.data[pxkey][index]; - if (pykey) - y = point_ds.data[pykey][index]; - point_ds.selection_manager.clear(); - } - } - return [x, y]; - }; - return PolyToolView; - }(edit_tool_1.EditToolView)); - exports.PolyToolView = PolyToolView; - var PolyTool = /** @class */ (function (_super) { - tslib_1.__extends(PolyTool, _super); - function PolyTool(attrs) { - return _super.call(this, attrs) || this; - } - PolyTool.initClass = function () { - this.prototype.type = "PolyTool"; - this.prototype.default_view = PolyToolView; - this.define({ - vertex_renderer: [p.Instance], - }); - }; - return PolyTool; - }(edit_tool_1.EditTool)); - exports.PolyTool = PolyTool; - PolyTool.initClass(); -} -, -/* models/tools/gestures/box_select_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var select_tool_1 = require(266) /* ./select_tool */; - var box_annotation_1 = require(67) /* ../../annotations/box_annotation */; - var p = require(18) /* ../../../core/properties */; - var BoxSelectToolView = /** @class */ (function (_super) { - tslib_1.__extends(BoxSelectToolView, _super); - function BoxSelectToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxSelectToolView.prototype._compute_limits = function (curpoint) { - var frame = this.plot_view.frame; - var dims = this.model.dimensions; - var base_point = this._base_point; - if (this.model.origin == "center") { - var cx = base_point[0], cy = base_point[1]; - var dx = curpoint[0], dy = curpoint[1]; - base_point = [cx - (dx - cx), cy - (dy - cy)]; - } - return this.model._get_dim_limits(base_point, curpoint, frame, dims); - }; - BoxSelectToolView.prototype._pan_start = function (ev) { - var sx = ev.sx, sy = ev.sy; - this._base_point = [sx, sy]; - }; - BoxSelectToolView.prototype._pan = function (ev) { - var sx = ev.sx, sy = ev.sy; - var curpoint = [sx, sy]; - var _a = this._compute_limits(curpoint), sxlim = _a[0], sylim = _a[1]; - this.model.overlay.update({ left: sxlim[0], right: sxlim[1], top: sylim[0], bottom: sylim[1] }); - if (this.model.select_every_mousemove) { - var append = ev.shiftKey; - this._do_select(sxlim, sylim, false, append); - } - }; - BoxSelectToolView.prototype._pan_end = function (ev) { - var sx = ev.sx, sy = ev.sy; - var curpoint = [sx, sy]; - var _a = this._compute_limits(curpoint), sxlim = _a[0], sylim = _a[1]; - var append = ev.shiftKey; - this._do_select(sxlim, sylim, true, append); - this.model.overlay.update({ left: null, right: null, top: null, bottom: null }); - this._base_point = null; - this.plot_view.push_state('box_select', { selection: this.plot_view.get_selection() }); - }; - BoxSelectToolView.prototype._do_select = function (_a, _b, final, append) { - var sx0 = _a[0], sx1 = _a[1]; - var sy0 = _b[0], sy1 = _b[1]; - if (append === void 0) { - append = false; - } - var geometry = { type: 'rect', sx0: sx0, sx1: sx1, sy0: sy0, sy1: sy1 }; - this._select(geometry, final, append); - }; - BoxSelectToolView.prototype._emit_callback = function (geometry) { - var r = this.computed_renderers[0]; - var frame = this.plot_view.frame; - var xscale = frame.xscales[r.x_range_name]; - var yscale = frame.yscales[r.y_range_name]; - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - var g = tslib_1.__assign({ x0: x0, y0: y0, x1: x1, y1: y1 }, geometry); - if (this.model.callback != null) - this.model.callback.execute(this.model, { geometry: g }); - }; - return BoxSelectToolView; - }(select_tool_1.SelectToolView)); - exports.BoxSelectToolView = BoxSelectToolView; - var DEFAULT_BOX_OVERLAY = function () { - return new box_annotation_1.BoxAnnotation({ - level: "overlay", - render_mode: "css", - top_units: "screen", - left_units: "screen", - bottom_units: "screen", - right_units: "screen", - fill_color: { value: "lightgrey" }, - fill_alpha: { value: 0.5 }, - line_color: { value: "black" }, - line_alpha: { value: 1.0 }, - line_width: { value: 2 }, - line_dash: { value: [4, 4] }, - }); - }; - var BoxSelectTool = /** @class */ (function (_super) { - tslib_1.__extends(BoxSelectTool, _super); - function BoxSelectTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Box Select"; - _this.icon = "bk-tool-icon-box-select"; - _this.event_type = "pan"; - _this.default_order = 30; - return _this; - } - BoxSelectTool.initClass = function () { - this.prototype.type = "BoxSelectTool"; - this.prototype.default_view = BoxSelectToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - select_every_mousemove: [p.Boolean, false], - callback: [p.Any], - overlay: [p.Instance, DEFAULT_BOX_OVERLAY], - origin: [p.BoxOrigin, "corner"], - }); - }; - Object.defineProperty(BoxSelectTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimensions); - }, - enumerable: true, - configurable: true - }); - return BoxSelectTool; - }(select_tool_1.SelectTool)); - exports.BoxSelectTool = BoxSelectTool; - BoxSelectTool.initClass(); -} -, -/* models/tools/gestures/box_zoom_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - var box_annotation_1 = require(67) /* ../../annotations/box_annotation */; - var p = require(18) /* ../../../core/properties */; - var BoxZoomToolView = /** @class */ (function (_super) { - tslib_1.__extends(BoxZoomToolView, _super); - function BoxZoomToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - BoxZoomToolView.prototype._match_aspect = function (base_point, curpoint, frame) { - // aspect ratio of plot frame - var a = frame.bbox.aspect; - var hend = frame.bbox.h_range.end; - var hstart = frame.bbox.h_range.start; - var vend = frame.bbox.v_range.end; - var vstart = frame.bbox.v_range.start; - // current aspect of cursor-defined box - var vw = Math.abs(base_point[0] - curpoint[0]); - var vh = Math.abs(base_point[1] - curpoint[1]); - var va = vh == 0 ? 0 : vw / vh; - var xmod = (va >= a ? [1, va / a] : [a / va, 1])[0]; - // OK the code blocks below merit some explanation. They do: - // - // compute left/right, pin to frame if necessary - // compute top/bottom (based on new left/right), pin to frame if necessary - // recompute left/right (based on top/bottom), in case top/bottom were pinned - // base_point[0] is left - var left; - var right; - if (base_point[0] <= curpoint[0]) { - left = base_point[0]; - right = base_point[0] + vw * xmod; - if (right > hend) - right = hend; - // base_point[0] is right - } - else { - right = base_point[0]; - left = base_point[0] - vw * xmod; - if (left < hstart) - left = hstart; - } - vw = Math.abs(right - left); - // base_point[1] is bottom - var top; - var bottom; - if (base_point[1] <= curpoint[1]) { - bottom = base_point[1]; - top = base_point[1] + vw / a; - if (top > vend) - top = vend; - // base_point[1] is top - } - else { - top = base_point[1]; - bottom = base_point[1] - vw / a; - if (bottom < vstart) - bottom = vstart; - } - vh = Math.abs(top - bottom); - // base_point[0] is left - if (base_point[0] <= curpoint[0]) - right = base_point[0] + a * vh; - // base_point[0] is right - else - left = base_point[0] - a * vh; - return [[left, right], [bottom, top]]; - }; - BoxZoomToolView.prototype._compute_limits = function (curpoint) { - var _a, _b; - var frame = this.plot_view.frame; - var dims = this.model.dimensions; - var base_point = this._base_point; - if (this.model.origin == "center") { - var cx = base_point[0], cy = base_point[1]; - var dx = curpoint[0], dy = curpoint[1]; - base_point = [cx - (dx - cx), cy - (dy - cy)]; - } - var sx; - var sy; - if (this.model.match_aspect && dims == 'both') - _a = this._match_aspect(base_point, curpoint, frame), sx = _a[0], sy = _a[1]; - else - _b = this.model._get_dim_limits(base_point, curpoint, frame, dims), sx = _b[0], sy = _b[1]; - return [sx, sy]; - }; - BoxZoomToolView.prototype._pan_start = function (ev) { - this._base_point = [ev.sx, ev.sy]; - }; - BoxZoomToolView.prototype._pan = function (ev) { - var curpoint = [ev.sx, ev.sy]; - var _a = this._compute_limits(curpoint), sx = _a[0], sy = _a[1]; - this.model.overlay.update({ left: sx[0], right: sx[1], top: sy[0], bottom: sy[1] }); - }; - BoxZoomToolView.prototype._pan_end = function (ev) { - var curpoint = [ev.sx, ev.sy]; - var _a = this._compute_limits(curpoint), sx = _a[0], sy = _a[1]; - this._update(sx, sy); - this.model.overlay.update({ left: null, right: null, top: null, bottom: null }); - this._base_point = null; - }; - BoxZoomToolView.prototype._update = function (_a, _b) { - var sx0 = _a[0], sx1 = _a[1]; - var sy0 = _b[0], sy1 = _b[1]; - // If the viewing window is too small, no-op: it is likely that the user did - // not intend to make this box zoom and instead was trying to cancel out of the - // zoom, a la matplotlib's ToolZoom. Like matplotlib, set the threshold at 5 pixels. - if (Math.abs(sx1 - sx0) <= 5 || Math.abs(sy1 - sy0) <= 5) - return; - var _c = this.plot_view.frame, xscales = _c.xscales, yscales = _c.yscales; - var xrs = {}; - for (var name_1 in xscales) { - var scale = xscales[name_1]; - var _d = scale.r_invert(sx0, sx1), start = _d[0], end = _d[1]; - xrs[name_1] = { start: start, end: end }; - } - var yrs = {}; - for (var name_2 in yscales) { - var scale = yscales[name_2]; - var _e = scale.r_invert(sy0, sy1), start = _e[0], end = _e[1]; - yrs[name_2] = { start: start, end: end }; - } - var zoom_info = { xrs: xrs, yrs: yrs }; - this.plot_view.push_state('box_zoom', { range: zoom_info }); - this.plot_view.update_range(zoom_info); - }; - return BoxZoomToolView; - }(gesture_tool_1.GestureToolView)); - exports.BoxZoomToolView = BoxZoomToolView; - var DEFAULT_BOX_OVERLAY = function () { - return new box_annotation_1.BoxAnnotation({ - level: "overlay", - render_mode: "css", - top_units: "screen", - left_units: "screen", - bottom_units: "screen", - right_units: "screen", - fill_color: { value: "lightgrey" }, - fill_alpha: { value: 0.5 }, - line_color: { value: "black" }, - line_alpha: { value: 1.0 }, - line_width: { value: 2 }, - line_dash: { value: [4, 4] }, - }); - }; - var BoxZoomTool = /** @class */ (function (_super) { - tslib_1.__extends(BoxZoomTool, _super); - function BoxZoomTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Box Zoom"; - _this.icon = "bk-tool-icon-box-zoom"; - _this.event_type = "pan"; - _this.default_order = 20; - return _this; - } - BoxZoomTool.initClass = function () { - this.prototype.type = "BoxZoomTool"; - this.prototype.default_view = BoxZoomToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - overlay: [p.Instance, DEFAULT_BOX_OVERLAY], - match_aspect: [p.Boolean, false], - origin: [p.BoxOrigin, "corner"], - }); - }; - Object.defineProperty(BoxZoomTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimensions); - }, - enumerable: true, - configurable: true - }); - return BoxZoomTool; - }(gesture_tool_1.GestureTool)); - exports.BoxZoomTool = BoxZoomTool; - BoxZoomTool.initClass(); -} -, -/* models/tools/gestures/gesture_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var button_tool_1 = require(251) /* ../button_tool */; - var on_off_button_1 = require(275) /* ../on_off_button */; - var GestureToolView = /** @class */ (function (_super) { - tslib_1.__extends(GestureToolView, _super); - function GestureToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return GestureToolView; - }(button_tool_1.ButtonToolView)); - exports.GestureToolView = GestureToolView; - var GestureTool = /** @class */ (function (_super) { - tslib_1.__extends(GestureTool, _super); - function GestureTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.button_view = on_off_button_1.OnOffButtonView; - return _this; - } - GestureTool.initClass = function () { - this.prototype.type = "GestureTool"; - }; - return GestureTool; - }(button_tool_1.ButtonTool)); - exports.GestureTool = GestureTool; - GestureTool.initClass(); -} -, -/* models/tools/gestures/lasso_select_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var select_tool_1 = require(266) /* ./select_tool */; - var poly_annotation_1 = require(74) /* ../../annotations/poly_annotation */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var LassoSelectToolView = /** @class */ (function (_super) { - tslib_1.__extends(LassoSelectToolView, _super); - function LassoSelectToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - LassoSelectToolView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.data = null; - }; - LassoSelectToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.active.change, function () { return _this._active_change(); }); - }; - LassoSelectToolView.prototype._active_change = function () { - if (!this.model.active) - this._clear_overlay(); - }; - LassoSelectToolView.prototype._keyup = function (ev) { - if (ev.keyCode == dom_1.Keys.Enter) - this._clear_overlay(); - }; - LassoSelectToolView.prototype._pan_start = function (ev) { - var sx = ev.sx, sy = ev.sy; - this.data = { sx: [sx], sy: [sy] }; - }; - LassoSelectToolView.prototype._pan = function (ev) { - var _sx = ev.sx, _sy = ev.sy; - var _a = this.plot_view.frame.bbox.clip(_sx, _sy), sx = _a[0], sy = _a[1]; - this.data.sx.push(sx); - this.data.sy.push(sy); - var overlay = this.model.overlay; - overlay.update({ xs: this.data.sx, ys: this.data.sy }); - if (this.model.select_every_mousemove) { - var append = ev.shiftKey; - this._do_select(this.data.sx, this.data.sy, false, append); - } - }; - LassoSelectToolView.prototype._pan_end = function (ev) { - this._clear_overlay(); - var append = ev.shiftKey; - this._do_select(this.data.sx, this.data.sy, true, append); - this.plot_view.push_state('lasso_select', { selection: this.plot_view.get_selection() }); - }; - LassoSelectToolView.prototype._clear_overlay = function () { - this.model.overlay.update({ xs: [], ys: [] }); - }; - LassoSelectToolView.prototype._do_select = function (sx, sy, final, append) { - var geometry = { type: 'poly', sx: sx, sy: sy }; - this._select(geometry, final, append); - }; - LassoSelectToolView.prototype._emit_callback = function (geometry) { - var r = this.computed_renderers[0]; - var frame = this.plot_view.frame; - var xscale = frame.xscales[r.x_range_name]; - var yscale = frame.yscales[r.y_range_name]; - var x = xscale.v_invert(geometry.sx); - var y = yscale.v_invert(geometry.sy); - var g = tslib_1.__assign({ x: x, y: y }, geometry); - if (this.model.callback != null) - this.model.callback.execute(this.model, { geometry: g }); - }; - return LassoSelectToolView; - }(select_tool_1.SelectToolView)); - exports.LassoSelectToolView = LassoSelectToolView; - var DEFAULT_POLY_OVERLAY = function () { - return new poly_annotation_1.PolyAnnotation({ - level: "overlay", - xs_units: "screen", - ys_units: "screen", - fill_color: { value: "lightgrey" }, - fill_alpha: { value: 0.5 }, - line_color: { value: "black" }, - line_alpha: { value: 1.0 }, - line_width: { value: 2 }, - line_dash: { value: [4, 4] }, - }); - }; - var LassoSelectTool = /** @class */ (function (_super) { - tslib_1.__extends(LassoSelectTool, _super); - function LassoSelectTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Lasso Select"; - _this.icon = "bk-tool-icon-lasso-select"; - _this.event_type = "pan"; - _this.default_order = 12; - return _this; - } - LassoSelectTool.initClass = function () { - this.prototype.type = "LassoSelectTool"; - this.prototype.default_view = LassoSelectToolView; - this.define({ - select_every_mousemove: [p.Boolean, true], - callback: [p.Any], - overlay: [p.Instance, DEFAULT_POLY_OVERLAY], - }); - }; - return LassoSelectTool; - }(select_tool_1.SelectTool)); - exports.LassoSelectTool = LassoSelectTool; - LassoSelectTool.initClass(); -} -, -/* models/tools/gestures/pan_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - var p = require(18) /* ../../../core/properties */; - var PanToolView = /** @class */ (function (_super) { - tslib_1.__extends(PanToolView, _super); - function PanToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PanToolView.prototype._pan_start = function (ev) { - this.last_dx = 0; - this.last_dy = 0; - var sx = ev.sx, sy = ev.sy; - var bbox = this.plot_view.frame.bbox; - if (!bbox.contains(sx, sy)) { - var hr = bbox.h_range; - var vr = bbox.v_range; - if (sx < hr.start || sx > hr.end) - this.v_axis_only = true; - if (sy < vr.start || sy > vr.end) - this.h_axis_only = true; - } - if (this.model.document != null) - this.model.document.interactive_start(this.plot_model); - }; - PanToolView.prototype._pan = function (ev) { - this._update(ev.deltaX, ev.deltaY); - if (this.model.document != null) - this.model.document.interactive_start(this.plot_model); - }; - PanToolView.prototype._pan_end = function (_e) { - this.h_axis_only = false; - this.v_axis_only = false; - if (this.pan_info != null) - this.plot_view.push_state('pan', { range: this.pan_info }); - }; - PanToolView.prototype._update = function (dx, dy) { - var frame = this.plot_view.frame; - var new_dx = dx - this.last_dx; - var new_dy = dy - this.last_dy; - var hr = frame.bbox.h_range; - var sx_low = hr.start - new_dx; - var sx_high = hr.end - new_dx; - var vr = frame.bbox.v_range; - var sy_low = vr.start - new_dy; - var sy_high = vr.end - new_dy; - var dims = this.model.dimensions; - var sx0; - var sx1; - var sdx; - if ((dims == 'width' || dims == 'both') && !this.v_axis_only) { - sx0 = sx_low; - sx1 = sx_high; - sdx = -new_dx; - } - else { - sx0 = hr.start; - sx1 = hr.end; - sdx = 0; - } - var sy0; - var sy1; - var sdy; - if ((dims == 'height' || dims == 'both') && !this.h_axis_only) { - sy0 = sy_low; - sy1 = sy_high; - sdy = -new_dy; - } - else { - sy0 = vr.start; - sy1 = vr.end; - sdy = 0; - } - this.last_dx = dx; - this.last_dy = dy; - var xscales = frame.xscales, yscales = frame.yscales; - var xrs = {}; - for (var name_1 in xscales) { - var scale = xscales[name_1]; - var _a = scale.r_invert(sx0, sx1), start = _a[0], end = _a[1]; - xrs[name_1] = { start: start, end: end }; - } - var yrs = {}; - for (var name_2 in yscales) { - var scale = yscales[name_2]; - var _b = scale.r_invert(sy0, sy1), start = _b[0], end = _b[1]; - yrs[name_2] = { start: start, end: end }; - } - this.pan_info = { xrs: xrs, yrs: yrs, sdx: sdx, sdy: sdy }; - this.plot_view.update_range(this.pan_info, true); - }; - return PanToolView; - }(gesture_tool_1.GestureToolView)); - exports.PanToolView = PanToolView; - var PanTool = /** @class */ (function (_super) { - tslib_1.__extends(PanTool, _super); - function PanTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Pan"; - _this.event_type = "pan"; - _this.default_order = 10; - return _this; - } - PanTool.initClass = function () { - this.prototype.type = "PanTool"; - this.prototype.default_view = PanToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - }); - }; - Object.defineProperty(PanTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip("Pan", this.dimensions); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PanTool.prototype, "icon", { - get: function () { - switch (this.dimensions) { - case "both": return "bk-tool-icon-pan"; - case "width": return "bk-tool-icon-xpan"; - case "height": return "bk-tool-icon-ypan"; - } - }, - enumerable: true, - configurable: true - }); - return PanTool; - }(gesture_tool_1.GestureTool)); - exports.PanTool = PanTool; - PanTool.initClass(); -} -, -/* models/tools/gestures/poly_select_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var select_tool_1 = require(266) /* ./select_tool */; - var poly_annotation_1 = require(74) /* ../../annotations/poly_annotation */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var array_1 = require(24) /* ../../../core/util/array */; - var PolySelectToolView = /** @class */ (function (_super) { - tslib_1.__extends(PolySelectToolView, _super); - function PolySelectToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - PolySelectToolView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.data = { sx: [], sy: [] }; - }; - PolySelectToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.active.change, function () { return _this._active_change(); }); - }; - PolySelectToolView.prototype._active_change = function () { - if (!this.model.active) - this._clear_data(); - }; - PolySelectToolView.prototype._keyup = function (ev) { - if (ev.keyCode == dom_1.Keys.Enter) - this._clear_data(); - }; - PolySelectToolView.prototype._doubletap = function (ev) { - var append = ev.shiftKey; - this._do_select(this.data.sx, this.data.sy, true, append); - this.plot_view.push_state('poly_select', { selection: this.plot_view.get_selection() }); - this._clear_data(); - }; - PolySelectToolView.prototype._clear_data = function () { - this.data = { sx: [], sy: [] }; - this.model.overlay.update({ xs: [], ys: [] }); - }; - PolySelectToolView.prototype._tap = function (ev) { - var sx = ev.sx, sy = ev.sy; - var frame = this.plot_view.frame; - if (!frame.bbox.contains(sx, sy)) - return; - this.data.sx.push(sx); - this.data.sy.push(sy); - this.model.overlay.update({ xs: array_1.copy(this.data.sx), ys: array_1.copy(this.data.sy) }); - }; - PolySelectToolView.prototype._do_select = function (sx, sy, final, append) { - var geometry = { type: 'poly', sx: sx, sy: sy }; - this._select(geometry, final, append); - }; - PolySelectToolView.prototype._emit_callback = function (geometry) { - var r = this.computed_renderers[0]; - var frame = this.plot_view.frame; - var xscale = frame.xscales[r.x_range_name]; - var yscale = frame.yscales[r.y_range_name]; - var x = xscale.v_invert(geometry.sx); - var y = yscale.v_invert(geometry.sy); - var g = tslib_1.__assign({ x: x, y: y }, geometry); - if (this.model.callback != null) - this.model.callback.execute(this.model, { geometry: g }); - }; - return PolySelectToolView; - }(select_tool_1.SelectToolView)); - exports.PolySelectToolView = PolySelectToolView; - var DEFAULT_POLY_OVERLAY = function () { - return new poly_annotation_1.PolyAnnotation({ - level: "overlay", - xs_units: "screen", - ys_units: "screen", - fill_color: { value: "lightgrey" }, - fill_alpha: { value: 0.5 }, - line_color: { value: "black" }, - line_alpha: { value: 1.0 }, - line_width: { value: 2 }, - line_dash: { value: [4, 4] }, - }); - }; - var PolySelectTool = /** @class */ (function (_super) { - tslib_1.__extends(PolySelectTool, _super); - function PolySelectTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Poly Select"; - _this.icon = "bk-tool-icon-polygon-select"; - _this.event_type = "tap"; - _this.default_order = 11; - return _this; - } - PolySelectTool.initClass = function () { - this.prototype.type = "PolySelectTool"; - this.prototype.default_view = PolySelectToolView; - this.define({ - callback: [p.Any], - overlay: [p.Instance, DEFAULT_POLY_OVERLAY], - }); - }; - return PolySelectTool; - }(select_tool_1.SelectTool)); - exports.PolySelectTool = PolySelectTool; - PolySelectTool.initClass(); -} -, -/* models/tools/gestures/range_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var box_annotation_1 = require(67) /* ../../annotations/box_annotation */; - var logging_1 = require(17) /* ../../../core/logging */; - var p = require(18) /* ../../../core/properties */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - function flip_side(side) { - switch (side) { - case 1 /* Left */: return 2 /* Right */; - case 2 /* Right */: return 1 /* Left */; - case 4 /* Bottom */: return 5 /* Top */; - case 5 /* Top */: return 4 /* Bottom */; - default: return side; - } - } - exports.flip_side = flip_side; - // TODO (bev) This would be better directly with BoxAnnotation, but hard - // to test on a view. Move when "View Models" are implemented - function is_near(pos, value, scale, tolerance) { - if (value == null) - return false; - var svalue = scale.compute(value); - return Math.abs(pos - svalue) < tolerance; - } - exports.is_near = is_near; - // TODO (bev) This would be better directly with BoxAnnotation, but hard - // to test on a view. Move when "View Models" are implemented - function is_inside(sx, sy, xscale, yscale, overlay) { - var result = true; - if (overlay.left != null && overlay.right != null) { - var x = xscale.invert(sx); - if (x < overlay.left || x > overlay.right) - result = false; - } - if (overlay.bottom != null && overlay.top != null) { - var y = yscale.invert(sy); - if (y < overlay.bottom || y > overlay.top) - result = false; - } - return result; - } - exports.is_inside = is_inside; - function sides_inside(start, end, range) { - var result = 0; - if (start >= range.start && start <= range.end) - result += 1; - if (end >= range.start && end <= range.end) - result += 1; - return result; - } - exports.sides_inside = sides_inside; - function compute_value(value, scale, sdelta, range) { - var svalue = scale.compute(value); - var new_value = scale.invert(svalue + sdelta); - if (new_value >= range.start && new_value <= range.end) - return new_value; - return value; - } - exports.compute_value = compute_value; - function compute_end_side(end, range, side) { - if (end > range.start) { - range.end = end; - return side; - } - else { - range.end = range.start; - range.start = end; - return flip_side(side); - } - } - exports.compute_end_side = compute_end_side; - function compute_start_side(start, range, side) { - if (start < range.end) { - range.start = start; - return side; - } - else { - range.start = range.end; - range.end = start; - return flip_side(side); - } - } - exports.compute_start_side = compute_start_side; - function update_range(range, scale, delta, plot_range) { - var _a = scale.r_compute(range.start, range.end), sstart = _a[0], send = _a[1]; - var _b = scale.r_invert(sstart + delta, send + delta), start = _b[0], end = _b[1]; - var initial_sides_inside = sides_inside(range.start, range.end, plot_range); - var final_sides_inside = sides_inside(start, end, plot_range); - // Allow the update as long as the number of sides in-bounds does not decrease - if (final_sides_inside >= initial_sides_inside) { - range.start = start; - range.end = end; - } - } - exports.update_range = update_range; - var RangeToolView = /** @class */ (function (_super) { - tslib_1.__extends(RangeToolView, _super); - function RangeToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - RangeToolView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.side = 0 /* None */; - this.model.update_overlay_from_ranges(); - }; - RangeToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - if (this.model.x_range != null) - this.connect(this.model.x_range.change, function () { return _this.model.update_overlay_from_ranges(); }); - if (this.model.y_range != null) - this.connect(this.model.y_range.change, function () { return _this.model.update_overlay_from_ranges(); }); - }; - RangeToolView.prototype._pan_start = function (ev) { - this.last_dx = 0; - this.last_dy = 0; - var xr = this.model.x_range; - var yr = this.model.y_range; - var frame = this.plot_view.frame; - var xscale = frame.xscales.default; - var yscale = frame.yscales.default; - var overlay = this.model.overlay; - var left = overlay.left, right = overlay.right, top = overlay.top, bottom = overlay.bottom; - var tolerance = this.model.overlay.properties.line_width.value() + box_annotation_1.EDGE_TOLERANCE; - if (xr != null && this.model.x_interaction) { - if (is_near(ev.sx, left, xscale, tolerance)) - this.side = 1 /* Left */; - else if (is_near(ev.sx, right, xscale, tolerance)) - this.side = 2 /* Right */; - else if (is_inside(ev.sx, ev.sy, xscale, yscale, overlay)) { - this.side = 3 /* LeftRight */; - } - } - if (yr != null && this.model.y_interaction) { - if (this.side == 0 /* None */ && is_near(ev.sy, bottom, yscale, tolerance)) - this.side = 4 /* Bottom */; - if (this.side == 0 /* None */ && is_near(ev.sy, top, yscale, tolerance)) - this.side = 5 /* Top */; - else if (is_inside(ev.sx, ev.sy, xscale, yscale, this.model.overlay)) { - if (this.side == 3 /* LeftRight */) - this.side = 7 /* LeftRightBottomTop */; - else - this.side = 6 /* BottomTop */; - } - } - }; - RangeToolView.prototype._pan = function (ev) { - var frame = this.plot_view.frame; - var new_dx = ev.deltaX - this.last_dx; - var new_dy = ev.deltaY - this.last_dy; - var xr = this.model.x_range; - var yr = this.model.y_range; - var xscale = frame.xscales.default; - var yscale = frame.yscales.default; - if (xr != null) { - if (this.side == 3 /* LeftRight */ || this.side == 7 /* LeftRightBottomTop */) - update_range(xr, xscale, new_dx, frame.x_range); - else if (this.side == 1 /* Left */) { - var start = compute_value(xr.start, xscale, new_dx, frame.x_range); - this.side = compute_start_side(start, xr, this.side); - } - else if (this.side == 2 /* Right */) { - var end = compute_value(xr.end, xscale, new_dx, frame.x_range); - this.side = compute_end_side(end, xr, this.side); - } - } - if (yr != null) { - if (this.side == 6 /* BottomTop */ || this.side == 7 /* LeftRightBottomTop */) - update_range(yr, yscale, new_dy, frame.y_range); - else if (this.side == 4 /* Bottom */) { - yr.start = compute_value(yr.start, yscale, new_dy, frame.y_range); - var start = compute_value(yr.start, yscale, new_dy, frame.y_range); - this.side = compute_start_side(start, yr, this.side); - } - else if (this.side == 5 /* Top */) { - yr.end = compute_value(yr.end, yscale, new_dy, frame.y_range); - var end = compute_value(yr.end, yscale, new_dy, frame.y_range); - this.side = compute_end_side(end, yr, this.side); - } - } - this.last_dx = ev.deltaX; - this.last_dy = ev.deltaY; - }; - RangeToolView.prototype._pan_end = function (_ev) { - this.side = 0 /* None */; - }; - return RangeToolView; - }(gesture_tool_1.GestureToolView)); - exports.RangeToolView = RangeToolView; - var DEFAULT_RANGE_OVERLAY = function () { - return new box_annotation_1.BoxAnnotation({ - level: "overlay", - render_mode: "canvas", - fill_color: "lightgrey", - fill_alpha: { value: 0.5 }, - line_color: { value: "black" }, - line_alpha: { value: 1.0 }, - line_width: { value: 0.5 }, - line_dash: [2, 2], - }); - }; - var RangeTool = /** @class */ (function (_super) { - tslib_1.__extends(RangeTool, _super); - function RangeTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Range Tool"; - _this.icon = "bk-tool-icon-range"; - _this.event_type = "pan"; - _this.default_order = 1; - return _this; - } - RangeTool.initClass = function () { - this.prototype.type = "RangeTool"; - this.prototype.default_view = RangeToolView; - this.define({ - x_range: [p.Instance, null], - x_interaction: [p.Boolean, true], - y_range: [p.Instance, null], - y_interaction: [p.Boolean, true], - overlay: [p.Instance, DEFAULT_RANGE_OVERLAY], - }); - }; - RangeTool.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.overlay.in_cursor = "grab"; - this.overlay.ew_cursor = this.x_range != null && this.x_interaction ? "ew-resize" : null; - this.overlay.ns_cursor = this.y_range != null && this.y_interaction ? "ns-resize" : null; - }; - RangeTool.prototype.update_overlay_from_ranges = function () { - if (this.x_range == null && this.y_range == null) { - this.overlay.left = null; - this.overlay.right = null; - this.overlay.bottom = null; - this.overlay.top = null; - logging_1.logger.warn('RangeTool not configured with any Ranges.'); - } - if (this.x_range == null) { - this.overlay.left = null; - this.overlay.right = null; - } - else { - this.overlay.left = this.x_range.start; - this.overlay.right = this.x_range.end; - } - if (this.y_range == null) { - this.overlay.bottom = null; - this.overlay.top = null; - } - else { - this.overlay.bottom = this.y_range.start; - this.overlay.top = this.y_range.end; - } - }; - return RangeTool; - }(gesture_tool_1.GestureTool)); - exports.RangeTool = RangeTool; - RangeTool.initClass(); -} -, -/* models/tools/gestures/select_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - var glyph_renderer_1 = require(193) /* ../../renderers/glyph_renderer */; - var graph_renderer_1 = require(194) /* ../../renderers/graph_renderer */; - var util_1 = require(281) /* ../util */; - var p = require(18) /* ../../../core/properties */; - var dom_1 = require(5) /* ../../../core/dom */; - var bokeh_events_1 = require(3) /* ../../../core/bokeh_events */; - var SelectToolView = /** @class */ (function (_super) { - tslib_1.__extends(SelectToolView, _super); - function SelectToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(SelectToolView.prototype, "computed_renderers", { - get: function () { - var renderers = this.model.renderers; - var all_renderers = this.plot_model.renderers; - var names = this.model.names; - return util_1.compute_renderers(renderers, all_renderers, names); - }, - enumerable: true, - configurable: true - }); - SelectToolView.prototype._computed_renderers_by_data_source = function () { - var renderers_by_source = {}; - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - var source_id = void 0; - if (r instanceof glyph_renderer_1.GlyphRenderer) - source_id = r.data_source.id; - else if (r instanceof graph_renderer_1.GraphRenderer) - source_id = r.node_renderer.data_source.id; - else - continue; - if (!(source_id in renderers_by_source)) - renderers_by_source[source_id] = []; - renderers_by_source[source_id].push(r); - } - return renderers_by_source; - }; - SelectToolView.prototype._keyup = function (ev) { - if (ev.keyCode == dom_1.Keys.Esc) { - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - r.get_selection_manager().clear(); - } - this.plot_view.request_render(); - } - }; - SelectToolView.prototype._select = function (geometry, final, append) { - var renderers_by_source = this._computed_renderers_by_data_source(); - for (var id in renderers_by_source) { - var renderers = renderers_by_source[id]; - var sm = renderers[0].get_selection_manager(); - var r_views = []; - for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) { - var r = renderers_1[_i]; - if (r.id in this.plot_view.renderer_views) - r_views.push(this.plot_view.renderer_views[r.id]); - } - sm.select(r_views, geometry, final, append); - } - // XXX: messed up class structure - if (this.model.callback != null) - this._emit_callback(geometry); - this._emit_selection_event(geometry, final); - }; - SelectToolView.prototype._emit_selection_event = function (geometry, final) { - if (final === void 0) { - final = true; - } - var frame = this.plot_view.frame; - var xm = frame.xscales.default; - var ym = frame.yscales.default; - var g; // XXX: Geometry & something - switch (geometry.type) { - case 'point': { - var sx = geometry.sx, sy = geometry.sy; - var x = xm.invert(sx); - var y = ym.invert(sy); - g = tslib_1.__assign({}, geometry, { x: x, y: y }); - break; - } - case 'rect': { - var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1; - var _a = xm.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1]; - var _b = ym.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1]; - g = tslib_1.__assign({}, geometry, { x0: x0, y0: y0, x1: x1, y1: y1 }); - break; - } - case 'poly': { - var sx = geometry.sx, sy = geometry.sy; - var x = xm.v_invert(sx); - var y = ym.v_invert(sy); - g = tslib_1.__assign({}, geometry, { x: x, y: y }); - break; - } - default: - throw new Error("Unrecognized selection geometry type: '" + geometry.type + "'"); - } - this.plot_model.trigger_event(new bokeh_events_1.SelectionGeometry(g, final)); - }; - return SelectToolView; - }(gesture_tool_1.GestureToolView)); - exports.SelectToolView = SelectToolView; - var SelectTool = /** @class */ (function (_super) { - tslib_1.__extends(SelectTool, _super); - function SelectTool(attrs) { - return _super.call(this, attrs) || this; - } - SelectTool.initClass = function () { - this.prototype.type = "SelectTool"; - this.define({ - renderers: [p.Any, 'auto'], - names: [p.Array, []], - }); - }; - return SelectTool; - }(gesture_tool_1.GestureTool)); - exports.SelectTool = SelectTool; - SelectTool.initClass(); -} -, -/* models/tools/gestures/tap_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var select_tool_1 = require(266) /* ./select_tool */; - var p = require(18) /* ../../../core/properties */; - var TapToolView = /** @class */ (function (_super) { - tslib_1.__extends(TapToolView, _super); - function TapToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - TapToolView.prototype._tap = function (ev) { - var sx = ev.sx, sy = ev.sy; - var geometry = { type: 'point', sx: sx, sy: sy }; - var append = ev.shiftKey; - this._select(geometry, true, append); - }; - TapToolView.prototype._select = function (geometry, final, append) { - var _this = this; - var callback = this.model.callback; - if (this.model.behavior == "select") { - var renderers_by_source = this._computed_renderers_by_data_source(); - for (var id in renderers_by_source) { - var renderers = renderers_by_source[id]; - var sm = renderers[0].get_selection_manager(); - var r_views = renderers.map(function (r) { return _this.plot_view.renderer_views[r.id]; }); - var did_hit = sm.select(r_views, geometry, final, append); - if (did_hit && callback != null) { - var frame = this.plot_view.frame; - var xscale = frame.xscales[renderers[0].x_range_name]; - var yscale = frame.yscales[renderers[0].y_range_name]; - var x = xscale.invert(geometry.sx); - var y = yscale.invert(geometry.sy); - var data = { geometries: tslib_1.__assign({}, geometry, { x: x, y: y }), source: sm.source }; - callback.execute(this.model, data); - } - } - this._emit_selection_event(geometry); - this.plot_view.push_state('tap', { selection: this.plot_view.get_selection() }); - } - else { - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - var sm = r.get_selection_manager(); - var did_hit = sm.inspect(this.plot_view.renderer_views[r.id], geometry); - if (did_hit && callback != null) { - var frame = this.plot_view.frame; - var xscale = frame.xscales[r.x_range_name]; - var yscale = frame.yscales[r.y_range_name]; - var x = xscale.invert(geometry.sx); - var y = yscale.invert(geometry.sy); - var data = { geometries: tslib_1.__assign({}, geometry, { x: x, y: y }), source: sm.source }; - callback.execute(this.model, data); - } - } - } - }; - return TapToolView; - }(select_tool_1.SelectToolView)); - exports.TapToolView = TapToolView; - var TapTool = /** @class */ (function (_super) { - tslib_1.__extends(TapTool, _super); - function TapTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Tap"; - _this.icon = "bk-tool-icon-tap-select"; - _this.event_type = "tap"; - _this.default_order = 10; - return _this; - } - TapTool.initClass = function () { - this.prototype.type = "TapTool"; - this.prototype.default_view = TapToolView; - this.define({ - behavior: [p.TapBehavior, "select"], - callback: [p.Any], - }); - }; - return TapTool; - }(select_tool_1.SelectTool)); - exports.TapTool = TapTool; - TapTool.initClass(); -} -, -/* models/tools/gestures/wheel_pan_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - var p = require(18) /* ../../../core/properties */; - var WheelPanToolView = /** @class */ (function (_super) { - tslib_1.__extends(WheelPanToolView, _super); - function WheelPanToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - WheelPanToolView.prototype._scroll = function (ev) { - var factor = this.model.speed * ev.delta; - // clamp the magnitude of factor, if it is > 1 bad things happen - if (factor > 0.9) - factor = 0.9; - else if (factor < -0.9) - factor = -0.9; - this._update_ranges(factor); - }; - WheelPanToolView.prototype._update_ranges = function (factor) { - var frame = this.plot_view.frame; - var hr = frame.bbox.h_range; - var vr = frame.bbox.v_range; - var _a = [hr.start, hr.end], sx_low = _a[0], sx_high = _a[1]; - var _b = [vr.start, vr.end], sy_low = _b[0], sy_high = _b[1]; - var sx0; - var sx1; - var sy0; - var sy1; - switch (this.model.dimension) { - case "height": { - var sy_range = Math.abs(sy_high - sy_low); - sx0 = sx_low; - sx1 = sx_high; - sy0 = sy_low - sy_range * factor; - sy1 = sy_high - sy_range * factor; - break; - } - case "width": { - var sx_range = Math.abs(sx_high - sx_low); - sx0 = sx_low - sx_range * factor; - sx1 = sx_high - sx_range * factor; - sy0 = sy_low; - sy1 = sy_high; - break; - } - default: - throw new Error("this shouldn't have happened"); - } - var xscales = frame.xscales, yscales = frame.yscales; - var xrs = {}; - for (var name_1 in xscales) { - var scale = xscales[name_1]; - var _c = scale.r_invert(sx0, sx1), start = _c[0], end = _c[1]; - xrs[name_1] = { start: start, end: end }; - } - var yrs = {}; - for (var name_2 in yscales) { - var scale = yscales[name_2]; - var _d = scale.r_invert(sy0, sy1), start = _d[0], end = _d[1]; - yrs[name_2] = { start: start, end: end }; - } - // OK this sucks we can't set factor independently in each direction. It is used - // for GMap plots, and GMap plots always preserve aspect, so effective the value - // of 'dimensions' is ignored. - var pan_info = { xrs: xrs, yrs: yrs, factor: factor }; - this.plot_view.push_state('wheel_pan', { range: pan_info }); - this.plot_view.update_range(pan_info, false, true); - if (this.model.document != null) - this.model.document.interactive_start(this.plot_model); - }; - return WheelPanToolView; - }(gesture_tool_1.GestureToolView)); - exports.WheelPanToolView = WheelPanToolView; - var WheelPanTool = /** @class */ (function (_super) { - tslib_1.__extends(WheelPanTool, _super); - function WheelPanTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Wheel Pan"; - _this.icon = "bk-tool-icon-wheel-pan"; - _this.event_type = "scroll"; - _this.default_order = 12; - return _this; - } - WheelPanTool.initClass = function () { - this.prototype.type = 'WheelPanTool'; - this.prototype.default_view = WheelPanToolView; - this.define({ - dimension: [p.Dimension, "width"], - }); - this.internal({ - speed: [p.Number, 1 / 1000], - }); - }; - Object.defineProperty(WheelPanTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimension); - }, - enumerable: true, - configurable: true - }); - return WheelPanTool; - }(gesture_tool_1.GestureTool)); - exports.WheelPanTool = WheelPanTool; - WheelPanTool.initClass(); -} -, -/* models/tools/gestures/wheel_zoom_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var gesture_tool_1 = require(261) /* ./gesture_tool */; - var zoom_1 = require(48) /* ../../../core/util/zoom */; - var p = require(18) /* ../../../core/properties */; - var compat_1 = require(31) /* ../../../core/util/compat */; - var WheelZoomToolView = /** @class */ (function (_super) { - tslib_1.__extends(WheelZoomToolView, _super); - function WheelZoomToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - WheelZoomToolView.prototype._pinch = function (ev) { - // TODO (bev) this can probably be done much better - var sx = ev.sx, sy = ev.sy, scale = ev.scale; - var delta; - if (scale >= 1) - delta = (scale - 1) * 20.0; - else - delta = -20.0 / scale; - this._scroll({ type: "wheel", sx: sx, sy: sy, delta: delta }); - }; - WheelZoomToolView.prototype._scroll = function (ev) { - var frame = this.plot_view.frame; - var hr = frame.bbox.h_range; - var vr = frame.bbox.v_range; - var sx = ev.sx, sy = ev.sy; - var dims = this.model.dimensions; - // restrict to axis configured in tool's dimensions property and if - // zoom origin is inside of frame range/domain - var h_axis = (dims == 'width' || dims == 'both') && hr.start < sx && sx < hr.end; - var v_axis = (dims == 'height' || dims == 'both') && vr.start < sy && sy < vr.end; - if ((!h_axis || !v_axis) && !this.model.zoom_on_axis) { - return; - } - var factor = this.model.speed * ev.delta; - var zoom_info = zoom_1.scale_range(frame, factor, h_axis, v_axis, { x: sx, y: sy }); - this.plot_view.push_state('wheel_zoom', { range: zoom_info }); - this.plot_view.update_range(zoom_info, false, true, this.model.maintain_focus); - if (this.model.document != null) - this.model.document.interactive_start(this.plot_model); - }; - return WheelZoomToolView; - }(gesture_tool_1.GestureToolView)); - exports.WheelZoomToolView = WheelZoomToolView; - var WheelZoomTool = /** @class */ (function (_super) { - tslib_1.__extends(WheelZoomTool, _super); - function WheelZoomTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Wheel Zoom"; - _this.icon = "bk-tool-icon-wheel-zoom"; - _this.event_type = compat_1.is_mobile ? "pinch" : "scroll"; - _this.default_order = 10; - return _this; - } - WheelZoomTool.initClass = function () { - this.prototype.type = "WheelZoomTool"; - this.prototype.default_view = WheelZoomToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - maintain_focus: [p.Boolean, true], - zoom_on_axis: [p.Boolean, true], - speed: [p.Number, 1 / 600], - }); - }; - Object.defineProperty(WheelZoomTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip(this.tool_name, this.dimensions); - }, - enumerable: true, - configurable: true - }); - return WheelZoomTool; - }(gesture_tool_1.GestureTool)); - exports.WheelZoomTool = WheelZoomTool; - WheelZoomTool.initClass(); -} -, -/* models/tools/index */ function _(require, module, exports) { - var action_tool_1 = require(242) /* ./actions/action_tool */; - exports.ActionTool = action_tool_1.ActionTool; - var custom_action_1 = require(243) /* ./actions/custom_action */; - exports.CustomAction = custom_action_1.CustomAction; - var help_tool_1 = require(244) /* ./actions/help_tool */; - exports.HelpTool = help_tool_1.HelpTool; - var redo_tool_1 = require(245) /* ./actions/redo_tool */; - exports.RedoTool = redo_tool_1.RedoTool; - var reset_tool_1 = require(246) /* ./actions/reset_tool */; - exports.ResetTool = reset_tool_1.ResetTool; - var save_tool_1 = require(247) /* ./actions/save_tool */; - exports.SaveTool = save_tool_1.SaveTool; - var undo_tool_1 = require(248) /* ./actions/undo_tool */; - exports.UndoTool = undo_tool_1.UndoTool; - var zoom_in_tool_1 = require(249) /* ./actions/zoom_in_tool */; - exports.ZoomInTool = zoom_in_tool_1.ZoomInTool; - var zoom_out_tool_1 = require(250) /* ./actions/zoom_out_tool */; - exports.ZoomOutTool = zoom_out_tool_1.ZoomOutTool; - var button_tool_1 = require(251) /* ./button_tool */; - exports.ButtonTool = button_tool_1.ButtonTool; - var edit_tool_1 = require(253) /* ./edit/edit_tool */; - exports.EditTool = edit_tool_1.EditTool; - var box_edit_tool_1 = require(252) /* ./edit/box_edit_tool */; - exports.BoxEditTool = box_edit_tool_1.BoxEditTool; - var freehand_draw_tool_1 = require(254) /* ./edit/freehand_draw_tool */; - exports.FreehandDrawTool = freehand_draw_tool_1.FreehandDrawTool; - var point_draw_tool_1 = require(255) /* ./edit/point_draw_tool */; - exports.PointDrawTool = point_draw_tool_1.PointDrawTool; - var poly_draw_tool_1 = require(256) /* ./edit/poly_draw_tool */; - exports.PolyDrawTool = poly_draw_tool_1.PolyDrawTool; - var poly_tool_1 = require(258) /* ./edit/poly_tool */; - exports.PolyTool = poly_tool_1.PolyTool; - var poly_edit_tool_1 = require(257) /* ./edit/poly_edit_tool */; - exports.PolyEditTool = poly_edit_tool_1.PolyEditTool; - var box_select_tool_1 = require(259) /* ./gestures/box_select_tool */; - exports.BoxSelectTool = box_select_tool_1.BoxSelectTool; - var box_zoom_tool_1 = require(260) /* ./gestures/box_zoom_tool */; - exports.BoxZoomTool = box_zoom_tool_1.BoxZoomTool; - var gesture_tool_1 = require(261) /* ./gestures/gesture_tool */; - exports.GestureTool = gesture_tool_1.GestureTool; - var lasso_select_tool_1 = require(262) /* ./gestures/lasso_select_tool */; - exports.LassoSelectTool = lasso_select_tool_1.LassoSelectTool; - var pan_tool_1 = require(263) /* ./gestures/pan_tool */; - exports.PanTool = pan_tool_1.PanTool; - var poly_select_tool_1 = require(264) /* ./gestures/poly_select_tool */; - exports.PolySelectTool = poly_select_tool_1.PolySelectTool; - var range_tool_1 = require(265) /* ./gestures/range_tool */; - exports.RangeTool = range_tool_1.RangeTool; - var select_tool_1 = require(266) /* ./gestures/select_tool */; - exports.SelectTool = select_tool_1.SelectTool; - var tap_tool_1 = require(267) /* ./gestures/tap_tool */; - exports.TapTool = tap_tool_1.TapTool; - var wheel_pan_tool_1 = require(268) /* ./gestures/wheel_pan_tool */; - exports.WheelPanTool = wheel_pan_tool_1.WheelPanTool; - var wheel_zoom_tool_1 = require(269) /* ./gestures/wheel_zoom_tool */; - exports.WheelZoomTool = wheel_zoom_tool_1.WheelZoomTool; - var crosshair_tool_1 = require(271) /* ./inspectors/crosshair_tool */; - exports.CrosshairTool = crosshair_tool_1.CrosshairTool; - var customjs_hover_1 = require(272) /* ./inspectors/customjs_hover */; - exports.CustomJSHover = customjs_hover_1.CustomJSHover; - var hover_tool_1 = require(273) /* ./inspectors/hover_tool */; - exports.HoverTool = hover_tool_1.HoverTool; - var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */; - exports.InspectTool = inspect_tool_1.InspectTool; - var tool_1 = require(276) /* ./tool */; - exports.Tool = tool_1.Tool; - var tool_proxy_1 = require(277) /* ./tool_proxy */; - exports.ToolProxy = tool_proxy_1.ToolProxy; - var toolbar_1 = require(278) /* ./toolbar */; - exports.Toolbar = toolbar_1.Toolbar; - var toolbar_base_1 = require(279) /* ./toolbar_base */; - exports.ToolbarBase = toolbar_base_1.ToolbarBase; - var toolbar_box_1 = require(280) /* ./toolbar_box */; - exports.ProxyToolbar = toolbar_box_1.ProxyToolbar; - var toolbar_box_2 = require(280) /* ./toolbar_box */; - exports.ToolbarBox = toolbar_box_2.ToolbarBox; -} -, -/* models/tools/inspectors/crosshair_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var inspect_tool_1 = require(274) /* ./inspect_tool */; - var span_1 = require(76) /* ../../annotations/span */; - var p = require(18) /* ../../../core/properties */; - var object_1 = require(35) /* ../../../core/util/object */; - var CrosshairToolView = /** @class */ (function (_super) { - tslib_1.__extends(CrosshairToolView, _super); - function CrosshairToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - CrosshairToolView.prototype._move = function (ev) { - if (!this.model.active) - return; - var sx = ev.sx, sy = ev.sy; - if (!this.plot_view.frame.bbox.contains(sx, sy)) - this._update_spans(null, null); - else - this._update_spans(sx, sy); - }; - CrosshairToolView.prototype._move_exit = function (_e) { - this._update_spans(null, null); - }; - CrosshairToolView.prototype._update_spans = function (x, y) { - var dims = this.model.dimensions; - if (dims == "width" || dims == "both") - this.model.spans.width.computed_location = y; - if (dims == "height" || dims == "both") - this.model.spans.height.computed_location = x; - }; - return CrosshairToolView; - }(inspect_tool_1.InspectToolView)); - exports.CrosshairToolView = CrosshairToolView; - var CrosshairTool = /** @class */ (function (_super) { - tslib_1.__extends(CrosshairTool, _super); - function CrosshairTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Crosshair"; - _this.icon = "bk-tool-icon-crosshair"; - return _this; - } - CrosshairTool.initClass = function () { - this.prototype.type = "CrosshairTool"; - this.prototype.default_view = CrosshairToolView; - this.define({ - dimensions: [p.Dimensions, "both"], - line_color: [p.Color, 'black'], - line_width: [p.Number, 1], - line_alpha: [p.Number, 1.0], - }); - this.internal({ - location_units: [p.SpatialUnits, "screen"], - render_mode: [p.RenderMode, "css"], - spans: [p.Any], - }); - }; - Object.defineProperty(CrosshairTool.prototype, "tooltip", { - get: function () { - return this._get_dim_tooltip("Crosshair", this.dimensions); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CrosshairTool.prototype, "synthetic_renderers", { - get: function () { - return object_1.values(this.spans); - }, - enumerable: true, - configurable: true - }); - CrosshairTool.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.spans = { - width: new span_1.Span({ - for_hover: true, - dimension: "width", - render_mode: this.render_mode, - location_units: this.location_units, - line_color: this.line_color, - line_width: this.line_width, - line_alpha: this.line_alpha, - }), - height: new span_1.Span({ - for_hover: true, - dimension: "height", - render_mode: this.render_mode, - location_units: this.location_units, - line_color: this.line_color, - line_width: this.line_width, - line_alpha: this.line_alpha, - }), - }; - }; - return CrosshairTool; - }(inspect_tool_1.InspectTool)); - exports.CrosshairTool = CrosshairTool; - CrosshairTool.initClass(); -} -, -/* models/tools/inspectors/customjs_hover */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../../model */; - var p = require(18) /* ../../../core/properties */; - var object_1 = require(35) /* ../../../core/util/object */; - var string_1 = require(40) /* ../../../core/util/string */; - var CustomJSHover = /** @class */ (function (_super) { - tslib_1.__extends(CustomJSHover, _super); - function CustomJSHover(attrs) { - return _super.call(this, attrs) || this; - } - CustomJSHover.initClass = function () { - this.prototype.type = 'CustomJSHover'; - this.define({ - args: [p.Any, {}], - code: [p.String, ""], - }); - }; - Object.defineProperty(CustomJSHover.prototype, "values", { - get: function () { - return object_1.values(this.args); - }, - enumerable: true, - configurable: true - }); - /*protected*/ CustomJSHover.prototype._make_code = function (valname, formatname, varsname, fn) { - // this relies on keys(args) and values(args) returning keys and values - // in the same order - return new (Function.bind.apply(Function, [void 0].concat(object_1.keys(this.args), [valname, formatname, varsname, "require", "exports", string_1.use_strict(fn)])))(); - }; - CustomJSHover.prototype.format = function (value, format, special_vars) { - var formatter = this._make_code("value", "format", "special_vars", this.code); - return formatter.apply(void 0, this.values.concat([value, format, special_vars, require, exports])); - }; - return CustomJSHover; - }(model_1.Model)); - exports.CustomJSHover = CustomJSHover; - CustomJSHover.initClass(); -} -, -/* models/tools/inspectors/hover_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var inspect_tool_1 = require(274) /* ./inspect_tool */; - var tooltip_1 = require(80) /* ../../annotations/tooltip */; - var glyph_renderer_1 = require(193) /* ../../renderers/glyph_renderer */; - var graph_renderer_1 = require(194) /* ../../renderers/graph_renderer */; - var util_1 = require(281) /* ../util */; - var hittest = require(9) /* ../../../core/hittest */; - var templating_1 = require(42) /* ../../../core/util/templating */; - var dom_1 = require(5) /* ../../../core/dom */; - var p = require(18) /* ../../../core/properties */; - var color_1 = require(30) /* ../../../core/util/color */; - var object_1 = require(35) /* ../../../core/util/object */; - var types_1 = require(46) /* ../../../core/util/types */; - var build_views_1 = require(4) /* ../../../core/build_views */; - function _nearest_line_hit(i, geometry, sx, sy, dx, dy) { - var d1 = { x: dx[i], y: dy[i] }; - var d2 = { x: dx[i + 1], y: dy[i + 1] }; - var dist1; - var dist2; - if (geometry.type == "span") { - if (geometry.direction == "h") { - dist1 = Math.abs(d1.x - sx); - dist2 = Math.abs(d2.x - sx); - } - else { - dist1 = Math.abs(d1.y - sy); - dist2 = Math.abs(d2.y - sy); - } - } - else { - var s = { x: sx, y: sy }; - dist1 = hittest.dist_2_pts(d1, s); - dist2 = hittest.dist_2_pts(d2, s); - } - if (dist1 < dist2) - return [[d1.x, d1.y], i]; - else - return [[d2.x, d2.y], i + 1]; - } - exports._nearest_line_hit = _nearest_line_hit; - function _line_hit(xs, ys, ind) { - return [[xs[ind], ys[ind]], ind]; - } - exports._line_hit = _line_hit; - var HoverToolView = /** @class */ (function (_super) { - tslib_1.__extends(HoverToolView, _super); - function HoverToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - HoverToolView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.ttviews = {}; - }; - HoverToolView.prototype.remove = function () { - build_views_1.remove_views(this.ttviews); - _super.prototype.remove.call(this); - }; - HoverToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - if (r instanceof glyph_renderer_1.GlyphRenderer) - this.connect(r.data_source.inspect, this._update); - else if (r instanceof graph_renderer_1.GraphRenderer) { - this.connect(r.node_renderer.data_source.inspect, this._update); - this.connect(r.edge_renderer.data_source.inspect, this._update); - } - } - // TODO: this.connect(this.plot_model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null) - this.connect(this.model.properties.renderers.change, function () { return _this._computed_renderers = _this._ttmodels = null; }); - this.connect(this.model.properties.names.change, function () { return _this._computed_renderers = _this._ttmodels = null; }); - this.connect(this.model.properties.tooltips.change, function () { return _this._ttmodels = null; }); - }; - HoverToolView.prototype._compute_ttmodels = function () { - var ttmodels = {}; - var tooltips = this.model.tooltips; - if (tooltips != null) { - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - if (r instanceof glyph_renderer_1.GlyphRenderer) { - var tooltip = new tooltip_1.Tooltip({ - custom: types_1.isString(tooltips) || types_1.isFunction(tooltips), - attachment: this.model.attachment, - show_arrow: this.model.show_arrow, - }); - ttmodels[r.id] = tooltip; - } - else if (r instanceof graph_renderer_1.GraphRenderer) { - var tooltip = new tooltip_1.Tooltip({ - custom: types_1.isString(tooltips) || types_1.isFunction(tooltips), - attachment: this.model.attachment, - show_arrow: this.model.show_arrow, - }); - ttmodels[r.node_renderer.id] = tooltip; - ttmodels[r.edge_renderer.id] = tooltip; - } - } - } - build_views_1.build_views(this.ttviews, object_1.values(ttmodels), { parent: this.plot_view }); - return ttmodels; - }; - Object.defineProperty(HoverToolView.prototype, "computed_renderers", { - get: function () { - if (this._computed_renderers == null) { - var renderers = this.model.renderers; - var all_renderers = this.plot_model.renderers; - var names = this.model.names; - this._computed_renderers = util_1.compute_renderers(renderers, all_renderers, names); - } - return this._computed_renderers; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(HoverToolView.prototype, "ttmodels", { - get: function () { - if (this._ttmodels == null) - this._ttmodels = this._compute_ttmodels(); - return this._ttmodels; - }, - enumerable: true, - configurable: true - }); - HoverToolView.prototype._clear = function () { - this._inspect(Infinity, Infinity); - for (var rid in this.ttmodels) { - var tt = this.ttmodels[rid]; - tt.clear(); - } - }; - HoverToolView.prototype._move = function (ev) { - if (!this.model.active) - return; - var sx = ev.sx, sy = ev.sy; - if (!this.plot_view.frame.bbox.contains(sx, sy)) - this._clear(); - else - this._inspect(sx, sy); - }; - HoverToolView.prototype._move_exit = function () { - this._clear(); - }; - HoverToolView.prototype._inspect = function (sx, sy) { - var geometry; - if (this.model.mode == 'mouse') - geometry = { type: 'point', sx: sx, sy: sy }; - else { - var direction = this.model.mode == 'vline' ? 'h' : 'v'; - geometry = { type: 'span', direction: direction, sx: sx, sy: sy }; - } - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - var sm = r.get_selection_manager(); - sm.inspect(this.plot_view.renderer_views[r.id], geometry); - } - if (this.model.callback != null) - this._emit_callback(geometry); - }; - HoverToolView.prototype._update = function (_a) { - var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; - var renderer_view = _a[0], geometry = _a[1].geometry; - if (!this.model.active) - return; - if (!(renderer_view instanceof glyph_renderer_1.GlyphRendererView || renderer_view instanceof graph_renderer_1.GraphRendererView)) - return; - var renderer = renderer_view.model; - var tooltip = this.ttmodels[renderer.id]; - if (tooltip == null) - return; - tooltip.clear(); - var selection_manager = renderer.get_selection_manager(); - var indices = selection_manager.inspectors[renderer.id]; - if (renderer instanceof glyph_renderer_1.GlyphRenderer) - indices = renderer.view.convert_selection_to_subset(indices); - if (indices.is_empty()) - return; - var ds = selection_manager.source; - var frame = this.plot_view.frame; - var sx = geometry.sx, sy = geometry.sy; - var xscale = frame.xscales[renderer.x_range_name]; - var yscale = frame.yscales[renderer.y_range_name]; - var x = xscale.invert(sx); - var y = yscale.invert(sy); - var glyph = renderer_view.glyph; // XXX - for (var _i = 0, _t = indices.line_indices; _i < _t.length; _i++) { - var i = _t[_i]; - var data_x = glyph._x[i + 1]; - var data_y = glyph._y[i + 1]; - var ii = i; - var rx = void 0; - var ry = void 0; - switch (this.model.line_policy) { - case "interp": { // and renderer.get_interpolation_hit? - _b = glyph.get_interpolation_hit(i, geometry), data_x = _b[0], data_y = _b[1]; - rx = xscale.compute(data_x); - ry = yscale.compute(data_y); - break; - } - case "prev": { - _c = _line_hit(glyph.sx, glyph.sy, i), _d = _c[0], rx = _d[0], ry = _d[1], ii = _c[1]; - break; - } - case "next": { - _e = _line_hit(glyph.sx, glyph.sy, i + 1), _f = _e[0], rx = _f[0], ry = _f[1], ii = _e[1]; - break; - } - case "nearest": { - _g = _nearest_line_hit(i, geometry, sx, sy, glyph.sx, glyph.sy), _h = _g[0], rx = _h[0], ry = _h[1], ii = _g[1]; - data_x = glyph._x[ii]; - data_y = glyph._y[ii]; - break; - } - default: { - _j = [sx, sy], rx = _j[0], ry = _j[1]; - } - } - var vars = { - index: ii, - x: x, y: y, sx: sx, sy: sy, data_x: data_x, data_y: data_y, rx: rx, ry: ry, - indices: indices.line_indices, - name: renderer_view.model.name, - }; - tooltip.add(rx, ry, this._render_tooltips(ds, ii, vars)); - } - for (var _u = 0, _v = indices.image_indices; _u < _v.length; _u++) { - var struct = _v[_u]; - var vars = { index: struct.index, x: x, y: y, sx: sx, sy: sy }; - var rendered = this._render_tooltips(ds, struct, vars); - tooltip.add(sx, sy, rendered); - } - for (var _w = 0, _z = indices.indices; _w < _z.length; _w++) { - var i = _z[_w]; - // multiglyphs set additional indices, e.g. multiline_indices for different tooltips - if (!object_1.isEmpty(indices.multiline_indices)) { - for (var _0 = 0, _1 = indices.multiline_indices[i.toString()]; _0 < _1.length; _0++) { - var j = _1[_0]; - var data_x = glyph._xs[i][j]; - var data_y = glyph._ys[i][j]; - var jj = j; - var rx = void 0; - var ry = void 0; - switch (this.model.line_policy) { - case "interp": { // and renderer.get_interpolation_hit? - _k = glyph.get_interpolation_hit(i, j, geometry), data_x = _k[0], data_y = _k[1]; - rx = xscale.compute(data_x); - ry = yscale.compute(data_y); - break; - } - case "prev": { - _l = _line_hit(glyph.sxs[i], glyph.sys[i], j), _m = _l[0], rx = _m[0], ry = _m[1], jj = _l[1]; - break; - } - case "next": { - _o = _line_hit(glyph.sxs[i], glyph.sys[i], j + 1), _p = _o[0], rx = _p[0], ry = _p[1], jj = _o[1]; - break; - } - case "nearest": { - _q = _nearest_line_hit(j, geometry, sx, sy, glyph.sxs[i], glyph.sys[i]), _r = _q[0], rx = _r[0], ry = _r[1], jj = _q[1]; - data_x = glyph._xs[i][jj]; - data_y = glyph._ys[i][jj]; - break; - } - default: - throw new Error("should't have happened"); - } - var index = void 0; - if (renderer instanceof glyph_renderer_1.GlyphRenderer) - index = renderer.view.convert_indices_from_subset([i])[0]; - else - index = i; - var vars = { - index: index, x: x, y: y, sx: sx, sy: sy, data_x: data_x, data_y: data_y, - segment_index: jj, - indices: indices.multiline_indices, - name: renderer_view.model.name, - }; - tooltip.add(rx, ry, this._render_tooltips(ds, index, vars)); - } - } - else { - // handle non-multiglyphs - var data_x = glyph._x != null ? glyph._x[i] : undefined; - var data_y = glyph._y != null ? glyph._y[i] : undefined; - var rx = void 0; - var ry = void 0; - if (this.model.point_policy == 'snap_to_data') { // and renderer.glyph.sx? and renderer.glyph.sy? - // Pass in our screen position so we can determine which patch we're - // over if there are discontinuous patches. - var pt = glyph.get_anchor_point(this.model.anchor, i, [sx, sy]); - if (pt == null) - pt = glyph.get_anchor_point("center", i, [sx, sy]); - rx = pt.x; - ry = pt.y; - } - else - _s = [sx, sy], rx = _s[0], ry = _s[1]; - var index = void 0; - if (renderer instanceof glyph_renderer_1.GlyphRenderer) - index = renderer.view.convert_indices_from_subset([i])[0]; - else - index = i; - var vars = { - index: index, x: x, y: y, sx: sx, sy: sy, data_x: data_x, data_y: data_y, - indices: indices.indices, - name: renderer_view.model.name, - }; - tooltip.add(rx, ry, this._render_tooltips(ds, index, vars)); - } - } - }; - HoverToolView.prototype._emit_callback = function (geometry) { - for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) { - var r = _a[_i]; - var index = r.data_source.inspected; - var frame = this.plot_view.frame; - var xscale = frame.xscales[r.x_range_name]; - var yscale = frame.yscales[r.y_range_name]; - var x = xscale.invert(geometry.sx); - var y = yscale.invert(geometry.sy); - var g = tslib_1.__assign({ x: x, y: y }, geometry); - this.model.callback.execute(this.model, { index: index, geometry: g, renderer: r }); - } - }; - HoverToolView.prototype._render_tooltips = function (ds, i, vars) { - var tooltips = this.model.tooltips; - if (types_1.isString(tooltips)) { - var el = dom_1.div(); - el.innerHTML = templating_1.replace_placeholders(tooltips, ds, i, this.model.formatters, vars); - return el; - } - else if (types_1.isFunction(tooltips)) { - return tooltips(ds, vars); - } - else { - var rows = dom_1.div({ style: { display: "table", borderSpacing: "2px" } }); - for (var _i = 0, tooltips_1 = tooltips; _i < tooltips_1.length; _i++) { - var _a = tooltips_1[_i], label = _a[0], value = _a[1]; - var row = dom_1.div({ style: { display: "table-row" } }); - rows.appendChild(row); - var cell = void 0; - cell = dom_1.div({ style: { display: "table-cell" }, class: 'bk-tooltip-row-label' }, label.length != 0 ? label + ": " : ""); - row.appendChild(cell); - cell = dom_1.div({ style: { display: "table-cell" }, class: 'bk-tooltip-row-value' }); - row.appendChild(cell); - if (value.indexOf("$color") >= 0) { - var _b = value.match(/\$color(\[.*\])?:(\w*)/), _c = _b[1], opts = _c === void 0 ? "" : _c, colname = _b[2]; // XXX! - var column = ds.get_column(colname); // XXX: change to columnar ds - if (column == null) { - var el_1 = dom_1.span({}, colname + " unknown"); - cell.appendChild(el_1); - continue; - } - var hex = opts.indexOf("hex") >= 0; - var swatch = opts.indexOf("swatch") >= 0; - var color = types_1.isNumber(i) ? column[i] : null; - if (color == null) { - var el_2 = dom_1.span({}, "(null)"); - cell.appendChild(el_2); - continue; - } - if (hex) - color = color_1.color2hex(color); - var el = dom_1.span({}, color); - cell.appendChild(el); - if (swatch) { - el = dom_1.span({ class: 'bk-tooltip-color-block', style: { backgroundColor: color } }, " "); - cell.appendChild(el); - } - } - else { - var el = dom_1.span(); - el.innerHTML = templating_1.replace_placeholders(value.replace("$~", "$data_"), ds, i, this.model.formatters, vars); - cell.appendChild(el); - } - } - return rows; - } - }; - return HoverToolView; - }(inspect_tool_1.InspectToolView)); - exports.HoverToolView = HoverToolView; - var HoverTool = /** @class */ (function (_super) { - tslib_1.__extends(HoverTool, _super); - function HoverTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.tool_name = "Hover"; - _this.icon = "bk-tool-icon-hover"; - return _this; - } - HoverTool.initClass = function () { - this.prototype.type = "HoverTool"; - this.prototype.default_view = HoverToolView; - this.define({ - tooltips: [p.Any, [ - ["index", "$index"], - ["data (x, y)", "($x, $y)"], - ["screen (x, y)", "($sx, $sy)"], - ]], - formatters: [p.Any, {}], - renderers: [p.Any, 'auto'], - names: [p.Array, []], - mode: [p.HoverMode, 'mouse'], - point_policy: [p.PointPolicy, 'snap_to_data'], - line_policy: [p.LinePolicy, 'nearest'], - show_arrow: [p.Boolean, true], - anchor: [p.Anchor, 'center'], - attachment: [p.TooltipAttachment, 'horizontal'], - callback: [p.Any], - }); - }; - return HoverTool; - }(inspect_tool_1.InspectTool)); - exports.HoverTool = HoverTool; - HoverTool.initClass(); -} -, -/* models/tools/inspectors/inspect_tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var button_tool_1 = require(251) /* ../button_tool */; - var on_off_button_1 = require(275) /* ../on_off_button */; - var p = require(18) /* ../../../core/properties */; - var InspectToolView = /** @class */ (function (_super) { - tslib_1.__extends(InspectToolView, _super); - function InspectToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - return InspectToolView; - }(button_tool_1.ButtonToolView)); - exports.InspectToolView = InspectToolView; - var InspectTool = /** @class */ (function (_super) { - tslib_1.__extends(InspectTool, _super); - function InspectTool(attrs) { - var _this = _super.call(this, attrs) || this; - _this.event_type = "move"; - return _this; - } - InspectTool.initClass = function () { - this.prototype.type = "InspectTool"; - this.prototype.button_view = on_off_button_1.OnOffButtonView; - this.define({ - toggleable: [p.Boolean, true], - }); - this.override({ - active: true, - }); - }; - return InspectTool; - }(button_tool_1.ButtonTool)); - exports.InspectTool = InspectTool; - InspectTool.initClass(); -} -, -/* models/tools/on_off_button */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var button_tool_1 = require(251) /* ./button_tool */; - var OnOffButtonView = /** @class */ (function (_super) { - tslib_1.__extends(OnOffButtonView, _super); - function OnOffButtonView() { - return _super !== null && _super.apply(this, arguments) || this; - } - OnOffButtonView.prototype.render = function () { - _super.prototype.render.call(this); - if (this.model.active) - this.el.classList.add('bk-active'); - else - this.el.classList.remove('bk-active'); - }; - OnOffButtonView.prototype._clicked = function () { - var active = this.model.active; - this.model.active = !active; - }; - return OnOffButtonView; - }(button_tool_1.ButtonToolButtonView)); - exports.OnOffButtonView = OnOffButtonView; -} -, -/* models/tools/tool */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../core/properties */; - var view_1 = require(50) /* ../../core/view */; - var array_1 = require(24) /* ../../core/util/array */; - var model_1 = require(62) /* ../../model */; - var ToolView = /** @class */ (function (_super) { - tslib_1.__extends(ToolView, _super); - function ToolView() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(ToolView.prototype, "plot_view", { - get: function () { - return this.parent; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolView.prototype, "plot_model", { - get: function () { - return this.parent.model; - }, - enumerable: true, - configurable: true - }); - ToolView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.active.change, function () { - if (_this.model.active) - _this.activate(); - else - _this.deactivate(); - }); - }; - // activate is triggered by toolbar ui actions - ToolView.prototype.activate = function () { }; - // deactivate is triggered by toolbar ui actions - ToolView.prototype.deactivate = function () { }; - return ToolView; - }(view_1.View)); - exports.ToolView = ToolView; - var Tool = /** @class */ (function (_super) { - tslib_1.__extends(Tool, _super); - function Tool(attrs) { - return _super.call(this, attrs) || this; - } - Tool.initClass = function () { - this.prototype.type = "Tool"; - this.internal({ - active: [p.Boolean, false], - }); - }; - Object.defineProperty(Tool.prototype, "synthetic_renderers", { - get: function () { - return []; - }, - enumerable: true, - configurable: true - }); - // utility function to return a tool name, modified - // by the active dimenions. Used by tools that have dimensions - Tool.prototype._get_dim_tooltip = function (name, dims) { - switch (dims) { - case "width": return name + " (x-axis)"; - case "height": return name + " (y-axis)"; - case "both": return name; - } - }; - // utility function to get limits along both dimensions, given - // optional dimensional constraints - Tool.prototype._get_dim_limits = function (_a, _b, frame, dims) { - var sx0 = _a[0], sy0 = _a[1]; - var sx1 = _b[0], sy1 = _b[1]; - var hr = frame.bbox.h_range; - var sxlim; - if (dims == 'width' || dims == 'both') { - sxlim = [array_1.min([sx0, sx1]), array_1.max([sx0, sx1])]; - sxlim = [array_1.max([sxlim[0], hr.start]), array_1.min([sxlim[1], hr.end])]; - } - else - sxlim = [hr.start, hr.end]; - var vr = frame.bbox.v_range; - var sylim; - if (dims == 'height' || dims == 'both') { - sylim = [array_1.min([sy0, sy1]), array_1.max([sy0, sy1])]; - sylim = [array_1.max([sylim[0], vr.start]), array_1.min([sylim[1], vr.end])]; - } - else - sylim = [vr.start, vr.end]; - return [sxlim, sylim]; - }; - return Tool; - }(model_1.Model)); - exports.Tool = Tool; - Tool.initClass(); -} -, -/* models/tools/tool_proxy */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../core/properties */; - var signaling_1 = require(22) /* ../../core/signaling */; - var model_1 = require(62) /* ../../model */; - var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */; - var ToolProxy = /** @class */ (function (_super) { - tslib_1.__extends(ToolProxy, _super); - function ToolProxy(attrs) { - return _super.call(this, attrs) || this; - } - ToolProxy.initClass = function () { - this.prototype.type = "ToolProxy"; - this.define({ - tools: [p.Array, []], - active: [p.Boolean, false], - disabled: [p.Boolean, false], - }); - }; - Object.defineProperty(ToolProxy.prototype, "button_view", { - // Operates all the tools given only one button - get: function () { - return this.tools[0].button_view; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "event_type", { - get: function () { - return this.tools[0].event_type; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "tooltip", { - get: function () { - return this.tools[0].tooltip; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "tool_name", { - get: function () { - return this.tools[0].tool_name; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "icon", { - get: function () { - return this.tools[0].computed_icon; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "computed_icon", { - get: function () { - return this.icon; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolProxy.prototype, "toggleable", { - get: function () { - var tool = this.tools[0]; - return tool instanceof inspect_tool_1.InspectTool && tool.toggleable; - }, - enumerable: true, - configurable: true - }); - ToolProxy.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this.do = new signaling_1.Signal0(this, "do"); - }; - ToolProxy.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.do, function () { return _this.doit(); }); - this.connect(this.properties.active.change, function () { return _this.set_active(); }); - }; - ToolProxy.prototype.doit = function () { - for (var _i = 0, _a = this.tools; _i < _a.length; _i++) { - var tool = _a[_i]; - tool.do.emit(); - } - }; - ToolProxy.prototype.set_active = function () { - for (var _i = 0, _a = this.tools; _i < _a.length; _i++) { - var tool = _a[_i]; - tool.active = this.active; - } - }; - return ToolProxy; - }(model_1.Model)); - exports.ToolProxy = ToolProxy; - ToolProxy.initClass(); -} -, -/* models/tools/toolbar */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var action_tool_1 = require(242) /* ./actions/action_tool */; - var help_tool_1 = require(244) /* ./actions/help_tool */; - var gesture_tool_1 = require(261) /* ./gestures/gesture_tool */; - var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */; - var toolbar_base_1 = require(279) /* ./toolbar_base */; - var Toolbar = /** @class */ (function (_super) { - tslib_1.__extends(Toolbar, _super); - function Toolbar(attrs) { - return _super.call(this, attrs) || this; - } - Toolbar.initClass = function () { - this.prototype.type = 'Toolbar'; - this.prototype.default_view = toolbar_base_1.ToolbarBaseView; - this.define({ - active_drag: [p.Any, 'auto'], - active_inspect: [p.Any, 'auto'], - active_scroll: [p.Any, 'auto'], - active_tap: [p.Any, 'auto'], - active_multi: [p.Any, null], - }); - }; - Toolbar.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._init_tools(); - }; - Toolbar.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.properties.tools.change, function () { return _this._init_tools(); }); - }; - Toolbar.prototype._init_tools = function () { - var _this = this; - var _loop_1 = function (tool) { - if (tool instanceof inspect_tool_1.InspectTool) { - if (!array_1.some(this_1.inspectors, function (t) { return t.id == tool.id; })) { - this_1.inspectors = this_1.inspectors.concat([tool]); - } - } - else if (tool instanceof help_tool_1.HelpTool) { - if (!array_1.some(this_1.help, function (t) { return t.id == tool.id; })) { - this_1.help = this_1.help.concat([tool]); - } - } - else if (tool instanceof action_tool_1.ActionTool) { - if (!array_1.some(this_1.actions, function (t) { return t.id == tool.id; })) { - this_1.actions = this_1.actions.concat([tool]); - } - } - else if (tool instanceof gesture_tool_1.GestureTool) { - var event_types = void 0; - var multi = void 0; - if (types_1.isString(tool.event_type)) { - event_types = [tool.event_type]; - multi = false; - } - else { - event_types = tool.event_type || []; - multi = true; - } - for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) { - var et = event_types_1[_i]; - if (!(et in this_1.gestures)) { - logging_1.logger.warn("Toolbar: unknown event type '" + et + "' for tool: " + tool.type + " (" + tool.id + ")"); - continue; - } - if (multi) - et = "multi"; - if (!array_1.some(this_1.gestures[et].tools, function (t) { return t.id == tool.id; })) - this_1.gestures[et].tools = this_1.gestures[et].tools.concat([tool]); - this_1.connect(tool.properties.active.change, this_1._active_change.bind(this_1, tool)); - } - } - }; - var this_1 = this; - for (var _i = 0, _a = this.tools; _i < _a.length; _i++) { - var tool = _a[_i]; - _loop_1(tool); - } - if (this.active_inspect == 'auto') { - // do nothing as all tools are active be default - } - else if (this.active_inspect instanceof inspect_tool_1.InspectTool) { - for (var _b = 0, _c = this.inspectors; _b < _c.length; _b++) { - var inspector = _c[_b]; - if (inspector != this.active_inspect) - inspector.active = false; - } - } - else if (types_1.isArray(this.active_inspect)) { - for (var _d = 0, _e = this.inspectors; _d < _e.length; _d++) { - var inspector = _e[_d]; - if (!array_1.includes(this.active_inspect, inspector)) - inspector.active = false; - } - } - else if (this.active_inspect == null) { - for (var _f = 0, _g = this.inspectors; _f < _g.length; _f++) { - var inspector = _g[_f]; - inspector.active = false; - } - } - var _activate_gesture = function (tool) { - if (tool.active) { - // tool was activated by a proxy, but we need to finish configuration manually - _this._active_change(tool); - } - else - tool.active = true; - }; - for (var et in this.gestures) { - var gesture = this.gestures[et]; - if (gesture.tools.length == 0) - continue; - gesture.tools = array_1.sort_by(gesture.tools, function (tool) { return tool.default_order; }); - if (et == 'tap') { - if (this.active_tap == null) - continue; - if (this.active_tap == 'auto') - _activate_gesture(gesture.tools[0]); - else - _activate_gesture(this.active_tap); - } - if (et == 'pan') { - if (this.active_drag == null) - continue; - if (this.active_drag == 'auto') - _activate_gesture(gesture.tools[0]); - else - _activate_gesture(this.active_drag); - } - if (et == 'pinch' || et == 'scroll') { - if (this.active_scroll == null || this.active_scroll == 'auto') - continue; - _activate_gesture(this.active_scroll); - } - if (this.active_multi != null) - _activate_gesture(this.active_multi); - } - }; - return Toolbar; - }(toolbar_base_1.ToolbarBase)); - exports.Toolbar = Toolbar; - Toolbar.initClass(); -} -, -/* models/tools/toolbar_base */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var logging_1 = require(17) /* ../../core/logging */; - var dom_1 = require(5) /* ../../core/dom */; - var build_views_1 = require(4) /* ../../core/build_views */; - var p = require(18) /* ../../core/properties */; - var dom_view_1 = require(6) /* ../../core/dom_view */; - var types_1 = require(46) /* ../../core/util/types */; - var model_1 = require(62) /* ../../model */; - var ToolbarViewModel = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarViewModel, _super); - function ToolbarViewModel(attrs) { - return _super.call(this, attrs) || this; - } - ToolbarViewModel.initClass = function () { - this.prototype.type = 'ToolbarBase'; - this.define({ - _visible: [p.Any, null], - autohide: [p.Boolean, false], - }); - }; - Object.defineProperty(ToolbarViewModel.prototype, "visible", { - get: function () { - return (!this.autohide) ? true : (this._visible == null) ? false : this._visible; - }, - enumerable: true, - configurable: true - }); - return ToolbarViewModel; - }(model_1.Model)); - exports.ToolbarViewModel = ToolbarViewModel; - ToolbarViewModel.initClass(); - var ToolbarBaseView = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarBaseView, _super); - function ToolbarBaseView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ToolbarBaseView.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._tool_button_views = {}; - this._build_tool_button_views(); - this._toolbar_view_model = new ToolbarViewModel({ autohide: this.model.autohide }); - }; - ToolbarBaseView.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.model.properties.tools.change, function () { return _this._build_tool_button_views(); }); - this.connect(this.model.properties.autohide.change, function () { - _this._toolbar_view_model.autohide = _this.model.autohide; - _this._on_visible_change(); - }); - this.connect(this._toolbar_view_model.properties._visible.change, function () { return _this._on_visible_change(); }); - }; - ToolbarBaseView.prototype.remove = function () { - build_views_1.remove_views(this._tool_button_views); - _super.prototype.remove.call(this); - }; - ToolbarBaseView.prototype._build_tool_button_views = function () { - var tools = (this.model._proxied_tools != null ? this.model._proxied_tools : this.model.tools); // XXX - build_views_1.build_views(this._tool_button_views, tools, { parent: this }, function (tool) { return tool.button_view; }); - }; - ToolbarBaseView.prototype.set_visibility = function (visible) { - if (visible != this._toolbar_view_model._visible) { - this._toolbar_view_model._visible = visible; - } - }; - ToolbarBaseView.prototype._on_visible_change = function () { - var visible = this._toolbar_view_model.visible; - var hidden_class = "bk-toolbar-hidden"; - if (this.el.classList.contains(hidden_class) && visible) { - this.el.classList.remove(hidden_class); - } - else if (!visible) { - this.el.classList.add(hidden_class); - } - }; - ToolbarBaseView.prototype.render = function () { - var _this = this; - dom_1.empty(this.el); - this.el.classList.add("bk-toolbar"); - this.el.classList.add("bk-toolbar-" + this.model.toolbar_location); - this._toolbar_view_model.autohide = this.model.autohide; - this._on_visible_change(); - if (this.model.logo != null) { - var cls = this.model.logo === "grey" ? "bk-grey" : null; - var logo = dom_1.a({ href: "https://bokeh.pydata.org/", target: "_blank", class: ["bk-logo", "bk-logo-small", cls] }); - this.el.appendChild(logo); - } - var bars = []; - var el = function (tool) { - return _this._tool_button_views[tool.id].el; - }; - var gestures = this.model.gestures; - for (var et in gestures) { - bars.push(gestures[et].tools.map(el)); - } - bars.push(this.model.actions.map(el)); - bars.push(this.model.inspectors.filter(function (tool) { return tool.toggleable; }).map(el)); - bars.push(this.model.help.map(el)); - for (var _i = 0, bars_1 = bars; _i < bars_1.length; _i++) { - var bar = bars_1[_i]; - if (bar.length !== 0) { - var el_1 = dom_1.div({ class: 'bk-button-bar' }, bar); - this.el.appendChild(el_1); - } - } - }; - ToolbarBaseView.prototype.update_layout = function () { }; - ToolbarBaseView.prototype.update_position = function () { }; - ToolbarBaseView.prototype.after_layout = function () { - this._has_finished = true; - }; - return ToolbarBaseView; - }(dom_view_1.DOMView)); - exports.ToolbarBaseView = ToolbarBaseView; - var ToolbarBase = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarBase, _super); - function ToolbarBase(attrs) { - return _super.call(this, attrs) || this; - } - ToolbarBase.initClass = function () { - this.prototype.type = 'ToolbarBase'; - this.prototype.default_view = ToolbarBaseView; - this.define({ - tools: [p.Array, []], - logo: [p.Logo, 'normal'], - autohide: [p.Boolean, false], - }); - this.internal({ - gestures: [p.Any, function () { - return ({ - pan: { tools: [], active: null }, - scroll: { tools: [], active: null }, - pinch: { tools: [], active: null }, - tap: { tools: [], active: null }, - doubletap: { tools: [], active: null }, - press: { tools: [], active: null }, - rotate: { tools: [], active: null }, - move: { tools: [], active: null }, - multi: { tools: [], active: null }, - }); - }], - actions: [p.Array, []], - inspectors: [p.Array, []], - help: [p.Array, []], - toolbar_location: [p.Location, 'right'], - }); - }; - Object.defineProperty(ToolbarBase.prototype, "horizontal", { - get: function () { - return this.toolbar_location === "above" || this.toolbar_location === "below"; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ToolbarBase.prototype, "vertical", { - get: function () { - return this.toolbar_location === "left" || this.toolbar_location === "right"; - }, - enumerable: true, - configurable: true - }); - ToolbarBase.prototype._active_change = function (tool) { - var event_type = tool.event_type; - if (event_type == null) - return; - var event_types = types_1.isString(event_type) ? [event_type] : event_type; - for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) { - var et = event_types_1[_i]; - if (tool.active) { - var currently_active_tool = this.gestures[et].active; - if (currently_active_tool != null && tool != currently_active_tool) { - logging_1.logger.debug("Toolbar: deactivating tool: " + currently_active_tool.type + " (" + currently_active_tool.id + ") for event type '" + et + "'"); - currently_active_tool.active = false; - } - this.gestures[et].active = tool; - logging_1.logger.debug("Toolbar: activating tool: " + tool.type + " (" + tool.id + ") for event type '" + et + "'"); - } - else - this.gestures[et].active = null; - } - }; - return ToolbarBase; - }(model_1.Model)); - exports.ToolbarBase = ToolbarBase; - ToolbarBase.initClass(); -} -, -/* models/tools/toolbar_box */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var p = require(18) /* ../../core/properties */; - var logging_1 = require(17) /* ../../core/logging */; - var types_1 = require(46) /* ../../core/util/types */; - var array_1 = require(24) /* ../../core/util/array */; - var action_tool_1 = require(242) /* ./actions/action_tool */; - var help_tool_1 = require(244) /* ./actions/help_tool */; - var gesture_tool_1 = require(261) /* ./gestures/gesture_tool */; - var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */; - var toolbar_base_1 = require(279) /* ./toolbar_base */; - var tool_proxy_1 = require(277) /* ./tool_proxy */; - var layout_dom_1 = require(163) /* ../layouts/layout_dom */; - var layout_1 = require(13) /* ../../core/layout */; - var ProxyToolbar = /** @class */ (function (_super) { - tslib_1.__extends(ProxyToolbar, _super); - function ProxyToolbar(attrs) { - return _super.call(this, attrs) || this; - } - ProxyToolbar.initClass = function () { - this.prototype.type = "ProxyToolbar"; - }; - ProxyToolbar.prototype.initialize = function () { - _super.prototype.initialize.call(this); - this._init_tools(); - this._merge_tools(); - }; - ProxyToolbar.prototype._init_tools = function () { - var _loop_1 = function (tool) { - if (tool instanceof inspect_tool_1.InspectTool) { - if (!array_1.some(this_1.inspectors, function (t) { return t.id == tool.id; })) - this_1.inspectors = this_1.inspectors.concat([tool]); - } - else if (tool instanceof help_tool_1.HelpTool) { - if (!array_1.some(this_1.help, function (t) { return t.id == tool.id; })) - this_1.help = this_1.help.concat([tool]); - } - else if (tool instanceof action_tool_1.ActionTool) { - if (!array_1.some(this_1.actions, function (t) { return t.id == tool.id; })) - this_1.actions = this_1.actions.concat([tool]); - } - else if (tool instanceof gesture_tool_1.GestureTool) { - var event_types = void 0; - var multi = void 0; - if (types_1.isString(tool.event_type)) { - event_types = [tool.event_type]; - multi = false; - } - else { - event_types = tool.event_type || []; - multi = true; - } - for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) { - var et = event_types_1[_i]; - if (!(et in this_1.gestures)) { - logging_1.logger.warn("Toolbar: unknown event type '" + et + "' for tool: " + tool.type + " (" + tool.id + ")"); - continue; - } - if (multi) - et = "multi"; - if (!array_1.some(this_1.gestures[et].tools, function (t) { return t.id == tool.id; })) - this_1.gestures[et].tools = this_1.gestures[et].tools.concat([tool]); - } - } - }; - var this_1 = this; - for (var _i = 0, _a = this.tools; _i < _a.length; _i++) { - var tool = _a[_i]; - _loop_1(tool); - } - }; - ProxyToolbar.prototype._merge_tools = function () { - var _this = this; - var _a; - // Go through all the tools on the toolbar and replace them with - // a proxy e.g. PanTool, BoxSelectTool, etc. - this._proxied_tools = []; - var inspectors = {}; - var actions = {}; - var gestures = {}; - var new_help_tools = []; - var new_help_urls = []; - for (var _i = 0, _b = this.help; _i < _b.length; _i++) { - var helptool = _b[_i]; - if (!array_1.includes(new_help_urls, helptool.redirect)) { - new_help_tools.push(helptool); - new_help_urls.push(helptool.redirect); - } - } - (_a = this._proxied_tools).push.apply(_a, new_help_tools); - this.help = new_help_tools; - for (var event_type in this.gestures) { - var gesture = this.gestures[event_type]; - if (!(event_type in gestures)) { - gestures[event_type] = {}; - } - for (var _c = 0, _d = gesture.tools; _c < _d.length; _c++) { - var tool = _d[_c]; - if (!(tool.type in gestures[event_type])) { - gestures[event_type][tool.type] = []; - } - gestures[event_type][tool.type].push(tool); - } - } - for (var _e = 0, _f = this.inspectors; _e < _f.length; _e++) { - var tool = _f[_e]; - if (!(tool.type in inspectors)) { - inspectors[tool.type] = []; - } - inspectors[tool.type].push(tool); - } - for (var _g = 0, _h = this.actions; _g < _h.length; _g++) { - var tool = _h[_g]; - if (!(tool.type in actions)) { - actions[tool.type] = []; - } - actions[tool.type].push(tool); - } - // Add a proxy for each of the groups of tools. - var make_proxy = function (tools, active) { - if (active === void 0) { - active = false; - } - var proxy = new tool_proxy_1.ToolProxy({ tools: tools, active: active }); - _this._proxied_tools.push(proxy); - return proxy; - }; - for (var event_type in gestures) { - var gesture = this.gestures[event_type]; - gesture.tools = []; - for (var tool_type in gestures[event_type]) { - var tools = gestures[event_type][tool_type]; - if (tools.length > 0) { - if (event_type == 'multi') { - for (var _j = 0, tools_1 = tools; _j < tools_1.length; _j++) { - var tool = tools_1[_j]; - var proxy = make_proxy([tool]); - gesture.tools.push(proxy); - this.connect(proxy.properties.active.change, this._active_change.bind(this, proxy)); - } - } - else { - var proxy = make_proxy(tools); - gesture.tools.push(proxy); - this.connect(proxy.properties.active.change, this._active_change.bind(this, proxy)); - } - } - } - } - this.actions = []; - for (var tool_type in actions) { - var tools = actions[tool_type]; - if (tool_type == 'CustomAction') { - for (var _k = 0, tools_2 = tools; _k < tools_2.length; _k++) { - var tool = tools_2[_k]; - this.actions.push(make_proxy([tool])); - } - } - else if (tools.length > 0) { - this.actions.push(make_proxy(tools)); // XXX - } - } - this.inspectors = []; - for (var tool_type in inspectors) { - var tools = inspectors[tool_type]; - if (tools.length > 0) - this.inspectors.push(make_proxy(tools, true)); // XXX - } - for (var et in this.gestures) { - var gesture = this.gestures[et]; - if (gesture.tools.length == 0) - continue; - gesture.tools = array_1.sort_by(gesture.tools, function (tool) { return tool.default_order; }); - if (!(et == 'pinch' || et == 'scroll' || et == 'multi')) - gesture.tools[0].active = true; - } - }; - return ProxyToolbar; - }(toolbar_base_1.ToolbarBase)); - exports.ProxyToolbar = ProxyToolbar; - ProxyToolbar.initClass(); - var ToolbarBoxView = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarBoxView, _super); - function ToolbarBoxView() { - return _super !== null && _super.apply(this, arguments) || this; - } - ToolbarBoxView.prototype.initialize = function () { - this.model.toolbar.toolbar_location = this.model.toolbar_location; - _super.prototype.initialize.call(this); - }; - Object.defineProperty(ToolbarBoxView.prototype, "child_models", { - get: function () { - return [this.model.toolbar]; // XXX - }, - enumerable: true, - configurable: true - }); - ToolbarBoxView.prototype._update_layout = function () { - this.layout = new layout_1.ContentBox(this.child_views[0].el); - var toolbar = this.model.toolbar; - if (toolbar.horizontal) { - this.layout.set_sizing({ - width_policy: "fit", min_width: 100, height_policy: "fixed", - }); - } - else { - this.layout.set_sizing({ - width_policy: "fixed", height_policy: "fit", min_height: 100, - }); - } - }; - return ToolbarBoxView; - }(layout_dom_1.LayoutDOMView)); - exports.ToolbarBoxView = ToolbarBoxView; - var ToolbarBox = /** @class */ (function (_super) { - tslib_1.__extends(ToolbarBox, _super); - function ToolbarBox(attrs) { - return _super.call(this, attrs) || this; - } - ToolbarBox.initClass = function () { - this.prototype.type = 'ToolbarBox'; - this.prototype.default_view = ToolbarBoxView; - this.define({ - toolbar: [p.Instance], - toolbar_location: [p.Location, "right"], - }); - }; - return ToolbarBox; - }(layout_dom_1.LayoutDOM)); - exports.ToolbarBox = ToolbarBox; - ToolbarBox.initClass(); -} -, -/* models/tools/util */ function _(require, module, exports) { - var array_1 = require(24) /* ../../core/util/array */; - function compute_renderers(renderers, all_renderers, names) { - if (renderers == null) - return []; - var result = renderers == 'auto' ? all_renderers : renderers; - if (names.length > 0) - result = result.filter(function (r) { return array_1.includes(names, r.name); }); - return result; - } - exports.compute_renderers = compute_renderers; -} -, -/* models/transforms/customjs_transform */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transform_1 = require(289) /* ./transform */; - var p = require(18) /* ../../core/properties */; - var object_1 = require(35) /* ../../core/util/object */; - var string_1 = require(40) /* ../../core/util/string */; - var CustomJSTransform = /** @class */ (function (_super) { - tslib_1.__extends(CustomJSTransform, _super); - function CustomJSTransform(attrs) { - return _super.call(this, attrs) || this; - } - CustomJSTransform.initClass = function () { - this.prototype.type = 'CustomJSTransform'; - this.define({ - args: [p.Any, {}], - func: [p.String, ""], - v_func: [p.String, ""], - use_strict: [p.Boolean, false], - }); - }; - Object.defineProperty(CustomJSTransform.prototype, "names", { - get: function () { - return object_1.keys(this.args); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJSTransform.prototype, "values", { - get: function () { - return object_1.values(this.args); - }, - enumerable: true, - configurable: true - }); - CustomJSTransform.prototype._make_transform = function (name, func) { - var code = this.use_strict ? string_1.use_strict(func) : func; - return new (Function.bind.apply(Function, [void 0].concat(this.names, [name, "require", "exports", code])))(); - }; - Object.defineProperty(CustomJSTransform.prototype, "scalar_transform", { - get: function () { - return this._make_transform("x", this.func); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CustomJSTransform.prototype, "vector_transform", { - get: function () { - return this._make_transform("xs", this.v_func); - }, - enumerable: true, - configurable: true - }); - CustomJSTransform.prototype.compute = function (x) { - return this.scalar_transform.apply(this, this.values.concat([x, require, {}])); - }; - CustomJSTransform.prototype.v_compute = function (xs) { - return this.vector_transform.apply(this, this.values.concat([xs, require, {}])); - }; - return CustomJSTransform; - }(transform_1.Transform)); - exports.CustomJSTransform = CustomJSTransform; - CustomJSTransform.initClass(); -} -, -/* models/transforms/dodge */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transform_1 = require(289) /* ./transform */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var p = require(18) /* ../../core/properties */; - var types_1 = require(46) /* ../../core/util/types */; - var Dodge = /** @class */ (function (_super) { - tslib_1.__extends(Dodge, _super); - function Dodge(attrs) { - return _super.call(this, attrs) || this; - } - Dodge.initClass = function () { - this.prototype.type = "Dodge"; - this.define({ - value: [p.Number, 0], - range: [p.Instance], - }); - }; - // XXX: this is repeated in ./jitter.ts - Dodge.prototype.v_compute = function (xs0) { - var xs; - if (this.range instanceof factor_range_1.FactorRange) - xs = this.range.v_synthetic(xs0); - else if (types_1.isArrayableOf(xs0, types_1.isNumber)) - xs = xs0; - else - throw new Error("unexpected"); - var result = new Float64Array(xs.length); - for (var i = 0; i < xs.length; i++) { - var x = xs[i]; - result[i] = this._compute(x); - } - return result; - }; - Dodge.prototype.compute = function (x) { - if (this.range instanceof factor_range_1.FactorRange) - return this._compute(this.range.synthetic(x)); - else if (types_1.isNumber(x)) - return this._compute(x); - else - throw new Error("unexpected"); - }; - Dodge.prototype._compute = function (x) { - return x + this.value; - }; - return Dodge; - }(transform_1.Transform)); - exports.Dodge = Dodge; - Dodge.initClass(); -} -, -/* models/transforms/index */ function _(require, module, exports) { - var customjs_transform_1 = require(282) /* ./customjs_transform */; - exports.CustomJSTransform = customjs_transform_1.CustomJSTransform; - var dodge_1 = require(283) /* ./dodge */; - exports.Dodge = dodge_1.Dodge; - var interpolator_1 = require(285) /* ./interpolator */; - exports.Interpolator = interpolator_1.Interpolator; - var jitter_1 = require(286) /* ./jitter */; - exports.Jitter = jitter_1.Jitter; - var linear_interpolator_1 = require(287) /* ./linear_interpolator */; - exports.LinearInterpolator = linear_interpolator_1.LinearInterpolator; - var step_interpolator_1 = require(288) /* ./step_interpolator */; - exports.StepInterpolator = step_interpolator_1.StepInterpolator; - var transform_1 = require(289) /* ./transform */; - exports.Transform = transform_1.Transform; -} -, -/* models/transforms/interpolator */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transform_1 = require(289) /* ./transform */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var types_1 = require(46) /* ../../core/util/types */; - var Interpolator = /** @class */ (function (_super) { - tslib_1.__extends(Interpolator, _super); - function Interpolator(attrs) { - var _this = _super.call(this, attrs) || this; - _this._sorted_dirty = true; - return _this; - } - Interpolator.initClass = function () { - this.prototype.type = "Interpolator"; - this.define({ - x: [p.Any], - y: [p.Any], - data: [p.Any], - clip: [p.Boolean, true], - }); - }; - Interpolator.prototype.connect_signals = function () { - var _this = this; - _super.prototype.connect_signals.call(this); - this.connect(this.change, function () { return _this._sorted_dirty = true; }); - }; - Interpolator.prototype.v_compute = function (xs) { - var result = new Float64Array(xs.length); - for (var i = 0; i < xs.length; i++) { - var x = xs[i]; - result[i] = this.compute(x); - } - return result; - }; - Interpolator.prototype.sort = function (descending) { - if (descending === void 0) { - descending = false; - } - if (!this._sorted_dirty) - return; - var tsx; - var tsy; - if (types_1.isString(this.x) && types_1.isString(this.y) && this.data != null) { - var column_names = this.data.columns(); - if (!array_1.includes(column_names, this.x)) - throw new Error("The x parameter does not correspond to a valid column name defined in the data parameter"); - if (!array_1.includes(column_names, this.y)) - throw new Error("The y parameter does not correspond to a valid column name defined in the data parameter"); - tsx = this.data.get_column(this.x); - tsy = this.data.get_column(this.y); - } - else if (types_1.isArray(this.x) && types_1.isArray(this.y)) { - tsx = this.x; - tsy = this.y; - } - else { - throw new Error("parameters 'x' and 'y' must be both either string fields or arrays"); - } - if (tsx.length !== tsy.length) - throw new Error("The length for x and y do not match"); - if (tsx.length < 2) - throw new Error("x and y must have at least two elements to support interpolation"); - // The following sorting code is referenced from: - // http://stackoverflow.com/questions/11499268/sort-two-arrays-the-same-way - var list = []; - for (var j in tsx) { - list.push({ x: tsx[j], y: tsy[j] }); - } - if (descending) - list.sort(function (a, b) { return a.x > b.x ? -1 : (a.x == b.x ? 0 : 1); }); - else - list.sort(function (a, b) { return a.x < b.x ? -1 : (a.x == b.x ? 0 : 1); }); - this._x_sorted = []; - this._y_sorted = []; - for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { - var _a = list_1[_i], x = _a.x, y = _a.y; - this._x_sorted.push(x); - this._y_sorted.push(y); - } - this._sorted_dirty = false; - }; - return Interpolator; - }(transform_1.Transform)); - exports.Interpolator = Interpolator; - Interpolator.initClass(); -} -, -/* models/transforms/jitter */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var transform_1 = require(289) /* ./transform */; - var factor_range_1 = require(188) /* ../ranges/factor_range */; - var types_1 = require(46) /* ../../core/util/types */; - var p = require(18) /* ../../core/properties */; - var bokeh_math = require(34) /* ../../core/util/math */; - var Jitter = /** @class */ (function (_super) { - tslib_1.__extends(Jitter, _super); - function Jitter(attrs) { - return _super.call(this, attrs) || this; - } - Jitter.initClass = function () { - this.prototype.type = "Jitter"; - this.define({ - mean: [p.Number, 0], - width: [p.Number, 1], - distribution: [p.Distribution, 'uniform'], - range: [p.Instance], - }); - this.internal({ - previous_values: [p.Array], - }); - }; - Jitter.prototype.v_compute = function (xs0) { - if (this.previous_values != null && this.previous_values.length == xs0.length) - return this.previous_values; - var xs; - if (this.range instanceof factor_range_1.FactorRange) - xs = this.range.v_synthetic(xs0); - else if (types_1.isArrayableOf(xs0, types_1.isNumber)) - xs = xs0; - else - throw new Error("unexpected"); - var result = new Float64Array(xs.length); - for (var i = 0; i < xs.length; i++) { - var x = xs[i]; - result[i] = this._compute(x); - } - this.previous_values = result; - return result; - }; - Jitter.prototype.compute = function (x) { - if (this.range instanceof factor_range_1.FactorRange) - return this._compute(this.range.synthetic(x)); - else if (types_1.isNumber(x)) - return this._compute(x); - else - throw new Error("unexpected"); - }; - Jitter.prototype._compute = function (x) { - switch (this.distribution) { - case "uniform": - return x + this.mean + (bokeh_math.random() - 0.5) * this.width; - case "normal": - return x + bokeh_math.rnorm(this.mean, this.width); - } - }; - return Jitter; - }(transform_1.Transform)); - exports.Jitter = Jitter; - Jitter.initClass(); -} -, -/* models/transforms/linear_interpolator */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var array_1 = require(24) /* ../../core/util/array */; - var interpolator_1 = require(285) /* ./interpolator */; - var LinearInterpolator = /** @class */ (function (_super) { - tslib_1.__extends(LinearInterpolator, _super); - function LinearInterpolator(attrs) { - return _super.call(this, attrs) || this; - } - LinearInterpolator.initClass = function () { - this.prototype.type = "LinearInterpolator"; - }; - LinearInterpolator.prototype.compute = function (x) { - this.sort(false); - if (this.clip) { - if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1]) - return NaN; - } - else { - if (x < this._x_sorted[0]) - return this._y_sorted[0]; - if (x > this._x_sorted[this._x_sorted.length - 1]) - return this._y_sorted[this._y_sorted.length - 1]; - } - if (x == this._x_sorted[0]) - return this._y_sorted[0]; - var ind = array_1.find_last_index(this._x_sorted, function (num) { return num < x; }); - var x1 = this._x_sorted[ind]; - var x2 = this._x_sorted[ind + 1]; - var y1 = this._y_sorted[ind]; - var y2 = this._y_sorted[ind + 1]; - return y1 + (((x - x1) / (x2 - x1)) * (y2 - y1)); - }; - return LinearInterpolator; - }(interpolator_1.Interpolator)); - exports.LinearInterpolator = LinearInterpolator; - LinearInterpolator.initClass(); -} -, -/* models/transforms/step_interpolator */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var interpolator_1 = require(285) /* ./interpolator */; - var p = require(18) /* ../../core/properties */; - var array_1 = require(24) /* ../../core/util/array */; - var StepInterpolator = /** @class */ (function (_super) { - tslib_1.__extends(StepInterpolator, _super); - function StepInterpolator(attrs) { - return _super.call(this, attrs) || this; - } - StepInterpolator.initClass = function () { - this.prototype.type = "StepInterpolator"; - this.define({ - mode: [p.StepMode, "after"], - }); - }; - StepInterpolator.prototype.compute = function (x) { - this.sort(false); - if (this.clip) { - if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1]) - return NaN; - } - else { - if (x < this._x_sorted[0]) - return this._y_sorted[0]; - if (x > this._x_sorted[this._x_sorted.length - 1]) - return this._y_sorted[this._y_sorted.length - 1]; - } - var ind; - switch (this.mode) { - case "after": { - ind = array_1.find_last_index(this._x_sorted, function (num) { return x >= num; }); - break; - } - case "before": { - ind = array_1.find_index(this._x_sorted, function (num) { return x <= num; }); - break; - } - case "center": { - var diffs = this._x_sorted.map(function (tx) { return Math.abs(tx - x); }); - var mdiff_1 = array_1.min(diffs); - ind = array_1.find_index(diffs, function (num) { return mdiff_1 === num; }); - break; - } - default: - throw new Error("unknown mode: " + this.mode); - } - return ind != -1 ? this._y_sorted[ind] : NaN; - }; - return StepInterpolator; - }(interpolator_1.Interpolator)); - exports.StepInterpolator = StepInterpolator; - StepInterpolator.initClass(); -} -, -/* models/transforms/transform */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var model_1 = require(62) /* ../../model */; - var Transform = /** @class */ (function (_super) { - tslib_1.__extends(Transform, _super); - function Transform(attrs) { - return _super.call(this, attrs) || this; - } - Transform.initClass = function () { - this.prototype.type = "Transform"; - }; - return Transform; - }(model_1.Model)); - exports.Transform = Transform; - Transform.initClass(); -} -, -/* polyfill */ function _(require, module, exports) { - if (typeof Map === "undefined") { - require(351) /* es6-map/implement */; - } - if (typeof WeakMap === "undefined") { - require(363) /* es6-weak-map/implement */; - } - if (typeof Promise === "undefined") { - require(357) /* es6-promise */.polyfill(); - } - if (typeof Math.log10 === "undefined") { - Math.log10 = function (x) { - return Math.log(x) * Math.LOG10E; - }; - } - // ref: https://github.com/bokeh/bokeh/issues/7373 - if (typeof Number.isInteger === "undefined") { - Number.isInteger = function (value) { - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; - }; - } - if (typeof String.prototype.repeat === "undefined") { - String.prototype.repeat = function (count) { - if (this == null) { - throw new TypeError('can\'t convert ' + this + ' to object'); - } - var str = '' + this; - count = +count; - if (count != count) { - count = 0; - } - if (count < 0) { - throw new RangeError('repeat count must be non-negative'); - } - if (count == Infinity) { - throw new RangeError('repeat count must be less than infinity'); - } - count = Math.floor(count); - if (str.length == 0 || count == 0) { - return ''; - } - // Ensuring count is a 31-bit integer allows us to heavily optimize the - // main part. But anyway, most current (August 2014) browsers can't handle - // strings 1 << 28 chars or longer, so: - if (str.length * count >= 1 << 28) { - throw new RangeError('repeat count must not overflow maximum string size'); - } - var rpt = ''; - for (;;) { - if ((count & 1) == 1) { - rpt += str; - } - count >>>= 1; - if (count == 0) { - break; - } - str += str; - } - // Could we try: - // return Array(count + 1).join(this) - return rpt; - }; - } - // Production steps of ECMA-262, Edition 6, 22.1.2.1 - if (typeof Array.from === "undefined") { - Array.from = (function () { - var toStr = Object.prototype.toString; - var isCallable = function (fn) { - return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; - }; - var toInteger = function (value) { - var number = Number(value); - if (isNaN(number)) { - return 0; - } - if (number === 0 || !isFinite(number)) { - return number; - } - return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); - }; - var maxSafeInteger = Math.pow(2, 53) - 1; - var toLength = function (value) { - var len = toInteger(value); - return Math.min(Math.max(len, 0), maxSafeInteger); - }; - // The length property of the from method is 1. - return function from(arrayLike /*, mapFn, thisArg */) { - // 1. Let C be the this value. - var C = this; - // 2. Let items be ToObject(arrayLike). - var items = Object(arrayLike); - // 3. ReturnIfAbrupt(items). - if (arrayLike == null) { - throw new TypeError('Array.from requires an array-like object - not null or undefined'); - } - // 4. If mapfn is undefined, then let mapping be false. - var mapFn = arguments.length > 1 ? arguments[1] : void undefined; - var T; - if (typeof mapFn !== 'undefined') { - // 5. else - // 5. a If IsCallable(mapfn) is false, throw a TypeError exception. - if (!isCallable(mapFn)) { - throw new TypeError('Array.from: when provided, the second argument must be a function'); - } - // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (arguments.length > 2) { - T = arguments[2]; - } - } - // 10. Let lenValue be Get(items, "length"). - // 11. Let len be ToLength(lenValue). - var len = toLength(items.length); - // 13. If IsConstructor(C) is true, then - // 13. a. Let A be the result of calling the [[Construct]] internal method - // of C with an argument list containing the single item len. - // 14. a. Else, Let A be ArrayCreate(len). - var A = isCallable(C) ? Object(new C(len)) : new Array(len); - // 16. Let k be 0. - var k = 0; - // 17. Repeat, while k < len… (also steps a - h) - while (k < len) { - var kValue = items[k]; - if (mapFn) { - A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); - } - else { - A[k] = kValue; - } - k += 1; - } - // 18. Let putStatus be Put(A, "length", len, true). - A.length = len; - // 20. Return A. - return A; - }; - }()); - } -} -, -/* protocol/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(292) /* ./message */, exports); - tslib_1.__exportStar(require(293) /* ./receiver */, exports); -} -, -/* protocol/message */ function _(require, module, exports) { - var string_1 = require(40) /* ../core/util/string */; - var Message = /** @class */ (function () { - function Message(header, metadata, content) { - this.header = header; - this.metadata = metadata; - this.content = content; - this.buffers = []; - } - Message.assemble = function (header_json, metadata_json, content_json) { - var header = JSON.parse(header_json); - var metadata = JSON.parse(metadata_json); - var content = JSON.parse(content_json); - return new Message(header, metadata, content); - }; - Message.prototype.assemble_buffer = function (buf_header, buf_payload) { - var nb = this.header.num_buffers != null ? this.header.num_buffers : 0; - if (nb <= this.buffers.length) - throw new Error("too many buffers received, expecting #{nb}"); - this.buffers.push([buf_header, buf_payload]); - }; - // not defined for BokehJS, only *receiving* buffers is supported - // add_buffer: (buf_header, buf_payload) -> - // write_buffers: (socket) - Message.create = function (msgtype, metadata, content) { - if (content === void 0) { - content = {}; - } - var header = Message.create_header(msgtype); - return new Message(header, metadata, content); - }; - Message.create_header = function (msgtype) { - return { - msgid: string_1.uniqueId(), - msgtype: msgtype, - }; - }; - Message.prototype.complete = function () { - if (this.header != null && this.metadata != null && this.content != null) { - if ('num_buffers' in this.header) - return this.buffers.length === this.header.num_buffers; - else - return true; - } - else - return false; - }; - Message.prototype.send = function (socket) { - var nb = this.header.num_buffers != null ? this.header.num_buffers : 0; - if (nb > 0) - throw new Error("BokehJS only supports receiving buffers, not sending"); - var header_json = JSON.stringify(this.header); - var metadata_json = JSON.stringify(this.metadata); - var content_json = JSON.stringify(this.content); - socket.send(header_json); - socket.send(metadata_json); - socket.send(content_json); - }; - Message.prototype.msgid = function () { - return this.header.msgid; - }; - Message.prototype.msgtype = function () { - return this.header.msgtype; - }; - Message.prototype.reqid = function () { - return this.header.reqid; - }; - // return the reason we should close on bad protocol, if there is one - Message.prototype.problem = function () { - if (!('msgid' in this.header)) - return "No msgid in header"; - else if (!('msgtype' in this.header)) - return "No msgtype in header"; - else - return null; - }; - return Message; - }()); - exports.Message = Message; -} -, -/* protocol/receiver */ function _(require, module, exports) { - var message_1 = require(292) /* ./message */; - var Receiver = /** @class */ (function () { - function Receiver() { - this.message = null; - this._partial = null; - this._fragments = []; - this._buf_header = null; - this._current_consumer = this._HEADER; - } - Receiver.prototype.consume = function (fragment) { - this._current_consumer(fragment); - }; - Receiver.prototype._HEADER = function (fragment) { - this._assume_text(fragment); - this.message = null; - this._partial = null; - this._fragments = [fragment]; - this._buf_header = null; - this._current_consumer = this._METADATA; - }; - Receiver.prototype._METADATA = function (fragment) { - this._assume_text(fragment); - this._fragments.push(fragment); - this._current_consumer = this._CONTENT; - }; - Receiver.prototype._CONTENT = function (fragment) { - this._assume_text(fragment); - this._fragments.push(fragment); - var _a = this._fragments.slice(0, 3), header_json = _a[0], metadata_json = _a[1], content_json = _a[2]; - this._partial = message_1.Message.assemble(header_json, metadata_json, content_json); - this._check_complete(); - }; - Receiver.prototype._BUFFER_HEADER = function (fragment) { - this._assume_text(fragment); - this._buf_header = fragment; // XXX: assume text but Header is expected - this._current_consumer = this._BUFFER_PAYLOAD; - }; - Receiver.prototype._BUFFER_PAYLOAD = function (fragment) { - this._assume_binary(fragment); - this._partial.assemble_buffer(this._buf_header, fragment); - this._check_complete(); - }; - Receiver.prototype._assume_text = function (fragment) { - if (fragment instanceof ArrayBuffer) - throw new Error("Expected text fragment but received binary fragment"); - }; - Receiver.prototype._assume_binary = function (fragment) { - if (!(fragment instanceof ArrayBuffer)) - throw new Error("Expected binary fragment but received text fragment"); - }; - Receiver.prototype._check_complete = function () { - if (this._partial.complete()) { - this.message = this._partial; - this._current_consumer = this._HEADER; - } - else - this._current_consumer = this._BUFFER_HEADER; - }; - return Receiver; - }()); - exports.Receiver = Receiver; -} -, -/* safely */ function _(require, module, exports) { - function _burst_into_flames(error) { - // Make box - var box = document.createElement("div"); - box.style.backgroundColor = "#f2dede"; - box.style.border = "1px solid #a94442"; - box.style.borderRadius = "4px"; - box.style.display = "inline-block"; - box.style.fontFamily = "sans-serif"; - box.style.marginTop = "5px"; - box.style.minWidth = "200px"; - box.style.padding = "5px 5px 5px 10px"; - box.classList.add("bokeh-error-box-into-flames"); - // Make button - var button = document.createElement("span"); - button.style.backgroundColor = "#a94442"; - button.style.borderRadius = "0px 4px 0px 0px"; - button.style.color = "white"; - button.style.cursor = "pointer"; - button.style.cssFloat = "right"; - button.style.fontSize = "0.8em"; - button.style.margin = "-6px -6px 0px 0px"; - button.style.padding = "2px 5px 4px 5px"; - button.title = "close"; - button.setAttribute("aria-label", "close"); - button.appendChild(document.createTextNode("x")); - button.addEventListener("click", function () { return body.removeChild(box); }); - // Make title - var title = document.createElement("h3"); - title.style.color = "#a94442"; - title.style.margin = "8px 0px 0px 0px"; - title.style.padding = "0px"; - title.appendChild(document.createTextNode("Bokeh Error")); - // Make message - var message = document.createElement("pre"); - message.style.whiteSpace = "unset"; - message.style.overflowX = "auto"; - var text = error instanceof Error ? error.message : error; - message.appendChild(document.createTextNode(text)); - // Add pieces to box - box.appendChild(button); - box.appendChild(title); - box.appendChild(message); - // Put box in doc - var body = document.getElementsByTagName("body")[0]; - body.insertBefore(box, body.firstChild); - } - function safely(fn, silent) { - if (silent === void 0) { - silent = false; - } - try { - return fn(); - } - catch (error) { - _burst_into_flames(error); - if (!silent) - throw error; - else - return; - } - } - exports.safely = safely; -} -, -/* testing */ function _(require, module, exports) { - // Just a dumb key/value record for collecting arbitrary info for tests - exports.results = {}; - // Selenium has race conditions that make it difficult to read out the - // results structure. This function deletes/creates a div that can act as - // a semaphore. Tests should wait for the previous div to be stale, then - // find the new div. At that point the results should be available - function _update_test_div() { - var body = document.getElementsByTagName("body")[0]; - var col = document.getElementsByClassName("bokeh-test-div"); - if (col.length == 1) { - body.removeChild(col[0]); - delete col[0]; - } - var box = document.createElement("div"); - box.classList.add("bokeh-test-div"); - box.style.display = "none"; - body.insertBefore(box, body.firstChild); - } - function init() { - _update_test_div(); - } - exports.init = init; - function record(key, value) { - exports.results[key] = value; - _update_test_div(); - } - exports.record = record; - function count(key) { - if (exports.results[key] == undefined) - exports.results[key] = 0; - exports.results[key] += 1; - _update_test_div(); - } - exports.count = count; - function clear() { - for (var _i = 0, _a = Object.keys(exports.results); _i < _a.length; _i++) { - var prop = _a[_i]; - delete exports.results[prop]; - } - _update_test_div(); - } - exports.clear = clear; -} -, -/* version */ function _(require, module, exports) { - exports.version = '1.1.0'; -} -, -/* canvas2svg/canvas2svg */ function _(require, module, exports) { - /*!! - * Canvas 2 Svg v1.0.21 - * A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document. - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/mit-license.php - * - * Author: - * Kerry Liu - * - * Copyright (c) 2014 Gliffy Inc. - */ - ; - (function () { - "use strict"; - var STYLES, ctx, CanvasGradient, CanvasPattern, namedEntities; - //helper function to format a string - function format(str, args) { - var keys = Object.keys(args), i; - for (i = 0; i < keys.length; i++) { - str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]); - } - return str; - } - //helper function that generates a random string - function randomString(holder) { - var chars, randomstring, i; - if (!holder) { - throw new Error("cannot create a random attribute name for an undefined object"); - } - chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; - randomstring = ""; - do { - randomstring = ""; - for (i = 0; i < 12; i++) { - randomstring += chars[Math.floor(Math.random() * chars.length)]; - } - } while (holder[randomstring]); - return randomstring; - } - //helper function to map named to numbered entities - function createNamedToNumberedLookup(items, radix) { - var i, entity, lookup = {}, base10, base16; - items = items.split(','); - radix = radix || 10; - // Map from named to numbered entities. - for (i = 0; i < items.length; i += 2) { - entity = '&' + items[i + 1] + ';'; - base10 = parseInt(items[i], radix); - lookup[entity] = '&#' + base10 + ';'; - } - //FF and IE need to create a regex from hex values ie   == \xa0 - lookup["\\xa0"] = ' '; - return lookup; - } - //helper function to map canvas-textAlign to svg-textAnchor - function getTextAnchor(textAlign) { - //TODO: support rtl languages - var mapping = { "left": "start", "right": "end", "center": "middle", "start": "start", "end": "end" }; - return mapping[textAlign] || mapping.start; - } - //helper function to map canvas-textBaseline to svg-dominantBaseline - function getDominantBaseline(textBaseline) { - //INFO: not supported in all browsers - var mapping = { "alphabetic": "alphabetic", "hanging": "hanging", "top": "text-before-edge", "bottom": "text-after-edge", "middle": "central" }; - return mapping[textBaseline] || mapping.alphabetic; - } - // Unpack entities lookup where the numbers are in radix 32 to reduce the size - // entity mapping courtesy of tinymce - namedEntities = createNamedToNumberedLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + - '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + - '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + - '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + - '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + - '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + - '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + - '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + - '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + - '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + - 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + - 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + - 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + - 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + - 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + - '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + - '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + - '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + - '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + - '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + - 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + - 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + - 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + - '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + - '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); - //Some basic mappings for attributes and default values. - STYLES = { - "strokeStyle": { - svgAttr: "stroke", - canvas: "#000000", - svg: "none", - apply: "stroke" //apply on stroke() or fill() - }, - "fillStyle": { - svgAttr: "fill", - canvas: "#000000", - svg: null, - apply: "fill" - }, - "lineCap": { - svgAttr: "stroke-linecap", - canvas: "butt", - svg: "butt", - apply: "stroke" - }, - "lineJoin": { - svgAttr: "stroke-linejoin", - canvas: "miter", - svg: "miter", - apply: "stroke" - }, - "miterLimit": { - svgAttr: "stroke-miterlimit", - canvas: 10, - svg: 4, - apply: "stroke" - }, - "lineWidth": { - svgAttr: "stroke-width", - canvas: 1, - svg: 1, - apply: "stroke" - }, - "globalAlpha": { - svgAttr: "opacity", - canvas: 1, - svg: 1, - apply: "fill stroke" - }, - "font": { - //font converts to multiple svg attributes, there is custom logic for this - canvas: "10px sans-serif" - }, - "shadowColor": { - canvas: "#000000" - }, - "shadowOffsetX": { - canvas: 0 - }, - "shadowOffsetY": { - canvas: 0 - }, - "shadowBlur": { - canvas: 0 - }, - "textAlign": { - canvas: "start" - }, - "textBaseline": { - canvas: "alphabetic" - }, - "lineDash": { - svgAttr: "stroke-dasharray", - canvas: [], - svg: null, - apply: "stroke" - } - }; - /** - * - * @param gradientNode - reference to the gradient - * @constructor - */ - CanvasGradient = function (gradientNode, ctx) { - this.__root = gradientNode; - this.__ctx = ctx; - }; - /** - * Adds a color stop to the gradient root - */ - CanvasGradient.prototype.addColorStop = function (offset, color) { - var stop = this.__ctx.__createElement("stop"), regex, matches; - stop.setAttribute("offset", offset); - if (color.indexOf("rgba") !== -1) { - //separate alpha value, since webkit can't handle it - regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi; - matches = regex.exec(color); - stop.setAttribute("stop-color", format("rgb({r},{g},{b})", { r: matches[1], g: matches[2], b: matches[3] })); - stop.setAttribute("stop-opacity", matches[4]); - } - else { - stop.setAttribute("stop-color", color); - } - this.__root.appendChild(stop); - }; - CanvasPattern = function (pattern, ctx) { - this.__root = pattern; - this.__ctx = ctx; - }; - /** - * The mock canvas context - * @param o - options include: - * ctx - existing Context2D to wrap around - * width - width of your canvas (defaults to 500) - * height - height of your canvas (defaults to 500) - * enableMirroring - enables canvas mirroring (get image data) (defaults to false) - * document - the document object (defaults to the current document) - */ - ctx = function (o) { - var defaultOptions = { width: 500, height: 500, enableMirroring: false }, options; - //keep support for this way of calling C2S: new C2S(width,height) - if (arguments.length > 1) { - options = defaultOptions; - options.width = arguments[0]; - options.height = arguments[1]; - } - else if (!o) { - options = defaultOptions; - } - else { - options = o; - } - if (!(this instanceof ctx)) { - //did someone call this without new? - return new ctx(options); - } - //setup options - this.width = options.width || defaultOptions.width; - this.height = options.height || defaultOptions.height; - this.enableMirroring = options.enableMirroring !== undefined ? options.enableMirroring : defaultOptions.enableMirroring; - this.canvas = this; ///point back to this instance! - this.__document = options.document || document; - // allow passing in an existing context to wrap around - // if a context is passed in, we know a canvas already exist - if (options.ctx) { - this.__ctx = options.ctx; - } - else { - this.__canvas = this.__document.createElement("canvas"); - this.__ctx = this.__canvas.getContext("2d"); - } - this.__setDefaultStyles(); - this.__stack = [this.__getStyleState()]; - this.__groupStack = []; - //the root svg element - this.__root = this.__document.createElementNS("http://www.w3.org/2000/svg", "svg"); - this.__root.setAttribute("version", 1.1); - this.__root.setAttribute("xmlns", "http://www.w3.org/2000/svg"); - this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); - this.__root.setAttribute("width", this.width); - this.__root.setAttribute("height", this.height); - //make sure we don't generate the same ids in defs - this.__ids = {}; - //defs tag - this.__defs = this.__document.createElementNS("http://www.w3.org/2000/svg", "defs"); - this.__root.appendChild(this.__defs); - //also add a group child. the svg element can't use the transform attribute - this.__currentElement = this.__document.createElementNS("http://www.w3.org/2000/svg", "g"); - this.__root.appendChild(this.__currentElement); - }; - /** - * Creates the specified svg element - * @private - */ - ctx.prototype.__createElement = function (elementName, properties, resetFill) { - if (typeof properties === "undefined") { - properties = {}; - } - var element = this.__document.createElementNS("http://www.w3.org/2000/svg", elementName), keys = Object.keys(properties), i, key; - if (resetFill) { - //if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black. - element.setAttribute("fill", "none"); - element.setAttribute("stroke", "none"); - } - for (i = 0; i < keys.length; i++) { - key = keys[i]; - element.setAttribute(key, properties[key]); - } - return element; - }; - /** - * Applies default canvas styles to the context - * @private - */ - ctx.prototype.__setDefaultStyles = function () { - //default 2d canvas context properties see:http://www.w3.org/TR/2dcontext/ - var keys = Object.keys(STYLES), i, key; - for (i = 0; i < keys.length; i++) { - key = keys[i]; - this[key] = STYLES[key].canvas; - } - }; - /** - * Applies styles on restore - * @param styleState - * @private - */ - ctx.prototype.__applyStyleState = function (styleState) { - var keys = Object.keys(styleState), i, key; - for (i = 0; i < keys.length; i++) { - key = keys[i]; - this[key] = styleState[key]; - } - }; - /** - * Gets the current style state - * @return {Object} - * @private - */ - ctx.prototype.__getStyleState = function () { - var i, styleState = {}, keys = Object.keys(STYLES), key; - for (i = 0; i < keys.length; i++) { - key = keys[i]; - styleState[key] = this[key]; - } - return styleState; - }; - /** - * Apples the current styles to the current SVG element. On "ctx.fill" or "ctx.stroke" - * @param type - * @private - */ - ctx.prototype.__applyStyleToCurrentElement = function (type) { - var currentElement = this.__currentElement; - var currentStyleGroup = this.__currentElementsToStyle; - if (currentStyleGroup) { - currentElement.setAttribute(type, ""); - currentElement = currentStyleGroup.element; - currentStyleGroup.children.forEach(function (node) { - node.setAttribute(type, ""); - }); - } - var keys = Object.keys(STYLES), i, style, value, id, regex, matches; - for (i = 0; i < keys.length; i++) { - style = STYLES[keys[i]]; - value = this[keys[i]]; - if (style.apply) { - //is this a gradient or pattern? - if (value instanceof CanvasPattern) { - //pattern - if (value.__ctx) { - //copy over defs - while (value.__ctx.__defs.childNodes.length) { - id = value.__ctx.__defs.childNodes[0].getAttribute("id"); - this.__ids[id] = id; - this.__defs.appendChild(value.__ctx.__defs.childNodes[0]); - } - } - currentElement.setAttribute(style.apply, format("url(#{id})", { id: value.__root.getAttribute("id") })); - } - else if (value instanceof CanvasGradient) { - //gradient - currentElement.setAttribute(style.apply, format("url(#{id})", { id: value.__root.getAttribute("id") })); - } - else if (style.apply.indexOf(type) !== -1 && style.svg !== value) { - if ((style.svgAttr === "stroke" || style.svgAttr === "fill") && value.indexOf("rgba") !== -1) { - //separate alpha value, since illustrator can't handle it - regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi; - matches = regex.exec(value); - currentElement.setAttribute(style.svgAttr, format("rgb({r},{g},{b})", { r: matches[1], g: matches[2], b: matches[3] })); - //should take globalAlpha here - var opacity = matches[4]; - var globalAlpha = this.globalAlpha; - if (globalAlpha != null) { - opacity *= globalAlpha; - } - currentElement.setAttribute(style.svgAttr + "-opacity", opacity); - } - else { - var attr = style.svgAttr; - if (keys[i] === 'globalAlpha') { - attr = type + '-' + style.svgAttr; - if (currentElement.getAttribute(attr)) { - //fill-opacity or stroke-opacity has already been set by stroke or fill. - continue; - } - } - //otherwise only update attribute if right type, and not svg default - currentElement.setAttribute(attr, value); - } - } - } - } - }; - /** - * Will return the closest group or svg node. May return the current element. - * @private - */ - ctx.prototype.__closestGroupOrSvg = function (node) { - node = node || this.__currentElement; - if (node.nodeName === "g" || node.nodeName === "svg") { - return node; - } - else { - return this.__closestGroupOrSvg(node.parentNode); - } - }; - /** - * Returns the serialized value of the svg so far - * @param fixNamedEntities - Standalone SVG doesn't support named entities, which document.createTextNode encodes. - * If true, we attempt to find all named entities and encode it as a numeric entity. - * @return serialized svg - */ - ctx.prototype.getSerializedSvg = function (fixNamedEntities) { - var serialized = new XMLSerializer().serializeToString(this.__root), keys, i, key, value, regexp, xmlns; - //IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly - xmlns = /xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi; - if (xmlns.test(serialized)) { - serialized = serialized.replace('xmlns="http://www.w3.org/2000/svg', 'xmlns:xlink="http://www.w3.org/1999/xlink'); - } - if (fixNamedEntities) { - keys = Object.keys(namedEntities); - //loop over each named entity and replace with the proper equivalent. - for (i = 0; i < keys.length; i++) { - key = keys[i]; - value = namedEntities[key]; - regexp = new RegExp(key, "gi"); - if (regexp.test(serialized)) { - serialized = serialized.replace(regexp, value); - } - } - } - return serialized; - }; - /** - * Returns the root svg - * @return - */ - ctx.prototype.getSvg = function () { - return this.__root; - }; - /** - * Will generate a group tag. - */ - ctx.prototype.save = function () { - var group = this.__createElement("g"); - var parent = this.__closestGroupOrSvg(); - this.__groupStack.push(parent); - parent.appendChild(group); - this.__currentElement = group; - this.__stack.push(this.__getStyleState()); - }; - /** - * Sets current element to parent, or just root if already root - */ - ctx.prototype.restore = function () { - this.__currentElement = this.__groupStack.pop(); - this.__currentElementsToStyle = null; - //Clearing canvas will make the poped group invalid, currentElement is set to the root group node. - if (!this.__currentElement) { - this.__currentElement = this.__root.childNodes[1]; - } - var state = this.__stack.pop(); - this.__applyStyleState(state); - }; - /** - * Helper method to add transform - * @private - */ - ctx.prototype.__addTransform = function (t) { - //if the current element has siblings, add another group - var parent = this.__closestGroupOrSvg(); - if (parent.childNodes.length > 0) { - if (this.__currentElement.nodeName === "path") { - if (!this.__currentElementsToStyle) - this.__currentElementsToStyle = { element: parent, children: [] }; - this.__currentElementsToStyle.children.push(this.__currentElement); - this.__applyCurrentDefaultPath(); - } - var group = this.__createElement("g"); - parent.appendChild(group); - this.__currentElement = group; - } - var transform = this.__currentElement.getAttribute("transform"); - if (transform) { - transform += " "; - } - else { - transform = ""; - } - transform += t; - this.__currentElement.setAttribute("transform", transform); - }; - /** - * scales the current element - */ - ctx.prototype.scale = function (x, y) { - if (y === undefined) { - y = x; - } - this.__addTransform(format("scale({x},{y})", { x: x, y: y })); - }; - /** - * rotates the current element - */ - ctx.prototype.rotate = function (angle) { - var degrees = (angle * 180 / Math.PI); - this.__addTransform(format("rotate({angle},{cx},{cy})", { angle: degrees, cx: 0, cy: 0 })); - }; - /** - * translates the current element - */ - ctx.prototype.translate = function (x, y) { - this.__addTransform(format("translate({x},{y})", { x: x, y: y })); - }; - /** - * applies a transform to the current element - */ - ctx.prototype.transform = function (a, b, c, d, e, f) { - this.__addTransform(format("matrix({a},{b},{c},{d},{e},{f})", { a: a, b: b, c: c, d: d, e: e, f: f })); - }; - /** - * Create a new Path Element - */ - ctx.prototype.beginPath = function () { - var path, parent; - // Note that there is only one current default path, it is not part of the drawing state. - // See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path - this.__currentDefaultPath = ""; - this.__currentPosition = {}; - path = this.__createElement("path", {}, true); - parent = this.__closestGroupOrSvg(); - parent.appendChild(path); - this.__currentElement = path; - }; - /** - * Helper function to apply currentDefaultPath to current path element - * @private - */ - ctx.prototype.__applyCurrentDefaultPath = function () { - var currentElement = this.__currentElement; - if (currentElement.nodeName === "path") { - currentElement.setAttribute("d", this.__currentDefaultPath); - } - else { - console.error("Attempted to apply path command to node", currentElement.nodeName); - } - }; - /** - * Helper function to add path command - * @private - */ - ctx.prototype.__addPathCommand = function (command) { - this.__currentDefaultPath += " "; - this.__currentDefaultPath += command; - }; - /** - * Adds the move command to the current path element, - * if the currentPathElement is not empty create a new path element - */ - ctx.prototype.moveTo = function (x, y) { - if (this.__currentElement.nodeName !== "path") { - this.beginPath(); - } - // creates a new subpath with the given point - this.__currentPosition = { x: x, y: y }; - this.__addPathCommand(format("M {x} {y}", { x: x, y: y })); - }; - /** - * Closes the current path - */ - ctx.prototype.closePath = function () { - if (this.__currentDefaultPath) { - this.__addPathCommand("Z"); - } - }; - /** - * Adds a line to command - */ - ctx.prototype.lineTo = function (x, y) { - this.__currentPosition = { x: x, y: y }; - if (this.__currentDefaultPath.indexOf('M') > -1) { - this.__addPathCommand(format("L {x} {y}", { x: x, y: y })); - } - else { - this.__addPathCommand(format("M {x} {y}", { x: x, y: y })); - } - }; - /** - * Add a bezier command - */ - ctx.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) { - this.__currentPosition = { x: x, y: y }; - this.__addPathCommand(format("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}", { cp1x: cp1x, cp1y: cp1y, cp2x: cp2x, cp2y: cp2y, x: x, y: y })); - }; - /** - * Adds a quadratic curve to command - */ - ctx.prototype.quadraticCurveTo = function (cpx, cpy, x, y) { - this.__currentPosition = { x: x, y: y }; - this.__addPathCommand(format("Q {cpx} {cpy} {x} {y}", { cpx: cpx, cpy: cpy, x: x, y: y })); - }; - /** - * Return a new normalized vector of given vector - */ - var normalize = function (vector) { - var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]); - return [vector[0] / len, vector[1] / len]; - }; - /** - * Adds the arcTo to the current path - * - * @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto - */ - ctx.prototype.arcTo = function (x1, y1, x2, y2, radius) { - // Let the point (x0, y0) be the last point in the subpath. - var x0 = this.__currentPosition && this.__currentPosition.x; - var y0 = this.__currentPosition && this.__currentPosition.y; - // First ensure there is a subpath for (x1, y1). - if (typeof x0 == "undefined" || typeof y0 == "undefined") { - return; - } - // Negative values for radius must cause the implementation to throw an IndexSizeError exception. - if (radius < 0) { - throw new Error("IndexSizeError: The radius provided (" + radius + ") is negative."); - } - // If the point (x0, y0) is equal to the point (x1, y1), - // or if the point (x1, y1) is equal to the point (x2, y2), - // or if the radius radius is zero, - // then the method must add the point (x1, y1) to the subpath, - // and connect that point to the previous point (x0, y0) by a straight line. - if (((x0 === x1) && (y0 === y1)) - || ((x1 === x2) && (y1 === y2)) - || (radius === 0)) { - this.lineTo(x1, y1); - return; - } - // Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line, - // then the method must add the point (x1, y1) to the subpath, - // and connect that point to the previous point (x0, y0) by a straight line. - var unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]); - var unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]); - if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) { - this.lineTo(x1, y1); - return; - } - // Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius, - // and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1), - // and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2). - // The points at which this circle touches these two lines are called the start and end tangent points respectively. - // note that both vectors are unit vectors, so the length is 1 - var cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]); - var theta = Math.acos(Math.abs(cos)); - // Calculate origin - var unit_vec_p1_origin = normalize([ - unit_vec_p1_p0[0] + unit_vec_p1_p2[0], - unit_vec_p1_p0[1] + unit_vec_p1_p2[1] - ]); - var len_p1_origin = radius / Math.sin(theta / 2); - var x = x1 + len_p1_origin * unit_vec_p1_origin[0]; - var y = y1 + len_p1_origin * unit_vec_p1_origin[1]; - // Calculate start angle and end angle - // rotate 90deg clockwise (note that y axis points to its down) - var unit_vec_origin_start_tangent = [ - -unit_vec_p1_p0[1], - unit_vec_p1_p0[0] - ]; - // rotate 90deg counter clockwise (note that y axis points to its down) - var unit_vec_origin_end_tangent = [ - unit_vec_p1_p2[1], - -unit_vec_p1_p2[0] - ]; - var getAngle = function (vector) { - // get angle (clockwise) between vector and (1, 0) - var x = vector[0]; - var y = vector[1]; - if (y >= 0) { // note that y axis points to its down - return Math.acos(x); - } - else { - return -Math.acos(x); - } - }; - var startAngle = getAngle(unit_vec_origin_start_tangent); - var endAngle = getAngle(unit_vec_origin_end_tangent); - // Connect the point (x0, y0) to the start tangent point by a straight line - this.lineTo(x + unit_vec_origin_start_tangent[0] * radius, y + unit_vec_origin_start_tangent[1] * radius); - // Connect the start tangent point to the end tangent point by arc - // and adding the end tangent point to the subpath. - this.arc(x, y, radius, startAngle, endAngle); - }; - /** - * Sets the stroke property on the current element - */ - ctx.prototype.stroke = function () { - if (this.__currentElement.nodeName === "path") { - this.__currentElement.setAttribute("paint-order", "fill stroke markers"); - } - this.__applyCurrentDefaultPath(); - this.__applyStyleToCurrentElement("stroke"); - }; - /** - * Sets fill properties on the current element - */ - ctx.prototype.fill = function () { - if (this.__currentElement.nodeName === "path") { - this.__currentElement.setAttribute("paint-order", "stroke fill markers"); - } - this.__applyCurrentDefaultPath(); - this.__applyStyleToCurrentElement("fill"); - }; - /** - * Adds a rectangle to the path. - */ - ctx.prototype.rect = function (x, y, width, height) { - if (this.__currentElement.nodeName !== "path") { - this.beginPath(); - } - this.moveTo(x, y); - this.lineTo(x + width, y); - this.lineTo(x + width, y + height); - this.lineTo(x, y + height); - this.lineTo(x, y); - this.closePath(); - }; - /** - * adds a rectangle element - */ - ctx.prototype.fillRect = function (x, y, width, height) { - var rect, parent; - rect = this.__createElement("rect", { - x: x, - y: y, - width: width, - height: height - }, true); - parent = this.__closestGroupOrSvg(); - parent.appendChild(rect); - this.__currentElement = rect; - this.__applyStyleToCurrentElement("fill"); - }; - /** - * Draws a rectangle with no fill - * @param x - * @param y - * @param width - * @param height - */ - ctx.prototype.strokeRect = function (x, y, width, height) { - var rect, parent; - rect = this.__createElement("rect", { - x: x, - y: y, - width: width, - height: height - }, true); - parent = this.__closestGroupOrSvg(); - parent.appendChild(rect); - this.__currentElement = rect; - this.__applyStyleToCurrentElement("stroke"); - }; - /** - * Clear entire canvas: - * 1. save current transforms - * 2. remove all the childNodes of the root g element - */ - ctx.prototype.__clearCanvas = function () { - var current = this.__closestGroupOrSvg(), transform = current.getAttribute("transform"); - var rootGroup = this.__root.childNodes[1]; - var childNodes = rootGroup.childNodes; - for (var i = childNodes.length - 1; i >= 0; i--) { - if (childNodes[i]) { - rootGroup.removeChild(childNodes[i]); - } - } - this.__currentElement = rootGroup; - //reset __groupStack as all the child group nodes are all removed. - this.__groupStack = []; - if (transform) { - this.__addTransform(transform); - } - }; - /** - * "Clears" a canvas by just drawing a white rectangle in the current group. - */ - ctx.prototype.clearRect = function (x, y, width, height) { - //clear entire canvas - if (x === 0 && y === 0 && width === this.width && height === this.height) { - this.__clearCanvas(); - return; - } - var rect, parent = this.__closestGroupOrSvg(); - rect = this.__createElement("rect", { - x: x, - y: y, - width: width, - height: height, - fill: "#FFFFFF" - }, true); - parent.appendChild(rect); - }; - /** - * Adds a linear gradient to a defs tag. - * Returns a canvas gradient object that has a reference to it's parent def - */ - ctx.prototype.createLinearGradient = function (x1, y1, x2, y2) { - var grad = this.__createElement("linearGradient", { - id: randomString(this.__ids), - x1: x1 + "px", - x2: x2 + "px", - y1: y1 + "px", - y2: y2 + "px", - "gradientUnits": "userSpaceOnUse" - }, false); - this.__defs.appendChild(grad); - return new CanvasGradient(grad, this); - }; - /** - * Adds a radial gradient to a defs tag. - * Returns a canvas gradient object that has a reference to it's parent def - */ - ctx.prototype.createRadialGradient = function (x0, y0, r0, x1, y1, r1) { - var grad = this.__createElement("radialGradient", { - id: randomString(this.__ids), - cx: x1 + "px", - cy: y1 + "px", - r: r1 + "px", - fx: x0 + "px", - fy: y0 + "px", - "gradientUnits": "userSpaceOnUse" - }, false); - this.__defs.appendChild(grad); - return new CanvasGradient(grad, this); - }; - /** - * Parses the font string and returns svg mapping - * @private - */ - ctx.prototype.__parseFont = function () { - var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i; - var fontPart = regex.exec(this.font); - var data = { - style: fontPart[1] || 'normal', - size: fontPart[4] || '10px', - family: fontPart[6] || 'sans-serif', - weight: fontPart[3] || 'normal', - decoration: fontPart[2] || 'normal', - href: null - }; - //canvas doesn't support underline natively, but we can pass this attribute - if (this.__fontUnderline === "underline") { - data.decoration = "underline"; - } - //canvas also doesn't support linking, but we can pass this as well - if (this.__fontHref) { - data.href = this.__fontHref; - } - return data; - }; - /** - * Helper to link text fragments - * @param font - * @param element - * @return {*} - * @private - */ - ctx.prototype.__wrapTextLink = function (font, element) { - if (font.href) { - var a = this.__createElement("a"); - a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", font.href); - a.appendChild(element); - return a; - } - return element; - }; - /** - * Fills or strokes text - * @param text - * @param x - * @param y - * @param action - stroke or fill - * @private - */ - ctx.prototype.__applyText = function (text, x, y, action) { - var font = this.__parseFont(), parent = this.__closestGroupOrSvg(), textElement = this.__createElement("text", { - "font-family": font.family, - "font-size": font.size, - "font-style": font.style, - "font-weight": font.weight, - "text-decoration": font.decoration, - "x": x, - "y": y, - "text-anchor": getTextAnchor(this.textAlign), - "dominant-baseline": getDominantBaseline(this.textBaseline) - }, true); - textElement.appendChild(this.__document.createTextNode(text)); - this.__currentElement = textElement; - this.__applyStyleToCurrentElement(action); - parent.appendChild(this.__wrapTextLink(font, textElement)); - }; - /** - * Creates a text element - * @param text - * @param x - * @param y - */ - ctx.prototype.fillText = function (text, x, y) { - this.__applyText(text, x, y, "fill"); - }; - /** - * Strokes text - * @param text - * @param x - * @param y - */ - ctx.prototype.strokeText = function (text, x, y) { - this.__applyText(text, x, y, "stroke"); - }; - /** - * No need to implement this for svg. - * @param text - * @return {TextMetrics} - */ - ctx.prototype.measureText = function (text) { - this.__ctx.font = this.font; - return this.__ctx.measureText(text); - }; - /** - * Arc command! - */ - ctx.prototype.arc = function (x, y, radius, startAngle, endAngle, counterClockwise) { - // in canvas no circle is drawn if no angle is provided. - if (startAngle === endAngle) { - return; - } - startAngle = startAngle % (2 * Math.PI); - endAngle = endAngle % (2 * Math.PI); - if (startAngle === endAngle) { - //circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle) - endAngle = ((endAngle + (2 * Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2 * Math.PI); - } - var endX = x + radius * Math.cos(endAngle), endY = y + radius * Math.sin(endAngle), startX = x + radius * Math.cos(startAngle), startY = y + radius * Math.sin(startAngle), sweepFlag = counterClockwise ? 0 : 1, largeArcFlag = 0, diff = endAngle - startAngle; - // https://github.com/gliffy/canvas2svg/issues/4 - if (diff < 0) { - diff += 2 * Math.PI; - } - if (counterClockwise) { - largeArcFlag = diff > Math.PI ? 0 : 1; - } - else { - largeArcFlag = diff > Math.PI ? 1 : 0; - } - this.lineTo(startX, startY); - this.__addPathCommand(format("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}", { rx: radius, ry: radius, xAxisRotation: 0, largeArcFlag: largeArcFlag, sweepFlag: sweepFlag, endX: endX, endY: endY })); - this.__currentPosition = { x: endX, y: endY }; - }; - /** - * Generates a ClipPath from the clip command. - */ - ctx.prototype.clip = function () { - var group = this.__closestGroupOrSvg(), clipPath = this.__createElement("clipPath"), id = randomString(this.__ids), newGroup = this.__createElement("g"); - this.__applyCurrentDefaultPath(); - group.removeChild(this.__currentElement); - clipPath.setAttribute("id", id); - clipPath.appendChild(this.__currentElement); - this.__defs.appendChild(clipPath); - //set the clip path to this group - group.setAttribute("clip-path", format("url(#{id})", { id: id })); - //clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations - // to this path - group.appendChild(newGroup); - this.__currentElement = newGroup; - }; - /** - * Draws a canvas, image or mock context to this canvas. - * Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support. - * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage - */ - ctx.prototype.drawImage = function () { - //convert arguments to a real array - var args = Array.prototype.slice.call(arguments), image = args[0], dx, dy, dw, dh, sx = 0, sy = 0, sw, sh, parent, svg, defs, group, currentElement, svgImage, canvas, context, id; - if (args.length === 3) { - dx = args[1]; - dy = args[2]; - sw = image.width; - sh = image.height; - dw = sw; - dh = sh; - } - else if (args.length === 5) { - dx = args[1]; - dy = args[2]; - dw = args[3]; - dh = args[4]; - sw = image.width; - sh = image.height; - } - else if (args.length === 9) { - sx = args[1]; - sy = args[2]; - sw = args[3]; - sh = args[4]; - dx = args[5]; - dy = args[6]; - dw = args[7]; - dh = args[8]; - } - else { - throw new Error("Inavlid number of arguments passed to drawImage: " + arguments.length); - } - parent = this.__closestGroupOrSvg(); - currentElement = this.__currentElement; - var translateDirective = "translate(" + dx + ", " + dy + ")"; - if (image instanceof ctx) { - //canvas2svg mock canvas context. In the future we may want to clone nodes instead. - //also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context. - svg = image.getSvg().cloneNode(true); - if (svg.childNodes && svg.childNodes.length > 1) { - defs = svg.childNodes[0]; - while (defs.childNodes.length) { - id = defs.childNodes[0].getAttribute("id"); - this.__ids[id] = id; - this.__defs.appendChild(defs.childNodes[0]); - } - group = svg.childNodes[1]; - if (group) { - //save original transform - var originTransform = group.getAttribute("transform"); - var transformDirective; - if (originTransform) { - transformDirective = originTransform + " " + translateDirective; - } - else { - transformDirective = translateDirective; - } - group.setAttribute("transform", transformDirective); - parent.appendChild(group); - } - } - } - else if (image.nodeName === "IMG") { - svgImage = this.__createElement("image"); - svgImage.setAttribute("width", dw); - svgImage.setAttribute("height", dh); - svgImage.setAttribute("preserveAspectRatio", "none"); - if (sx || sy || sw !== image.width || sh !== image.height) { - //crop the image using a temporary canvas - canvas = this.__document.createElement("canvas"); - canvas.width = dw; - canvas.height = dh; - context = canvas.getContext("2d"); - context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh); - image = canvas; - } - svgImage.setAttribute("transform", translateDirective); - svgImage.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src")); - parent.appendChild(svgImage); - } - else if (image.nodeName === "CANVAS") { - svgImage = this.__createElement("image"); - svgImage.setAttribute("width", dw); - svgImage.setAttribute("height", dh); - svgImage.setAttribute("preserveAspectRatio", "none"); - // draw canvas onto temporary canvas so that smoothing can be handled - canvas = this.__document.createElement("canvas"); - canvas.width = dw; - canvas.height = dh; - context = canvas.getContext("2d"); - context.imageSmoothingEnabled = false; - context.mozImageSmoothingEnabled = false; - context.oImageSmoothingEnabled = false; - context.webkitImageSmoothingEnabled = false; - context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh); - image = canvas; - svgImage.setAttribute("transform", translateDirective); - svgImage.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", image.toDataURL()); - parent.appendChild(svgImage); - } - }; - /** - * Generates a pattern tag - */ - ctx.prototype.createPattern = function (image, repetition) { - var pattern = this.__document.createElementNS("http://www.w3.org/2000/svg", "pattern"), id = randomString(this.__ids), img; - pattern.setAttribute("id", id); - pattern.setAttribute("width", image.width); - pattern.setAttribute("height", image.height); - if (image.nodeName === "CANVAS" || image.nodeName === "IMG") { - img = this.__document.createElementNS("http://www.w3.org/2000/svg", "image"); - img.setAttribute("width", image.width); - img.setAttribute("height", image.height); - img.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src")); - pattern.appendChild(img); - this.__defs.appendChild(pattern); - } - else if (image instanceof ctx) { - pattern.appendChild(image.__root.childNodes[1]); - this.__defs.appendChild(pattern); - } - return new CanvasPattern(pattern, this); - }; - ctx.prototype.setLineDash = function (dashArray) { - if (dashArray && dashArray.length > 0) { - this.lineDash = dashArray.join(","); - } - else { - this.lineDash = null; - } - }; - /** - * Not yet implemented - */ - ctx.prototype.drawFocusRing = function () { }; - ctx.prototype.createImageData = function () { }; - ctx.prototype.getImageData = function () { }; - ctx.prototype.putImageData = function () { }; - ctx.prototype.globalCompositeOperation = function () { }; - ctx.prototype.setTransform = function () { }; - //add options for alternative namespace - if (typeof window === "object") { - window.C2S = ctx; - } - // CommonJS/Browserify - if (typeof module === "object" && typeof module.exports === "object") { - module.exports = ctx; - } - }()); -} -, -/* d/auto-bind */ function _(require, module, exports) { - var copy = require(321) /* es5-ext/object/copy */, normalizeOptions = require(331) /* es5-ext/object/normalize-options */, ensureCallable = require(336) /* es5-ext/object/valid-callable */, map = require(330) /* es5-ext/object/map */, callable = require(336) /* es5-ext/object/valid-callable */, validValue = require(338) /* es5-ext/object/valid-value */, bind = Function.prototype.bind, defineProperty = Object.defineProperty, hasOwnProperty = Object.prototype.hasOwnProperty, define; - define = function (name, desc, options) { - var value = validValue(desc) && callable(desc.value), dgs; - dgs = copy(desc); - delete dgs.writable; - delete dgs.value; - dgs.get = function () { - if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) - return value; - desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this); - defineProperty(this, name, desc); - return this[name]; - }; - return dgs; - }; - module.exports = function (props /*, options*/) { - var options = normalizeOptions(arguments[1]); - if (options.resolveContext != null) - ensureCallable(options.resolveContext); - return map(props, function (desc, name) { return define(name, desc, options); }); - }; -} -, -/* d/index */ function _(require, module, exports) { - var assign = require(318) /* es5-ext/object/assign */, normalizeOpts = require(331) /* es5-ext/object/normalize-options */, isCallable = require(324) /* es5-ext/object/is-callable */, contains = require(339) /* es5-ext/string/#/contains */, d; - d = module.exports = function (dscr, value /*, options*/) { - var c, e, w, options, desc; - if ((arguments.length < 2) || (typeof dscr !== 'string')) { - options = value; - value = dscr; - dscr = null; - } - else { - options = arguments[2]; - } - if (dscr == null) { - c = w = true; - e = false; - } - else { - c = contains.call(dscr, 'c'); - e = contains.call(dscr, 'e'); - w = contains.call(dscr, 'w'); - } - desc = { value: value, configurable: c, enumerable: e, writable: w }; - return !options ? desc : assign(normalizeOpts(options), desc); - }; - d.gs = function (dscr, get, set /*, options*/) { - var c, e, options, desc; - if (typeof dscr !== 'string') { - options = set; - set = get; - get = dscr; - dscr = null; - } - else { - options = arguments[3]; - } - if (get == null) { - get = undefined; - } - else if (!isCallable(get)) { - options = get; - get = set = undefined; - } - else if (set == null) { - set = undefined; - } - else if (!isCallable(set)) { - options = set; - set = undefined; - } - if (dscr == null) { - c = true; - e = false; - } - else { - c = contains.call(dscr, 'c'); - e = contains.call(dscr, 'e'); - } - desc = { get: get, set: set, configurable: c, enumerable: e }; - return !options ? desc : assign(normalizeOpts(options), desc); - }; -} -, -/* es5-ext/array/#/clear */ function _(require, module, exports) { - var value = require(338) /* ../../object/valid-value */; - module.exports = function () { - value(this).length = 0; - return this; - }; -} -, -/* es5-ext/array/#/e-index-of */ function _(require, module, exports) { - var numberIsNaN = require(312) /* ../../number/is-nan */, toPosInt = require(316) /* ../../number/to-pos-integer */, value = require(338) /* ../../object/valid-value */, indexOf = Array.prototype.indexOf, objHasOwnProperty = Object.prototype.hasOwnProperty, abs = Math.abs, floor = Math.floor; - module.exports = function (searchElement /*, fromIndex*/) { - var i, length, fromIndex, val; - if (!numberIsNaN(searchElement)) - return indexOf.apply(this, arguments); - length = toPosInt(value(this).length); - fromIndex = arguments[1]; - if (isNaN(fromIndex)) - fromIndex = 0; - else if (fromIndex >= 0) - fromIndex = floor(fromIndex); - else - fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); - for (i = fromIndex; i < length; ++i) { - if (objHasOwnProperty.call(this, i)) { - val = this[i]; - if (numberIsNaN(val)) - return i; // Jslint: ignore - } - } - return -1; - }; -} -, -/* es5-ext/array/from/index */ function _(require, module, exports) { - module.exports = require(303) /* ./is-implemented */() - ? Array.from - : require(304) /* ./shim */; -} -, -/* es5-ext/array/from/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var from = Array.from, arr, result; - if (typeof from !== "function") - return false; - arr = ["raz", "dwa"]; - result = from(arr); - return Boolean(result && (result !== arr) && (result[1] === "dwa")); - }; -} -, -/* es5-ext/array/from/shim */ function _(require, module, exports) { - var iteratorSymbol = require(358) /* es6-symbol */.iterator, isArguments = require(305) /* ../../function/is-arguments */, isFunction = require(306) /* ../../function/is-function */, toPosInt = require(316) /* ../../number/to-pos-integer */, callable = require(336) /* ../../object/valid-callable */, validValue = require(338) /* ../../object/valid-value */, isValue = require(326) /* ../../object/is-value */, isString = require(342) /* ../../string/is-string */, isArray = Array.isArray, call = Function.prototype.call, desc = { configurable: true, enumerable: true, writable: true, value: null }, defineProperty = Object.defineProperty; - // eslint-disable-next-line complexity - module.exports = function (arrayLike /*, mapFn, thisArg*/) { - var mapFn = arguments[1], thisArg = arguments[2], Context, i, j, arr, length, code, iterator, result, getIterator, value; - arrayLike = Object(validValue(arrayLike)); - if (isValue(mapFn)) - callable(mapFn); - if (!this || this === Array || !isFunction(this)) { - // Result: Plain array - if (!mapFn) { - if (isArguments(arrayLike)) { - // Source: Arguments - length = arrayLike.length; - if (length !== 1) - return Array.apply(null, arrayLike); - arr = new Array(1); - arr[0] = arrayLike[0]; - return arr; - } - if (isArray(arrayLike)) { - // Source: Array - arr = new Array(length = arrayLike.length); - for (i = 0; i < length; ++i) - arr[i] = arrayLike[i]; - return arr; - } - } - arr = []; - } - else { - // Result: Non plain array - Context = this; - } - if (!isArray(arrayLike)) { - if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) { - // Source: Iterator - iterator = callable(getIterator).call(arrayLike); - if (Context) - arr = new Context(); - result = iterator.next(); - i = 0; - while (!result.done) { - value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value; - if (Context) { - desc.value = value; - defineProperty(arr, i, desc); - } - else { - arr[i] = value; - } - result = iterator.next(); - ++i; - } - length = i; - } - else if (isString(arrayLike)) { - // Source: String - length = arrayLike.length; - if (Context) - arr = new Context(); - for (i = 0, j = 0; i < length; ++i) { - value = arrayLike[i]; - if (i + 1 < length) { - code = value.charCodeAt(0); - // eslint-disable-next-line max-depth - if (code >= 0xd800 && code <= 0xdbff) - value += arrayLike[++i]; - } - value = mapFn ? call.call(mapFn, thisArg, value, j) : value; - if (Context) { - desc.value = value; - defineProperty(arr, j, desc); - } - else { - arr[j] = value; - } - ++j; - } - length = j; - } - } - if (length === undefined) { - // Source: array or array-like - length = toPosInt(arrayLike.length); - if (Context) - arr = new Context(length); - for (i = 0; i < length; ++i) { - value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; - if (Context) { - desc.value = value; - defineProperty(arr, i, desc); - } - else { - arr[i] = value; - } - } - } - if (Context) { - desc.value = null; - arr.length = length; - } - return arr; - }; -} -, -/* es5-ext/function/is-arguments */ function _(require, module, exports) { - var objToString = Object.prototype.toString, id = objToString.call((function () { - return arguments; - })()); - module.exports = function (value) { - return objToString.call(value) === id; - }; -} -, -/* es5-ext/function/is-function */ function _(require, module, exports) { - var objToString = Object.prototype.toString, id = objToString.call(require(307) /* ./noop */); - module.exports = function (value) { - return typeof value === "function" && objToString.call(value) === id; - }; -} -, -/* es5-ext/function/noop */ function _(require, module, exports) { - // eslint-disable-next-line no-empty-function - module.exports = function () { }; -} -, -/* es5-ext/global */ function _(require, module, exports) { - /* eslint strict: "off" */ - module.exports = (function () { - return this; - }()); -} -, -/* es5-ext/math/sign/index */ function _(require, module, exports) { - module.exports = require(310) /* ./is-implemented */() - ? Math.sign - : require(311) /* ./shim */; -} -, -/* es5-ext/math/sign/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var sign = Math.sign; - if (typeof sign !== "function") - return false; - return (sign(10) === 1) && (sign(-20) === -1); - }; -} -, -/* es5-ext/math/sign/shim */ function _(require, module, exports) { - module.exports = function (value) { - value = Number(value); - if (isNaN(value) || (value === 0)) - return value; - return value > 0 ? 1 : -1; - }; -} -, -/* es5-ext/number/is-nan/index */ function _(require, module, exports) { - module.exports = require(313) /* ./is-implemented */() - ? Number.isNaN - : require(314) /* ./shim */; -} -, -/* es5-ext/number/is-nan/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var numberIsNaN = Number.isNaN; - if (typeof numberIsNaN !== "function") - return false; - return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34); - }; -} -, -/* es5-ext/number/is-nan/shim */ function _(require, module, exports) { - module.exports = function (value) { - // eslint-disable-next-line no-self-compare - return value !== value; - }; -} -, -/* es5-ext/number/to-integer */ function _(require, module, exports) { - var sign = require(309) /* ../math/sign */, abs = Math.abs, floor = Math.floor; - module.exports = function (value) { - if (isNaN(value)) - return 0; - value = Number(value); - if ((value === 0) || !isFinite(value)) - return value; - return sign(value) * floor(abs(value)); - }; -} -, -/* es5-ext/number/to-pos-integer */ function _(require, module, exports) { - var toInteger = require(315) /* ./to-integer */, max = Math.max; - module.exports = function (value) { - return max(0, toInteger(value)); - }; -} -, -/* es5-ext/object/_iterate */ function _(require, module, exports) { - var callable = require(336) /* ./valid-callable */, value = require(338) /* ./valid-value */, bind = Function.prototype.bind, call = Function.prototype.call, keys = Object.keys, objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable; - module.exports = function (method, defVal) { - return function (obj, cb /*, thisArg, compareFn*/) { - var list, thisArg = arguments[2], compareFn = arguments[3]; - obj = Object(value(obj)); - callable(cb); - list = keys(obj); - if (compareFn) { - list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined); - } - if (typeof method !== "function") - method = list[method]; - return call.call(method, list, function (key, index) { - if (!objPropertyIsEnumerable.call(obj, key)) - return defVal; - return call.call(cb, thisArg, obj[key], key, obj, index); - }); - }; - }; -} -, -/* es5-ext/object/assign/index */ function _(require, module, exports) { - module.exports = require(319) /* ./is-implemented */() - ? Object.assign - : require(320) /* ./shim */; -} -, -/* es5-ext/object/assign/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var assign = Object.assign, obj; - if (typeof assign !== "function") - return false; - obj = { foo: "raz" }; - assign(obj, { bar: "dwa" }, { trzy: "trzy" }); - return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy"; - }; -} -, -/* es5-ext/object/assign/shim */ function _(require, module, exports) { - var keys = require(327) /* ../keys */, value = require(338) /* ../valid-value */, max = Math.max; - module.exports = function (dest, src /*, …srcn*/) { - var error, i, length = max(arguments.length, 2), assign; - dest = Object(value(dest)); - assign = function (key) { - try { - dest[key] = src[key]; - } - catch (e) { - if (!error) - error = e; - } - }; - for (i = 1; i < length; ++i) { - src = arguments[i]; - keys(src).forEach(assign); - } - if (error !== undefined) - throw error; - return dest; - }; -} -, -/* es5-ext/object/copy */ function _(require, module, exports) { - var aFrom = require(302) /* ../array/from */, assign = require(318) /* ./assign */, value = require(338) /* ./valid-value */; - module.exports = function (obj /*, propertyNames, options*/) { - var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]); - if (copy !== obj && !propertyNames) - return copy; - var result = {}; - if (propertyNames) { - aFrom(propertyNames, function (propertyName) { - if (options.ensure || propertyName in obj) - result[propertyName] = obj[propertyName]; - }); - } - else { - assign(result, obj); - } - return result; - }; -} -, -/* es5-ext/object/create */ function _(require, module, exports) { - var create = Object.create, shim; - if (!require(334) /* ./set-prototype-of/is-implemented */()) { - shim = require(335) /* ./set-prototype-of/shim */; - } - module.exports = (function () { - var nullObject, polyProps, desc; - if (!shim) - return create; - if (shim.level !== 1) - return create; - nullObject = {}; - polyProps = {}; - desc = { - configurable: false, - enumerable: false, - writable: true, - value: undefined - }; - Object.getOwnPropertyNames(Object.prototype).forEach(function (name) { - if (name === "__proto__") { - polyProps[name] = { - configurable: true, - enumerable: false, - writable: true, - value: undefined - }; - return; - } - polyProps[name] = desc; - }); - Object.defineProperties(nullObject, polyProps); - Object.defineProperty(shim, "nullPolyfill", { - configurable: false, - enumerable: false, - writable: false, - value: nullObject - }); - return function (prototype, props) { - return create(prototype === null ? nullObject : prototype, props); - }; - }()); -} -, -/* es5-ext/object/for-each */ function _(require, module, exports) { - module.exports = require(317) /* ./_iterate */("forEach"); -} -, -/* es5-ext/object/is-callable */ function _(require, module, exports) { - module.exports = function (obj) { - return typeof obj === "function"; - }; -} -, -/* es5-ext/object/is-object */ function _(require, module, exports) { - var isValue = require(326) /* ./is-value */; - var map = { function: true, object: true }; - module.exports = function (value) { - return (isValue(value) && map[typeof value]) || false; - }; -} -, -/* es5-ext/object/is-value */ function _(require, module, exports) { - var _undefined = require(307) /* ../function/noop */(); // Support ES3 engines - module.exports = function (val) { - return (val !== _undefined) && (val !== null); - }; -} -, -/* es5-ext/object/keys/index */ function _(require, module, exports) { - module.exports = require(328) /* ./is-implemented */() - ? Object.keys - : require(329) /* ./shim */; -} -, -/* es5-ext/object/keys/is-implemented */ function _(require, module, exports) { - module.exports = function () { - try { - Object.keys("primitive"); - return true; - } - catch (e) { - return false; - } - }; -} -, -/* es5-ext/object/keys/shim */ function _(require, module, exports) { - var isValue = require(326) /* ../is-value */; - var keys = Object.keys; - module.exports = function (object) { - return keys(isValue(object) ? Object(object) : object); - }; -} -, -/* es5-ext/object/map */ function _(require, module, exports) { - var callable = require(336) /* ./valid-callable */, forEach = require(323) /* ./for-each */, call = Function.prototype.call; - module.exports = function (obj, cb /*, thisArg*/) { - var result = {}, thisArg = arguments[2]; - callable(cb); - forEach(obj, function (value, key, targetObj, index) { - result[key] = call.call(cb, thisArg, value, key, targetObj, index); - }); - return result; - }; -} -, -/* es5-ext/object/normalize-options */ function _(require, module, exports) { - var isValue = require(326) /* ./is-value */; - var forEach = Array.prototype.forEach, create = Object.create; - var process = function (src, obj) { - var key; - for (key in src) - obj[key] = src[key]; - }; - // eslint-disable-next-line no-unused-vars - module.exports = function (opts1 /*, …options*/) { - var result = create(null); - forEach.call(arguments, function (options) { - if (!isValue(options)) - return; - process(Object(options), result); - }); - return result; - }; -} -, -/* es5-ext/object/primitive-set */ function _(require, module, exports) { - var forEach = Array.prototype.forEach, create = Object.create; - // eslint-disable-next-line no-unused-vars - module.exports = function (arg /*, …args*/) { - var set = create(null); - forEach.call(arguments, function (name) { - set[name] = true; - }); - return set; - }; -} -, -/* es5-ext/object/set-prototype-of/index */ function _(require, module, exports) { - module.exports = require(334) /* ./is-implemented */() - ? Object.setPrototypeOf - : require(335) /* ./shim */; -} -, -/* es5-ext/object/set-prototype-of/is-implemented */ function _(require, module, exports) { - var create = Object.create, getPrototypeOf = Object.getPrototypeOf, plainObject = {}; - module.exports = function ( /* CustomCreate*/) { - var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create; - if (typeof setPrototypeOf !== "function") - return false; - return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject; - }; -} -, -/* es5-ext/object/set-prototype-of/shim */ function _(require, module, exports) { - var isObject = require(325) /* ../is-object */, value = require(338) /* ../valid-value */, objIsPrototypeOf = Object.prototype.isPrototypeOf, defineProperty = Object.defineProperty, nullDesc = { - configurable: true, - enumerable: false, - writable: true, - value: undefined - }, validate; - validate = function (obj, prototype) { - value(obj); - if (prototype === null || isObject(prototype)) - return obj; - throw new TypeError("Prototype must be null or an object"); - }; - module.exports = (function (status) { - var fn, set; - if (!status) - return null; - if (status.level === 2) { - if (status.set) { - set = status.set; - fn = function (obj, prototype) { - set.call(validate(obj, prototype), prototype); - return obj; - }; - } - else { - fn = function (obj, prototype) { - validate(obj, prototype).__proto__ = prototype; - return obj; - }; - } - } - else { - fn = function self(obj, prototype) { - var isNullBase; - validate(obj, prototype); - isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj); - if (isNullBase) - delete self.nullPolyfill.__proto__; - if (prototype === null) - prototype = self.nullPolyfill; - obj.__proto__ = prototype; - if (isNullBase) - defineProperty(self.nullPolyfill, "__proto__", nullDesc); - return obj; - }; - } - return Object.defineProperty(fn, "level", { - configurable: false, - enumerable: false, - writable: false, - value: status.level - }); - }((function () { - var tmpObj1 = Object.create(null), tmpObj2 = {}, set, desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"); - if (desc) { - try { - set = desc.set; // Opera crashes at this point - set.call(tmpObj1, tmpObj2); - } - catch (ignore) { } - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) - return { set: set, level: 2 }; - } - tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) - return { level: 2 }; - tmpObj1 = {}; - tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) - return { level: 1 }; - return false; - })())); - require(322) /* ../create */; -} -, -/* es5-ext/object/valid-callable */ function _(require, module, exports) { - module.exports = function (fn) { - if (typeof fn !== "function") - throw new TypeError(fn + " is not a function"); - return fn; - }; -} -, -/* es5-ext/object/valid-object */ function _(require, module, exports) { - var isObject = require(325) /* ./is-object */; - module.exports = function (value) { - if (!isObject(value)) - throw new TypeError(value + " is not an Object"); - return value; - }; -} -, -/* es5-ext/object/valid-value */ function _(require, module, exports) { - var isValue = require(326) /* ./is-value */; - module.exports = function (value) { - if (!isValue(value)) - throw new TypeError("Cannot use null or undefined"); - return value; - }; -} -, -/* es5-ext/string/#/contains/index */ function _(require, module, exports) { - module.exports = require(340) /* ./is-implemented */() - ? String.prototype.contains - : require(341) /* ./shim */; -} -, -/* es5-ext/string/#/contains/is-implemented */ function _(require, module, exports) { - var str = "razdwatrzy"; - module.exports = function () { - if (typeof str.contains !== "function") - return false; - return (str.contains("dwa") === true) && (str.contains("foo") === false); - }; -} -, -/* es5-ext/string/#/contains/shim */ function _(require, module, exports) { - var indexOf = String.prototype.indexOf; - module.exports = function (searchString /*, position*/) { - return indexOf.call(this, searchString, arguments[1]) > -1; - }; -} -, -/* es5-ext/string/is-string */ function _(require, module, exports) { - var objToString = Object.prototype.toString, id = objToString.call(""); - module.exports = function (value) { - return (typeof value === "string" || - (value && - typeof value === "object" && - (value instanceof String || objToString.call(value) === id)) || - false); - }; -} -, -/* es5-ext/string/random-uniq */ function _(require, module, exports) { - var generated = Object.create(null), random = Math.random; - module.exports = function () { - var str; - do { - str = random() - .toString(36) - .slice(2); - } while (generated[str]); - return str; - }; -} -, -/* es6-iterator/array */ function _(require, module, exports) { - var setPrototypeOf = require(333) /* es5-ext/object/set-prototype-of */, contains = require(339) /* es5-ext/string/#/contains */, d = require(299) /* d */, Symbol = require(358) /* es6-symbol */, Iterator = require(347) /* ./ */; - var defineProperty = Object.defineProperty, ArrayIterator; - ArrayIterator = module.exports = function (arr, kind) { - if (!(this instanceof ArrayIterator)) - throw new TypeError("Constructor requires 'new'"); - Iterator.call(this, arr); - if (!kind) - kind = "value"; - else if (contains.call(kind, "key+value")) - kind = "key+value"; - else if (contains.call(kind, "key")) - kind = "key"; - else - kind = "value"; - defineProperty(this, "__kind__", d("", kind)); - }; - if (setPrototypeOf) - setPrototypeOf(ArrayIterator, Iterator); - // Internal %ArrayIteratorPrototype% doesn't expose its constructor - delete ArrayIterator.prototype.constructor; - ArrayIterator.prototype = Object.create(Iterator.prototype, { - _resolve: d(function (i) { - if (this.__kind__ === "value") - return this.__list__[i]; - if (this.__kind__ === "key+value") - return [i, this.__list__[i]]; - return i; - }) - }); - defineProperty(ArrayIterator.prototype, Symbol.toStringTag, d("c", "Array Iterator")); -} -, -/* es6-iterator/for-of */ function _(require, module, exports) { - var isArguments = require(305) /* es5-ext/function/is-arguments */, callable = require(336) /* es5-ext/object/valid-callable */, isString = require(342) /* es5-ext/string/is-string */, get = require(346) /* ./get */; - var isArray = Array.isArray, call = Function.prototype.call, some = Array.prototype.some; - module.exports = function (iterable, cb /*, thisArg*/) { - var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code; - if (isArray(iterable) || isArguments(iterable)) - mode = "array"; - else if (isString(iterable)) - mode = "string"; - else - iterable = get(iterable); - callable(cb); - doBreak = function () { - broken = true; - }; - if (mode === "array") { - some.call(iterable, function (value) { - call.call(cb, thisArg, value, doBreak); - return broken; - }); - return; - } - if (mode === "string") { - length = iterable.length; - for (i = 0; i < length; ++i) { - char = iterable[i]; - if (i + 1 < length) { - code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) - char += iterable[++i]; - } - call.call(cb, thisArg, char, doBreak); - if (broken) - break; - } - return; - } - result = iterable.next(); - while (!result.done) { - call.call(cb, thisArg, result.value, doBreak); - if (broken) - return; - result = iterable.next(); - } - }; -} -, -/* es6-iterator/get */ function _(require, module, exports) { - var isArguments = require(305) /* es5-ext/function/is-arguments */, isString = require(342) /* es5-ext/string/is-string */, ArrayIterator = require(344) /* ./array */, StringIterator = require(349) /* ./string */, iterable = require(350) /* ./valid-iterable */, iteratorSymbol = require(358) /* es6-symbol */.iterator; - module.exports = function (obj) { - if (typeof iterable(obj)[iteratorSymbol] === "function") - return obj[iteratorSymbol](); - if (isArguments(obj)) - return new ArrayIterator(obj); - if (isString(obj)) - return new StringIterator(obj); - return new ArrayIterator(obj); - }; -} -, -/* es6-iterator/index */ function _(require, module, exports) { - var clear = require(300) /* es5-ext/array/#/clear */, assign = require(318) /* es5-ext/object/assign */, callable = require(336) /* es5-ext/object/valid-callable */, value = require(338) /* es5-ext/object/valid-value */, d = require(299) /* d */, autoBind = require(298) /* d/auto-bind */, Symbol = require(358) /* es6-symbol */; - var defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, Iterator; - module.exports = Iterator = function (list, context) { - if (!(this instanceof Iterator)) - throw new TypeError("Constructor requires 'new'"); - defineProperties(this, { - __list__: d("w", value(list)), - __context__: d("w", context), - __nextIndex__: d("w", 0) - }); - if (!context) - return; - callable(context.on); - context.on("_add", this._onAdd); - context.on("_delete", this._onDelete); - context.on("_clear", this._onClear); - }; - // Internal %IteratorPrototype% doesn't expose its constructor - delete Iterator.prototype.constructor; - defineProperties(Iterator.prototype, assign({ - _next: d(function () { - var i; - if (!this.__list__) - return undefined; - if (this.__redo__) { - i = this.__redo__.shift(); - if (i !== undefined) - return i; - } - if (this.__nextIndex__ < this.__list__.length) - return this.__nextIndex__++; - this._unBind(); - return undefined; - }), - next: d(function () { - return this._createResult(this._next()); - }), - _createResult: d(function (i) { - if (i === undefined) - return { done: true, value: undefined }; - return { done: false, value: this._resolve(i) }; - }), - _resolve: d(function (i) { - return this.__list__[i]; - }), - _unBind: d(function () { - this.__list__ = null; - delete this.__redo__; - if (!this.__context__) - return; - this.__context__.off("_add", this._onAdd); - this.__context__.off("_delete", this._onDelete); - this.__context__.off("_clear", this._onClear); - this.__context__ = null; - }), - toString: d(function () { - return "[object " + (this[Symbol.toStringTag] || "Object") + "]"; - }) - }, autoBind({ - _onAdd: d(function (index) { - if (index >= this.__nextIndex__) - return; - ++this.__nextIndex__; - if (!this.__redo__) { - defineProperty(this, "__redo__", d("c", [index])); - return; - } - this.__redo__.forEach(function (redo, i) { - if (redo >= index) - this.__redo__[i] = ++redo; - }, this); - this.__redo__.push(index); - }), - _onDelete: d(function (index) { - var i; - if (index >= this.__nextIndex__) - return; - --this.__nextIndex__; - if (!this.__redo__) - return; - i = this.__redo__.indexOf(index); - if (i !== -1) - this.__redo__.splice(i, 1); - this.__redo__.forEach(function (redo, j) { - if (redo > index) - this.__redo__[j] = --redo; - }, this); - }), - _onClear: d(function () { - if (this.__redo__) - clear.call(this.__redo__); - this.__nextIndex__ = 0; - }) - }))); - defineProperty(Iterator.prototype, Symbol.iterator, d(function () { - return this; - })); -} -, -/* es6-iterator/is-iterable */ function _(require, module, exports) { - var isArguments = require(305) /* es5-ext/function/is-arguments */, isValue = require(326) /* es5-ext/object/is-value */, isString = require(342) /* es5-ext/string/is-string */; - var iteratorSymbol = require(358) /* es6-symbol */.iterator, isArray = Array.isArray; - module.exports = function (value) { - if (!isValue(value)) - return false; - if (isArray(value)) - return true; - if (isString(value)) - return true; - if (isArguments(value)) - return true; - return typeof value[iteratorSymbol] === "function"; - }; -} -, -/* es6-iterator/string */ function _(require, module, exports) { - var setPrototypeOf = require(333) /* es5-ext/object/set-prototype-of */, d = require(299) /* d */, Symbol = require(358) /* es6-symbol */, Iterator = require(347) /* ./ */; - var defineProperty = Object.defineProperty, StringIterator; - StringIterator = module.exports = function (str) { - if (!(this instanceof StringIterator)) - throw new TypeError("Constructor requires 'new'"); - str = String(str); - Iterator.call(this, str); - defineProperty(this, "__length__", d("", str.length)); - }; - if (setPrototypeOf) - setPrototypeOf(StringIterator, Iterator); - // Internal %ArrayIteratorPrototype% doesn't expose its constructor - delete StringIterator.prototype.constructor; - StringIterator.prototype = Object.create(Iterator.prototype, { - _next: d(function () { - if (!this.__list__) - return undefined; - if (this.__nextIndex__ < this.__length__) - return this.__nextIndex__++; - this._unBind(); - return undefined; - }), - _resolve: d(function (i) { - var char = this.__list__[i], code; - if (this.__nextIndex__ === this.__length__) - return char; - code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) - return char + this.__list__[this.__nextIndex__++]; - return char; - }) - }); - defineProperty(StringIterator.prototype, Symbol.toStringTag, d("c", "String Iterator")); -} -, -/* es6-iterator/valid-iterable */ function _(require, module, exports) { - var isIterable = require(348) /* ./is-iterable */; - module.exports = function (value) { - if (!isIterable(value)) - throw new TypeError(value + " is not iterable"); - return value; - }; -} -, -/* es6-map/implement */ function _(require, module, exports) { - if (!require(352) /* ./is-implemented */()) { - Object.defineProperty(require(308) /* es5-ext/global */, 'Map', { value: require(356) /* ./polyfill */, configurable: true, enumerable: false, - writable: true }); - } -} -, -/* es6-map/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var map, iterator, result; - if (typeof Map !== 'function') - return false; - try { - // WebKit doesn't support arguments and crashes - map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]); - } - catch (e) { - return false; - } - if (String(map) !== '[object Map]') - return false; - if (map.size !== 3) - return false; - if (typeof map.clear !== 'function') - return false; - if (typeof map.delete !== 'function') - return false; - if (typeof map.entries !== 'function') - return false; - if (typeof map.forEach !== 'function') - return false; - if (typeof map.get !== 'function') - return false; - if (typeof map.has !== 'function') - return false; - if (typeof map.keys !== 'function') - return false; - if (typeof map.set !== 'function') - return false; - if (typeof map.values !== 'function') - return false; - iterator = map.entries(); - result = iterator.next(); - if (result.done !== false) - return false; - if (!result.value) - return false; - if (result.value[0] !== 'raz') - return false; - if (result.value[1] !== 'one') - return false; - return true; - }; -} -, -/* es6-map/is-native-implemented */ function _(require, module, exports) { - module.exports = (function () { - if (typeof Map === 'undefined') - return false; - return (Object.prototype.toString.call(new Map()) === '[object Map]'); - }()); -} -, -/* es6-map/lib/iterator-kinds */ function _(require, module, exports) { - module.exports = require(332) /* es5-ext/object/primitive-set */('key', 'value', 'key+value'); -} -, -/* es6-map/lib/iterator */ function _(require, module, exports) { - var setPrototypeOf = require(333) /* es5-ext/object/set-prototype-of */, d = require(299) /* d */, Iterator = require(347) /* es6-iterator */, toStringTagSymbol = require(358) /* es6-symbol */.toStringTag, kinds = require(354) /* ./iterator-kinds */, defineProperties = Object.defineProperties, unBind = Iterator.prototype._unBind, MapIterator; - MapIterator = module.exports = function (map, kind) { - if (!(this instanceof MapIterator)) - return new MapIterator(map, kind); - Iterator.call(this, map.__mapKeysData__, map); - if (!kind || !kinds[kind]) - kind = 'key+value'; - defineProperties(this, { - __kind__: d('', kind), - __values__: d('w', map.__mapValuesData__) - }); - }; - if (setPrototypeOf) - setPrototypeOf(MapIterator, Iterator); - MapIterator.prototype = Object.create(Iterator.prototype, { - constructor: d(MapIterator), - _resolve: d(function (i) { - if (this.__kind__ === 'value') - return this.__values__[i]; - if (this.__kind__ === 'key') - return this.__list__[i]; - return [this.__list__[i], this.__values__[i]]; - }), - _unBind: d(function () { - this.__values__ = null; - unBind.call(this); - }), - toString: d(function () { return '[object Map Iterator]'; }) - }); - Object.defineProperty(MapIterator.prototype, toStringTagSymbol, d('c', 'Map Iterator')); -} -, -/* es6-map/polyfill */ function _(require, module, exports) { - var clear = require(300) /* es5-ext/array/#/clear */, eIndexOf = require(301) /* es5-ext/array/#/e-index-of */, setPrototypeOf = require(333) /* es5-ext/object/set-prototype-of */, callable = require(336) /* es5-ext/object/valid-callable */, validValue = require(338) /* es5-ext/object/valid-value */, d = require(299) /* d */, ee = require(367) /* event-emitter */, Symbol = require(358) /* es6-symbol */, iterator = require(350) /* es6-iterator/valid-iterable */, forOf = require(345) /* es6-iterator/for-of */, Iterator = require(355) /* ./lib/iterator */, isNative = require(353) /* ./is-native-implemented */, call = Function.prototype.call, defineProperties = Object.defineProperties, getPrototypeOf = Object.getPrototypeOf, MapPoly; - module.exports = MapPoly = function ( /*iterable*/) { - var iterable = arguments[0], keys, values, self; - if (!(this instanceof MapPoly)) - throw new TypeError('Constructor requires \'new\''); - if (isNative && setPrototypeOf && (Map !== MapPoly)) { - self = setPrototypeOf(new Map(), getPrototypeOf(this)); - } - else { - self = this; - } - if (iterable != null) - iterator(iterable); - defineProperties(self, { - __mapKeysData__: d('c', keys = []), - __mapValuesData__: d('c', values = []) - }); - if (!iterable) - return self; - forOf(iterable, function (value) { - var key = validValue(value)[0]; - value = value[1]; - if (eIndexOf.call(keys, key) !== -1) - return; - keys.push(key); - values.push(value); - }, self); - return self; - }; - if (isNative) { - if (setPrototypeOf) - setPrototypeOf(MapPoly, Map); - MapPoly.prototype = Object.create(Map.prototype, { - constructor: d(MapPoly) - }); - } - ee(defineProperties(MapPoly.prototype, { - clear: d(function () { - if (!this.__mapKeysData__.length) - return; - clear.call(this.__mapKeysData__); - clear.call(this.__mapValuesData__); - this.emit('_clear'); - }), - delete: d(function (key) { - var index = eIndexOf.call(this.__mapKeysData__, key); - if (index === -1) - return false; - this.__mapKeysData__.splice(index, 1); - this.__mapValuesData__.splice(index, 1); - this.emit('_delete', index, key); - return true; - }), - entries: d(function () { return new Iterator(this, 'key+value'); }), - forEach: d(function (cb /*, thisArg*/) { - var thisArg = arguments[1], iterator, result; - callable(cb); - iterator = this.entries(); - result = iterator._next(); - while (result !== undefined) { - call.call(cb, thisArg, this.__mapValuesData__[result], this.__mapKeysData__[result], this); - result = iterator._next(); - } - }), - get: d(function (key) { - var index = eIndexOf.call(this.__mapKeysData__, key); - if (index === -1) - return; - return this.__mapValuesData__[index]; - }), - has: d(function (key) { - return (eIndexOf.call(this.__mapKeysData__, key) !== -1); - }), - keys: d(function () { return new Iterator(this, 'key'); }), - set: d(function (key, value) { - var index = eIndexOf.call(this.__mapKeysData__, key), emit; - if (index === -1) { - index = this.__mapKeysData__.push(key) - 1; - emit = true; - } - this.__mapValuesData__[index] = value; - if (emit) - this.emit('_add', index, key); - return this; - }), - size: d.gs(function () { return this.__mapKeysData__.length; }), - values: d(function () { return new Iterator(this, 'value'); }), - toString: d(function () { return '[object Map]'; }) - })); - Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () { - return this.entries(); - })); - Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map')); -} -, -/* es6-promise/dist/es6-promise */ function _(require, module, exports) { - /*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE - * @version v4.2.6+9869a4bc - */ - (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.ES6Promise = factory()); - }(this, (function () { - 'use strict'; - function objectOrFunction(x) { - var type = typeof x; - return x !== null && (type === 'object' || type === 'function'); - } - function isFunction(x) { - return typeof x === 'function'; - } - var _isArray = void 0; - if (Array.isArray) { - _isArray = Array.isArray; - } - else { - _isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } - var isArray = _isArray; - var len = 0; - var vertxNext = void 0; - var customSchedulerFn = void 0; - var asap = function asap(callback, arg) { - queue[len] = callback; - queue[len + 1] = arg; - len += 2; - if (len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - if (customSchedulerFn) { - customSchedulerFn(flush); - } - else { - scheduleFlush(); - } - } - }; - function setScheduler(scheduleFn) { - customSchedulerFn = scheduleFn; - } - function setAsap(asapFn) { - asap = asapFn; - } - var browserWindow = typeof window !== 'undefined' ? window : undefined; - var browserGlobal = browserWindow || {}; - var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; - var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - // test for web worker but not in IE10 - var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; - // node - function useNextTick() { - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // see https://github.com/cujojs/when/issues/410 for details - return function () { - return process.nextTick(flush); - }; - } - // vertx - function useVertxTimer() { - if (typeof vertxNext !== 'undefined') { - return function () { - vertxNext(flush); - }; - } - return useSetTimeout(); - } - function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - return function () { - node.data = iterations = ++iterations % 2; - }; - } - // web worker - function useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = flush; - return function () { - return channel.port2.postMessage(0); - }; - } - function useSetTimeout() { - // Store setTimeout reference so es6-promise will be unaffected by - // other code modifying setTimeout (like sinon.useFakeTimers()) - var globalSetTimeout = setTimeout; - return function () { - return globalSetTimeout(flush, 1); - }; - } - var queue = new Array(1000); - function flush() { - for (var i = 0; i < len; i += 2) { - var callback = queue[i]; - var arg = queue[i + 1]; - callback(arg); - queue[i] = undefined; - queue[i + 1] = undefined; - } - len = 0; - } - function attemptVertx() { - try { - var vertx = Function('return this')().require('vertx'); - vertxNext = vertx.runOnLoop || vertx.runOnContext; - return useVertxTimer(); - } - catch (e) { - return useSetTimeout(); - } - } - var scheduleFlush = void 0; - // Decide what async method to use to triggering processing of queued callbacks: - if (isNode) { - scheduleFlush = useNextTick(); - } - else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); - } - else if (isWorker) { - scheduleFlush = useMessageChannel(); - } - else if (browserWindow === undefined && typeof require === 'function') { - scheduleFlush = attemptVertx(); - } - else { - scheduleFlush = useSetTimeout(); - } - function then(onFulfillment, onRejection) { - var parent = this; - var child = new this.constructor(noop); - if (child[PROMISE_ID] === undefined) { - makePromise(child); - } - var _state = parent._state; - if (_state) { - var callback = arguments[_state - 1]; - asap(function () { - return invokeCallback(_state, child, callback, parent._result); - }); - } - else { - subscribe(parent, child, onFulfillment, onRejection); - } - return child; - } - /** - `Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {Any} value value that the returned promise will be resolved with - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` - */ - function resolve$1(object) { - /*jshint validthis:true */ - var Constructor = this; - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - var promise = new Constructor(noop); - resolve(promise, object); - return promise; - } - var PROMISE_ID = Math.random().toString(36).substring(2); - function noop() { } - var PENDING = void 0; - var FULFILLED = 1; - var REJECTED = 2; - var TRY_CATCH_ERROR = { error: null }; - function selfFulfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - function cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - function getThen(promise) { - try { - return promise.then; - } - catch (error) { - TRY_CATCH_ERROR.error = error; - return TRY_CATCH_ERROR; - } - } - function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { - try { - then$$1.call(value, fulfillmentHandler, rejectionHandler); - } - catch (e) { - return e; - } - } - function handleForeignThenable(promise, thenable, then$$1) { - asap(function (promise) { - var sealed = false; - var error = tryThen(then$$1, thenable, function (value) { - if (sealed) { - return; - } - sealed = true; - if (thenable !== value) { - resolve(promise, value); - } - else { - fulfill(promise, value); - } - }, function (reason) { - if (sealed) { - return; - } - sealed = true; - reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - if (!sealed && error) { - sealed = true; - reject(promise, error); - } - }, promise); - } - function handleOwnThenable(promise, thenable) { - if (thenable._state === FULFILLED) { - fulfill(promise, thenable._result); - } - else if (thenable._state === REJECTED) { - reject(promise, thenable._result); - } - else { - subscribe(thenable, undefined, function (value) { - return resolve(promise, value); - }, function (reason) { - return reject(promise, reason); - }); - } - } - function handleMaybeThenable(promise, maybeThenable, then$$1) { - if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { - handleOwnThenable(promise, maybeThenable); - } - else { - if (then$$1 === TRY_CATCH_ERROR) { - reject(promise, TRY_CATCH_ERROR.error); - TRY_CATCH_ERROR.error = null; - } - else if (then$$1 === undefined) { - fulfill(promise, maybeThenable); - } - else if (isFunction(then$$1)) { - handleForeignThenable(promise, maybeThenable, then$$1); - } - else { - fulfill(promise, maybeThenable); - } - } - } - function resolve(promise, value) { - if (promise === value) { - reject(promise, selfFulfillment()); - } - else if (objectOrFunction(value)) { - handleMaybeThenable(promise, value, getThen(value)); - } - else { - fulfill(promise, value); - } - } - function publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - publish(promise); - } - function fulfill(promise, value) { - if (promise._state !== PENDING) { - return; - } - promise._result = value; - promise._state = FULFILLED; - if (promise._subscribers.length !== 0) { - asap(publish, promise); - } - } - function reject(promise, reason) { - if (promise._state !== PENDING) { - return; - } - promise._state = REJECTED; - promise._result = reason; - asap(publishRejection, promise); - } - function subscribe(parent, child, onFulfillment, onRejection) { - var _subscribers = parent._subscribers; - var length = _subscribers.length; - parent._onerror = null; - _subscribers[length] = child; - _subscribers[length + FULFILLED] = onFulfillment; - _subscribers[length + REJECTED] = onRejection; - if (length === 0 && parent._state) { - asap(publish, parent); - } - } - function publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - if (subscribers.length === 0) { - return; - } - var child = void 0, callback = void 0, detail = promise._result; - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - if (child) { - invokeCallback(settled, child, callback, detail); - } - else { - callback(detail); - } - } - promise._subscribers.length = 0; - } - function tryCatch(callback, detail) { - try { - return callback(detail); - } - catch (e) { - TRY_CATCH_ERROR.error = e; - return TRY_CATCH_ERROR; - } - } - function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), value = void 0, error = void 0, succeeded = void 0, failed = void 0; - if (hasCallback) { - value = tryCatch(callback, detail); - if (value === TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value.error = null; - } - else { - succeeded = true; - } - if (promise === value) { - reject(promise, cannotReturnOwn()); - return; - } - } - else { - value = detail; - succeeded = true; - } - if (promise._state !== PENDING) { - // noop - } - else if (hasCallback && succeeded) { - resolve(promise, value); - } - else if (failed) { - reject(promise, error); - } - else if (settled === FULFILLED) { - fulfill(promise, value); - } - else if (settled === REJECTED) { - reject(promise, value); - } - } - function initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value) { - resolve(promise, value); - }, function rejectPromise(reason) { - reject(promise, reason); - }); - } - catch (e) { - reject(promise, e); - } - } - var id = 0; - function nextId() { - return id++; - } - function makePromise(promise) { - promise[PROMISE_ID] = id++; - promise._state = undefined; - promise._result = undefined; - promise._subscribers = []; - } - function validationError() { - return new Error('Array Methods must be provided an Array'); - } - var Enumerator = function () { - function Enumerator(Constructor, input) { - this._instanceConstructor = Constructor; - this.promise = new Constructor(noop); - if (!this.promise[PROMISE_ID]) { - makePromise(this.promise); - } - if (isArray(input)) { - this.length = input.length; - this._remaining = input.length; - this._result = new Array(this.length); - if (this.length === 0) { - fulfill(this.promise, this._result); - } - else { - this.length = this.length || 0; - this._enumerate(input); - if (this._remaining === 0) { - fulfill(this.promise, this._result); - } - } - } - else { - reject(this.promise, validationError()); - } - } - Enumerator.prototype._enumerate = function _enumerate(input) { - for (var i = 0; this._state === PENDING && i < input.length; i++) { - this._eachEntry(input[i], i); - } - }; - Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { - var c = this._instanceConstructor; - var resolve$$1 = c.resolve; - if (resolve$$1 === resolve$1) { - var _then = getThen(entry); - if (_then === then && entry._state !== PENDING) { - this._settledAt(entry._state, i, entry._result); - } - else if (typeof _then !== 'function') { - this._remaining--; - this._result[i] = entry; - } - else if (c === Promise$1) { - var promise = new c(noop); - handleMaybeThenable(promise, entry, _then); - this._willSettleAt(promise, i); - } - else { - this._willSettleAt(new c(function (resolve$$1) { - return resolve$$1(entry); - }), i); - } - } - else { - this._willSettleAt(resolve$$1(entry), i); - } - }; - Enumerator.prototype._settledAt = function _settledAt(state, i, value) { - var promise = this.promise; - if (promise._state === PENDING) { - this._remaining--; - if (state === REJECTED) { - reject(promise, value); - } - else { - this._result[i] = value; - } - } - if (this._remaining === 0) { - fulfill(promise, this._result); - } - }; - Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { - var enumerator = this; - subscribe(promise, undefined, function (value) { - return enumerator._settledAt(FULFILLED, i, value); - }, function (reason) { - return enumerator._settledAt(REJECTED, i, reason); - }); - }; - return Enumerator; - }(); - /** - `Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = resolve(2); - let promise3 = resolve(3); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = reject(new Error("2")); - let promise3 = reject(new Error("3")); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static - */ - function all(entries) { - return new Enumerator(this, entries).promise; - } - /** - `Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} promises array of promises to observe - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. - */ - function race(entries) { - /*jshint validthis:true */ - var Constructor = this; - if (!isArray(entries)) { - return new Constructor(function (_, reject) { - return reject(new TypeError('You must pass an array to race.')); - }); - } - else { - return new Constructor(function (resolve, reject) { - var length = entries.length; - for (var i = 0; i < length; i++) { - Constructor.resolve(entries[i]).then(resolve, reject); - } - }); - } - } - /** - `Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {Any} reason value that the returned promise will be rejected with. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. - */ - function reject$1(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(noop); - reject(promise, reason); - return promise; - } - function needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - function needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise's eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - let promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - let xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {Function} resolver - Useful for tooling. - @constructor - */ - var Promise$1 = function () { - function Promise(resolver) { - this[PROMISE_ID] = nextId(); - this._result = this._state = undefined; - this._subscribers = []; - if (noop !== resolver) { - typeof resolver !== 'function' && needsResolver(); - this instanceof Promise ? initializePromise(this, resolver) : needsNew(); - } - } - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - Chaining - -------- - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - Assimilation - ------------ - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - If the assimliated promise rejects, then the downstream promise will also reject. - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - Simple Example - -------------- - Synchronous Example - ```javascript - let result; - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - Errback Example - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - Promise Example; - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - Advanced Example - -------------- - Synchronous Example - ```javascript - let author, books; - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - Errback Example - ```js - function foundBooks(books) { - } - function failure(reason) { - } - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - Promise Example; - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - Promise.prototype.catch = function _catch(onRejection) { - return this.then(null, onRejection); - }; - /** - `finally` will be invoked regardless of the promise's fate just as native - try/catch/finally behaves - - Synchronous example: - - ```js - findAuthor() { - if (Math.random() > 0.5) { - throw new Error(); - } - return new Author(); - } - - try { - return findAuthor(); // succeed or fail - } catch(error) { - return findOtherAuther(); - } finally { - // always runs - // doesn't affect the return value - } - ``` - - Asynchronous example: - - ```js - findAuthor().catch(function(reason){ - return findOtherAuther(); - }).finally(function(){ - // author was either found, or not - }); - ``` - - @method finally - @param {Function} callback - @return {Promise} - */ - Promise.prototype.finally = function _finally(callback) { - var promise = this; - var constructor = promise.constructor; - if (isFunction(callback)) { - return promise.then(function (value) { - return constructor.resolve(callback()).then(function () { - return value; - }); - }, function (reason) { - return constructor.resolve(callback()).then(function () { - throw reason; - }); - }); - } - return promise.then(callback, callback); - }; - return Promise; - }(); - Promise$1.prototype.then = then; - Promise$1.all = all; - Promise$1.race = race; - Promise$1.resolve = resolve$1; - Promise$1.reject = reject$1; - Promise$1._setScheduler = setScheduler; - Promise$1._setAsap = setAsap; - Promise$1._asap = asap; - /*global self*/ - function polyfill() { - var local = void 0; - if (typeof global !== 'undefined') { - local = global; - } - else if (typeof self !== 'undefined') { - local = self; - } - else { - try { - local = Function('return this')(); - } - catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - var P = local.Promise; - if (P) { - var promiseToString = null; - try { - promiseToString = Object.prototype.toString.call(P.resolve()); - } - catch (e) { - // silently ignored - } - if (promiseToString === '[object Promise]' && !P.cast) { - return; - } - } - local.Promise = Promise$1; - } - // Strange compat.. - Promise$1.polyfill = polyfill; - Promise$1.Promise = Promise$1; - return Promise$1; - }))); -} -, -/* es6-symbol/index */ function _(require, module, exports) { - module.exports = require(359) /* ./is-implemented */() ? Symbol : require(361) /* ./polyfill */; -} -, -/* es6-symbol/is-implemented */ function _(require, module, exports) { - var validTypes = { object: true, symbol: true }; - module.exports = function () { - var symbol; - if (typeof Symbol !== 'function') - return false; - symbol = Symbol('test symbol'); - try { - String(symbol); - } - catch (e) { - return false; - } - // Return 'true' also for polyfills - if (!validTypes[typeof Symbol.iterator]) - return false; - if (!validTypes[typeof Symbol.toPrimitive]) - return false; - if (!validTypes[typeof Symbol.toStringTag]) - return false; - return true; - }; -} -, -/* es6-symbol/is-symbol */ function _(require, module, exports) { - module.exports = function (x) { - if (!x) - return false; - if (typeof x === 'symbol') - return true; - if (!x.constructor) - return false; - if (x.constructor.name !== 'Symbol') - return false; - return (x[x.constructor.toStringTag] === 'Symbol'); - }; -} -, -/* es6-symbol/polyfill */ function _(require, module, exports) { - var d = require(299) /* d */, validateSymbol = require(362) /* ./validate-symbol */, create = Object.create, defineProperties = Object.defineProperties, defineProperty = Object.defineProperty, objPrototype = Object.prototype, NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null), isNativeSafe; - if (typeof Symbol === 'function') { - NativeSymbol = Symbol; - try { - String(NativeSymbol()); - isNativeSafe = true; - } - catch (ignore) { } - } - var generateName = (function () { - var created = create(null); - return function (desc) { - var postfix = 0, name, ie11BugWorkaround; - while (created[desc + (postfix || '')]) - ++postfix; - desc += (postfix || ''); - created[desc] = true; - name = '@@' + desc; - defineProperty(objPrototype, name, d.gs(null, function (value) { - // For IE11 issue see: - // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/ - // ie11-broken-getters-on-dom-objects - // https://github.com/medikoo/es6-symbol/issues/12 - if (ie11BugWorkaround) - return; - ie11BugWorkaround = true; - defineProperty(this, name, d(value)); - ie11BugWorkaround = false; - })); - return name; - }; - }()); - // Internal constructor (not one exposed) for creating Symbol instances. - // This one is used to ensure that `someSymbol instanceof Symbol` always return false - HiddenSymbol = function Symbol(description) { - if (this instanceof HiddenSymbol) - throw new TypeError('Symbol is not a constructor'); - return SymbolPolyfill(description); - }; - // Exposed `Symbol` constructor - // (returns instances of HiddenSymbol) - module.exports = SymbolPolyfill = function Symbol(description) { - var symbol; - if (this instanceof Symbol) - throw new TypeError('Symbol is not a constructor'); - if (isNativeSafe) - return NativeSymbol(description); - symbol = create(HiddenSymbol.prototype); - description = (description === undefined ? '' : String(description)); - return defineProperties(symbol, { - __description__: d('', description), - __name__: d('', generateName(description)) - }); - }; - defineProperties(SymbolPolyfill, { - for: d(function (key) { - if (globalSymbols[key]) - return globalSymbols[key]; - return (globalSymbols[key] = SymbolPolyfill(String(key))); - }), - keyFor: d(function (s) { - var key; - validateSymbol(s); - for (key in globalSymbols) - if (globalSymbols[key] === s) - return key; - }), - // To ensure proper interoperability with other native functions (e.g. Array.from) - // fallback to eventual native implementation of given symbol - hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')), - isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) || - SymbolPolyfill('isConcatSpreadable')), - iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')), - match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')), - replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')), - search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')), - species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')), - split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')), - toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')), - toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')), - unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables')) - }); - // Internal tweaks for real symbol producer - defineProperties(HiddenSymbol.prototype, { - constructor: d(SymbolPolyfill), - toString: d('', function () { return this.__name__; }) - }); - // Proper implementation of methods exposed on Symbol.prototype - // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype - defineProperties(SymbolPolyfill.prototype, { - toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), - valueOf: d(function () { return validateSymbol(this); }) - }); - defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () { - var symbol = validateSymbol(this); - if (typeof symbol === 'symbol') - return symbol; - return symbol.toString(); - })); - defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol')); - // Proper implementaton of toPrimitive and toStringTag for returned symbol instances - defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])); - // Note: It's important to define `toPrimitive` as last one, as some implementations - // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols) - // And that may invoke error in definition flow: - // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149 - defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])); -} -, -/* es6-symbol/validate-symbol */ function _(require, module, exports) { - var isSymbol = require(360) /* ./is-symbol */; - module.exports = function (value) { - if (!isSymbol(value)) - throw new TypeError(value + " is not a symbol"); - return value; - }; -} -, -/* es6-weak-map/implement */ function _(require, module, exports) { - if (!require(364) /* ./is-implemented */()) { - Object.defineProperty(require(308) /* es5-ext/global */, 'WeakMap', { value: require(366) /* ./polyfill */, configurable: true, enumerable: false, - writable: true }); - } -} -, -/* es6-weak-map/is-implemented */ function _(require, module, exports) { - module.exports = function () { - var weakMap, x; - if (typeof WeakMap !== 'function') - return false; - try { - // WebKit doesn't support arguments and crashes - weakMap = new WeakMap([[x = {}, 'one'], [{}, 'two'], [{}, 'three']]); - } - catch (e) { - return false; - } - if (String(weakMap) !== '[object WeakMap]') - return false; - if (typeof weakMap.set !== 'function') - return false; - if (weakMap.set({}, 1) !== weakMap) - return false; - if (typeof weakMap.delete !== 'function') - return false; - if (typeof weakMap.has !== 'function') - return false; - if (weakMap.get(x) !== 'one') - return false; - return true; - }; -} -, -/* es6-weak-map/is-native-implemented */ function _(require, module, exports) { - module.exports = (function () { - if (typeof WeakMap !== 'function') - return false; - return (Object.prototype.toString.call(new WeakMap()) === '[object WeakMap]'); - }()); -} -, -/* es6-weak-map/polyfill */ function _(require, module, exports) { - var setPrototypeOf = require(333) /* es5-ext/object/set-prototype-of */, object = require(337) /* es5-ext/object/valid-object */, value = require(338) /* es5-ext/object/valid-value */, randomUniq = require(343) /* es5-ext/string/random-uniq */, d = require(299) /* d */, getIterator = require(346) /* es6-iterator/get */, forOf = require(345) /* es6-iterator/for-of */, toStringTagSymbol = require(358) /* es6-symbol */.toStringTag, isNative = require(365) /* ./is-native-implemented */, isArray = Array.isArray, defineProperty = Object.defineProperty, hasOwnProperty = Object.prototype.hasOwnProperty, getPrototypeOf = Object.getPrototypeOf, WeakMapPoly; - module.exports = WeakMapPoly = function ( /*iterable*/) { - var iterable = arguments[0], self; - if (!(this instanceof WeakMapPoly)) - throw new TypeError('Constructor requires \'new\''); - if (isNative && setPrototypeOf && (WeakMap !== WeakMapPoly)) { - self = setPrototypeOf(new WeakMap(), getPrototypeOf(this)); - } - else { - self = this; - } - if (iterable != null) { - if (!isArray(iterable)) - iterable = getIterator(iterable); - } - defineProperty(self, '__weakMapData__', d('c', '$weakMap$' + randomUniq())); - if (!iterable) - return self; - forOf(iterable, function (val) { - value(val); - self.set(val[0], val[1]); - }); - return self; - }; - if (isNative) { - if (setPrototypeOf) - setPrototypeOf(WeakMapPoly, WeakMap); - WeakMapPoly.prototype = Object.create(WeakMap.prototype, { - constructor: d(WeakMapPoly) - }); - } - Object.defineProperties(WeakMapPoly.prototype, { - delete: d(function (key) { - if (hasOwnProperty.call(object(key), this.__weakMapData__)) { - delete key[this.__weakMapData__]; - return true; - } - return false; - }), - get: d(function (key) { - if (hasOwnProperty.call(object(key), this.__weakMapData__)) { - return key[this.__weakMapData__]; - } - }), - has: d(function (key) { - return hasOwnProperty.call(object(key), this.__weakMapData__); - }), - set: d(function (key, value) { - defineProperty(object(key), this.__weakMapData__, d('c', value)); - return this; - }), - toString: d(function () { return '[object WeakMap]'; }) - }); - defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap')); -} -, -/* event-emitter/index */ function _(require, module, exports) { - var d = require(299) /* d */, callable = require(336) /* es5-ext/object/valid-callable */, apply = Function.prototype.apply, call = Function.prototype.call, create = Object.create, defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, hasOwnProperty = Object.prototype.hasOwnProperty, descriptor = { configurable: true, enumerable: false, writable: true }, on, once, off, emit, methods, descriptors, base; - on = function (type, listener) { - var data; - callable(listener); - if (!hasOwnProperty.call(this, '__ee__')) { - data = descriptor.value = create(null); - defineProperty(this, '__ee__', descriptor); - descriptor.value = null; - } - else { - data = this.__ee__; - } - if (!data[type]) - data[type] = listener; - else if (typeof data[type] === 'object') - data[type].push(listener); - else - data[type] = [data[type], listener]; - return this; - }; - once = function (type, listener) { - var once, self; - callable(listener); - self = this; - on.call(this, type, once = function () { - off.call(self, type, once); - apply.call(listener, this, arguments); - }); - once.__eeOnceListener__ = listener; - return this; - }; - off = function (type, listener) { - var data, listeners, candidate, i; - callable(listener); - if (!hasOwnProperty.call(this, '__ee__')) - return this; - data = this.__ee__; - if (!data[type]) - return this; - listeners = data[type]; - if (typeof listeners === 'object') { - for (i = 0; (candidate = listeners[i]); ++i) { - if ((candidate === listener) || - (candidate.__eeOnceListener__ === listener)) { - if (listeners.length === 2) - data[type] = listeners[i ? 0 : 1]; - else - listeners.splice(i, 1); - } - } - } - else { - if ((listeners === listener) || - (listeners.__eeOnceListener__ === listener)) { - delete data[type]; - } - } - return this; - }; - emit = function (type) { - var i, l, listener, listeners, args; - if (!hasOwnProperty.call(this, '__ee__')) - return; - listeners = this.__ee__[type]; - if (!listeners) - return; - if (typeof listeners === 'object') { - l = arguments.length; - args = new Array(l - 1); - for (i = 1; i < l; ++i) - args[i - 1] = arguments[i]; - listeners = listeners.slice(); - for (i = 0; (listener = listeners[i]); ++i) { - apply.call(listener, this, args); - } - } - else { - switch (arguments.length) { - case 1: - call.call(listeners, this); - break; - case 2: - call.call(listeners, this, arguments[1]); - break; - case 3: - call.call(listeners, this, arguments[1], arguments[2]); - break; - default: - l = arguments.length; - args = new Array(l - 1); - for (i = 1; i < l; ++i) { - args[i - 1] = arguments[i]; - } - apply.call(listeners, this, args); - } - } - }; - methods = { - on: on, - once: once, - off: off, - emit: emit - }; - descriptors = { - on: d(on), - once: d(once), - off: d(off), - emit: d(emit) - }; - base = defineProperties({}, descriptors); - module.exports = exports = function (o) { - return (o == null) ? create(base) : defineProperties(Object(o), descriptors); - }; - exports.methods = methods; -} -, -/* flatbush/flatbush */ function _(require, module, exports) { - (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.Flatbush = factory()); - }(this, function () { - 'use strict'; - var FlatQueue = function FlatQueue() { - this.ids = []; - this.values = []; - this.length = 0; - }; - FlatQueue.prototype.clear = function clear() { - this.length = this.ids.length = this.values.length = 0; - }; - FlatQueue.prototype.push = function push(id, value) { - this.ids.push(id); - this.values.push(value); - var pos = this.length++; - while (pos > 0) { - var parent = (pos - 1) >> 1; - var parentValue = this.values[parent]; - if (value >= parentValue) { - break; - } - this.ids[pos] = this.ids[parent]; - this.values[pos] = parentValue; - pos = parent; - } - this.ids[pos] = id; - this.values[pos] = value; - }; - FlatQueue.prototype.pop = function pop() { - if (this.length === 0) { - return undefined; - } - var top = this.ids[0]; - this.length--; - if (this.length > 0) { - var id = this.ids[0] = this.ids[this.length]; - var value = this.values[0] = this.values[this.length]; - var halfLength = this.length >> 1; - var pos = 0; - while (pos < halfLength) { - var left = (pos << 1) + 1; - var right = left + 1; - var bestIndex = this.ids[left]; - var bestValue = this.values[left]; - var rightValue = this.values[right]; - if (right < this.length && rightValue < bestValue) { - left = right; - bestIndex = this.ids[right]; - bestValue = rightValue; - } - if (bestValue >= value) { - break; - } - this.ids[pos] = bestIndex; - this.values[pos] = bestValue; - pos = left; - } - this.ids[pos] = id; - this.values[pos] = value; - } - this.ids.pop(); - this.values.pop(); - return top; - }; - FlatQueue.prototype.peek = function peek() { - return this.ids[0]; - }; - FlatQueue.prototype.peekValue = function peekValue() { - return this.values[0]; - }; - var ARRAY_TYPES = [ - Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, - Int32Array, Uint32Array, Float32Array, Float64Array - ]; - var VERSION = 3; // serialized format version - var Flatbush = function Flatbush(numItems, nodeSize, ArrayType, data) { - if (nodeSize === void 0) - nodeSize = 16; - if (ArrayType === void 0) - ArrayType = Float64Array; - if (numItems === undefined) { - throw new Error('Missing required argument: numItems.'); - } - if (isNaN(numItems) || numItems <= 0) { - throw new Error(("Unpexpected numItems value: " + numItems + ".")); - } - this.numItems = +numItems; - this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535); - // calculate the total number of nodes in the R-tree to allocate space for - // and the index of each tree level (used in search later) - var n = numItems; - var numNodes = n; - this._levelBounds = [n * 4]; - do { - n = Math.ceil(n / this.nodeSize); - numNodes += n; - this._levelBounds.push(numNodes * 4); - } while (n !== 1); - this.ArrayType = ArrayType || Float64Array; - this.IndexArrayType = numNodes < 16384 ? Uint16Array : Uint32Array; - var arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType); - var nodesByteSize = numNodes * 4 * this.ArrayType.BYTES_PER_ELEMENT; - if (arrayTypeIndex < 0) { - throw new Error(("Unexpected typed array class: " + ArrayType + ".")); - } - if (data && (data instanceof ArrayBuffer)) { - this.data = data; - this._boxes = new this.ArrayType(this.data, 8, numNodes * 4); - this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes); - this._pos = numNodes * 4; - this.minX = this._boxes[this._pos - 4]; - this.minY = this._boxes[this._pos - 3]; - this.maxX = this._boxes[this._pos - 2]; - this.maxY = this._boxes[this._pos - 1]; - } - else { - this.data = new ArrayBuffer(8 + nodesByteSize + numNodes * this.IndexArrayType.BYTES_PER_ELEMENT); - this._boxes = new this.ArrayType(this.data, 8, numNodes * 4); - this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes); - this._pos = 0; - this.minX = Infinity; - this.minY = Infinity; - this.maxX = -Infinity; - this.maxY = -Infinity; - new Uint8Array(this.data, 0, 2).set([0xfb, (VERSION << 4) + arrayTypeIndex]); - new Uint16Array(this.data, 2, 1)[0] = nodeSize; - new Uint32Array(this.data, 4, 1)[0] = numItems; - } - // a priority queue for k-nearest-neighbors queries - this._queue = new FlatQueue(); - }; - Flatbush.from = function from(data) { - if (!(data instanceof ArrayBuffer)) { - throw new Error('Data must be an instance of ArrayBuffer.'); - } - var ref = new Uint8Array(data, 0, 2); - var magic = ref[0]; - var versionAndType = ref[1]; - if (magic !== 0xfb) { - throw new Error('Data does not appear to be in a Flatbush format.'); - } - if (versionAndType >> 4 !== VERSION) { - throw new Error(("Got v" + (versionAndType >> 4) + " data when expected v" + VERSION + ".")); - } - var ref$1 = new Uint16Array(data, 2, 1); - var nodeSize = ref$1[0]; - var ref$2 = new Uint32Array(data, 4, 1); - var numItems = ref$2[0]; - return new Flatbush(numItems, nodeSize, ARRAY_TYPES[versionAndType & 0x0f], data); - }; - Flatbush.prototype.add = function add(minX, minY, maxX, maxY) { - var index = this._pos >> 2; - this._indices[index] = index; - this._boxes[this._pos++] = minX; - this._boxes[this._pos++] = minY; - this._boxes[this._pos++] = maxX; - this._boxes[this._pos++] = maxY; - if (minX < this.minX) { - this.minX = minX; - } - if (minY < this.minY) { - this.minY = minY; - } - if (maxX > this.maxX) { - this.maxX = maxX; - } - if (maxY > this.maxY) { - this.maxY = maxY; - } - }; - Flatbush.prototype.finish = function finish() { - if (this._pos >> 2 !== this.numItems) { - throw new Error(("Added " + (this._pos >> 2) + " items when expected " + (this.numItems) + ".")); - } - var width = this.maxX - this.minX; - var height = this.maxY - this.minY; - var hilbertValues = new Uint32Array(this.numItems); - var hilbertMax = (1 << 16) - 1; - // map item centers into Hilbert coordinate space and calculate Hilbert values - for (var i = 0; i < this.numItems; i++) { - var pos = 4 * i; - var minX = this._boxes[pos++]; - var minY = this._boxes[pos++]; - var maxX = this._boxes[pos++]; - var maxY = this._boxes[pos++]; - var x = Math.floor(hilbertMax * ((minX + maxX) / 2 - this.minX) / width); - var y = Math.floor(hilbertMax * ((minY + maxY) / 2 - this.minY) / height); - hilbertValues[i] = hilbert(x, y); - } - // sort items by their Hilbert value (for packing later) - sort(hilbertValues, this._boxes, this._indices, 0, this.numItems - 1); - // generate nodes at each tree level, bottom-up - for (var i$1 = 0, pos$1 = 0; i$1 < this._levelBounds.length - 1; i$1++) { - var end = this._levelBounds[i$1]; - // generate a parent node for each block of consecutive nodes - while (pos$1 < end) { - var nodeMinX = Infinity; - var nodeMinY = Infinity; - var nodeMaxX = -Infinity; - var nodeMaxY = -Infinity; - var nodeIndex = pos$1; - // calculate bbox for the new node - for (var i$2 = 0; i$2 < this.nodeSize && pos$1 < end; i$2++) { - var minX$1 = this._boxes[pos$1++]; - var minY$1 = this._boxes[pos$1++]; - var maxX$1 = this._boxes[pos$1++]; - var maxY$1 = this._boxes[pos$1++]; - if (minX$1 < nodeMinX) { - nodeMinX = minX$1; - } - if (minY$1 < nodeMinY) { - nodeMinY = minY$1; - } - if (maxX$1 > nodeMaxX) { - nodeMaxX = maxX$1; - } - if (maxY$1 > nodeMaxY) { - nodeMaxY = maxY$1; - } - } - // add the new node to the tree data - this._indices[this._pos >> 2] = nodeIndex; - this._boxes[this._pos++] = nodeMinX; - this._boxes[this._pos++] = nodeMinY; - this._boxes[this._pos++] = nodeMaxX; - this._boxes[this._pos++] = nodeMaxY; - } - } - }; - Flatbush.prototype.search = function search(minX, minY, maxX, maxY, filterFn) { - if (this._pos !== this._boxes.length) { - throw new Error('Data not yet indexed - call index.finish().'); - } - var nodeIndex = this._boxes.length - 4; - var level = this._levelBounds.length - 1; - var queue = []; - var results = []; - while (nodeIndex !== undefined) { - // find the end index of the node - var end = Math.min(nodeIndex + this.nodeSize * 4, this._levelBounds[level]); - // search through child nodes - for (var pos = nodeIndex; pos < end; pos += 4) { - var index = this._indices[pos >> 2] | 0; - // check if node bbox intersects with query bbox - if (maxX < this._boxes[pos]) { - continue; - } // maxX < nodeMinX - if (maxY < this._boxes[pos + 1]) { - continue; - } // maxY < nodeMinY - if (minX > this._boxes[pos + 2]) { - continue; - } // minX > nodeMaxX - if (minY > this._boxes[pos + 3]) { - continue; - } // minY > nodeMaxY - if (nodeIndex < this.numItems * 4) { - if (filterFn === undefined || filterFn(index)) { - results.push(index); // leaf item - } - } - else { - queue.push(index); // node; add it to the search queue - queue.push(level - 1); - } - } - level = queue.pop(); - nodeIndex = queue.pop(); - } - return results; - }; - Flatbush.prototype.neighbors = function neighbors(x, y, maxResults, maxDistance, filterFn) { - if (maxResults === void 0) - maxResults = Infinity; - if (maxDistance === void 0) - maxDistance = Infinity; - if (this._pos !== this._boxes.length) { - throw new Error('Data not yet indexed - call index.finish().'); - } - var nodeIndex = this._boxes.length - 4; - var q = this._queue; - var results = []; - var maxDistSquared = maxDistance * maxDistance; - while (nodeIndex !== undefined) { - // find the end index of the node - var end = Math.min(nodeIndex + this.nodeSize * 4, upperBound(nodeIndex, this._levelBounds)); - // add child nodes to the queue - for (var pos = nodeIndex; pos < end; pos += 4) { - var index = this._indices[pos >> 2] | 0; - var dx = axisDist(x, this._boxes[pos], this._boxes[pos + 2]); - var dy = axisDist(y, this._boxes[pos + 1], this._boxes[pos + 3]); - var dist = dx * dx + dy * dy; - if (nodeIndex < this.numItems * 4) { // leaf node - if (filterFn === undefined || filterFn(index)) { - // put a negative index if it's an item rather than a node, to recognize later - q.push(-index - 1, dist); - } - } - else { - q.push(index, dist); - } - } - // pop items from the queue - while (q.length && q.peek() < 0) { - var dist$1 = q.peekValue(); - if (dist$1 > maxDistSquared) { - q.clear(); - return results; - } - results.push(-q.pop() - 1); - if (results.length === maxResults) { - q.clear(); - return results; - } - } - nodeIndex = q.pop(); - } - q.clear(); - return results; - }; - function axisDist(k, min, max) { - return k < min ? min - k : k <= max ? 0 : k - max; - } - // binary search for the first value in the array bigger than the given - function upperBound(value, arr) { - var i = 0; - var j = arr.length - 1; - while (i < j) { - var m = (i + j) >> 1; - if (arr[m] > value) { - j = m; - } - else { - i = m + 1; - } - } - return arr[i]; - } - // custom quicksort that sorts bbox data alongside the hilbert values - function sort(values, boxes, indices, left, right) { - if (left >= right) { - return; - } - var pivot = values[(left + right) >> 1]; - var i = left - 1; - var j = right + 1; - while (true) { - do { - i++; - } while (values[i] < pivot); - do { - j--; - } while (values[j] > pivot); - if (i >= j) { - break; - } - swap(values, boxes, indices, i, j); - } - sort(values, boxes, indices, left, j); - sort(values, boxes, indices, j + 1, right); - } - // swap two values and two corresponding boxes - function swap(values, boxes, indices, i, j) { - var temp = values[i]; - values[i] = values[j]; - values[j] = temp; - var k = 4 * i; - var m = 4 * j; - var a = boxes[k]; - var b = boxes[k + 1]; - var c = boxes[k + 2]; - var d = boxes[k + 3]; - boxes[k] = boxes[m]; - boxes[k + 1] = boxes[m + 1]; - boxes[k + 2] = boxes[m + 2]; - boxes[k + 3] = boxes[m + 3]; - boxes[m] = a; - boxes[m + 1] = b; - boxes[m + 2] = c; - boxes[m + 3] = d; - var e = indices[i]; - indices[i] = indices[j]; - indices[j] = e; - } - // Fast Hilbert curve algorithm by http://threadlocalmutex.com/ - // Ported from C++ https://github.com/rawrunprotected/hilbert_curves (public domain) - function hilbert(x, y) { - var a = x ^ y; - var b = 0xFFFF ^ a; - var c = 0xFFFF ^ (x | y); - var d = x & (y ^ 0xFFFF); - var A = a | (b >> 1); - var B = (a >> 1) ^ a; - var C = ((c >> 1) ^ (b & (d >> 1))) ^ c; - var D = ((a & (c >> 1)) ^ (d >> 1)) ^ d; - a = A; - b = B; - c = C; - d = D; - A = ((a & (a >> 2)) ^ (b & (b >> 2))); - B = ((a & (b >> 2)) ^ (b & ((a ^ b) >> 2))); - C ^= ((a & (c >> 2)) ^ (b & (d >> 2))); - D ^= ((b & (c >> 2)) ^ ((a ^ b) & (d >> 2))); - a = A; - b = B; - c = C; - d = D; - A = ((a & (a >> 4)) ^ (b & (b >> 4))); - B = ((a & (b >> 4)) ^ (b & ((a ^ b) >> 4))); - C ^= ((a & (c >> 4)) ^ (b & (d >> 4))); - D ^= ((b & (c >> 4)) ^ ((a ^ b) & (d >> 4))); - a = A; - b = B; - c = C; - d = D; - C ^= ((a & (c >> 8)) ^ (b & (d >> 8))); - D ^= ((b & (c >> 8)) ^ ((a ^ b) & (d >> 8))); - a = C ^ (C >> 1); - b = D ^ (D >> 1); - var i0 = x ^ y; - var i1 = b | (0xFFFF ^ (i0 | a)); - i0 = (i0 | (i0 << 8)) & 0x00FF00FF; - i0 = (i0 | (i0 << 4)) & 0x0F0F0F0F; - i0 = (i0 | (i0 << 2)) & 0x33333333; - i0 = (i0 | (i0 << 1)) & 0x55555555; - i1 = (i1 | (i1 << 8)) & 0x00FF00FF; - i1 = (i1 | (i1 << 4)) & 0x0F0F0F0F; - i1 = (i1 | (i1 << 2)) & 0x33333333; - i1 = (i1 | (i1 << 1)) & 0x55555555; - return ((i1 << 1) | i0) >>> 0; - } - return Flatbush; - })); -} -, -/* hammerjs/hammer */ function _(require, module, exports) { - /*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ - (function (window, document, exportName, undefined) { - 'use strict'; - var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; - var TEST_ELEMENT = document.createElement('div'); - var TYPE_FUNCTION = 'function'; - var round = Math.round; - var abs = Math.abs; - var now = Date.now; - /** - * set a timeout with a given scope - * @param {Function} fn - * @param {Number} timeout - * @param {Object} context - * @returns {number} - */ - function setTimeoutContext(fn, timeout, context) { - return setTimeout(bindFn(fn, context), timeout); - } - /** - * if the argument is an array, we want to execute the fn on each entry - * if it aint an array we don't want to do a thing. - * this is used by all the methods that accept a single and array argument. - * @param {*|Array} arg - * @param {String} fn - * @param {Object} [context] - * @returns {Boolean} - */ - function invokeArrayArg(arg, fn, context) { - if (Array.isArray(arg)) { - each(arg, context[fn], context); - return true; - } - return false; - } - /** - * walk objects and arrays - * @param {Object} obj - * @param {Function} iterator - * @param {Object} context - */ - function each(obj, iterator, context) { - var i; - if (!obj) { - return; - } - if (obj.forEach) { - obj.forEach(iterator, context); - } - else if (obj.length !== undefined) { - i = 0; - while (i < obj.length) { - iterator.call(context, obj[i], i, obj); - i++; - } - } - else { - for (i in obj) { - obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); - } - } - } - /** - * wrap a method with a deprecation warning and stack trace - * @param {Function} method - * @param {String} name - * @param {String} message - * @returns {Function} A new function wrapping the supplied method. - */ - function deprecate(method, name, message) { - var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; - return function () { - var e = new Error('get-stack-trace'); - var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') - .replace(/^\s+at\s+/gm, '') - .replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; - var log = window.console && (window.console.warn || window.console.log); - if (log) { - log.call(window.console, deprecationMessage, stack); - } - return method.apply(this, arguments); - }; - } - /** - * extend object. - * means that properties in dest will be overwritten by the ones in src. - * @param {Object} target - * @param {...Object} objects_to_assign - * @returns {Object} target - */ - var assign; - if (typeof Object.assign !== 'function') { - assign = function assign(target) { - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - }; - } - else { - assign = Object.assign; - } - /** - * extend object. - * means that properties in dest will be overwritten by the ones in src. - * @param {Object} dest - * @param {Object} src - * @param {Boolean} [merge=false] - * @returns {Object} dest - */ - var extend = deprecate(function extend(dest, src, merge) { - var keys = Object.keys(src); - var i = 0; - while (i < keys.length) { - if (!merge || (merge && dest[keys[i]] === undefined)) { - dest[keys[i]] = src[keys[i]]; - } - i++; - } - return dest; - }, 'extend', 'Use `assign`.'); - /** - * merge the values from src in the dest. - * means that properties that exist in dest will not be overwritten by src - * @param {Object} dest - * @param {Object} src - * @returns {Object} dest - */ - var merge = deprecate(function merge(dest, src) { - return extend(dest, src, true); - }, 'merge', 'Use `assign`.'); - /** - * simple class inheritance - * @param {Function} child - * @param {Function} base - * @param {Object} [properties] - */ - function inherit(child, base, properties) { - var baseP = base.prototype, childP; - childP = child.prototype = Object.create(baseP); - childP.constructor = child; - childP._super = baseP; - if (properties) { - assign(childP, properties); - } - } - /** - * simple function bind - * @param {Function} fn - * @param {Object} context - * @returns {Function} - */ - function bindFn(fn, context) { - return function boundFn() { - return fn.apply(context, arguments); - }; - } - /** - * let a boolean value also be a function that must return a boolean - * this first item in args will be used as the context - * @param {Boolean|Function} val - * @param {Array} [args] - * @returns {Boolean} - */ - function boolOrFn(val, args) { - if (typeof val == TYPE_FUNCTION) { - return val.apply(args ? args[0] || undefined : undefined, args); - } - return val; - } - /** - * use the val2 when val1 is undefined - * @param {*} val1 - * @param {*} val2 - * @returns {*} - */ - function ifUndefined(val1, val2) { - return (val1 === undefined) ? val2 : val1; - } - /** - * addEventListener with multiple events at once - * @param {EventTarget} target - * @param {String} types - * @param {Function} handler - */ - function addEventListeners(target, types, handler) { - each(splitStr(types), function (type) { - target.addEventListener(type, handler, false); - }); - } - /** - * removeEventListener with multiple events at once - * @param {EventTarget} target - * @param {String} types - * @param {Function} handler - */ - function removeEventListeners(target, types, handler) { - each(splitStr(types), function (type) { - target.removeEventListener(type, handler, false); - }); - } - /** - * find if a node is in the given parent - * @method hasParent - * @param {HTMLElement} node - * @param {HTMLElement} parent - * @return {Boolean} found - */ - function hasParent(node, parent) { - while (node) { - if (node == parent) { - return true; - } - node = node.parentNode; - } - return false; - } - /** - * small indexOf wrapper - * @param {String} str - * @param {String} find - * @returns {Boolean} found - */ - function inStr(str, find) { - return str.indexOf(find) > -1; - } - /** - * split string on whitespace - * @param {String} str - * @returns {Array} words - */ - function splitStr(str) { - return str.trim().split(/\s+/g); - } - /** - * find if a array contains the object using indexOf or a simple polyFill - * @param {Array} src - * @param {String} find - * @param {String} [findByKey] - * @return {Boolean|Number} false when not found, or the index - */ - function inArray(src, find, findByKey) { - if (src.indexOf && !findByKey) { - return src.indexOf(find); - } - else { - var i = 0; - while (i < src.length) { - if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { - return i; - } - i++; - } - return -1; - } - } - /** - * convert array-like objects to real arrays - * @param {Object} obj - * @returns {Array} - */ - function toArray(obj) { - return Array.prototype.slice.call(obj, 0); - } - /** - * unique array with objects based on a key (like 'id') or just by the array's value - * @param {Array} src [{id:1},{id:2},{id:1}] - * @param {String} [key] - * @param {Boolean} [sort=False] - * @returns {Array} [{id:1},{id:2}] - */ - function uniqueArray(src, key, sort) { - var results = []; - var values = []; - var i = 0; - while (i < src.length) { - var val = key ? src[i][key] : src[i]; - if (inArray(values, val) < 0) { - results.push(src[i]); - } - values[i] = val; - i++; - } - if (sort) { - if (!key) { - results = results.sort(); - } - else { - results = results.sort(function sortUniqueArray(a, b) { - return a[key] > b[key]; - }); - } - } - return results; - } - /** - * get the prefixed property - * @param {Object} obj - * @param {String} property - * @returns {String|Undefined} prefixed - */ - function prefixed(obj, property) { - var prefix, prop; - var camelProp = property[0].toUpperCase() + property.slice(1); - var i = 0; - while (i < VENDOR_PREFIXES.length) { - prefix = VENDOR_PREFIXES[i]; - prop = (prefix) ? prefix + camelProp : property; - if (prop in obj) { - return prop; - } - i++; - } - return undefined; - } - /** - * get a unique id - * @returns {number} uniqueId - */ - var _uniqueId = 1; - function uniqueId() { - return _uniqueId++; - } - /** - * get the window object of an element - * @param {HTMLElement} element - * @returns {DocumentView|Window} - */ - function getWindowForElement(element) { - var doc = element.ownerDocument || element; - return (doc.defaultView || doc.parentWindow || window); - } - var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; - var SUPPORT_TOUCH = ('ontouchstart' in window); - var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; - var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); - var INPUT_TYPE_TOUCH = 'touch'; - var INPUT_TYPE_PEN = 'pen'; - var INPUT_TYPE_MOUSE = 'mouse'; - var INPUT_TYPE_KINECT = 'kinect'; - var COMPUTE_INTERVAL = 25; - var INPUT_START = 1; - var INPUT_MOVE = 2; - var INPUT_END = 4; - var INPUT_CANCEL = 8; - var DIRECTION_NONE = 1; - var DIRECTION_LEFT = 2; - var DIRECTION_RIGHT = 4; - var DIRECTION_UP = 8; - var DIRECTION_DOWN = 16; - var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; - var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; - var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; - var PROPS_XY = ['x', 'y']; - var PROPS_CLIENT_XY = ['clientX', 'clientY']; - /** - * create new input type manager - * @param {Manager} manager - * @param {Function} callback - * @returns {Input} - * @constructor - */ - function Input(manager, callback) { - var self = this; - this.manager = manager; - this.callback = callback; - this.element = manager.element; - this.target = manager.options.inputTarget; - // smaller wrapper around the handler, for the scope and the enabled state of the manager, - // so when disabled the input events are completely bypassed. - this.domHandler = function (ev) { - if (boolOrFn(manager.options.enable, [manager])) { - self.handler(ev); - } - }; - this.init(); - } - Input.prototype = { - /** - * should handle the inputEvent data and trigger the callback - * @virtual - */ - handler: function () { }, - /** - * bind the events - */ - init: function () { - this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); - this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); - this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); - }, - /** - * unbind the events - */ - destroy: function () { - this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); - this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); - this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); - } - }; - /** - * create new input type manager - * called by the Manager constructor - * @param {Hammer} manager - * @returns {Input} - */ - function createInputInstance(manager) { - var Type; - var inputClass = manager.options.inputClass; - if (inputClass) { - Type = inputClass; - } - else if (SUPPORT_POINTER_EVENTS) { - Type = PointerEventInput; - } - else if (SUPPORT_ONLY_TOUCH) { - Type = TouchInput; - } - else if (!SUPPORT_TOUCH) { - Type = MouseInput; - } - else { - Type = TouchMouseInput; - } - return new (Type)(manager, inputHandler); - } - /** - * handle input events - * @param {Manager} manager - * @param {String} eventType - * @param {Object} input - */ - function inputHandler(manager, eventType, input) { - var pointersLen = input.pointers.length; - var changedPointersLen = input.changedPointers.length; - var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); - var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); - input.isFirst = !!isFirst; - input.isFinal = !!isFinal; - if (isFirst) { - manager.session = {}; - } - // source event is the normalized value of the domEvents - // like 'touchstart, mouseup, pointerdown' - input.eventType = eventType; - // compute scale, rotation etc - computeInputData(manager, input); - // emit secret event - manager.emit('hammer.input', input); - manager.recognize(input); - manager.session.prevInput = input; - } - /** - * extend the data with some usable properties like scale, rotate, velocity etc - * @param {Object} manager - * @param {Object} input - */ - function computeInputData(manager, input) { - var session = manager.session; - var pointers = input.pointers; - var pointersLength = pointers.length; - // store the first input to calculate the distance and direction - if (!session.firstInput) { - session.firstInput = simpleCloneInputData(input); - } - // to compute scale and rotation we need to store the multiple touches - if (pointersLength > 1 && !session.firstMultiple) { - session.firstMultiple = simpleCloneInputData(input); - } - else if (pointersLength === 1) { - session.firstMultiple = false; - } - var firstInput = session.firstInput; - var firstMultiple = session.firstMultiple; - var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; - var center = input.center = getCenter(pointers); - input.timeStamp = now(); - input.deltaTime = input.timeStamp - firstInput.timeStamp; - input.angle = getAngle(offsetCenter, center); - input.distance = getDistance(offsetCenter, center); - computeDeltaXY(session, input); - input.offsetDirection = getDirection(input.deltaX, input.deltaY); - var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); - input.overallVelocityX = overallVelocity.x; - input.overallVelocityY = overallVelocity.y; - input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; - input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; - input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; - input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > - session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); - computeIntervalInputData(session, input); - // find the correct target - var target = manager.element; - if (hasParent(input.srcEvent.target, target)) { - target = input.srcEvent.target; - } - input.target = target; - } - function computeDeltaXY(session, input) { - var center = input.center; - var offset = session.offsetDelta || {}; - var prevDelta = session.prevDelta || {}; - var prevInput = session.prevInput || {}; - if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { - prevDelta = session.prevDelta = { - x: prevInput.deltaX || 0, - y: prevInput.deltaY || 0 - }; - offset = session.offsetDelta = { - x: center.x, - y: center.y - }; - } - input.deltaX = prevDelta.x + (center.x - offset.x); - input.deltaY = prevDelta.y + (center.y - offset.y); - } - /** - * velocity is calculated every x ms - * @param {Object} session - * @param {Object} input - */ - function computeIntervalInputData(session, input) { - var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction; - if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { - var deltaX = input.deltaX - last.deltaX; - var deltaY = input.deltaY - last.deltaY; - var v = getVelocity(deltaTime, deltaX, deltaY); - velocityX = v.x; - velocityY = v.y; - velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; - direction = getDirection(deltaX, deltaY); - session.lastInterval = input; - } - else { - // use latest velocity info if it doesn't overtake a minimum period - velocity = last.velocity; - velocityX = last.velocityX; - velocityY = last.velocityY; - direction = last.direction; - } - input.velocity = velocity; - input.velocityX = velocityX; - input.velocityY = velocityY; - input.direction = direction; - } - /** - * create a simple clone from the input used for storage of firstInput and firstMultiple - * @param {Object} input - * @returns {Object} clonedInputData - */ - function simpleCloneInputData(input) { - // make a simple copy of the pointers because we will get a reference if we don't - // we only need clientXY for the calculations - var pointers = []; - var i = 0; - while (i < input.pointers.length) { - pointers[i] = { - clientX: round(input.pointers[i].clientX), - clientY: round(input.pointers[i].clientY) - }; - i++; - } - return { - timeStamp: now(), - pointers: pointers, - center: getCenter(pointers), - deltaX: input.deltaX, - deltaY: input.deltaY - }; - } - /** - * get the center of all the pointers - * @param {Array} pointers - * @return {Object} center contains `x` and `y` properties - */ - function getCenter(pointers) { - var pointersLength = pointers.length; - // no need to loop when only one touch - if (pointersLength === 1) { - return { - x: round(pointers[0].clientX), - y: round(pointers[0].clientY) - }; - } - var x = 0, y = 0, i = 0; - while (i < pointersLength) { - x += pointers[i].clientX; - y += pointers[i].clientY; - i++; - } - return { - x: round(x / pointersLength), - y: round(y / pointersLength) - }; - } - /** - * calculate the velocity between two points. unit is in px per ms. - * @param {Number} deltaTime - * @param {Number} x - * @param {Number} y - * @return {Object} velocity `x` and `y` - */ - function getVelocity(deltaTime, x, y) { - return { - x: x / deltaTime || 0, - y: y / deltaTime || 0 - }; - } - /** - * get the direction between two points - * @param {Number} x - * @param {Number} y - * @return {Number} direction - */ - function getDirection(x, y) { - if (x === y) { - return DIRECTION_NONE; - } - if (abs(x) >= abs(y)) { - return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; - } - return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; - } - /** - * calculate the absolute distance between two points - * @param {Object} p1 {x, y} - * @param {Object} p2 {x, y} - * @param {Array} [props] containing x and y keys - * @return {Number} distance - */ - function getDistance(p1, p2, props) { - if (!props) { - props = PROPS_XY; - } - var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; - return Math.sqrt((x * x) + (y * y)); - } - /** - * calculate the angle between two coordinates - * @param {Object} p1 - * @param {Object} p2 - * @param {Array} [props] containing x and y keys - * @return {Number} angle - */ - function getAngle(p1, p2, props) { - if (!props) { - props = PROPS_XY; - } - var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; - return Math.atan2(y, x) * 180 / Math.PI; - } - /** - * calculate the rotation degrees between two pointersets - * @param {Array} start array of pointers - * @param {Array} end array of pointers - * @return {Number} rotation - */ - function getRotation(start, end) { - return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); - } - /** - * calculate the scale factor between two pointersets - * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out - * @param {Array} start array of pointers - * @param {Array} end array of pointers - * @return {Number} scale - */ - function getScale(start, end) { - return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); - } - var MOUSE_INPUT_MAP = { - mousedown: INPUT_START, - mousemove: INPUT_MOVE, - mouseup: INPUT_END - }; - var MOUSE_ELEMENT_EVENTS = 'mousedown'; - var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; - /** - * Mouse events input - * @constructor - * @extends Input - */ - function MouseInput() { - this.evEl = MOUSE_ELEMENT_EVENTS; - this.evWin = MOUSE_WINDOW_EVENTS; - this.pressed = false; // mousedown state - Input.apply(this, arguments); - } - inherit(MouseInput, Input, { - /** - * handle mouse events - * @param {Object} ev - */ - handler: function MEhandler(ev) { - var eventType = MOUSE_INPUT_MAP[ev.type]; - // on start we want to have the left mouse button down - if (eventType & INPUT_START && ev.button === 0) { - this.pressed = true; - } - if (eventType & INPUT_MOVE && ev.which !== 1) { - eventType = INPUT_END; - } - // mouse must be down - if (!this.pressed) { - return; - } - if (eventType & INPUT_END) { - this.pressed = false; - } - this.callback(this.manager, eventType, { - pointers: [ev], - changedPointers: [ev], - pointerType: INPUT_TYPE_MOUSE, - srcEvent: ev - }); - } - }); - var POINTER_INPUT_MAP = { - pointerdown: INPUT_START, - pointermove: INPUT_MOVE, - pointerup: INPUT_END, - pointercancel: INPUT_CANCEL, - pointerout: INPUT_CANCEL - }; - // in IE10 the pointer types is defined as an enum - var IE10_POINTER_TYPE_ENUM = { - 2: INPUT_TYPE_TOUCH, - 3: INPUT_TYPE_PEN, - 4: INPUT_TYPE_MOUSE, - 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 - }; - var POINTER_ELEMENT_EVENTS = 'pointerdown'; - var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; - // IE10 has prefixed support, and case-sensitive - if (window.MSPointerEvent && !window.PointerEvent) { - POINTER_ELEMENT_EVENTS = 'MSPointerDown'; - POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; - } - /** - * Pointer events input - * @constructor - * @extends Input - */ - function PointerEventInput() { - this.evEl = POINTER_ELEMENT_EVENTS; - this.evWin = POINTER_WINDOW_EVENTS; - Input.apply(this, arguments); - this.store = (this.manager.session.pointerEvents = []); - } - inherit(PointerEventInput, Input, { - /** - * handle mouse events - * @param {Object} ev - */ - handler: function PEhandler(ev) { - var store = this.store; - var removePointer = false; - var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); - var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; - var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; - var isTouch = (pointerType == INPUT_TYPE_TOUCH); - // get index of the event in the store - var storeIndex = inArray(store, ev.pointerId, 'pointerId'); - // start and mouse must be down - if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { - if (storeIndex < 0) { - store.push(ev); - storeIndex = store.length - 1; - } - } - else if (eventType & (INPUT_END | INPUT_CANCEL)) { - removePointer = true; - } - // it not found, so the pointer hasn't been down (so it's probably a hover) - if (storeIndex < 0) { - return; - } - // update the event in the store - store[storeIndex] = ev; - this.callback(this.manager, eventType, { - pointers: store, - changedPointers: [ev], - pointerType: pointerType, - srcEvent: ev - }); - if (removePointer) { - // remove from the store - store.splice(storeIndex, 1); - } - } - }); - var SINGLE_TOUCH_INPUT_MAP = { - touchstart: INPUT_START, - touchmove: INPUT_MOVE, - touchend: INPUT_END, - touchcancel: INPUT_CANCEL - }; - var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; - var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; - /** - * Touch events input - * @constructor - * @extends Input - */ - function SingleTouchInput() { - this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; - this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; - this.started = false; - Input.apply(this, arguments); - } - inherit(SingleTouchInput, Input, { - handler: function TEhandler(ev) { - var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; - // should we handle the touch events? - if (type === INPUT_START) { - this.started = true; - } - if (!this.started) { - return; - } - var touches = normalizeSingleTouches.call(this, ev, type); - // when done, reset the started state - if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { - this.started = false; - } - this.callback(this.manager, type, { - pointers: touches[0], - changedPointers: touches[1], - pointerType: INPUT_TYPE_TOUCH, - srcEvent: ev - }); - } - }); - /** - * @this {TouchInput} - * @param {Object} ev - * @param {Number} type flag - * @returns {undefined|Array} [all, changed] - */ - function normalizeSingleTouches(ev, type) { - var all = toArray(ev.touches); - var changed = toArray(ev.changedTouches); - if (type & (INPUT_END | INPUT_CANCEL)) { - all = uniqueArray(all.concat(changed), 'identifier', true); - } - return [all, changed]; - } - var TOUCH_INPUT_MAP = { - touchstart: INPUT_START, - touchmove: INPUT_MOVE, - touchend: INPUT_END, - touchcancel: INPUT_CANCEL - }; - var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; - /** - * Multi-user touch events input - * @constructor - * @extends Input - */ - function TouchInput() { - this.evTarget = TOUCH_TARGET_EVENTS; - this.targetIds = {}; - Input.apply(this, arguments); - } - inherit(TouchInput, Input, { - handler: function MTEhandler(ev) { - var type = TOUCH_INPUT_MAP[ev.type]; - var touches = getTouches.call(this, ev, type); - if (!touches) { - return; - } - this.callback(this.manager, type, { - pointers: touches[0], - changedPointers: touches[1], - pointerType: INPUT_TYPE_TOUCH, - srcEvent: ev - }); - } - }); - /** - * @this {TouchInput} - * @param {Object} ev - * @param {Number} type flag - * @returns {undefined|Array} [all, changed] - */ - function getTouches(ev, type) { - var allTouches = toArray(ev.touches); - var targetIds = this.targetIds; - // when there is only one touch, the process can be simplified - if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { - targetIds[allTouches[0].identifier] = true; - return [allTouches, allTouches]; - } - var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target; - // get target touches from touches - targetTouches = allTouches.filter(function (touch) { - return hasParent(touch.target, target); - }); - // collect touches - if (type === INPUT_START) { - i = 0; - while (i < targetTouches.length) { - targetIds[targetTouches[i].identifier] = true; - i++; - } - } - // filter changed touches to only contain touches that exist in the collected target ids - i = 0; - while (i < changedTouches.length) { - if (targetIds[changedTouches[i].identifier]) { - changedTargetTouches.push(changedTouches[i]); - } - // cleanup removed touches - if (type & (INPUT_END | INPUT_CANCEL)) { - delete targetIds[changedTouches[i].identifier]; - } - i++; - } - if (!changedTargetTouches.length) { - return; - } - return [ - // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' - uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), - changedTargetTouches - ]; - } - /** - * Combined touch and mouse input - * - * Touch has a higher priority then mouse, and while touching no mouse events are allowed. - * This because touch devices also emit mouse events while doing a touch. - * - * @constructor - * @extends Input - */ - var DEDUP_TIMEOUT = 2500; - var DEDUP_DISTANCE = 25; - function TouchMouseInput() { - Input.apply(this, arguments); - var handler = bindFn(this.handler, this); - this.touch = new TouchInput(this.manager, handler); - this.mouse = new MouseInput(this.manager, handler); - this.primaryTouch = null; - this.lastTouches = []; - } - inherit(TouchMouseInput, Input, { - /** - * handle mouse and touch events - * @param {Hammer} manager - * @param {String} inputEvent - * @param {Object} inputData - */ - handler: function TMEhandler(manager, inputEvent, inputData) { - var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); - if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { - return; - } - // when we're in a touch event, record touches to de-dupe synthetic mouse event - if (isTouch) { - recordTouches.call(this, inputEvent, inputData); - } - else if (isMouse && isSyntheticEvent.call(this, inputData)) { - return; - } - this.callback(manager, inputEvent, inputData); - }, - /** - * remove the event listeners - */ - destroy: function destroy() { - this.touch.destroy(); - this.mouse.destroy(); - } - }); - function recordTouches(eventType, eventData) { - if (eventType & INPUT_START) { - this.primaryTouch = eventData.changedPointers[0].identifier; - setLastTouch.call(this, eventData); - } - else if (eventType & (INPUT_END | INPUT_CANCEL)) { - setLastTouch.call(this, eventData); - } - } - function setLastTouch(eventData) { - var touch = eventData.changedPointers[0]; - if (touch.identifier === this.primaryTouch) { - var lastTouch = { x: touch.clientX, y: touch.clientY }; - this.lastTouches.push(lastTouch); - var lts = this.lastTouches; - var removeLastTouch = function () { - var i = lts.indexOf(lastTouch); - if (i > -1) { - lts.splice(i, 1); - } - }; - setTimeout(removeLastTouch, DEDUP_TIMEOUT); - } - } - function isSyntheticEvent(eventData) { - var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; - for (var i = 0; i < this.lastTouches.length; i++) { - var t = this.lastTouches[i]; - var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); - if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { - return true; - } - } - return false; - } - var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); - var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; - // magical touchAction value - var TOUCH_ACTION_COMPUTE = 'compute'; - var TOUCH_ACTION_AUTO = 'auto'; - var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented - var TOUCH_ACTION_NONE = 'none'; - var TOUCH_ACTION_PAN_X = 'pan-x'; - var TOUCH_ACTION_PAN_Y = 'pan-y'; - var TOUCH_ACTION_MAP = getTouchActionProps(); - /** - * Touch Action - * sets the touchAction property or uses the js alternative - * @param {Manager} manager - * @param {String} value - * @constructor - */ - function TouchAction(manager, value) { - this.manager = manager; - this.set(value); - } - TouchAction.prototype = { - /** - * set the touchAction value on the element or enable the polyfill - * @param {String} value - */ - set: function (value) { - // find out the touch-action by the event handlers - if (value == TOUCH_ACTION_COMPUTE) { - value = this.compute(); - } - if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { - this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; - } - this.actions = value.toLowerCase().trim(); - }, - /** - * just re-set the touchAction value - */ - update: function () { - this.set(this.manager.options.touchAction); - }, - /** - * compute the value for the touchAction property based on the recognizer's settings - * @returns {String} value - */ - compute: function () { - var actions = []; - each(this.manager.recognizers, function (recognizer) { - if (boolOrFn(recognizer.options.enable, [recognizer])) { - actions = actions.concat(recognizer.getTouchAction()); - } - }); - return cleanTouchActions(actions.join(' ')); - }, - /** - * this method is called on each input cycle and provides the preventing of the browser behavior - * @param {Object} input - */ - preventDefaults: function (input) { - var srcEvent = input.srcEvent; - var direction = input.offsetDirection; - // if the touch action did prevented once this session - if (this.manager.session.prevented) { - srcEvent.preventDefault(); - return; - } - var actions = this.actions; - var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; - var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; - var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; - if (hasNone) { - //do not prevent defaults if this is a tap gesture - var isTapPointer = input.pointers.length === 1; - var isTapMovement = input.distance < 2; - var isTapTouchTime = input.deltaTime < 250; - if (isTapPointer && isTapMovement && isTapTouchTime) { - return; - } - } - if (hasPanX && hasPanY) { - // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent - return; - } - if (hasNone || - (hasPanY && direction & DIRECTION_HORIZONTAL) || - (hasPanX && direction & DIRECTION_VERTICAL)) { - return this.preventSrc(srcEvent); - } - }, - /** - * call preventDefault to prevent the browser's default behavior (scrolling in most cases) - * @param {Object} srcEvent - */ - preventSrc: function (srcEvent) { - this.manager.session.prevented = true; - srcEvent.preventDefault(); - } - }; - /** - * when the touchActions are collected they are not a valid value, so we need to clean things up. * - * @param {String} actions - * @returns {*} - */ - function cleanTouchActions(actions) { - // none - if (inStr(actions, TOUCH_ACTION_NONE)) { - return TOUCH_ACTION_NONE; - } - var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); - var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); - // if both pan-x and pan-y are set (different recognizers - // for different directions, e.g. horizontal pan but vertical swipe?) - // we need none (as otherwise with pan-x pan-y combined none of these - // recognizers will work, since the browser would handle all panning - if (hasPanX && hasPanY) { - return TOUCH_ACTION_NONE; - } - // pan-x OR pan-y - if (hasPanX || hasPanY) { - return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; - } - // manipulation - if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { - return TOUCH_ACTION_MANIPULATION; - } - return TOUCH_ACTION_AUTO; - } - function getTouchActionProps() { - if (!NATIVE_TOUCH_ACTION) { - return false; - } - var touchMap = {}; - var cssSupports = window.CSS && window.CSS.supports; - ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) { - // If css.supports is not supported but there is native touch-action assume it supports - // all values. This is the case for IE 10 and 11. - touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; - }); - return touchMap; - } - /** - * Recognizer flow explained; * - * All recognizers have the initial state of POSSIBLE when a input session starts. - * The definition of a input session is from the first input until the last input, with all it's movement in it. * - * Example session for mouse-input: mousedown -> mousemove -> mouseup - * - * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed - * which determines with state it should be. - * - * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to - * POSSIBLE to give it another change on the next cycle. - * - * Possible - * | - * +-----+---------------+ - * | | - * +-----+-----+ | - * | | | - * Failed Cancelled | - * +-------+------+ - * | | - * Recognized Began - * | - * Changed - * | - * Ended/Recognized - */ - var STATE_POSSIBLE = 1; - var STATE_BEGAN = 2; - var STATE_CHANGED = 4; - var STATE_ENDED = 8; - var STATE_RECOGNIZED = STATE_ENDED; - var STATE_CANCELLED = 16; - var STATE_FAILED = 32; - /** - * Recognizer - * Every recognizer needs to extend from this class. - * @constructor - * @param {Object} options - */ - function Recognizer(options) { - this.options = assign({}, this.defaults, options || {}); - this.id = uniqueId(); - this.manager = null; - // default is enable true - this.options.enable = ifUndefined(this.options.enable, true); - this.state = STATE_POSSIBLE; - this.simultaneous = {}; - this.requireFail = []; - } - Recognizer.prototype = { - /** - * @virtual - * @type {Object} - */ - defaults: {}, - /** - * set options - * @param {Object} options - * @return {Recognizer} - */ - set: function (options) { - assign(this.options, options); - // also update the touchAction, in case something changed about the directions/enabled state - this.manager && this.manager.touchAction.update(); - return this; - }, - /** - * recognize simultaneous with an other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - recognizeWith: function (otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { - return this; - } - var simultaneous = this.simultaneous; - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - if (!simultaneous[otherRecognizer.id]) { - simultaneous[otherRecognizer.id] = otherRecognizer; - otherRecognizer.recognizeWith(this); - } - return this; - }, - /** - * drop the simultaneous link. it doesnt remove the link on the other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - dropRecognizeWith: function (otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { - return this; - } - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - delete this.simultaneous[otherRecognizer.id]; - return this; - }, - /** - * recognizer can only run when an other is failing - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - requireFailure: function (otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { - return this; - } - var requireFail = this.requireFail; - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - if (inArray(requireFail, otherRecognizer) === -1) { - requireFail.push(otherRecognizer); - otherRecognizer.requireFailure(this); - } - return this; - }, - /** - * drop the requireFailure link. it does not remove the link on the other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - dropRequireFailure: function (otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { - return this; - } - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - var index = inArray(this.requireFail, otherRecognizer); - if (index > -1) { - this.requireFail.splice(index, 1); - } - return this; - }, - /** - * has require failures boolean - * @returns {boolean} - */ - hasRequireFailures: function () { - return this.requireFail.length > 0; - }, - /** - * if the recognizer can recognize simultaneous with an other recognizer - * @param {Recognizer} otherRecognizer - * @returns {Boolean} - */ - canRecognizeWith: function (otherRecognizer) { - return !!this.simultaneous[otherRecognizer.id]; - }, - /** - * You should use `tryEmit` instead of `emit` directly to check - * that all the needed recognizers has failed before emitting. - * @param {Object} input - */ - emit: function (input) { - var self = this; - var state = this.state; - function emit(event) { - self.manager.emit(event, input); - } - // 'panstart' and 'panmove' - if (state < STATE_ENDED) { - emit(self.options.event + stateStr(state)); - } - emit(self.options.event); // simple 'eventName' events - if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) - emit(input.additionalEvent); - } - // panend and pancancel - if (state >= STATE_ENDED) { - emit(self.options.event + stateStr(state)); - } - }, - /** - * Check that all the require failure recognizers has failed, - * if true, it emits a gesture event, - * otherwise, setup the state to FAILED. - * @param {Object} input - */ - tryEmit: function (input) { - if (this.canEmit()) { - return this.emit(input); - } - // it's failing anyway - this.state = STATE_FAILED; - }, - /** - * can we emit? - * @returns {boolean} - */ - canEmit: function () { - var i = 0; - while (i < this.requireFail.length) { - if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { - return false; - } - i++; - } - return true; - }, - /** - * update the recognizer - * @param {Object} inputData - */ - recognize: function (inputData) { - // make a new copy of the inputData - // so we can change the inputData without messing up the other recognizers - var inputDataClone = assign({}, inputData); - // is is enabled and allow recognizing? - if (!boolOrFn(this.options.enable, [this, inputDataClone])) { - this.reset(); - this.state = STATE_FAILED; - return; - } - // reset when we've reached the end - if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { - this.state = STATE_POSSIBLE; - } - this.state = this.process(inputDataClone); - // the recognizer has recognized a gesture - // so trigger an event - if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { - this.tryEmit(inputDataClone); - } - }, - /** - * return the state of the recognizer - * the actual recognizing happens in this method - * @virtual - * @param {Object} inputData - * @returns {Const} STATE - */ - process: function (inputData) { }, - /** - * return the preferred touch-action - * @virtual - * @returns {Array} - */ - getTouchAction: function () { }, - /** - * called when the gesture isn't allowed to recognize - * like when another is being recognized or it is disabled - * @virtual - */ - reset: function () { } - }; - /** - * get a usable string, used as event postfix - * @param {Const} state - * @returns {String} state - */ - function stateStr(state) { - if (state & STATE_CANCELLED) { - return 'cancel'; - } - else if (state & STATE_ENDED) { - return 'end'; - } - else if (state & STATE_CHANGED) { - return 'move'; - } - else if (state & STATE_BEGAN) { - return 'start'; - } - return ''; - } - /** - * direction cons to string - * @param {Const} direction - * @returns {String} - */ - function directionStr(direction) { - if (direction == DIRECTION_DOWN) { - return 'down'; - } - else if (direction == DIRECTION_UP) { - return 'up'; - } - else if (direction == DIRECTION_LEFT) { - return 'left'; - } - else if (direction == DIRECTION_RIGHT) { - return 'right'; - } - return ''; - } - /** - * get a recognizer by name if it is bound to a manager - * @param {Recognizer|String} otherRecognizer - * @param {Recognizer} recognizer - * @returns {Recognizer} - */ - function getRecognizerByNameIfManager(otherRecognizer, recognizer) { - var manager = recognizer.manager; - if (manager) { - return manager.get(otherRecognizer); - } - return otherRecognizer; - } - /** - * This recognizer is just used as a base for the simple attribute recognizers. - * @constructor - * @extends Recognizer - */ - function AttrRecognizer() { - Recognizer.apply(this, arguments); - } - inherit(AttrRecognizer, Recognizer, { - /** - * @namespace - * @memberof AttrRecognizer - */ - defaults: { - /** - * @type {Number} - * @default 1 - */ - pointers: 1 - }, - /** - * Used to check if it the recognizer receives valid input, like input.distance > 10. - * @memberof AttrRecognizer - * @param {Object} input - * @returns {Boolean} recognized - */ - attrTest: function (input) { - var optionPointers = this.options.pointers; - return optionPointers === 0 || input.pointers.length === optionPointers; - }, - /** - * Process the input and return the state for the recognizer - * @memberof AttrRecognizer - * @param {Object} input - * @returns {*} State - */ - process: function (input) { - var state = this.state; - var eventType = input.eventType; - var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); - var isValid = this.attrTest(input); - // on cancel input and we've recognized before, return STATE_CANCELLED - if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { - return state | STATE_CANCELLED; - } - else if (isRecognized || isValid) { - if (eventType & INPUT_END) { - return state | STATE_ENDED; - } - else if (!(state & STATE_BEGAN)) { - return STATE_BEGAN; - } - return state | STATE_CHANGED; - } - return STATE_FAILED; - } - }); - /** - * Pan - * Recognized when the pointer is down and moved in the allowed direction. - * @constructor - * @extends AttrRecognizer - */ - function PanRecognizer() { - AttrRecognizer.apply(this, arguments); - this.pX = null; - this.pY = null; - } - inherit(PanRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof PanRecognizer - */ - defaults: { - event: 'pan', - threshold: 10, - pointers: 1, - direction: DIRECTION_ALL - }, - getTouchAction: function () { - var direction = this.options.direction; - var actions = []; - if (direction & DIRECTION_HORIZONTAL) { - actions.push(TOUCH_ACTION_PAN_Y); - } - if (direction & DIRECTION_VERTICAL) { - actions.push(TOUCH_ACTION_PAN_X); - } - return actions; - }, - directionTest: function (input) { - var options = this.options; - var hasMoved = true; - var distance = input.distance; - var direction = input.direction; - var x = input.deltaX; - var y = input.deltaY; - // lock to axis? - if (!(direction & options.direction)) { - if (options.direction & DIRECTION_HORIZONTAL) { - direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; - hasMoved = x != this.pX; - distance = Math.abs(input.deltaX); - } - else { - direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; - hasMoved = y != this.pY; - distance = Math.abs(input.deltaY); - } - } - input.direction = direction; - return hasMoved && distance > options.threshold && direction & options.direction; - }, - attrTest: function (input) { - return AttrRecognizer.prototype.attrTest.call(this, input) && - (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); - }, - emit: function (input) { - this.pX = input.deltaX; - this.pY = input.deltaY; - var direction = directionStr(input.direction); - if (direction) { - input.additionalEvent = this.options.event + direction; - } - this._super.emit.call(this, input); - } - }); - /** - * Pinch - * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). - * @constructor - * @extends AttrRecognizer - */ - function PinchRecognizer() { - AttrRecognizer.apply(this, arguments); - } - inherit(PinchRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof PinchRecognizer - */ - defaults: { - event: 'pinch', - threshold: 0, - pointers: 2 - }, - getTouchAction: function () { - return [TOUCH_ACTION_NONE]; - }, - attrTest: function (input) { - return this._super.attrTest.call(this, input) && - (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); - }, - emit: function (input) { - if (input.scale !== 1) { - var inOut = input.scale < 1 ? 'in' : 'out'; - input.additionalEvent = this.options.event + inOut; - } - this._super.emit.call(this, input); - } - }); - /** - * Press - * Recognized when the pointer is down for x ms without any movement. - * @constructor - * @extends Recognizer - */ - function PressRecognizer() { - Recognizer.apply(this, arguments); - this._timer = null; - this._input = null; - } - inherit(PressRecognizer, Recognizer, { - /** - * @namespace - * @memberof PressRecognizer - */ - defaults: { - event: 'press', - pointers: 1, - time: 251, - threshold: 9 // a minimal movement is ok, but keep it low - }, - getTouchAction: function () { - return [TOUCH_ACTION_AUTO]; - }, - process: function (input) { - var options = this.options; - var validPointers = input.pointers.length === options.pointers; - var validMovement = input.distance < options.threshold; - var validTime = input.deltaTime > options.time; - this._input = input; - // we only allow little movement - // and we've reached an end event, so a tap is possible - if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { - this.reset(); - } - else if (input.eventType & INPUT_START) { - this.reset(); - this._timer = setTimeoutContext(function () { - this.state = STATE_RECOGNIZED; - this.tryEmit(); - }, options.time, this); - } - else if (input.eventType & INPUT_END) { - return STATE_RECOGNIZED; - } - return STATE_FAILED; - }, - reset: function () { - clearTimeout(this._timer); - }, - emit: function (input) { - if (this.state !== STATE_RECOGNIZED) { - return; - } - if (input && (input.eventType & INPUT_END)) { - this.manager.emit(this.options.event + 'up', input); - } - else { - this._input.timeStamp = now(); - this.manager.emit(this.options.event, this._input); - } - } - }); - /** - * Rotate - * Recognized when two or more pointer are moving in a circular motion. - * @constructor - * @extends AttrRecognizer - */ - function RotateRecognizer() { - AttrRecognizer.apply(this, arguments); - } - inherit(RotateRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof RotateRecognizer - */ - defaults: { - event: 'rotate', - threshold: 0, - pointers: 2 - }, - getTouchAction: function () { - return [TOUCH_ACTION_NONE]; - }, - attrTest: function (input) { - return this._super.attrTest.call(this, input) && - (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); - } - }); - /** - * Swipe - * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. - * @constructor - * @extends AttrRecognizer - */ - function SwipeRecognizer() { - AttrRecognizer.apply(this, arguments); - } - inherit(SwipeRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof SwipeRecognizer - */ - defaults: { - event: 'swipe', - threshold: 10, - velocity: 0.3, - direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, - pointers: 1 - }, - getTouchAction: function () { - return PanRecognizer.prototype.getTouchAction.call(this); - }, - attrTest: function (input) { - var direction = this.options.direction; - var velocity; - if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { - velocity = input.overallVelocity; - } - else if (direction & DIRECTION_HORIZONTAL) { - velocity = input.overallVelocityX; - } - else if (direction & DIRECTION_VERTICAL) { - velocity = input.overallVelocityY; - } - return this._super.attrTest.call(this, input) && - direction & input.offsetDirection && - input.distance > this.options.threshold && - input.maxPointers == this.options.pointers && - abs(velocity) > this.options.velocity && input.eventType & INPUT_END; - }, - emit: function (input) { - var direction = directionStr(input.offsetDirection); - if (direction) { - this.manager.emit(this.options.event + direction, input); - } - this.manager.emit(this.options.event, input); - } - }); - /** - * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur - * between the given interval and position. The delay option can be used to recognize multi-taps without firing - * a single tap. - * - * The eventData from the emitted event contains the property `tapCount`, which contains the amount of - * multi-taps being recognized. - * @constructor - * @extends Recognizer - */ - function TapRecognizer() { - Recognizer.apply(this, arguments); - // previous time and center, - // used for tap counting - this.pTime = false; - this.pCenter = false; - this._timer = null; - this._input = null; - this.count = 0; - } - inherit(TapRecognizer, Recognizer, { - /** - * @namespace - * @memberof PinchRecognizer - */ - defaults: { - event: 'tap', - pointers: 1, - taps: 1, - interval: 300, - time: 250, - threshold: 9, - posThreshold: 10 // a multi-tap can be a bit off the initial position - }, - getTouchAction: function () { - return [TOUCH_ACTION_MANIPULATION]; - }, - process: function (input) { - var options = this.options; - var validPointers = input.pointers.length === options.pointers; - var validMovement = input.distance < options.threshold; - var validTouchTime = input.deltaTime < options.time; - this.reset(); - if ((input.eventType & INPUT_START) && (this.count === 0)) { - return this.failTimeout(); - } - // we only allow little movement - // and we've reached an end event, so a tap is possible - if (validMovement && validTouchTime && validPointers) { - if (input.eventType != INPUT_END) { - return this.failTimeout(); - } - var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; - var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; - this.pTime = input.timeStamp; - this.pCenter = input.center; - if (!validMultiTap || !validInterval) { - this.count = 1; - } - else { - this.count += 1; - } - this._input = input; - // if tap count matches we have recognized it, - // else it has began recognizing... - var tapCount = this.count % options.taps; - if (tapCount === 0) { - // no failing requirements, immediately trigger the tap event - // or wait as long as the multitap interval to trigger - if (!this.hasRequireFailures()) { - return STATE_RECOGNIZED; - } - else { - this._timer = setTimeoutContext(function () { - this.state = STATE_RECOGNIZED; - this.tryEmit(); - }, options.interval, this); - return STATE_BEGAN; - } - } - } - return STATE_FAILED; - }, - failTimeout: function () { - this._timer = setTimeoutContext(function () { - this.state = STATE_FAILED; - }, this.options.interval, this); - return STATE_FAILED; - }, - reset: function () { - clearTimeout(this._timer); - }, - emit: function () { - if (this.state == STATE_RECOGNIZED) { - this._input.tapCount = this.count; - this.manager.emit(this.options.event, this._input); - } - } - }); - /** - * Simple way to create a manager with a default set of recognizers. - * @param {HTMLElement} element - * @param {Object} [options] - * @constructor - */ - function Hammer(element, options) { - options = options || {}; - options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); - return new Manager(element, options); - } - /** - * @const {string} - */ - Hammer.VERSION = '2.0.7'; - /** - * default settings - * @namespace - */ - Hammer.defaults = { - /** - * set if DOM events are being triggered. - * But this is slower and unused by simple implementations, so disabled by default. - * @type {Boolean} - * @default false - */ - domEvents: false, - /** - * The value for the touchAction property/fallback. - * When set to `compute` it will magically set the correct value based on the added recognizers. - * @type {String} - * @default compute - */ - touchAction: TOUCH_ACTION_COMPUTE, - /** - * @type {Boolean} - * @default true - */ - enable: true, - /** - * EXPERIMENTAL FEATURE -- can be removed/changed - * Change the parent input target element. - * If Null, then it is being set the to main element. - * @type {Null|EventTarget} - * @default null - */ - inputTarget: null, - /** - * force an input class - * @type {Null|Function} - * @default null - */ - inputClass: null, - /** - * Default recognizer setup when calling `Hammer()` - * When creating a new Manager these will be skipped. - * @type {Array} - */ - preset: [ - // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] - [RotateRecognizer, { enable: false }], - [PinchRecognizer, { enable: false }, ['rotate']], - [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }], - [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']], - [TapRecognizer], - [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']], - [PressRecognizer] - ], - /** - * Some CSS properties can be used to improve the working of Hammer. - * Add them to this method and they will be set when creating a new Manager. - * @namespace - */ - cssProps: { - /** - * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. - * @type {String} - * @default 'none' - */ - userSelect: 'none', - /** - * Disable the Windows Phone grippers when pressing an element. - * @type {String} - * @default 'none' - */ - touchSelect: 'none', - /** - * Disables the default callout shown when you touch and hold a touch target. - * On iOS, when you touch and hold a touch target such as a link, Safari displays - * a callout containing information about the link. This property allows you to disable that callout. - * @type {String} - * @default 'none' - */ - touchCallout: 'none', - /** - * Specifies whether zooming is enabled. Used by IE10> - * @type {String} - * @default 'none' - */ - contentZooming: 'none', - /** - * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. - * @type {String} - * @default 'none' - */ - userDrag: 'none', - /** - * Overrides the highlight color shown when the user taps a link or a JavaScript - * clickable element in iOS. This property obeys the alpha value, if specified. - * @type {String} - * @default 'rgba(0,0,0,0)' - */ - tapHighlightColor: 'rgba(0,0,0,0)' - } - }; - var STOP = 1; - var FORCED_STOP = 2; - /** - * Manager - * @param {HTMLElement} element - * @param {Object} [options] - * @constructor - */ - function Manager(element, options) { - this.options = assign({}, Hammer.defaults, options || {}); - this.options.inputTarget = this.options.inputTarget || element; - this.handlers = {}; - this.session = {}; - this.recognizers = []; - this.oldCssProps = {}; - this.element = element; - this.input = createInputInstance(this); - this.touchAction = new TouchAction(this, this.options.touchAction); - toggleCssProps(this, true); - each(this.options.recognizers, function (item) { - var recognizer = this.add(new (item[0])(item[1])); - item[2] && recognizer.recognizeWith(item[2]); - item[3] && recognizer.requireFailure(item[3]); - }, this); - } - Manager.prototype = { - /** - * set options - * @param {Object} options - * @returns {Manager} - */ - set: function (options) { - assign(this.options, options); - // Options that need a little more setup - if (options.touchAction) { - this.touchAction.update(); - } - if (options.inputTarget) { - // Clean up existing event listeners and reinitialize - this.input.destroy(); - this.input.target = options.inputTarget; - this.input.init(); - } - return this; - }, - /** - * stop recognizing for this session. - * This session will be discarded, when a new [input]start event is fired. - * When forced, the recognizer cycle is stopped immediately. - * @param {Boolean} [force] - */ - stop: function (force) { - this.session.stopped = force ? FORCED_STOP : STOP; - }, - /** - * run the recognizers! - * called by the inputHandler function on every movement of the pointers (touches) - * it walks through all the recognizers and tries to detect the gesture that is being made - * @param {Object} inputData - */ - recognize: function (inputData) { - var session = this.session; - if (session.stopped) { - return; - } - // run the touch-action polyfill - this.touchAction.preventDefaults(inputData); - var recognizer; - var recognizers = this.recognizers; - // this holds the recognizer that is being recognized. - // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED - // if no recognizer is detecting a thing, it is set to `null` - var curRecognizer = session.curRecognizer; - // reset when the last recognizer is recognized - // or when we're in a new session - if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { - curRecognizer = session.curRecognizer = null; - } - var i = 0; - while (i < recognizers.length) { - recognizer = recognizers[i]; - // find out if we are allowed try to recognize the input for this one. - // 1. allow if the session is NOT forced stopped (see the .stop() method) - // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one - // that is being recognized. - // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. - // this can be setup with the `recognizeWith()` method on the recognizer. - if (session.stopped !== FORCED_STOP && ( // 1 - !curRecognizer || recognizer == curRecognizer || // 2 - recognizer.canRecognizeWith(curRecognizer))) { // 3 - recognizer.recognize(inputData); - } - else { - recognizer.reset(); - } - // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the - // current active recognizer. but only if we don't already have an active recognizer - if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { - curRecognizer = session.curRecognizer = recognizer; - } - i++; - } - }, - /** - * get a recognizer by its event name. - * @param {Recognizer|String} recognizer - * @returns {Recognizer|Null} - */ - get: function (recognizer) { - if (recognizer instanceof Recognizer) { - return recognizer; - } - var recognizers = this.recognizers; - for (var i = 0; i < recognizers.length; i++) { - if (recognizers[i].options.event == recognizer) { - return recognizers[i]; - } - } - return null; - }, - /** - * add a recognizer to the manager - * existing recognizers with the same event name will be removed - * @param {Recognizer} recognizer - * @returns {Recognizer|Manager} - */ - add: function (recognizer) { - if (invokeArrayArg(recognizer, 'add', this)) { - return this; - } - // remove existing - var existing = this.get(recognizer.options.event); - if (existing) { - this.remove(existing); - } - this.recognizers.push(recognizer); - recognizer.manager = this; - this.touchAction.update(); - return recognizer; - }, - /** - * remove a recognizer by name or instance - * @param {Recognizer|String} recognizer - * @returns {Manager} - */ - remove: function (recognizer) { - if (invokeArrayArg(recognizer, 'remove', this)) { - return this; - } - recognizer = this.get(recognizer); - // let's make sure this recognizer exists - if (recognizer) { - var recognizers = this.recognizers; - var index = inArray(recognizers, recognizer); - if (index !== -1) { - recognizers.splice(index, 1); - this.touchAction.update(); - } - } - return this; - }, - /** - * bind event - * @param {String} events - * @param {Function} handler - * @returns {EventEmitter} this - */ - on: function (events, handler) { - if (events === undefined) { - return; - } - if (handler === undefined) { - return; - } - var handlers = this.handlers; - each(splitStr(events), function (event) { - handlers[event] = handlers[event] || []; - handlers[event].push(handler); - }); - return this; - }, - /** - * unbind event, leave emit blank to remove all handlers - * @param {String} events - * @param {Function} [handler] - * @returns {EventEmitter} this - */ - off: function (events, handler) { - if (events === undefined) { - return; - } - var handlers = this.handlers; - each(splitStr(events), function (event) { - if (!handler) { - delete handlers[event]; - } - else { - handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); - } - }); - return this; - }, - /** - * emit event to the listeners - * @param {String} event - * @param {Object} data - */ - emit: function (event, data) { - // we also want to trigger dom events - if (this.options.domEvents) { - triggerDomEvent(event, data); - } - // no handlers, so skip it all - var handlers = this.handlers[event] && this.handlers[event].slice(); - if (!handlers || !handlers.length) { - return; - } - data.type = event; - data.preventDefault = function () { - data.srcEvent.preventDefault(); - }; - var i = 0; - while (i < handlers.length) { - handlers[i](data); - i++; - } - }, - /** - * destroy the manager and unbinds all events - * it doesn't unbind dom events, that is the user own responsibility - */ - destroy: function () { - this.element && toggleCssProps(this, false); - this.handlers = {}; - this.session = {}; - this.input.destroy(); - this.element = null; - } - }; - /** - * add/remove the css properties as defined in manager.options.cssProps - * @param {Manager} manager - * @param {Boolean} add - */ - function toggleCssProps(manager, add) { - var element = manager.element; - if (!element.style) { - return; - } - var prop; - each(manager.options.cssProps, function (value, name) { - prop = prefixed(element.style, name); - if (add) { - manager.oldCssProps[prop] = element.style[prop]; - element.style[prop] = value; - } - else { - element.style[prop] = manager.oldCssProps[prop] || ''; - } - }); - if (!add) { - manager.oldCssProps = {}; - } - } - /** - * trigger dom event - * @param {String} event - * @param {Object} data - */ - function triggerDomEvent(event, data) { - var gestureEvent = document.createEvent('Event'); - gestureEvent.initEvent(event, true, true); - gestureEvent.gesture = data; - data.target.dispatchEvent(gestureEvent); - } - assign(Hammer, { - INPUT_START: INPUT_START, - INPUT_MOVE: INPUT_MOVE, - INPUT_END: INPUT_END, - INPUT_CANCEL: INPUT_CANCEL, - STATE_POSSIBLE: STATE_POSSIBLE, - STATE_BEGAN: STATE_BEGAN, - STATE_CHANGED: STATE_CHANGED, - STATE_ENDED: STATE_ENDED, - STATE_RECOGNIZED: STATE_RECOGNIZED, - STATE_CANCELLED: STATE_CANCELLED, - STATE_FAILED: STATE_FAILED, - DIRECTION_NONE: DIRECTION_NONE, - DIRECTION_LEFT: DIRECTION_LEFT, - DIRECTION_RIGHT: DIRECTION_RIGHT, - DIRECTION_UP: DIRECTION_UP, - DIRECTION_DOWN: DIRECTION_DOWN, - DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, - DIRECTION_VERTICAL: DIRECTION_VERTICAL, - DIRECTION_ALL: DIRECTION_ALL, - Manager: Manager, - Input: Input, - TouchAction: TouchAction, - TouchInput: TouchInput, - MouseInput: MouseInput, - PointerEventInput: PointerEventInput, - TouchMouseInput: TouchMouseInput, - SingleTouchInput: SingleTouchInput, - Recognizer: Recognizer, - AttrRecognizer: AttrRecognizer, - Tap: TapRecognizer, - Pan: PanRecognizer, - Swipe: SwipeRecognizer, - Pinch: PinchRecognizer, - Rotate: RotateRecognizer, - Press: PressRecognizer, - on: addEventListeners, - off: removeEventListeners, - each: each, - merge: merge, - extend: extend, - assign: assign, - inherit: inherit, - bindFn: bindFn, - prefixed: prefixed - }); - // this prevents errors when Hammer is loaded in the presence of an AMD - // style loader but by script tag, not by the loader. - var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line - freeGlobal.Hammer = Hammer; - if (typeof define === 'function' && define.amd) { - define(function () { - return Hammer; - }); - } - else if (typeof module != 'undefined' && module.exports) { - module.exports = Hammer; - } - else { - window[exportName] = Hammer; - } - })(window, document, 'Hammer'); -} -, -/* numbro/numbro */ function _(require, module, exports) { - /*! - * numbro.js - * version : 1.6.2 - * author : Företagsplatsen AB - * license : MIT - * http://www.foretagsplatsen.se - */ - /************************************ - Constants - ************************************/ - var numbro, VERSION = '1.6.2', - // internal storage for culture config files - cultures = {}, - // Todo: Remove in 2.0.0 - languages = cultures, currentCulture = 'en-US', zeroFormat = null, defaultFormat = '0,0', defaultCurrencyFormat = '0$', - // check for nodeJS - hasModule = (typeof module !== 'undefined' && module.exports), - // default culture - enUS = { - delimiters: { - thousands: ',', - decimal: '.' - }, - abbreviations: { - thousand: 'k', - million: 'm', - billion: 'b', - trillion: 't' - }, - ordinal: function (number) { - var b = number % 10; - return (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - }, - currency: { - symbol: '$', - position: 'prefix' - }, - defaults: { - currencyFormat: ',0000 a' - }, - formats: { - fourDigits: '0000 a', - fullWithTwoDecimals: '$ ,0.00', - fullWithTwoDecimalsNoCurrency: ',0.00' - } - }; - /************************************ - Constructors - ************************************/ - // Numbro prototype object - function Numbro(number) { - this._value = number; - } - function zeroes(count) { - var i, ret = ''; - for (i = 0; i < count; i++) { - ret += '0'; - } - return ret; - } - /** - * Implementation of toFixed() for numbers with exponent > 21 - * - * - */ - function toFixedLarge(value, precision) { - var mantissa, beforeDec, afterDec, exponent, str; - str = value.toString(); - mantissa = str.split('e')[0]; - exponent = str.split('e')[1]; - beforeDec = mantissa.split('.')[0]; - afterDec = mantissa.split('.')[1] || ''; - str = beforeDec + afterDec + zeroes(exponent - afterDec.length); - if (precision > 0) { - str += '.' + zeroes(precision); - } - return str; - } - /** - * Implementation of toFixed() that treats floats more like decimals - * - * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present - * problems for accounting- and finance-related software. - */ - function toFixed(value, precision, roundingFunction, optionals) { - var power = Math.pow(10, precision), optionalsRegExp, output; - if (value.toFixed(0).search('e') > -1) { - // Above 1e21, toFixed returns scientific notation, which - // is useless and unexpected - output = toFixedLarge(value, precision); - } - else { - //roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round); - // Multiply up by precision, round accurately, then divide and use native toFixed(): - output = (roundingFunction(value * power) / power).toFixed(precision); - } - if (optionals) { - optionalsRegExp = new RegExp('0{1,' + optionals + '}$'); - output = output.replace(optionalsRegExp, ''); - } - return output; - } - /************************************ - Formatting - ************************************/ - // determine what type of formatting we need to do - function formatNumbro(value, format, roundingFunction) { - var output; - // TODO: do something with `language` - // figure out what kind of format we are dealing with - if (format.indexOf('$') > -1) { // currency!!!!! - output = formatCurrency(value, format, roundingFunction); - } - else if (format.indexOf('%') > -1) { // percentage - output = formatPercentage(value, format, roundingFunction); - } - else if (format.indexOf(':') > -1) { // time - output = formatTime(value); - } - else { // plain ol' numbers or bytes - output = formatNumber(value, format, roundingFunction); - } - // return string - return output; - } - function formatCurrency(value, originalFormat, roundingFunction) { - var format = originalFormat, symbolIndex = format.indexOf('$'), openParenIndex = format.indexOf('('), plusSignIndex = format.indexOf('+'), minusSignIndex = format.indexOf('-'), space = '', decimalSeparator = '', spliceIndex, output; - if (format.indexOf('$') === -1) { - // Use defaults instead of the format provided - if (cultures[currentCulture].currency.position === 'infix') { - decimalSeparator = cultures[currentCulture].currency.symbol; - if (cultures[currentCulture].currency.spaceSeparated) { - decimalSeparator = ' ' + decimalSeparator + ' '; - } - } - else if (cultures[currentCulture].currency.spaceSeparated) { - space = ' '; - } - } - else { - // check for space before or after currency - if (format.indexOf(' $') > -1) { - space = ' '; - format = format.replace(' $', ''); - } - else if (format.indexOf('$ ') > -1) { - space = ' '; - format = format.replace('$ ', ''); - } - else { - format = format.replace('$', ''); - } - } - // Format The Number - output = formatNumber(value, format, roundingFunction, decimalSeparator); - if (originalFormat.indexOf('$') === -1) { - // Use defaults instead of the format provided - switch (cultures[currentCulture].currency.position) { - case 'postfix': - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + cultures[currentCulture].currency.symbol); - output = output.join(''); - } - else { - output = output + space + cultures[currentCulture].currency.symbol; - } - break; - case 'infix': - break; - case 'prefix': - if (output.indexOf('(') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1; - output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space); - output = output.join(''); - } - else { - output = cultures[currentCulture].currency.symbol + space + output; - } - break; - default: - throw Error('Currency position should be among ["prefix", "infix", "postfix"]'); - } - } - else { - // position the symbol - if (symbolIndex <= 1) { - if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = 1; - if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) { - // the symbol appears before the "(", "+" or "-" - spliceIndex = 0; - } - output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space); - output = output.join(''); - } - else { - output = cultures[currentCulture].currency.symbol + space + output; - } - } - else { - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + cultures[currentCulture].currency.symbol); - output = output.join(''); - } - else { - output = output + space + cultures[currentCulture].currency.symbol; - } - } - } - return output; - } - function formatPercentage(value, format, roundingFunction) { - var space = '', output; - value = value * 100; - // check for space before % - if (format.indexOf(' %') > -1) { - space = ' '; - format = format.replace(' %', ''); - } - else { - format = format.replace('%', ''); - } - output = formatNumber(value, format, roundingFunction); - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + '%'); - output = output.join(''); - } - else { - output = output + space + '%'; - } - return output; - } - function formatTime(value) { - var hours = Math.floor(value / 60 / 60), minutes = Math.floor((value - (hours * 60 * 60)) / 60), seconds = Math.round(value - (hours * 60 * 60) - (minutes * 60)); - return hours + ':' + - ((minutes < 10) ? '0' + minutes : minutes) + ':' + - ((seconds < 10) ? '0' + seconds : seconds); - } - function formatNumber(value, format, roundingFunction, sep) { - var negP = false, signed = false, optDec = false, abbr = '', i, abbrK = false, // force abbreviation to thousands - abbrM = false, // force abbreviation to millions - abbrB = false, // force abbreviation to billions - abbrT = false, // force abbreviation to trillions - abbrForce = false, // force abbreviation - bytes = '', ord = '', abs = Math.abs(value), binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], min, max, power, totalLength, length, minimumPrecision, pow, w, intPrecision, precision, prefix, postfix, thousands, d = '', forcedNeg = false, neg = false, indexOpenP, size, indexMinus, paren = '', minlen; - // check if number is zero and a custom zero format has been set - if (value === 0 && zeroFormat !== null) { - return zeroFormat; - } - if (!isFinite(value)) { - return '' + value; - } - if (format.indexOf('{') === 0) { - var end = format.indexOf('}'); - if (end === -1) { - throw Error('Format should also contain a "}"'); - } - prefix = format.slice(1, end); - format = format.slice(end + 1); - } - else { - prefix = ''; - } - if (format.indexOf('}') === format.length - 1) { - var start = format.indexOf('{'); - if (start === -1) { - throw Error('Format should also contain a "{"'); - } - postfix = format.slice(start + 1, -1); - format = format.slice(0, start + 1); - } - else { - postfix = ''; - } - // check for min length - var info; - if (format.indexOf('.') === -1) { - info = format.match(/([0-9]+).*/); - } - else { - info = format.match(/([0-9]+)\..*/); - } - minlen = info === null ? -1 : info[1].length; - // see if we should use parentheses for negative number or if we should prefix with a sign - // if both are present we default to parentheses - if (format.indexOf('-') !== -1) { - forcedNeg = true; - } - if (format.indexOf('(') > -1) { - negP = true; - format = format.slice(1, -1); - } - else if (format.indexOf('+') > -1) { - signed = true; - format = format.replace(/\+/g, ''); - } - // see if abbreviation is wanted - if (format.indexOf('a') > -1) { - intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0']; - intPrecision = parseInt(intPrecision[0], 10); - // check if abbreviation is specified - abbrK = format.indexOf('aK') >= 0; - abbrM = format.indexOf('aM') >= 0; - abbrB = format.indexOf('aB') >= 0; - abbrT = format.indexOf('aT') >= 0; - abbrForce = abbrK || abbrM || abbrB || abbrT; - // check for space before abbreviation - if (format.indexOf(' a') > -1) { - abbr = ' '; - format = format.replace(' a', ''); - } - else { - format = format.replace('a', ''); - } - totalLength = Math.floor(Math.log(abs) / Math.LN10) + 1; - minimumPrecision = totalLength % 3; - minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision; - if (intPrecision && abs !== 0) { - length = Math.floor(Math.log(abs) / Math.LN10) + 1 - intPrecision; - pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3); - abs = abs / Math.pow(10, pow); - if (format.indexOf('.') === -1 && intPrecision > 3) { - format += '[.]'; - size = length === 0 ? 0 : 3 * ~~(length / 3) - length; - size = size < 0 ? size + 3 : size; - for (i = 0; i < size; i++) { - format += '0'; - } - } - } - if (Math.floor(Math.log(Math.abs(value)) / Math.LN10) + 1 !== intPrecision) { - if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) { - // trillion - abbr = abbr + cultures[currentCulture].abbreviations.trillion; - value = value / Math.pow(10, 12); - } - else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) { - // billion - abbr = abbr + cultures[currentCulture].abbreviations.billion; - value = value / Math.pow(10, 9); - } - else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) { - // million - abbr = abbr + cultures[currentCulture].abbreviations.million; - value = value / Math.pow(10, 6); - } - else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) { - // thousand - abbr = abbr + cultures[currentCulture].abbreviations.thousand; - value = value / Math.pow(10, 3); - } - } - } - // see if we are formatting binary bytes - if (format.indexOf('b') > -1) { - // check for space before - if (format.indexOf(' b') > -1) { - bytes = ' '; - format = format.replace(' b', ''); - } - else { - format = format.replace('b', ''); - } - for (power = 0; power <= binarySuffixes.length; power++) { - min = Math.pow(1024, power); - max = Math.pow(1024, power + 1); - if (value >= min && value < max) { - bytes = bytes + binarySuffixes[power]; - if (min > 0) { - value = value / min; - } - break; - } - } - } - // see if we are formatting decimal bytes - if (format.indexOf('d') > -1) { - // check for space before - if (format.indexOf(' d') > -1) { - bytes = ' '; - format = format.replace(' d', ''); - } - else { - format = format.replace('d', ''); - } - for (power = 0; power <= decimalSuffixes.length; power++) { - min = Math.pow(1000, power); - max = Math.pow(1000, power + 1); - if (value >= min && value < max) { - bytes = bytes + decimalSuffixes[power]; - if (min > 0) { - value = value / min; - } - break; - } - } - } - // see if ordinal is wanted - if (format.indexOf('o') > -1) { - // check for space before - if (format.indexOf(' o') > -1) { - ord = ' '; - format = format.replace(' o', ''); - } - else { - format = format.replace('o', ''); - } - if (cultures[currentCulture].ordinal) { - ord = ord + cultures[currentCulture].ordinal(value); - } - } - if (format.indexOf('[.]') > -1) { - optDec = true; - format = format.replace('[.]', '.'); - } - w = value.toString().split('.')[0]; - precision = format.split('.')[1]; - thousands = format.indexOf(','); - if (precision) { - if (precision.indexOf('*') !== -1) { - d = toFixed(value, value.toString().split('.')[1].length, roundingFunction); - } - else { - if (precision.indexOf('[') > -1) { - precision = precision.replace(']', ''); - precision = precision.split('['); - d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length); - } - else { - d = toFixed(value, precision.length, roundingFunction); - } - } - w = d.split('.')[0]; - if (d.split('.')[1].length) { - var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal; - d = p + d.split('.')[1]; - } - else { - d = ''; - } - if (optDec && Number(d.slice(1)) === 0) { - d = ''; - } - } - else { - w = toFixed(value, null, roundingFunction); - } - // format number - if (w.indexOf('-') > -1) { - w = w.slice(1); - neg = true; - } - if (w.length < minlen) { - w = new Array(minlen - w.length + 1).join('0') + w; - } - if (thousands > -1) { - w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + - cultures[currentCulture].delimiters.thousands); - } - if (format.indexOf('.') === 0) { - w = ''; - } - indexOpenP = format.indexOf('('); - indexMinus = format.indexOf('-'); - if (indexOpenP < indexMinus) { - paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : ''); - } - else { - paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : ''); - } - return prefix + - paren + ((!neg && signed && value !== 0) ? '+' : '') + - w + d + - ((ord) ? ord : '') + - ((abbr && !sep) ? abbr : '') + - ((bytes) ? bytes : '') + - ((negP && neg) ? ')' : '') + - postfix; - } - /************************************ - Top Level Functions - ************************************/ - numbro = function (input) { - if (numbro.isNumbro(input)) { - input = input.value(); - } - else if (input === 0 || typeof input === 'undefined') { - input = 0; - } - else if (!Number(input)) { - input = numbro.fn.unformat(input); - } - return new Numbro(Number(input)); - }; - // version number - numbro.version = VERSION; - // compare numbro object - numbro.isNumbro = function (obj) { - return obj instanceof Numbro; - }; - /** - * This function allow the user to set a new language with a fallback if - * the language does not exist. If no fallback language is provided, - * it fallbacks to english. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `setCulture` should be used instead. - */ - numbro.setLanguage = function (newLanguage, fallbackLanguage) { - console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead'); - var key = newLanguage, prefix = newLanguage.split('-')[0], matchingLanguage = null; - if (!languages[key]) { - Object.keys(languages).forEach(function (language) { - if (!matchingLanguage && language.split('-')[0] === prefix) { - matchingLanguage = language; - } - }); - key = matchingLanguage || fallbackLanguage || 'en-US'; - } - chooseCulture(key); - }; - /** - * This function allow the user to set a new culture with a fallback if - * the culture does not exist. If no fallback culture is provided, - * it fallbacks to "en-US". - */ - numbro.setCulture = function (newCulture, fallbackCulture) { - var key = newCulture, suffix = newCulture.split('-')[1], matchingCulture = null; - if (!cultures[key]) { - if (suffix) { - Object.keys(cultures).forEach(function (language) { - if (!matchingCulture && language.split('-')[1] === suffix) { - matchingCulture = language; - } - }); - } - key = matchingCulture || fallbackCulture || 'en-US'; - } - chooseCulture(key); - }; - /** - * This function will load languages and then set the global language. If - * no arguments are passed in, it will simply return the current global - * language key. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. - */ - numbro.language = function (key, values) { - console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead'); - if (!key) { - return currentCulture; - } - if (key && !values) { - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - chooseCulture(key); - } - if (values || !languages[key]) { - setCulture(key, values); - } - return numbro; - }; - /** - * This function will load cultures and then set the global culture. If - * no arguments are passed in, it will simply return the current global - * culture code. - */ - numbro.culture = function (code, values) { - if (!code) { - return currentCulture; - } - if (code && !values) { - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - chooseCulture(code); - } - if (values || !cultures[code]) { - setCulture(code, values); - } - return numbro; - }; - /** - * This function provides access to the loaded language data. If - * no arguments are passed in, it will simply return the current - * global language object. - * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. - */ - numbro.languageData = function (key) { - console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead'); - if (!key) { - return languages[currentCulture]; - } - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - return languages[key]; - }; - /** - * This function provides access to the loaded culture data. If - * no arguments are passed in, it will simply return the current - * global culture object. - */ - numbro.cultureData = function (code) { - if (!code) { - return cultures[currentCulture]; - } - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - return cultures[code]; - }; - numbro.culture('en-US', enUS); - /** - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `cultures` should be used instead. - */ - numbro.languages = function () { - console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead'); - return languages; - }; - numbro.cultures = function () { - return cultures; - }; - numbro.zeroFormat = function (format) { - zeroFormat = typeof (format) === 'string' ? format : null; - }; - numbro.defaultFormat = function (format) { - defaultFormat = typeof (format) === 'string' ? format : '0.0'; - }; - numbro.defaultCurrencyFormat = function (format) { - defaultCurrencyFormat = typeof (format) === 'string' ? format : '0$'; - }; - numbro.validate = function (val, culture) { - var _decimalSep, _thousandSep, _currSymbol, _valArray, _abbrObj, _thousandRegEx, cultureData, temp; - //coerce val to string - if (typeof val !== 'string') { - val += ''; - if (console.warn) { - console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val); - } - } - //trim whitespaces from either sides - val = val.trim(); - //if val is just digits return true - if (!!val.match(/^\d+$/)) { - return true; - } - //if val is empty return false - if (val === '') { - return false; - } - //get the decimal and thousands separator from numbro.cultureData - try { - //check if the culture is understood by numbro. if not, default it to current culture - cultureData = numbro.cultureData(culture); - } - catch (e) { - cultureData = numbro.cultureData(numbro.culture()); - } - //setup the delimiters and currency symbol based on culture - _currSymbol = cultureData.currency.symbol; - _abbrObj = cultureData.abbreviations; - _decimalSep = cultureData.delimiters.decimal; - if (cultureData.delimiters.thousands === '.') { - _thousandSep = '\\.'; - } - else { - _thousandSep = cultureData.delimiters.thousands; - } - // validating currency symbol - temp = val.match(/^[^\d]+/); - if (temp !== null) { - val = val.substr(1); - if (temp[0] !== _currSymbol) { - return false; - } - } - //validating abbreviation symbol - temp = val.match(/[^\d]+$/); - if (temp !== null) { - val = val.slice(0, -1); - if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && - temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) { - return false; - } - } - _thousandRegEx = new RegExp(_thousandSep + '{2}'); - if (!val.match(/[^\d.,]/g)) { - _valArray = val.split(_decimalSep); - if (_valArray.length > 2) { - return false; - } - else { - if (_valArray.length < 2) { - return (!!_valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx)); - } - else { - if (_valArray[0].length === 1) { - return (!!_valArray[0].match(/^\d+$/) && - !_valArray[0].match(_thousandRegEx) && - !!_valArray[1].match(/^\d+$/)); - } - else { - return (!!_valArray[0].match(/^\d+.*\d$/) && - !_valArray[0].match(_thousandRegEx) && - !!_valArray[1].match(/^\d+$/)); - } - } - } - } - return false; - }; - /************************************ - Helpers - ************************************/ - function setCulture(code, values) { - cultures[code] = values; - } - function chooseCulture(code) { - currentCulture = code; - var defaults = cultures[code].defaults; - if (defaults && defaults.format) { - numbro.defaultFormat(defaults.format); - } - if (defaults && defaults.currencyFormat) { - numbro.defaultCurrencyFormat(defaults.currencyFormat); - } - } - function format(input, formatString, language, roundingFunction) { - if (language != null && language !== numbro.culture()) { - numbro.setCulture(language); - } - return formatNumbro(Number(input), formatString != null ? formatString : defaultFormat, roundingFunction == null ? Math.round : roundingFunction); - } - module.exports = { "format": format }; -} -, -/* proj4/lib/Proj */ function _(require, module, exports) { - var parseCode = require(391) /* ./parseCode */; - var extend = require(389) /* ./extend */; - var projections = require(393) /* ./projections */; - var deriveConstants = require(388) /* ./deriveConstants */; - var Datum = require(379) /* ./constants/Datum */; - var datum = require(384) /* ./datum */; - function Projection(srsCode, callback) { - if (!(this instanceof Projection)) { - return new Projection(srsCode); - } - callback = callback || function (error) { - if (error) { - throw error; - } - }; - var json = parseCode(srsCode); - if (typeof json !== 'object') { - callback(srsCode); - return; - } - var ourProj = Projection.projections.get(json.projName); - if (!ourProj) { - callback(srsCode); - return; - } - if (json.datumCode && json.datumCode !== 'none') { - var datumDef = Datum[json.datumCode]; - if (datumDef) { - json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null; - json.ellps = datumDef.ellipse; - json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode; - } - } - json.k0 = json.k0 || 1.0; - json.axis = json.axis || 'enu'; - var sphere = deriveConstants.sphere(json.a, json.b, json.rf, json.ellps, json.sphere); - var ecc = deriveConstants.eccentricity(sphere.a, sphere.b, sphere.rf, json.R_A); - var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere.a, sphere.b, ecc.es, ecc.ep2); - extend(this, json); // transfer everything over from the projection because we don't know what we'll need - extend(this, ourProj); // transfer all the methods from the projection - // copy the 4 things over we calulated in deriveConstants.sphere - this.a = sphere.a; - this.b = sphere.b; - this.rf = sphere.rf; - this.sphere = sphere.sphere; - // copy the 3 things we calculated in deriveConstants.eccentricity - this.es = ecc.es; - this.e = ecc.e; - this.ep2 = ecc.ep2; - // add in the datum object - this.datum = datumObj; - // init the projection - this.init(); - // legecy callback from back in the day when it went to spatialreference.org - callback(null, this); - } - Projection.projections = projections; - Projection.projections.start(); - module.exports = Projection; -} -, -/* proj4/lib/adjust_axis */ function _(require, module, exports) { - module.exports = function (crs, denorm, point) { - var xin = point.x, yin = point.y, zin = point.z || 0.0; - var v, t, i; - var out = {}; - for (i = 0; i < 3; i++) { - if (denorm && i === 2 && point.z === undefined) { - continue; - } - if (i === 0) { - v = xin; - t = 'x'; - } - else if (i === 1) { - v = yin; - t = 'y'; - } - else { - v = zin; - t = 'z'; - } - switch (crs.axis[i]) { - case 'e': - out[t] = v; - break; - case 'w': - out[t] = -v; - break; - case 'n': - out[t] = v; - break; - case 's': - out[t] = -v; - break; - case 'u': - if (point[t] !== undefined) { - out.z = v; - } - break; - case 'd': - if (point[t] !== undefined) { - out.z = -v; - } - break; - default: - //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName); - return null; - } - } - return out; - }; -} -, -/* proj4/lib/common/adjust_lon */ function _(require, module, exports) { - var TWO_PI = Math.PI * 2; - // SPI is slightly greater than Math.PI, so values that exceed the -180..180 - // degree range by a tiny amount don't get wrapped. This prevents points that - // have drifted from their original location along the 180th meridian (due to - // floating point error) from changing their sign. - var SPI = 3.14159265359; - var sign = require(376) /* ./sign */; - module.exports = function (x) { - return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI)); - }; -} -, -/* proj4/lib/common/msfnz */ function _(require, module, exports) { - module.exports = function (eccent, sinphi, cosphi) { - var con = eccent * sinphi; - return cosphi / (Math.sqrt(1 - con * con)); - }; -} -, -/* proj4/lib/common/phi2z */ function _(require, module, exports) { - var HALF_PI = Math.PI / 2; - module.exports = function (eccent, ts) { - var eccnth = 0.5 * eccent; - var con, dphi; - var phi = HALF_PI - 2 * Math.atan(ts); - for (var i = 0; i <= 15; i++) { - con = eccent * Math.sin(phi); - dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi; - phi += dphi; - if (Math.abs(dphi) <= 0.0000000001) { - return phi; - } - } - //console.log("phi2z has NoConvergence"); - return -9999; - }; -} -, -/* proj4/lib/common/sign */ function _(require, module, exports) { - module.exports = function (x) { - return x < 0 ? -1 : 1; - }; -} -, -/* proj4/lib/common/toPoint */ function _(require, module, exports) { - module.exports = function (array) { - var out = { - x: array[0], - y: array[1] - }; - if (array.length > 2) { - out.z = array[2]; - } - if (array.length > 3) { - out.m = array[3]; - } - return out; - }; -} -, -/* proj4/lib/common/tsfnz */ function _(require, module, exports) { - var HALF_PI = Math.PI / 2; - module.exports = function (eccent, phi, sinphi) { - var con = eccent * sinphi; - var com = 0.5 * eccent; - con = Math.pow(((1 - con) / (1 + con)), com); - return (Math.tan(0.5 * (HALF_PI - phi)) / con); - }; -} -, -/* proj4/lib/constants/Datum */ function _(require, module, exports) { - exports.wgs84 = { - towgs84: "0,0,0", - ellipse: "WGS84", - datumName: "WGS84" - }; - exports.ch1903 = { - towgs84: "674.374,15.056,405.346", - ellipse: "bessel", - datumName: "swiss" - }; - exports.ggrs87 = { - towgs84: "-199.87,74.79,246.62", - ellipse: "GRS80", - datumName: "Greek_Geodetic_Reference_System_1987" - }; - exports.nad83 = { - towgs84: "0,0,0", - ellipse: "GRS80", - datumName: "North_American_Datum_1983" - }; - exports.nad27 = { - nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", - ellipse: "clrk66", - datumName: "North_American_Datum_1927" - }; - exports.potsdam = { - towgs84: "606.0,23.0,413.0", - ellipse: "bessel", - datumName: "Potsdam Rauenberg 1950 DHDN" - }; - exports.carthage = { - towgs84: "-263.0,6.0,431.0", - ellipse: "clark80", - datumName: "Carthage 1934 Tunisia" - }; - exports.hermannskogel = { - towgs84: "653.0,-212.0,449.0", - ellipse: "bessel", - datumName: "Hermannskogel" - }; - exports.ire65 = { - towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", - ellipse: "mod_airy", - datumName: "Ireland 1965" - }; - exports.rassadiran = { - towgs84: "-133.63,-157.5,-158.62", - ellipse: "intl", - datumName: "Rassadiran" - }; - exports.nzgd49 = { - towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", - ellipse: "intl", - datumName: "New Zealand Geodetic Datum 1949" - }; - exports.osgb36 = { - towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", - ellipse: "airy", - datumName: "Airy 1830" - }; - exports.s_jtsk = { - towgs84: "589,76,480", - ellipse: 'bessel', - datumName: 'S-JTSK (Ferro)' - }; - exports.beduaram = { - towgs84: '-106,-87,188', - ellipse: 'clrk80', - datumName: 'Beduaram' - }; - exports.gunung_segara = { - towgs84: '-403,684,41', - ellipse: 'bessel', - datumName: 'Gunung Segara Jakarta' - }; - exports.rnb72 = { - towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1", - ellipse: "intl", - datumName: "Reseau National Belge 1972" - }; -} -, -/* proj4/lib/constants/Ellipsoid */ function _(require, module, exports) { - exports.MERIT = { - a: 6378137.0, - rf: 298.257, - ellipseName: "MERIT 1983" - }; - exports.SGS85 = { - a: 6378136.0, - rf: 298.257, - ellipseName: "Soviet Geodetic System 85" - }; - exports.GRS80 = { - a: 6378137.0, - rf: 298.257222101, - ellipseName: "GRS 1980(IUGG, 1980)" - }; - exports.IAU76 = { - a: 6378140.0, - rf: 298.257, - ellipseName: "IAU 1976" - }; - exports.airy = { - a: 6377563.396, - b: 6356256.910, - ellipseName: "Airy 1830" - }; - exports.APL4 = { - a: 6378137, - rf: 298.25, - ellipseName: "Appl. Physics. 1965" - }; - exports.NWL9D = { - a: 6378145.0, - rf: 298.25, - ellipseName: "Naval Weapons Lab., 1965" - }; - exports.mod_airy = { - a: 6377340.189, - b: 6356034.446, - ellipseName: "Modified Airy" - }; - exports.andrae = { - a: 6377104.43, - rf: 300.0, - ellipseName: "Andrae 1876 (Den., Iclnd.)" - }; - exports.aust_SA = { - a: 6378160.0, - rf: 298.25, - ellipseName: "Australian Natl & S. Amer. 1969" - }; - exports.GRS67 = { - a: 6378160.0, - rf: 298.2471674270, - ellipseName: "GRS 67(IUGG 1967)" - }; - exports.bessel = { - a: 6377397.155, - rf: 299.1528128, - ellipseName: "Bessel 1841" - }; - exports.bess_nam = { - a: 6377483.865, - rf: 299.1528128, - ellipseName: "Bessel 1841 (Namibia)" - }; - exports.clrk66 = { - a: 6378206.4, - b: 6356583.8, - ellipseName: "Clarke 1866" - }; - exports.clrk80 = { - a: 6378249.145, - rf: 293.4663, - ellipseName: "Clarke 1880 mod." - }; - exports.clrk58 = { - a: 6378293.645208759, - rf: 294.2606763692654, - ellipseName: "Clarke 1858" - }; - exports.CPM = { - a: 6375738.7, - rf: 334.29, - ellipseName: "Comm. des Poids et Mesures 1799" - }; - exports.delmbr = { - a: 6376428.0, - rf: 311.5, - ellipseName: "Delambre 1810 (Belgium)" - }; - exports.engelis = { - a: 6378136.05, - rf: 298.2566, - ellipseName: "Engelis 1985" - }; - exports.evrst30 = { - a: 6377276.345, - rf: 300.8017, - ellipseName: "Everest 1830" - }; - exports.evrst48 = { - a: 6377304.063, - rf: 300.8017, - ellipseName: "Everest 1948" - }; - exports.evrst56 = { - a: 6377301.243, - rf: 300.8017, - ellipseName: "Everest 1956" - }; - exports.evrst69 = { - a: 6377295.664, - rf: 300.8017, - ellipseName: "Everest 1969" - }; - exports.evrstSS = { - a: 6377298.556, - rf: 300.8017, - ellipseName: "Everest (Sabah & Sarawak)" - }; - exports.fschr60 = { - a: 6378166.0, - rf: 298.3, - ellipseName: "Fischer (Mercury Datum) 1960" - }; - exports.fschr60m = { - a: 6378155.0, - rf: 298.3, - ellipseName: "Fischer 1960" - }; - exports.fschr68 = { - a: 6378150.0, - rf: 298.3, - ellipseName: "Fischer 1968" - }; - exports.helmert = { - a: 6378200.0, - rf: 298.3, - ellipseName: "Helmert 1906" - }; - exports.hough = { - a: 6378270.0, - rf: 297.0, - ellipseName: "Hough" - }; - exports.intl = { - a: 6378388.0, - rf: 297.0, - ellipseName: "International 1909 (Hayford)" - }; - exports.kaula = { - a: 6378163.0, - rf: 298.24, - ellipseName: "Kaula 1961" - }; - exports.lerch = { - a: 6378139.0, - rf: 298.257, - ellipseName: "Lerch 1979" - }; - exports.mprts = { - a: 6397300.0, - rf: 191.0, - ellipseName: "Maupertius 1738" - }; - exports.new_intl = { - a: 6378157.5, - b: 6356772.2, - ellipseName: "New International 1967" - }; - exports.plessis = { - a: 6376523.0, - rf: 6355863.0, - ellipseName: "Plessis 1817 (France)" - }; - exports.krass = { - a: 6378245.0, - rf: 298.3, - ellipseName: "Krassovsky, 1942" - }; - exports.SEasia = { - a: 6378155.0, - b: 6356773.3205, - ellipseName: "Southeast Asia" - }; - exports.walbeck = { - a: 6376896.0, - b: 6355834.8467, - ellipseName: "Walbeck" - }; - exports.WGS60 = { - a: 6378165.0, - rf: 298.3, - ellipseName: "WGS 60" - }; - exports.WGS66 = { - a: 6378145.0, - rf: 298.25, - ellipseName: "WGS 66" - }; - exports.WGS7 = { - a: 6378135.0, - rf: 298.26, - ellipseName: "WGS 72" - }; - exports.WGS84 = { - a: 6378137.0, - rf: 298.257223563, - ellipseName: "WGS 84" - }; - exports.sphere = { - a: 6370997.0, - b: 6370997.0, - ellipseName: "Normal Sphere (r=6370997)" - }; -} -, -/* proj4/lib/constants/PrimeMeridian */ function _(require, module, exports) { - exports.greenwich = 0.0; //"0dE", - exports.lisbon = -9.131906111111; //"9d07'54.862\"W", - exports.paris = 2.337229166667; //"2d20'14.025\"E", - exports.bogota = -74.080916666667; //"74d04'51.3\"W", - exports.madrid = -3.687938888889; //"3d41'16.58\"W", - exports.rome = 12.452333333333; //"12d27'8.4\"E", - exports.bern = 7.439583333333; //"7d26'22.5\"E", - exports.jakarta = 106.807719444444; //"106d48'27.79\"E", - exports.ferro = -17.666666666667; //"17d40'W", - exports.brussels = 4.367975; //"4d22'4.71\"E", - exports.stockholm = 18.058277777778; //"18d3'29.8\"E", - exports.athens = 23.7163375; //"23d42'58.815\"E", - exports.oslo = 10.722916666667; //"10d43'22.5\"E" -} -, -/* proj4/lib/constants/units */ function _(require, module, exports) { - exports.ft = { to_meter: 0.3048 }; - exports['us-ft'] = { to_meter: 1200 / 3937 }; -} -, -/* proj4/lib/core */ function _(require, module, exports) { - var proj = require(371) /* ./Proj */; - var transform = require(396) /* ./transform */; - var wgs84 = proj('WGS84'); - function transformer(from, to, coords) { - var transformedArray; - if (Array.isArray(coords)) { - transformedArray = transform(from, to, coords); - if (coords.length === 3) { - return [transformedArray.x, transformedArray.y, transformedArray.z]; - } - else { - return [transformedArray.x, transformedArray.y]; - } - } - else { - return transform(from, to, coords); - } - } - function checkProj(item) { - if (item instanceof proj) { - return item; - } - if (item.oProj) { - return item.oProj; - } - return proj(item); - } - function proj4(fromProj, toProj, coord) { - fromProj = checkProj(fromProj); - var single = false; - var obj; - if (typeof toProj === 'undefined') { - toProj = fromProj; - fromProj = wgs84; - single = true; - } - else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) { - coord = toProj; - toProj = fromProj; - fromProj = wgs84; - single = true; - } - toProj = checkProj(toProj); - if (coord) { - return transformer(fromProj, toProj, coord); - } - else { - obj = { - forward: function (coords) { - return transformer(fromProj, toProj, coords); - }, - inverse: function (coords) { - return transformer(toProj, fromProj, coords); - } - }; - if (single) { - obj.oProj = toProj; - } - return obj; - } - } - module.exports = proj4; -} -, -/* proj4/lib/datum */ function _(require, module, exports) { - var PJD_3PARAM = 1; - var PJD_7PARAM = 2; - var PJD_WGS84 = 4; // WGS84 or equivalent - var PJD_NODATUM = 5; // WGS84 or equivalent - var SEC_TO_RAD = 4.84813681109535993589914102357e-6; - function datum(datumCode, datum_params, a, b, es, ep2) { - var out = {}; - out.datum_type = PJD_WGS84; //default setting - if (datumCode && datumCode === 'none') { - out.datum_type = PJD_NODATUM; - } - if (datum_params) { - out.datum_params = datum_params.map(parseFloat); - if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) { - out.datum_type = PJD_3PARAM; - } - if (out.datum_params.length > 3) { - if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) { - out.datum_type = PJD_7PARAM; - out.datum_params[3] *= SEC_TO_RAD; - out.datum_params[4] *= SEC_TO_RAD; - out.datum_params[5] *= SEC_TO_RAD; - out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0; - } - } - } - out.a = a; //datum object also uses these values - out.b = b; - out.es = es; - out.ep2 = ep2; - return out; - } - module.exports = datum; -} -, -/* proj4/lib/datumUtils */ function _(require, module, exports) { - var PJD_3PARAM = 1; - var PJD_7PARAM = 2; - var HALF_PI = Math.PI / 2; - exports.compareDatums = function (source, dest) { - if (source.datum_type !== dest.datum_type) { - return false; // false, datums are not equal - } - else if (source.a !== dest.a || Math.abs(this.es - dest.es) > 0.000000000050) { - // the tolerence for es is to ensure that GRS80 and WGS84 - // are considered identical - return false; - } - else if (source.datum_type === PJD_3PARAM) { - return (this.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]); - } - else if (source.datum_type === PJD_7PARAM) { - return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]); - } - else { - return true; // datums are equal - } - }; // cs_compare_datums() - /* - * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates - * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z), - * according to the current ellipsoid parameters. - * - * Latitude : Geodetic latitude in radians (input) - * Longitude : Geodetic longitude in radians (input) - * Height : Geodetic height, in meters (input) - * X : Calculated Geocentric X coordinate, in meters (output) - * Y : Calculated Geocentric Y coordinate, in meters (output) - * Z : Calculated Geocentric Z coordinate, in meters (output) - * - */ - exports.geodeticToGeocentric = function (p, es, a) { - var Longitude = p.x; - var Latitude = p.y; - var Height = p.z ? p.z : 0; //Z value not always supplied - var Rn; /* Earth radius at location */ - var Sin_Lat; /* Math.sin(Latitude) */ - var Sin2_Lat; /* Square of Math.sin(Latitude) */ - var Cos_Lat; /* Math.cos(Latitude) */ - /* - ** Don't blow up if Latitude is just a little out of the value - ** range as it may just be a rounding issue. Also removed longitude - ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001. - */ - if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) { - Latitude = -HALF_PI; - } - else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) { - Latitude = HALF_PI; - } - else if ((Latitude < -HALF_PI) || (Latitude > HALF_PI)) { - /* Latitude out of range */ - //..reportError('geocent:lat out of range:' + Latitude); - return null; - } - if (Longitude > Math.PI) { - Longitude -= (2 * Math.PI); - } - Sin_Lat = Math.sin(Latitude); - Cos_Lat = Math.cos(Latitude); - Sin2_Lat = Sin_Lat * Sin_Lat; - Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat)); - return { - x: (Rn + Height) * Cos_Lat * Math.cos(Longitude), - y: (Rn + Height) * Cos_Lat * Math.sin(Longitude), - z: ((Rn * (1 - es)) + Height) * Sin_Lat - }; - }; // cs_geodetic_to_geocentric() - exports.geocentricToGeodetic = function (p, es, a, b) { - /* local defintions and variables */ - /* end-criterium of loop, accuracy of sin(Latitude) */ - var genau = 1e-12; - var genau2 = (genau * genau); - var maxiter = 30; - var P; /* distance between semi-minor axis and location */ - var RR; /* distance between center and location */ - var CT; /* sin of geocentric latitude */ - var ST; /* cos of geocentric latitude */ - var RX; - var RK; - var RN; /* Earth radius at location */ - var CPHI0; /* cos of start or old geodetic latitude in iterations */ - var SPHI0; /* sin of start or old geodetic latitude in iterations */ - var CPHI; /* cos of searched geodetic latitude */ - var SPHI; /* sin of searched geodetic latitude */ - var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */ - var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */ - var X = p.x; - var Y = p.y; - var Z = p.z ? p.z : 0.0; //Z value not always supplied - var Longitude; - var Latitude; - var Height; - P = Math.sqrt(X * X + Y * Y); - RR = Math.sqrt(X * X + Y * Y + Z * Z); - /* special cases for latitude and longitude */ - if (P / a < genau) { - /* special case, if P=0. (X=0., Y=0.) */ - Longitude = 0.0; - /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis - * of ellipsoid (=center of mass), Latitude becomes PI/2 */ - if (RR / a < genau) { - Latitude = HALF_PI; - Height = -b; - return { - x: p.x, - y: p.y, - z: p.z - }; - } - } - else { - /* ellipsoidal (geodetic) longitude - * interval: -PI < Longitude <= +PI */ - Longitude = Math.atan2(Y, X); - } - /* -------------------------------------------------------------- - * Following iterative algorithm was developped by - * "Institut for Erdmessung", University of Hannover, July 1988. - * Internet: www.ife.uni-hannover.de - * Iterative computation of CPHI,SPHI and Height. - * Iteration of CPHI and SPHI to 10**-12 radian resp. - * 2*10**-7 arcsec. - * -------------------------------------------------------------- - */ - CT = Z / RR; - ST = P / RR; - RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST); - CPHI0 = ST * (1.0 - es) * RX; - SPHI0 = CT * RX; - iter = 0; - /* loop to find sin(Latitude) resp. Latitude - * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */ - do { - iter++; - RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0); - /* ellipsoidal (geodetic) height */ - Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0); - RK = es * RN / (RN + Height); - RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST); - CPHI = ST * (1.0 - RK) * RX; - SPHI = CT * RX; - SDPHI = SPHI * CPHI0 - CPHI * SPHI0; - CPHI0 = CPHI; - SPHI0 = SPHI; - } while (SDPHI * SDPHI > genau2 && iter < maxiter); - /* ellipsoidal (geodetic) latitude */ - Latitude = Math.atan(SPHI / Math.abs(CPHI)); - return { - x: Longitude, - y: Latitude, - z: Height - }; - }; // cs_geocentric_to_geodetic() - /****************************************************************/ - // pj_geocentic_to_wgs84( p ) - // p = point to transform in geocentric coordinates (x,y,z) - /** point object, nothing fancy, just allows values to be - passed back and forth by reference rather than by value. - Other point classes may be used as long as they have - x and y properties, which will get modified in the transform method. - */ - exports.geocentricToWgs84 = function (p, datum_type, datum_params) { - if (datum_type === PJD_3PARAM) { - // if( x[io] === HUGE_VAL ) - // continue; - return { - x: p.x + datum_params[0], - y: p.y + datum_params[1], - z: p.z + datum_params[2], - }; - } - else if (datum_type === PJD_7PARAM) { - var Dx_BF = datum_params[0]; - var Dy_BF = datum_params[1]; - var Dz_BF = datum_params[2]; - var Rx_BF = datum_params[3]; - var Ry_BF = datum_params[4]; - var Rz_BF = datum_params[5]; - var M_BF = datum_params[6]; - // if( x[io] === HUGE_VAL ) - // continue; - return { - x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF, - y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF, - z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF - }; - } - }; // cs_geocentric_to_wgs84 - /****************************************************************/ - // pj_geocentic_from_wgs84() - // coordinate system definition, - // point to transform in geocentric coordinates (x,y,z) - exports.geocentricFromWgs84 = function (p, datum_type, datum_params) { - if (datum_type === PJD_3PARAM) { - //if( x[io] === HUGE_VAL ) - // continue; - return { - x: p.x - datum_params[0], - y: p.y - datum_params[1], - z: p.z - datum_params[2], - }; - } - else if (datum_type === PJD_7PARAM) { - var Dx_BF = datum_params[0]; - var Dy_BF = datum_params[1]; - var Dz_BF = datum_params[2]; - var Rx_BF = datum_params[3]; - var Ry_BF = datum_params[4]; - var Rz_BF = datum_params[5]; - var M_BF = datum_params[6]; - var x_tmp = (p.x - Dx_BF) / M_BF; - var y_tmp = (p.y - Dy_BF) / M_BF; - var z_tmp = (p.z - Dz_BF) / M_BF; - //if( x[io] === HUGE_VAL ) - // continue; - return { - x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp, - y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp, - z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp - }; - } //cs_geocentric_from_wgs84() - }; -} -, -/* proj4/lib/datum_transform */ function _(require, module, exports) { - var PJD_3PARAM = 1; - var PJD_7PARAM = 2; - var PJD_NODATUM = 5; // WGS84 or equivalent - var datum = require(385) /* ./datumUtils */; - function checkParams(type) { - return (type === PJD_3PARAM || type === PJD_7PARAM); - } - module.exports = function (source, dest, point) { - // Short cut if the datums are identical. - if (datum.compareDatums(source, dest)) { - return point; // in this case, zero is sucess, - // whereas cs_compare_datums returns 1 to indicate TRUE - // confusing, should fix this - } - // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest - if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) { - return point; - } - // If this datum requires grid shifts, then apply it to geodetic coordinates. - // Do we need to go through geocentric coordinates? - if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) { - return point; - } - // Convert to geocentric coordinates. - point = datum.geodeticToGeocentric(point, source.es, source.a); - // Convert between datums - if (checkParams(source.datum_type)) { - point = datum.geocentricToWgs84(point, source.datum_type, source.datum_params); - } - if (checkParams(dest.datum_type)) { - point = datum.geocentricFromWgs84(point, dest.datum_type, dest.datum_params); - } - return datum.geocentricToGeodetic(point, dest.es, dest.a, dest.b); - }; -} -, -/* proj4/lib/defs */ function _(require, module, exports) { - var globals = require(390) /* ./global */; - var parseProj = require(392) /* ./projString */; - var wkt = require(397) /* ./wkt */; - function defs(name) { - /*global console*/ - var that = this; - if (arguments.length === 2) { - var def = arguments[1]; - if (typeof def === 'string') { - if (def.charAt(0) === '+') { - defs[name] = parseProj(arguments[1]); - } - else { - defs[name] = wkt(arguments[1]); - } - } - else { - defs[name] = def; - } - } - else if (arguments.length === 1) { - if (Array.isArray(name)) { - return name.map(function (v) { - if (Array.isArray(v)) { - defs.apply(that, v); - } - else { - defs(v); - } - }); - } - else if (typeof name === 'string') { - if (name in defs) { - return defs[name]; - } - } - else if ('EPSG' in name) { - defs['EPSG:' + name.EPSG] = name; - } - else if ('ESRI' in name) { - defs['ESRI:' + name.ESRI] = name; - } - else if ('IAU2000' in name) { - defs['IAU2000:' + name.IAU2000] = name; - } - else { - console.log(name); - } - return; - } - } - globals(defs); - module.exports = defs; -} -, -/* proj4/lib/deriveConstants */ function _(require, module, exports) { - // ellipoid pj_set_ell.c - var SIXTH = 0.1666666666666666667; - /* 1/6 */ - var RA4 = 0.04722222222222222222; - /* 17/360 */ - var RA6 = 0.02215608465608465608; - var EPSLN = 1.0e-10; - var Ellipsoid = require(380) /* ./constants/Ellipsoid */; - exports.eccentricity = function (a, b, rf, R_A) { - var a2 = a * a; // used in geocentric - var b2 = b * b; // used in geocentric - var es = (a2 - b2) / a2; // e ^ 2 - var e = 0; - if (R_A) { - a *= 1 - es * (SIXTH + es * (RA4 + es * RA6)); - a2 = a * a; - es = 0; - } - else { - e = Math.sqrt(es); // eccentricity - } - var ep2 = (a2 - b2) / b2; // used in geocentric - return { - es: es, - e: e, - ep2: ep2 - }; - }; - exports.sphere = function (a, b, rf, ellps, sphere) { - if (!a) { // do we have an ellipsoid? - var ellipse = Ellipsoid[ellps]; - if (!ellipse) { - ellipse = Ellipsoid.WGS84; - } - a = ellipse.a; - b = ellipse.b; - rf = ellipse.rf; - } - if (rf && !b) { - b = (1.0 - 1.0 / rf) * a; - } - if (rf === 0 || Math.abs(a - b) < EPSLN) { - sphere = true; - b = a; - } - return { - a: a, - b: b, - rf: rf, - sphere: sphere - }; - }; -} -, -/* proj4/lib/extend */ function _(require, module, exports) { - module.exports = function (destination, source) { - destination = destination || {}; - var value, property; - if (!source) { - return destination; - } - for (property in source) { - value = source[property]; - if (value !== undefined) { - destination[property] = value; - } - } - return destination; - }; -} -, -/* proj4/lib/global */ function _(require, module, exports) { - module.exports = function (defs) { - defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); - defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"); - defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"); - defs.WGS84 = defs['EPSG:4326']; - defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857 - defs.GOOGLE = defs['EPSG:3857']; - defs['EPSG:900913'] = defs['EPSG:3857']; - defs['EPSG:102113'] = defs['EPSG:3857']; - }; -} -, -/* proj4/lib/parseCode */ function _(require, module, exports) { - var defs = require(387) /* ./defs */; - var wkt = require(397) /* ./wkt */; - var projStr = require(392) /* ./projString */; - function testObj(code) { - return typeof code === 'string'; - } - function testDef(code) { - return code in defs; - } - var codeWords = ['GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS']; - function testWKT(code) { - return codeWords.some(function (word) { - return code.indexOf(word) > -1; - }); - } - function testProj(code) { - return code[0] === '+'; - } - function parse(code) { - if (testObj(code)) { - //check to see if this is a WKT string - if (testDef(code)) { - return defs[code]; - } - if (testWKT(code)) { - return wkt(code); - } - if (testProj(code)) { - return projStr(code); - } - } - else { - return code; - } - } - module.exports = parse; -} -, -/* proj4/lib/projString */ function _(require, module, exports) { - var D2R = 0.01745329251994329577; - var PrimeMeridian = require(381) /* ./constants/PrimeMeridian */; - var units = require(382) /* ./constants/units */; - module.exports = function (defData) { - var self = {}; - var paramObj = defData.split('+').map(function (v) { - return v.trim(); - }).filter(function (a) { - return a; - }).reduce(function (p, a) { - var split = a.split('='); - split.push(true); - p[split[0].toLowerCase()] = split[1]; - return p; - }, {}); - var paramName, paramVal, paramOutname; - var params = { - proj: 'projName', - datum: 'datumCode', - rf: function (v) { - self.rf = parseFloat(v); - }, - lat_0: function (v) { - self.lat0 = v * D2R; - }, - lat_1: function (v) { - self.lat1 = v * D2R; - }, - lat_2: function (v) { - self.lat2 = v * D2R; - }, - lat_ts: function (v) { - self.lat_ts = v * D2R; - }, - lon_0: function (v) { - self.long0 = v * D2R; - }, - lon_1: function (v) { - self.long1 = v * D2R; - }, - lon_2: function (v) { - self.long2 = v * D2R; - }, - alpha: function (v) { - self.alpha = parseFloat(v) * D2R; - }, - lonc: function (v) { - self.longc = v * D2R; - }, - x_0: function (v) { - self.x0 = parseFloat(v); - }, - y_0: function (v) { - self.y0 = parseFloat(v); - }, - k_0: function (v) { - self.k0 = parseFloat(v); - }, - k: function (v) { - self.k0 = parseFloat(v); - }, - a: function (v) { - self.a = parseFloat(v); - }, - b: function (v) { - self.b = parseFloat(v); - }, - r_a: function () { - self.R_A = true; - }, - zone: function (v) { - self.zone = parseInt(v, 10); - }, - south: function () { - self.utmSouth = true; - }, - towgs84: function (v) { - self.datum_params = v.split(",").map(function (a) { - return parseFloat(a); - }); - }, - to_meter: function (v) { - self.to_meter = parseFloat(v); - }, - units: function (v) { - self.units = v; - if (units[v]) { - self.to_meter = units[v].to_meter; - } - }, - from_greenwich: function (v) { - self.from_greenwich = v * D2R; - }, - pm: function (v) { - self.from_greenwich = (PrimeMeridian[v] ? PrimeMeridian[v] : parseFloat(v)) * D2R; - }, - nadgrids: function (v) { - if (v === '@null') { - self.datumCode = 'none'; - } - else { - self.nadgrids = v; - } - }, - axis: function (v) { - var legalAxis = "ewnsud"; - if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) { - self.axis = v; - } - } - }; - for (paramName in paramObj) { - paramVal = paramObj[paramName]; - if (paramName in params) { - paramOutname = params[paramName]; - if (typeof paramOutname === 'function') { - paramOutname(paramVal); - } - else { - self[paramOutname] = paramVal; - } - } - else { - self[paramName] = paramVal; - } - } - if (typeof self.datumCode === 'string' && self.datumCode !== "WGS84") { - self.datumCode = self.datumCode.toLowerCase(); - } - return self; - }; -} -, -/* proj4/lib/projections */ function _(require, module, exports) { - var projs = [ - require(395) /* ./projections/merc */, - require(394) /* ./projections/longlat */ - ]; - var names = {}; - var projStore = []; - function add(proj, i) { - var len = projStore.length; - if (!proj.names) { - console.log(i); - return true; - } - projStore[len] = proj; - proj.names.forEach(function (n) { - names[n.toLowerCase()] = len; - }); - return this; - } - exports.add = add; - exports.get = function (name) { - if (!name) { - return false; - } - var n = name.toLowerCase(); - if (typeof names[n] !== 'undefined' && projStore[names[n]]) { - return projStore[names[n]]; - } - }; - exports.start = function () { - projs.forEach(add); - }; -} -, -/* proj4/lib/projections/longlat */ function _(require, module, exports) { - exports.init = function () { - //no-op for longlat - }; - function identity(pt) { - return pt; - } - exports.forward = identity; - exports.inverse = identity; - exports.names = ["longlat", "identity"]; -} -, -/* proj4/lib/projections/merc */ function _(require, module, exports) { - var msfnz = require(374) /* ../common/msfnz */; - var HALF_PI = Math.PI / 2; - var EPSLN = 1.0e-10; - var R2D = 57.29577951308232088; - var adjust_lon = require(373) /* ../common/adjust_lon */; - var FORTPI = Math.PI / 4; - var tsfnz = require(378) /* ../common/tsfnz */; - var phi2z = require(375) /* ../common/phi2z */; - exports.init = function () { - var con = this.b / this.a; - this.es = 1 - con * con; - if (!('x0' in this)) { - this.x0 = 0; - } - if (!('y0' in this)) { - this.y0 = 0; - } - this.e = Math.sqrt(this.es); - if (this.lat_ts) { - if (this.sphere) { - this.k0 = Math.cos(this.lat_ts); - } - else { - this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)); - } - } - else { - if (!this.k0) { - if (this.k) { - this.k0 = this.k; - } - else { - this.k0 = 1; - } - } - } - }; - /* Mercator forward equations--mapping lat,long to x,y - --------------------------------------------------*/ - exports.forward = function (p) { - var lon = p.x; - var lat = p.y; - // convert to radians - if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) { - return null; - } - var x, y; - if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) { - return null; - } - else { - if (this.sphere) { - x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0); - y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat)); - } - else { - var sinphi = Math.sin(lat); - var ts = tsfnz(this.e, lat, sinphi); - x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0); - y = this.y0 - this.a * this.k0 * Math.log(ts); - } - p.x = x; - p.y = y; - return p; - } - }; - /* Mercator inverse equations--mapping x,y to lat/long - --------------------------------------------------*/ - exports.inverse = function (p) { - var x = p.x - this.x0; - var y = p.y - this.y0; - var lon, lat; - if (this.sphere) { - lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0))); - } - else { - var ts = Math.exp(-y / (this.a * this.k0)); - lat = phi2z(this.e, ts); - if (lat === -9999) { - return null; - } - } - lon = adjust_lon(this.long0 + x / (this.a * this.k0)); - p.x = lon; - p.y = lat; - return p; - }; - exports.names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"]; -} -, -/* proj4/lib/transform */ function _(require, module, exports) { - var D2R = 0.01745329251994329577; - var R2D = 57.29577951308232088; - var PJD_3PARAM = 1; - var PJD_7PARAM = 2; - var datum_transform = require(386) /* ./datum_transform */; - var adjust_axis = require(372) /* ./adjust_axis */; - var proj = require(371) /* ./Proj */; - var toPoint = require(377) /* ./common/toPoint */; - function checkNotWGS(source, dest) { - return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84'); - } - module.exports = function transform(source, dest, point) { - var wgs84; - if (Array.isArray(point)) { - point = toPoint(point); - } - // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84 - if (source.datum && dest.datum && checkNotWGS(source, dest)) { - wgs84 = new proj('WGS84'); - point = transform(source, wgs84, point); - source = wgs84; - } - // DGR, 2010/11/12 - if (source.axis !== 'enu') { - point = adjust_axis(source, false, point); - } - // Transform source points to long/lat, if they aren't already. - if (source.projName === 'longlat') { - point = { - x: point.x * D2R, - y: point.y * D2R - }; - } - else { - if (source.to_meter) { - point = { - x: point.x * source.to_meter, - y: point.y * source.to_meter - }; - } - point = source.inverse(point); // Convert Cartesian to longlat - } - // Adjust for the prime meridian if necessary - if (source.from_greenwich) { - point.x += source.from_greenwich; - } - // Convert datums if needed, and if possible. - point = datum_transform(source.datum, dest.datum, point); - // Adjust for the prime meridian if necessary - if (dest.from_greenwich) { - point = { - x: point.x - dest.grom_greenwich, - y: point.y - }; - } - if (dest.projName === 'longlat') { - // convert radians to decimal degrees - point = { - x: point.x * R2D, - y: point.y * R2D - }; - } - else { // else project - point = dest.forward(point); - if (dest.to_meter) { - point = { - x: point.x / dest.to_meter, - y: point.y / dest.to_meter - }; - } - } - // DGR, 2010/11/12 - if (dest.axis !== 'enu') { - return adjust_axis(dest, true, point); - } - return point; - }; -} -, -/* proj4/lib/wkt */ function _(require, module, exports) { - var D2R = 0.01745329251994329577; - var extend = require(389) /* ./extend */; - function mapit(obj, key, v) { - obj[key] = v.map(function (aa) { - var o = {}; - sExpr(aa, o); - return o; - }).reduce(function (a, b) { - return extend(a, b); - }, {}); - } - function sExpr(v, obj) { - var key; - if (!Array.isArray(v)) { - obj[v] = true; - return; - } - else { - key = v.shift(); - if (key === 'PARAMETER') { - key = v.shift(); - } - if (v.length === 1) { - if (Array.isArray(v[0])) { - obj[key] = {}; - sExpr(v[0], obj[key]); - } - else { - obj[key] = v[0]; - } - } - else if (!v.length) { - obj[key] = true; - } - else if (key === 'TOWGS84') { - obj[key] = v; - } - else { - obj[key] = {}; - if (['UNIT', 'PRIMEM', 'VERT_DATUM'].indexOf(key) > -1) { - obj[key] = { - name: v[0].toLowerCase(), - convert: v[1] - }; - if (v.length === 3) { - obj[key].auth = v[2]; - } - } - else if (key === 'SPHEROID') { - obj[key] = { - name: v[0], - a: v[1], - rf: v[2] - }; - if (v.length === 4) { - obj[key].auth = v[3]; - } - } - else if (['GEOGCS', 'GEOCCS', 'DATUM', 'VERT_CS', 'COMPD_CS', 'LOCAL_CS', 'FITTED_CS', 'LOCAL_DATUM'].indexOf(key) > -1) { - v[0] = ['name', v[0]]; - mapit(obj, key, v); - } - else if (v.every(function (aa) { - return Array.isArray(aa); - })) { - mapit(obj, key, v); - } - else { - sExpr(v, obj[key]); - } - } - } - } - function rename(obj, params) { - var outName = params[0]; - var inName = params[1]; - if (!(outName in obj) && (inName in obj)) { - obj[outName] = obj[inName]; - if (params.length === 3) { - obj[outName] = params[2](obj[outName]); - } - } - } - function d2r(input) { - return input * D2R; - } - function cleanWKT(wkt) { - if (wkt.type === 'GEOGCS') { - wkt.projName = 'longlat'; - } - else if (wkt.type === 'LOCAL_CS') { - wkt.projName = 'identity'; - wkt.local = true; - } - else { - if (typeof wkt.PROJECTION === "object") { - wkt.projName = Object.keys(wkt.PROJECTION)[0]; - } - else { - wkt.projName = wkt.PROJECTION; - } - } - if (wkt.UNIT) { - wkt.units = wkt.UNIT.name.toLowerCase(); - if (wkt.units === 'metre') { - wkt.units = 'meter'; - } - if (wkt.UNIT.convert) { - if (wkt.type === 'GEOGCS') { - if (wkt.DATUM && wkt.DATUM.SPHEROID) { - wkt.to_meter = parseFloat(wkt.UNIT.convert, 10) * wkt.DATUM.SPHEROID.a; - } - } - else { - wkt.to_meter = parseFloat(wkt.UNIT.convert, 10); - } - } - } - if (wkt.GEOGCS) { - //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){ - // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R; - //} - if (wkt.GEOGCS.DATUM) { - wkt.datumCode = wkt.GEOGCS.DATUM.name.toLowerCase(); - } - else { - wkt.datumCode = wkt.GEOGCS.name.toLowerCase(); - } - if (wkt.datumCode.slice(0, 2) === 'd_') { - wkt.datumCode = wkt.datumCode.slice(2); - } - if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') { - wkt.datumCode = 'nzgd49'; - } - if (wkt.datumCode === "wgs_1984") { - if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') { - wkt.sphere = true; - } - wkt.datumCode = 'wgs84'; - } - if (wkt.datumCode.slice(-6) === '_ferro') { - wkt.datumCode = wkt.datumCode.slice(0, -6); - } - if (wkt.datumCode.slice(-8) === '_jakarta') { - wkt.datumCode = wkt.datumCode.slice(0, -8); - } - if (~wkt.datumCode.indexOf('belge')) { - wkt.datumCode = "rnb72"; - } - if (wkt.GEOGCS.DATUM && wkt.GEOGCS.DATUM.SPHEROID) { - wkt.ellps = wkt.GEOGCS.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk'); - if (wkt.ellps.toLowerCase().slice(0, 13) === "international") { - wkt.ellps = 'intl'; - } - wkt.a = wkt.GEOGCS.DATUM.SPHEROID.a; - wkt.rf = parseFloat(wkt.GEOGCS.DATUM.SPHEROID.rf, 10); - } - if (~wkt.datumCode.indexOf('osgb_1936')) { - wkt.datumCode = "osgb36"; - } - } - if (wkt.b && !isFinite(wkt.b)) { - wkt.b = wkt.a; - } - function toMeter(input) { - var ratio = wkt.to_meter || 1; - return parseFloat(input, 10) * ratio; - } - var renamer = function (a) { - return rename(wkt, a); - }; - var list = [ - ['standard_parallel_1', 'Standard_Parallel_1'], - ['standard_parallel_2', 'Standard_Parallel_2'], - ['false_easting', 'False_Easting'], - ['false_northing', 'False_Northing'], - ['central_meridian', 'Central_Meridian'], - ['latitude_of_origin', 'Latitude_Of_Origin'], - ['latitude_of_origin', 'Central_Parallel'], - ['scale_factor', 'Scale_Factor'], - ['k0', 'scale_factor'], - ['latitude_of_center', 'Latitude_of_center'], - ['lat0', 'latitude_of_center', d2r], - ['longitude_of_center', 'Longitude_Of_Center'], - ['longc', 'longitude_of_center', d2r], - ['x0', 'false_easting', toMeter], - ['y0', 'false_northing', toMeter], - ['long0', 'central_meridian', d2r], - ['lat0', 'latitude_of_origin', d2r], - ['lat0', 'standard_parallel_1', d2r], - ['lat1', 'standard_parallel_1', d2r], - ['lat2', 'standard_parallel_2', d2r], - ['alpha', 'azimuth', d2r], - ['srsCode', 'name'] - ]; - list.forEach(renamer); - if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === "Lambert_Azimuthal_Equal_Area")) { - wkt.long0 = wkt.longc; - } - if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { - wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90); - wkt.lat_ts = wkt.lat1; - } - } - module.exports = function (wkt, self) { - var lisp = JSON.parse(("," + wkt).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g, ',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g, ',"$1"]').replace(/,\["VERTCS".+/, '')); - var type = lisp.shift(); - var name = lisp.shift(); - lisp.unshift(['name', name]); - lisp.unshift(['type', type]); - lisp.unshift('output'); - var obj = {}; - sExpr(lisp, obj); - cleanWKT(obj.output); - return extend(self, obj.output); - }; -} -, -/* sprintf-js/src/sprintf */ function _(require, module, exports) { - /* global window, exports, define */ - !function () { - 'use strict'; - var re = { - not_string: /[^s]/, - not_bool: /[^t]/, - not_type: /[^T]/, - not_primitive: /[^v]/, - number: /[diefg]/, - numeric_arg: /[bcdiefguxX]/, - json: /[j]/, - not_json: /[^j]/, - text: /^[^\x25]+/, - modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, - key: /^([a-z_][a-z_\d]*)/i, - key_access: /^\.([a-z_][a-z_\d]*)/i, - index_access: /^\[(\d+)\]/, - sign: /^[+-]/ - }; - function sprintf(key) { - // `arguments` is not an array, but should be fine for this call - return sprintf_format(sprintf_parse(key), arguments); - } - function vsprintf(fmt, argv) { - return sprintf.apply(null, [fmt].concat(argv || [])); - } - function sprintf_format(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign; - for (i = 0; i < tree_length; i++) { - if (typeof parse_tree[i] === 'string') { - output += parse_tree[i]; - } - else if (typeof parse_tree[i] === 'object') { - ph = parse_tree[i]; // convenience purposes only - if (ph.keys) { // keyword argument - arg = argv[cursor]; - for (k = 0; k < ph.keys.length; k++) { - if (arg == undefined) { - throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k - 1])); - } - arg = arg[ph.keys[k]]; - } - } - else if (ph.param_no) { // positional argument (explicit) - arg = argv[ph.param_no]; - } - else { // positional argument (implicit) - arg = argv[cursor++]; - } - if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) { - arg = arg(); - } - if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) { - throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)); - } - if (re.number.test(ph.type)) { - is_positive = arg >= 0; - } - switch (ph.type) { - case 'b': - arg = parseInt(arg, 10).toString(2); - break; - case 'c': - arg = String.fromCharCode(parseInt(arg, 10)); - break; - case 'd': - case 'i': - arg = parseInt(arg, 10); - break; - case 'j': - arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0); - break; - case 'e': - arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential(); - break; - case 'f': - arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg); - break; - case 'g': - arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg); - break; - case 'o': - arg = (parseInt(arg, 10) >>> 0).toString(8); - break; - case 's': - arg = String(arg); - arg = (ph.precision ? arg.substring(0, ph.precision) : arg); - break; - case 't': - arg = String(!!arg); - arg = (ph.precision ? arg.substring(0, ph.precision) : arg); - break; - case 'T': - arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase(); - arg = (ph.precision ? arg.substring(0, ph.precision) : arg); - break; - case 'u': - arg = parseInt(arg, 10) >>> 0; - break; - case 'v': - arg = arg.valueOf(); - arg = (ph.precision ? arg.substring(0, ph.precision) : arg); - break; - case 'x': - arg = (parseInt(arg, 10) >>> 0).toString(16); - break; - case 'X': - arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase(); - break; - } - if (re.json.test(ph.type)) { - output += arg; - } - else { - if (re.number.test(ph.type) && (!is_positive || ph.sign)) { - sign = is_positive ? '+' : '-'; - arg = arg.toString().replace(re.sign, ''); - } - else { - sign = ''; - } - pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '; - pad_length = ph.width - (sign + arg).length; - pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''; - output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg); - } - } - } - return output; - } - var sprintf_cache = Object.create(null); - function sprintf_parse(fmt) { - if (sprintf_cache[fmt]) { - return sprintf_cache[fmt]; - } - var _fmt = fmt, match, parse_tree = [], arg_names = 0; - while (_fmt) { - if ((match = re.text.exec(_fmt)) !== null) { - parse_tree.push(match[0]); - } - else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree.push('%'); - } - else if ((match = re.placeholder.exec(_fmt)) !== null) { - if (match[2]) { - arg_names |= 1; - var field_list = [], replacement_field = match[2], field_match = []; - if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list.push(field_match[1]); - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { - if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list.push(field_match[1]); - } - else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list.push(field_match[1]); - } - else { - throw new SyntaxError('[sprintf] failed to parse named argument key'); - } - } - } - else { - throw new SyntaxError('[sprintf] failed to parse named argument key'); - } - match[2] = field_list; - } - else { - arg_names |= 2; - } - if (arg_names === 3) { - throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported'); - } - parse_tree.push({ - placeholder: match[0], - param_no: match[1], - keys: match[2], - sign: match[3], - pad_char: match[4], - align: match[5], - width: match[6], - precision: match[7], - type: match[8] - }); - } - else { - throw new SyntaxError('[sprintf] unexpected placeholder'); - } - _fmt = _fmt.substring(match[0].length); - } - return sprintf_cache[fmt] = parse_tree; - } - /** - * export to either browser or node.js - */ - /* eslint-disable quote-props */ - if (typeof exports !== 'undefined') { - exports['sprintf'] = sprintf; - exports['vsprintf'] = vsprintf; - } - if (typeof window !== 'undefined') { - window['sprintf'] = sprintf; - window['vsprintf'] = vsprintf; - if (typeof define === 'function' && define['amd']) { - define(function () { - return { - 'sprintf': sprintf, - 'vsprintf': vsprintf - }; - }); - } - } - /* eslint-enable quote-props */ - }(); // eslint-disable-line -} -, -/* timezone/index */ function _(require, module, exports) { - !function (definition) { - if (typeof module == "object" && module.exports) - module.exports = definition(); - else if (typeof define == "function") - define(definition); - else - this.tz = definition(); - }(function () { - /* - function die () { - console.log.apply(console, __slice.call(arguments, 0)); - return process.exit(1); - } - - function say () { return console.log.apply(console, __slice.call(arguments, 0)) } - */ - function actualize(entry, rule, year) { - var actualized, date = rule.day[1]; - do { - actualized = new Date(Date.UTC(year, rule.month, Math.abs(date++))); - } while (rule.day[0] < 7 && actualized.getUTCDay() != rule.day[0]); - actualized = { - clock: rule.clock, - sort: actualized.getTime(), - rule: rule, - save: rule.save * 6e4, - offset: entry.offset - }; - actualized[actualized.clock] = actualized.sort + rule.time * 6e4; - if (actualized.posix) { - actualized.wallclock = actualized[actualized.clock] + (entry.offset + rule.saved); - } - else { - actualized.posix = actualized[actualized.clock] - (entry.offset + rule.saved); - } - return actualized; - } - function find(request, clock, time) { - var i, I, entry, found, zone = request[request.zone], actualized = [], abbrev, rules, j, year = new Date(time).getUTCFullYear(), off = 1; - for (i = 1, I = zone.length; i < I; i++) - if (zone[i][clock] <= time) - break; - entry = zone[i]; - if (entry.rules) { - rules = request[entry.rules]; - for (j = year + 1; j >= year - off; --j) - for (i = 0, I = rules.length; i < I; i++) - if (rules[i].from <= j && j <= rules[i].to) - actualized.push(actualize(entry, rules[i], j)); - else if (rules[i].to < j && off == 1) - off = j - rules[i].to; - actualized.sort(function (a, b) { return a.sort - b.sort; }); - for (i = 0, I = actualized.length; i < I; i++) { - if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock]) - found = actualized[i]; - } - } - if (found) { - if (abbrev = /^(.*)\/(.*)$/.exec(entry.format)) { - found.abbrev = abbrev[found.save ? 2 : 1]; - } - else { - found.abbrev = entry.format.replace(/%s/, found.rule.letter); - } - } - return found || entry; - } - function convertToWallclock(request, posix) { - if (request.zone == "UTC") - return posix; - request.entry = find(request, "posix", posix); - return posix + request.entry.offset + request.entry.save; - } - function convertToPOSIX(request, wallclock) { - if (request.zone == "UTC") - return wallclock; - var entry, diff; - request.entry = entry = find(request, "wallclock", wallclock); - diff = wallclock - entry.wallclock; - return 0 < diff && diff < entry.save ? null : wallclock - entry.offset - entry.save; - } - function adjust(request, posix, match) { - var increment = +(match[1] + 1) // conversion necessary for week day addition - , offset = match[2] * increment, index = UNITS.indexOf(match[3].toLowerCase()), date; - if (index > 9) { - posix += offset * TIME[index - 10]; - } - else { - date = new Date(convertToWallclock(request, posix)); - if (index < 7) { - while (offset) { - date.setUTCDate(date.getUTCDate() + increment); - if (date.getUTCDay() == index) - offset -= increment; - } - } - else if (index == 7) { - date.setUTCFullYear(date.getUTCFullYear() + offset); - } - else if (index == 8) { - date.setUTCMonth(date.getUTCMonth() + offset); - } - else { - date.setUTCDate(date.getUTCDate() + offset); - } - if ((posix = convertToPOSIX(request, date.getTime())) == null) { - posix = convertToPOSIX(request, date.getTime() + 864e5 * increment) - 864e5 * increment; - } - } - return posix; - } - function convert(vargs) { - if (!vargs.length) - return "1.0.22"; - var request = Object.create(this), adjustments = [], i, I, $, argument, date; - for (i = 0; i < vargs.length; i++) { // leave the for loop alone, it works. - argument = vargs[i]; - // https://twitter.com/bigeasy/status/215112186572439552 - if (Array.isArray(argument)) { - if (!i && !isNaN(argument[1])) { - date = argument; - } - else { - argument.splice.apply(vargs, [i--, 1].concat(argument)); - } - } - else if (isNaN(argument)) { - $ = typeof argument; - if ($ == "string") { - if (~argument.indexOf("%")) { - request.format = argument; - } - else if (!i && argument == "*") { - date = argument; - } - else if (!i && ($ = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|(([+-])(\d{2}(:\d{2}){0,2})))?)?$/.exec(argument))) { - date = []; - date.push.apply(date, $.slice(1, 8)); - if ($[9]) { - date.push($[10] + 1); - date.push.apply(date, $[11].split(/:/)); - } - else if ($[8]) { - date.push(1); - } - } - else if (/^\w{2,3}_\w{2}$/.test(argument)) { - request.locale = argument; - } - else if ($ = UNIT_RE.exec(argument)) { - adjustments.push($); - } - else { - request.zone = argument; - } - } - else if ($ == "function") { - if ($ = argument.call(request)) - return $; - } - else if (/^\w{2,3}_\w{2}$/.test(argument.name)) { - request[argument.name] = argument; - } - else if (argument.zones) { - for ($ in argument.zones) - request[$] = argument.zones[$]; - for ($ in argument.rules) - request[$] = argument.rules[$]; - } - } - else if (!i) { - date = argument; - } - } - if (!request[request.locale]) - delete request.locale; - if (!request[request.zone]) - delete request.zone; - if (date != null) { - if (date == "*") { - date = request.clock(); - } - else if (Array.isArray(date)) { - $ = []; - I = !date[7]; - for (i = 0; i < 11; i++) - $[i] = +(date[i] || 0); // conversion necessary for decrement - --$[1]; // Grr.. - date = Date.UTC.apply(Date.UTC, $) + -$[7] * ($[8] * 36e5 + $[9] * 6e4 + $[10] * 1e3); - } - else { - date = Math.floor(date); - } - if (!isNaN(date)) { - if (I) - date = convertToPOSIX(request, date); - if (date == null) - return date; - for (i = 0, I = adjustments.length; i < I; i++) { - date = adjust(request, date, adjustments[i]); - } - if (!request.format) - return date; - $ = new Date(convertToWallclock(request, date)); - return request.format.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g, function (value, flag, colons, padding, specifier) { - var f, fill = "0", pad; - if (f = request[specifier]) { - value = String(f.call(request, $, date, flag, colons.length)); - if ((flag || f.style) == "_") - fill = " "; - pad = flag == "-" ? 0 : f.pad || 0; - while (value.length < pad) - value = fill + value; - pad = flag == "-" ? 0 : padding || f.pad; - while (value.length < pad) - value = fill + value; - if (specifier == "N" && pad < value.length) - value = value.slice(0, pad); - if (flag == "^") - value = value.toUpperCase(); - } - return value; - }); - } - } - return function () { return request.convert(arguments); }; - } - var context = { clock: function () { return +(new Date()); }, - zone: "UTC", - entry: { abbrev: "UTC", offset: 0, save: 0 }, - UTC: 1, - z: function (date, posix, flag, delimiters) { - var offset = this.entry.offset + this.entry.save, seconds = Math.abs(offset / 1000), parts = [], part = 3600, i, z; - for (i = 0; i < 3; i++) { - parts.push(("0" + Math.floor(seconds / part)).slice(-2)); - seconds %= part; - part /= 60; - } - if (flag == "^" && !offset) - return "Z"; - if (flag == "^") - delimiters = 3; - if (delimiters == 3) { - z = parts.join(":"); - z = z.replace(/:00$/, ""); - if (flag != "^") - z = z.replace(/:00$/, ""); - } - else if (delimiters) { - z = parts.slice(0, delimiters + 1).join(":"); - if (flag == "^") - z = z.replace(/:00$/, ""); - } - else { - z = parts.slice(0, 2).join(""); - } - z = (offset < 0 ? "-" : "+") + z; - z = z.replace(/([-+])(0)/, { "_": " $1", "-": "$1" }[flag] || "$1$2"); - return z; - }, - "%": function (date) { return "%"; }, - n: function (date) { return "\n"; }, - t: function (date) { return "\t"; }, - U: function (date) { return weekOfYear(date, 0); }, - W: function (date) { return weekOfYear(date, 1); }, - V: function (date) { return isoWeek(date)[0]; }, - G: function (date) { return isoWeek(date)[1]; }, - g: function (date) { return isoWeek(date)[1] % 100; }, - j: function (date) { return Math.floor((date.getTime() - Date.UTC(date.getUTCFullYear(), 0)) / 864e5) + 1; }, - s: function (date) { return Math.floor(date.getTime() / 1000); }, - C: function (date) { return Math.floor(date.getUTCFullYear() / 100); }, - N: function (date) { return date.getTime() % 1000 * 1000000; }, - m: function (date) { return date.getUTCMonth() + 1; }, - Y: function (date) { return date.getUTCFullYear(); }, - y: function (date) { return date.getUTCFullYear() % 100; }, - H: function (date) { return date.getUTCHours(); }, - M: function (date) { return date.getUTCMinutes(); }, - S: function (date) { return date.getUTCSeconds(); }, - e: function (date) { return date.getUTCDate(); }, - d: function (date) { return date.getUTCDate(); }, - u: function (date) { return date.getUTCDay() || 7; }, - w: function (date) { return date.getUTCDay(); }, - l: function (date) { return date.getUTCHours() % 12 || 12; }, - I: function (date) { return date.getUTCHours() % 12 || 12; }, - k: function (date) { return date.getUTCHours(); }, - Z: function (date) { return this.entry.abbrev; }, - a: function (date) { return this[this.locale].day.abbrev[date.getUTCDay()]; }, - A: function (date) { return this[this.locale].day.full[date.getUTCDay()]; }, - h: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; }, - b: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; }, - B: function (date) { return this[this.locale].month.full[date.getUTCMonth()]; }, - P: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)].toLowerCase(); }, - p: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)]; }, - R: function (date, posix) { return this.convert([posix, "%H:%M"]); }, - T: function (date, posix) { return this.convert([posix, "%H:%M:%S"]); }, - D: function (date, posix) { return this.convert([posix, "%m/%d/%y"]); }, - F: function (date, posix) { return this.convert([posix, "%Y-%m-%d"]); }, - x: function (date, posix) { return this.convert([posix, this[this.locale].date]); }, - r: function (date, posix) { return this.convert([posix, this[this.locale].time12 || '%I:%M:%S']); }, - X: function (date, posix) { return this.convert([posix, this[this.locale].time24]); }, - c: function (date, posix) { return this.convert([posix, this[this.locale].dateTime]); }, - convert: convert, - locale: "en_US", - en_US: { - date: "%m/%d/%Y", - time24: "%I:%M:%S %p", - time12: "%I:%M:%S %p", - dateTime: "%a %d %b %Y %I:%M:%S %p %Z", - meridiem: ["AM", "PM"], - month: { - abbrev: "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec".split("|"), - full: "January|February|March|April|May|June|July|August|September|October|November|December".split("|") - }, - day: { - abbrev: "Sun|Mon|Tue|Wed|Thu|Fri|Sat".split("|"), - full: "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday".split("|") - } - } - }; - var UNITS = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond", UNIT_RE = new RegExp("^\\s*([+-])(\\d+)\\s+(" + UNITS + ")s?\\s*$", "i"), TIME = [36e5, 6e4, 1e3, 1]; - UNITS = UNITS.toLowerCase().split("|"); - "delmHMSUWVgCIky".replace(/./g, function (e) { context[e].pad = 2; }); - context.N.pad = 9; - context.j.pad = 3; - context.k.style = "_"; - context.l.style = "_"; - context.e.style = "_"; - function weekOfYear(date, startOfWeek) { - var diff, nyd, weekStart; - nyd = new Date(Date.UTC(date.getUTCFullYear(), 0)); - diff = Math.floor((date.getTime() - nyd.getTime()) / 864e5); - if (nyd.getUTCDay() == startOfWeek) { - weekStart = 0; - } - else { - weekStart = 7 - nyd.getUTCDay() + startOfWeek; - if (weekStart == 8) { - weekStart = 1; - } - } - return diff >= weekStart ? Math.floor((diff - weekStart) / 7) + 1 : 0; - } - function isoWeek(date) { - var nyd, nyy, week; - nyy = date.getUTCFullYear(); - nyd = new Date(Date.UTC(nyy, 0)).getUTCDay(); - week = weekOfYear(date, 1) + (nyd > 1 && nyd <= 4 ? 1 : 0); - if (!week) { - nyy = date.getUTCFullYear() - 1; - nyd = new Date(Date.UTC(nyy, 0)).getUTCDay(); - week = nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29) ? 53 : 52; - return [week, date.getUTCFullYear() - 1]; - } - else if (week == 53 && !(nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29))) { - return [1, date.getUTCFullYear() + 1]; - } - else { - return [week, date.getUTCFullYear()]; - } - } - return function () { return context.convert(arguments); }; - }); -} -, -/* tslib/tslib */ function _(require, module, exports) { - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global global, define, System, Reflect, Promise */ - var __extends; - var __assign; - var __rest; - var __decorate; - var __param; - var __metadata; - var __awaiter; - var __generator; - var __exportStar; - var __values; - var __read; - var __spread; - var __await; - var __asyncGenerator; - var __asyncDelegator; - var __asyncValues; - var __makeTemplateObject; - var __importStar; - var __importDefault; - (function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } - })(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; }; - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - __rest = function (s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) - if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; - return t; - }; - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if (d = decorators[i]) - r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); }; - }; - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") - return Reflect.metadata(metadataKey, metadataValue); - }; - __awaiter = function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { - step(generator.next(value)); - } - catch (e) { - reject(e); - } } - function rejected(value) { try { - step(generator["throw"](value)); - } - catch (e) { - reject(e); - } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function () { if (t[0] & 1) - throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body.call(thisArg, _); - } - catch (e) { - op = [6, e]; - y = 0; - } - finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - __exportStar = function (m, exports) { - for (var p in m) - if (!exports.hasOwnProperty(p)) - exports[p] = m[p]; - }; - __values = function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) - return m.call(o); - return { - next: function () { - if (o && i >= o.length) - o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - }; - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) - return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) - ar.push(r.value); - } - catch (error) { - e = { error: error }; - } - finally { - try { - if (r && !r.done && (m = i["return"])) - m.call(i); - } - finally { - if (e) - throw e.error; - } - } - return ar; - }; - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) - i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { - step(g[n](v)); - } - catch (e) { - settle(q[0][3], e); - } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) - resume(q[0][0], q[0][1]); } - }; - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - __asyncValues = function (o) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } - }; - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } - else { - cooked.raw = raw; - } - return cooked; - }; - __importStar = function (mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) - result[k] = mod[k]; - result["default"] = mod; - return result; - }; - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - }); -} - -], {"base":0,"client/connection":1,"client/session":2,"core/bokeh_events":3,"core/build_views":4,"core/dom":5,"core/dom_view":6,"core/enums":7,"core/has_props":8,"core/hittest":9,"core/layout/alignments":10,"core/layout/grid":11,"core/layout/html":12,"core/layout/index":13,"core/layout/layoutable":14,"core/layout/side_panel":15,"core/layout/types":16,"core/logging":17,"core/properties":18,"core/property_mixins":19,"core/selection_manager":20,"core/settings":21,"core/signaling":22,"core/ui_events":23,"core/util/array":24,"core/util/arrayable":25,"core/util/assert":26,"core/util/bbox":27,"core/util/callback":28,"core/util/canvas":29,"core/util/color":30,"core/util/compat":31,"core/util/data_structures":32,"core/util/eq":33,"core/util/math":34,"core/util/object":35,"core/util/projections":36,"core/util/refs":37,"core/util/serialization":38,"core/util/spatial":39,"core/util/string":40,"core/util/svg_colors":41,"core/util/templating":42,"core/util/text":43,"core/util/throttle":44,"core/util/typed_array":45,"core/util/types":46,"core/util/wheel":47,"core/util/zoom":48,"core/vectorization":49,"core/view":50,"core/visuals":51,"document/document":52,"document/events":53,"document/index":54,"embed/dom":55,"embed/index":56,"embed/notebook":57,"embed/server":58,"embed/standalone":59,"index":60,"main":61,"model":62,"models/annotations/annotation":63,"models/annotations/arrow":64,"models/annotations/arrow_head":65,"models/annotations/band":66,"models/annotations/box_annotation":67,"models/annotations/color_bar":68,"models/annotations/index":69,"models/annotations/label":70,"models/annotations/label_set":71,"models/annotations/legend":72,"models/annotations/legend_item":73,"models/annotations/poly_annotation":74,"models/annotations/slope":75,"models/annotations/span":76,"models/annotations/text_annotation":77,"models/annotations/title":78,"models/annotations/toolbar_panel":79,"models/annotations/tooltip":80,"models/annotations/whisker":81,"models/axes/axis":82,"models/axes/categorical_axis":83,"models/axes/continuous_axis":84,"models/axes/datetime_axis":85,"models/axes/index":86,"models/axes/linear_axis":87,"models/axes/log_axis":88,"models/axes/mercator_axis":89,"models/callbacks/callback":90,"models/callbacks/customjs":91,"models/callbacks/index":92,"models/callbacks/open_url":93,"models/canvas/canvas":94,"models/canvas/cartesian_frame":95,"models/canvas/index":96,"models/expressions/cumsum":97,"models/expressions/expression":98,"models/expressions/index":99,"models/expressions/stack":100,"models/filters/boolean_filter":101,"models/filters/customjs_filter":102,"models/filters/filter":103,"models/filters/group_filter":104,"models/filters/index":105,"models/filters/index_filter":106,"models/formatters/basic_tick_formatter":107,"models/formatters/categorical_tick_formatter":108,"models/formatters/datetime_tick_formatter":109,"models/formatters/func_tick_formatter":110,"models/formatters/index":111,"models/formatters/log_tick_formatter":112,"models/formatters/mercator_tick_formatter":113,"models/formatters/numeral_tick_formatter":114,"models/formatters/printf_tick_formatter":115,"models/formatters/tick_formatter":116,"models/glyphs/annular_wedge":117,"models/glyphs/annulus":118,"models/glyphs/arc":119,"models/glyphs/bezier":120,"models/glyphs/box":121,"models/glyphs/center_rotatable":122,"models/glyphs/circle":123,"models/glyphs/ellipse":124,"models/glyphs/ellipse_oval":125,"models/glyphs/glyph":126,"models/glyphs/hbar":127,"models/glyphs/hex_tile":128,"models/glyphs/image":129,"models/glyphs/image_base":130,"models/glyphs/image_rgba":131,"models/glyphs/image_url":132,"models/glyphs/index":133,"models/glyphs/line":134,"models/glyphs/multi_line":135,"models/glyphs/multi_polygons":136,"models/glyphs/oval":137,"models/glyphs/patch":138,"models/glyphs/patches":139,"models/glyphs/quad":140,"models/glyphs/quadratic":141,"models/glyphs/ray":142,"models/glyphs/rect":143,"models/glyphs/segment":144,"models/glyphs/step":145,"models/glyphs/text":146,"models/glyphs/utils":147,"models/glyphs/vbar":148,"models/glyphs/wedge":149,"models/glyphs/xy_glyph":150,"models/graphs/graph_hit_test_policy":151,"models/graphs/index":152,"models/graphs/layout_provider":153,"models/graphs/static_layout_provider":154,"models/grids/grid":155,"models/grids/index":156,"models/index":157,"models/layouts/box":158,"models/layouts/column":159,"models/layouts/grid_box":160,"models/layouts/html_box":161,"models/layouts/index":162,"models/layouts/layout_dom":163,"models/layouts/row":164,"models/layouts/spacer":165,"models/layouts/tabs":166,"models/layouts/widget_box":167,"models/mappers/categorical_color_mapper":168,"models/mappers/categorical_mapper":169,"models/mappers/categorical_marker_mapper":170,"models/mappers/color_mapper":171,"models/mappers/continuous_color_mapper":172,"models/mappers/index":173,"models/mappers/linear_color_mapper":174,"models/mappers/log_color_mapper":175,"models/mappers/mapper":176,"models/markers/defs":177,"models/markers/index":178,"models/markers/marker":179,"models/markers/scatter":180,"models/plots/gmap_plot":181,"models/plots/gmap_plot_canvas":182,"models/plots/index":183,"models/plots/plot":184,"models/plots/plot_canvas":185,"models/ranges/data_range":186,"models/ranges/data_range1d":187,"models/ranges/factor_range":188,"models/ranges/index":189,"models/ranges/range":190,"models/ranges/range1d":191,"models/renderers/data_renderer":192,"models/renderers/glyph_renderer":193,"models/renderers/graph_renderer":194,"models/renderers/guide_renderer":195,"models/renderers/index":196,"models/renderers/renderer":197,"models/scales/categorical_scale":198,"models/scales/index":199,"models/scales/linear_scale":200,"models/scales/log_scale":201,"models/scales/scale":202,"models/selections/index":203,"models/selections/interaction_policy":204,"models/selections/selection":205,"models/sources/ajax_data_source":206,"models/sources/cds_view":207,"models/sources/column_data_source":208,"models/sources/columnar_data_source":209,"models/sources/data_source":210,"models/sources/geojson_data_source":211,"models/sources/index":212,"models/sources/remote_data_source":213,"models/sources/server_sent_data_source":214,"models/sources/web_data_source":215,"models/tickers/adaptive_ticker":216,"models/tickers/basic_ticker":217,"models/tickers/categorical_ticker":218,"models/tickers/composite_ticker":219,"models/tickers/continuous_ticker":220,"models/tickers/datetime_ticker":221,"models/tickers/days_ticker":222,"models/tickers/fixed_ticker":223,"models/tickers/index":224,"models/tickers/log_ticker":225,"models/tickers/mercator_ticker":226,"models/tickers/months_ticker":227,"models/tickers/single_interval_ticker":228,"models/tickers/ticker":229,"models/tickers/util":230,"models/tickers/years_ticker":231,"models/tiles/bbox_tile_source":232,"models/tiles/image_pool":233,"models/tiles/index":234,"models/tiles/mercator_tile_source":235,"models/tiles/quadkey_tile_source":236,"models/tiles/tile_renderer":237,"models/tiles/tile_source":238,"models/tiles/tile_utils":239,"models/tiles/tms_tile_source":240,"models/tiles/wmts_tile_source":241,"models/tools/actions/action_tool":242,"models/tools/actions/custom_action":243,"models/tools/actions/help_tool":244,"models/tools/actions/redo_tool":245,"models/tools/actions/reset_tool":246,"models/tools/actions/save_tool":247,"models/tools/actions/undo_tool":248,"models/tools/actions/zoom_in_tool":249,"models/tools/actions/zoom_out_tool":250,"models/tools/button_tool":251,"models/tools/edit/box_edit_tool":252,"models/tools/edit/edit_tool":253,"models/tools/edit/freehand_draw_tool":254,"models/tools/edit/point_draw_tool":255,"models/tools/edit/poly_draw_tool":256,"models/tools/edit/poly_edit_tool":257,"models/tools/edit/poly_tool":258,"models/tools/gestures/box_select_tool":259,"models/tools/gestures/box_zoom_tool":260,"models/tools/gestures/gesture_tool":261,"models/tools/gestures/lasso_select_tool":262,"models/tools/gestures/pan_tool":263,"models/tools/gestures/poly_select_tool":264,"models/tools/gestures/range_tool":265,"models/tools/gestures/select_tool":266,"models/tools/gestures/tap_tool":267,"models/tools/gestures/wheel_pan_tool":268,"models/tools/gestures/wheel_zoom_tool":269,"models/tools/index":270,"models/tools/inspectors/crosshair_tool":271,"models/tools/inspectors/customjs_hover":272,"models/tools/inspectors/hover_tool":273,"models/tools/inspectors/inspect_tool":274,"models/tools/on_off_button":275,"models/tools/tool":276,"models/tools/tool_proxy":277,"models/tools/toolbar":278,"models/tools/toolbar_base":279,"models/tools/toolbar_box":280,"models/tools/util":281,"models/transforms/customjs_transform":282,"models/transforms/dodge":283,"models/transforms/index":284,"models/transforms/interpolator":285,"models/transforms/jitter":286,"models/transforms/linear_interpolator":287,"models/transforms/step_interpolator":288,"models/transforms/transform":289,"polyfill":290,"protocol/index":291,"protocol/message":292,"protocol/receiver":293,"safely":294,"testing":295,"version":296}, 61, null); -}) - -//# sourceMappingURL=bokeh.js.map \ No newline at end of file diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.3.1.min.js b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.3.1.min.js new file mode 100644 index 000000000..c860b0938 --- /dev/null +++ b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.3.1.min.js @@ -0,0 +1,594 @@ +/*! + * Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Anaconda nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +(function(root, factory) { + const bokeh = factory(); + bokeh.__bokeh__ = true; + if (typeof root.Bokeh === "undefined" || typeof root.Bokeh.__bokeh__ === "undefined") { + root.Bokeh = bokeh; + } + const Bokeh = root.Bokeh; + Bokeh[bokeh.version] = bokeh; +})(this, function() { + var define; + var parent_require = typeof require === "function" && require + return (function(modules, entry, aliases, externals) { + if (aliases === undefined) aliases = {}; + if (externals === undefined) externals = {}; + + var cache = {}; + + var normalize = function(name) { + if (typeof name === "number") + return name; + + if (name === "bokehjs") + return entry; + + if (!externals[name]) { + var prefix = "@bokehjs/" + if (name.slice(0, prefix.length) === prefix) + name = name.slice(prefix.length) + } + + var alias = aliases[name] + if (alias != null) + return alias; + + var trailing = name.length > 0 && name[name.lenght-1] === "/"; + var index = aliases[name + (trailing ? "" : "/") + "index"]; + if (index != null) + return index; + + return name; + } + + var require = function(name) { + var mod = cache[name]; + if (!mod) { + var id = normalize(name); + + mod = cache[id]; + if (!mod) { + if (!modules[id]) { + if (externals[id] === false || (externals[id] == true && parent_require)) { + try { + mod = {exports: externals[id] ? parent_require(id) : {}}; + cache[id] = cache[name] = mod; + return mod.exports; + } catch (e) {} + } + + var err = new Error("Cannot find module '" + name + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + mod = {exports: {}}; + cache[id] = cache[name] = mod; + + function __esModule() { + Object.defineProperty(mod.exports, "__esModule", {value: true}); + } + + function __esExport(name, value) { + Object.defineProperty(mod.exports, name, { + enumerable: true, get: function () { return value; } + }); + } + + modules[id].call(mod.exports, require, mod, mod.exports, __esModule, __esExport); + } else { + cache[name] = mod; + } + } + + return mod.exports; + } + require.resolve = function(name) { + return "" + } + + var main = require(entry); + main.require = require; + + if (typeof Proxy !== "undefined") { + // allow Bokeh.loader["@bokehjs/module/name"] syntax + main.loader = new Proxy({}, { + get: function(_obj, module) { + return require(module); + } + }); + } + + main.register_plugin = function(plugin_modules, plugin_entry, plugin_aliases, plugin_externals) { + if (plugin_aliases === undefined) plugin_aliases = {}; + if (plugin_externals === undefined) plugin_externals = {}; + + for (var name in plugin_modules) { + modules[name] = plugin_modules[name]; + } + + for (var name in plugin_aliases) { + aliases[name] = plugin_aliases[name]; + } + + for (var name in plugin_externals) { + externals[name] = plugin_externals[name]; + } + + var plugin = require(plugin_entry); + + for (var name in plugin) { + main[name] = plugin[name]; + } + + return plugin; + } + + return main; +}) +([ +function _(t,_,n,o,r){o();t(1).__exportStar(t(2),n)}, +function _(t,e,n,r,o){r();var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};n.__extends=function(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)};function i(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function u(t){return this instanceof u?(this.v=t,this):new u(t)}n.__assign=function(){return n.__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0;c--)(o=t[c])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i},n.__param=function(t,e){return function(n,r){e(n,r,t)}},n.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n.__awaiter=function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))},n.__generator=function(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]1||c(t,e)}))})}function c(t,e){try{(n=o[t](e)).value instanceof u?Promise.resolve(n.value.v).then(f,l):s(a[0][2],n)}catch(t){s(a[0][3],t)}var n}function f(t){c("next",t)}function l(t){c("throw",t)}function s(t,e){t(e),a.shift(),a.length&&c(a[0][0],a[0][1])}},n.__asyncDelegator=function(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:u(t[r](e)),done:"return"===r}:o?o(e):e}:o}},n.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=i(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}},n.__makeTemplateObject=function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t};var f=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};n.__importStar=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n.__createBinding(e,t,r);return f(e,t),e},n.__importDefault=function(t){return t&&t.__esModule?t:{default:t}},n.__classPrivateFieldGet=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},n.__classPrivateFieldSet=function(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}}, +function _(e,t,o,s,l){s();const n=e(1);l("version",e(3).version),l("index",e(4).index),o.embed=n.__importStar(e(4)),o.protocol=n.__importStar(e(404)),o._testing=n.__importStar(e(405));var r=e(19);l("logger",r.logger),l("set_log_level",r.set_log_level),l("settings",e(28).settings),l("Models",e(7).Models),l("documents",e(5).documents),l("safely",e(406).safely)}, +function _(n,i,o,c,e){c(),o.version="2.3.1"}, +function _(e,o,t,n,s){n();const d=e(5),r=e(19),_=e(34),c=e(13),i=e(8),a=e(16),u=e(395),l=e(397),m=e(396);var f=e(395);s("add_document_standalone",f.add_document_standalone),s("index",f.index),s("add_document_from_session",e(397).add_document_from_session);var g=e(402);async function w(e,o,t,n){i.isString(e)&&(e=JSON.parse(_.unescape(e)));const s={};for(const[o,t]of c.entries(e))s[o]=d.Document.from_json(t);const a=[];for(const e of o){const o=m._resolve_element(e),d=m._resolve_root_elements(e);if(null!=e.docid)a.push(await u.add_document_standalone(s[e.docid],o,d,e.use_for_title));else{if(null==e.token)throw new Error("Error rendering Bokeh items: either 'docid' or 'token' was expected.");{const s=l._get_ws_url(t,n);r.logger.debug(`embed: computed ws url: ${s}`);try{a.push(await l.add_document_from_session(s,e.token,o,d,e.use_for_title)),console.log("Bokeh items were rendered successfully")}catch(e){console.log("Error rendering Bokeh items:",e)}}}}return a}s("embed_items_notebook",g.embed_items_notebook),s("kernels",g.kernels),s("BOKEH_ROOT",e(396).BOKEH_ROOT),t.embed_item=async function(e,o){const t={},n=_.uuid4();t[n]=e.doc,null==o&&(o=e.target_id);const s=document.getElementById(o);null!=s&&s.classList.add(m.BOKEH_ROOT);const d={roots:{[e.root_id]:o},root_ids:[e.root_id],docid:n};await a.defer();const[r]=await w(t,[d]);return r},t.embed_items=async function(e,o,t,n){return await a.defer(),w(e,o,t,n)}}, +function _(t,_,o,r,n){r();const a=t(1);a.__exportStar(t(6),o),a.__exportStar(t(35),o)}, +function _(e,t,s,o,n){o();const r=e(1),i=e(7),l=e(3),_=e(19),a=e(264),c=e(14),d=e(30),h=e(15),f=e(17),u=e(31),m=e(9),g=e(13),v=r.__importStar(e(132)),w=e(26),p=e(8),b=e(319),y=e(130),k=e(53),M=e(394),j=e(35);class S{constructor(e){this.document=e,this.session=null,this.subscribed_models=new Set}send_event(e){const t=new j.MessageSentEvent(this.document,"bokeh_event",e.to_json());this.document._trigger_on_change(t)}trigger(e){for(const t of this.subscribed_models)null!=e.origin&&e.origin!=t||t._process_event(e)}}s.EventManager=S,S.__name__="EventManager",s.documents=[],s.DEFAULT_TITLE="Bokeh Application";class E{constructor(e){var t;s.documents.push(this),this._init_timestamp=Date.now(),this._resolver=null!==(t=null==e?void 0:e.resolver)&&void 0!==t?t:new i.ModelResolver,this._title=s.DEFAULT_TITLE,this._roots=[],this._all_models=new Map,this._all_models_freeze_count=0,this._callbacks=new Map,this._message_callbacks=new Map,this.event_manager=new S(this),this.idle=new h.Signal0(this,"idle"),this._idle_roots=new WeakMap,this._interactive_timestamp=null,this._interactive_plot=null}get layoutables(){return this._roots.filter((e=>e instanceof b.LayoutDOM))}get is_idle(){for(const e of this.layoutables)if(!this._idle_roots.has(e))return!1;return!0}notify_idle(e){this._idle_roots.set(e,!0),this.is_idle&&(_.logger.info(`document idle at ${Date.now()-this._init_timestamp} ms`),this.event_manager.send_event(new a.DocumentReady),this.idle.emit())}clear(){this._push_all_models_freeze();try{for(;this._roots.length>0;)this.remove_root(this._roots[0])}finally{this._pop_all_models_freeze()}}interactive_start(e){null==this._interactive_plot&&(this._interactive_plot=e,this._interactive_plot.trigger_event(new a.LODStart)),this._interactive_timestamp=Date.now()}interactive_stop(){null!=this._interactive_plot&&this._interactive_plot.trigger_event(new a.LODEnd),this._interactive_plot=null,this._interactive_timestamp=null}interactive_duration(){return null==this._interactive_timestamp?-1:Date.now()-this._interactive_timestamp}destructively_move(e){if(e===this)throw new Error("Attempted to overwrite a document with itself");e.clear();const t=m.copy(this._roots);this.clear();for(const e of t)if(null!=e.document)throw new Error(`Somehow we didn't detach ${e}`);if(0!=this._all_models.size)throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);for(const s of t)e.add_root(s);e.set_title(this._title)}_push_all_models_freeze(){this._all_models_freeze_count+=1}_pop_all_models_freeze(){this._all_models_freeze_count-=1,0===this._all_models_freeze_count&&this._recompute_all_models()}_invalidate_all_models(){_.logger.debug("invalidating document models"),0===this._all_models_freeze_count&&this._recompute_all_models()}_recompute_all_models(){let e=new Set;for(const t of this._roots)e=v.union(e,t.references());const t=new Set(this._all_models.values()),s=v.difference(t,e),o=v.difference(e,t),n=new Map;for(const t of e)n.set(t.id,t);for(const e of s)e.detach_document();for(const e of o)e.attach_document(this);this._all_models=n}roots(){return this._roots}add_root(e,t){if(_.logger.debug(`Adding root: ${e}`),!m.includes(this._roots,e)){this._push_all_models_freeze();try{this._roots.push(e)}finally{this._pop_all_models_freeze()}this._trigger_on_change(new j.RootAddedEvent(this,e,t))}}remove_root(e,t){const s=this._roots.indexOf(e);if(!(s<0)){this._push_all_models_freeze();try{this._roots.splice(s,1)}finally{this._pop_all_models_freeze()}this._trigger_on_change(new j.RootRemovedEvent(this,e,t))}}title(){return this._title}set_title(e,t){e!==this._title&&(this._title=e,this._trigger_on_change(new j.TitleChangedEvent(this,e,t)))}get_model_by_id(e){var t;return null!==(t=this._all_models.get(e))&&void 0!==t?t:null}get_model_by_name(e){const t=[];for(const s of this._all_models.values())s instanceof k.Model&&s.name==e&&t.push(s);switch(t.length){case 0:return null;case 1:return t[0];default:throw new Error(`Multiple models are named '${e}'`)}}on_message(e,t){const s=this._message_callbacks.get(e);null==s?this._message_callbacks.set(e,new Set([t])):s.add(t)}remove_on_message(e,t){var s;null===(s=this._message_callbacks.get(e))||void 0===s||s.delete(t)}_trigger_on_message(e,t){const s=this._message_callbacks.get(e);if(null!=s)for(const e of s)e(t)}on_change(e,t=!1){this._callbacks.has(e)||this._callbacks.set(e,t)}remove_on_change(e){this._callbacks.delete(e)}_trigger_on_change(e){for(const[t,s]of this._callbacks)if(!s&&e instanceof j.DocumentEventBatch)for(const s of e.events)t(s);else t(e)}_notify_change(e,t,s,o,n){this._trigger_on_change(new j.ModelChangedEvent(this,e,t,s,o,null==n?void 0:n.setter_id,null==n?void 0:n.hint))}static _instantiate_object(e,t,s,o){const n=Object.assign(Object.assign({},s),{id:e,__deferred__:!0});return new(o.get(t))(n)}static _instantiate_references_json(e,t,s){var o;const n=new Map;for(const r of e){const e=r.id,i=r.type,l=null!==(o=r.attributes)&&void 0!==o?o:{};let _=t.get(e);null==_&&(_=E._instantiate_object(e,i,l,s),null!=r.subtype&&_.set_subtype(r.subtype)),n.set(_.id,_)}return n}static _resolve_refs(e,t,s,o){function n(e){var r;if(f.is_ref(e)){const o=null!==(r=t.get(e.id))&&void 0!==r?r:s.get(e.id);if(null!=o)return o;throw new Error(`reference ${JSON.stringify(e)} isn't known (not in Document?)`)}return u.is_NDArray_ref(e)?u.decode_NDArray(e,o):p.isArray(e)?function(e){const t=[];for(const s of e)t.push(n(s));return t}(e):p.isPlainObject(e)?function(e){const t={};for(const[s,o]of g.entries(e))t[s]=n(o);return t}(e):e}return n(e)}static _initialize_references_json(e,t,s,o){const n=new Map;for(const{id:r,attributes:i}of e){const e=!t.has(r),l=e?s.get(r):t.get(r),_=E._resolve_refs(i,t,s,o);l.setv(_,{silent:!0}),n.set(r,{instance:l,is_new:e})}const r=[],i=new Set;function l(e){if(e instanceof c.HasProps){if(n.has(e.id)&&!i.has(e.id)){i.add(e.id);const{instance:t,is_new:s}=n.get(e.id),{attributes:o}=t;for(const e of g.values(o))l(e);s&&(t.finalize(),r.push(t))}}else if(p.isArray(e))for(const t of e)l(t);else if(p.isPlainObject(e))for(const t of g.values(e))l(t)}for(const e of n.values())l(e.instance);for(const e of r)e.connect_signals()}static _event_for_attribute_change(e,t,s,o,n){if(o.get_model_by_id(e.id).property(t).syncable){const r={kind:"ModelChanged",model:{id:e.id},attr:t,new:s};return c.HasProps._json_record_references(o,s,n,{recursive:!0}),r}return null}static _events_to_sync_objects(e,t,s,o){const n=Object.keys(e.attributes),r=Object.keys(t.attributes),i=m.difference(n,r),l=m.difference(r,n),a=m.intersection(n,r),c=[];for(const e of i)_.logger.warn(`Server sent key ${e} but we don't seem to have it in our JSON`);for(const n of l){const r=t.attributes[n];c.push(E._event_for_attribute_change(e,n,r,s,o))}for(const n of a){const r=e.attributes[n],i=t.attributes[n];null==r&&null==i||(null==r||null==i?c.push(E._event_for_attribute_change(e,n,i,s,o)):w.is_equal(r,i)||c.push(E._event_for_attribute_change(e,n,i,s,o)))}return c.filter((e=>null!=e))}static _compute_patch_since_json(e,t){const s=t.to_json(!1);function o(e){const t=new Map;for(const s of e.roots.references)t.set(s.id,s);return t}const n=o(e),r=new Map,i=[];for(const t of e.roots.root_ids)r.set(t,n.get(t)),i.push(t);const l=o(s),_=new Map,a=[];for(const e of s.roots.root_ids)_.set(e,l.get(e)),a.push(e);if(i.sort(),a.sort(),m.difference(i,a).length>0||m.difference(a,i).length>0)throw new Error("Not implemented: computing add/remove of document roots");const c=new Set;let h=[];for(const e of t._all_models.keys())if(n.has(e)){const s=E._events_to_sync_objects(n.get(e),l.get(e),t,c);h=h.concat(s)}const f=new d.Serializer({include_defaults:!1});return f.to_serializable([...c]),{references:[...f.definitions],events:h}}to_json_string(e=!0){return JSON.stringify(this.to_json(e))}to_json(e=!0){const t=new d.Serializer({include_defaults:e}),s=t.to_serializable(this._roots);return{version:l.version,title:this._title,roots:{root_ids:s.map((e=>e.id)),references:[...t.definitions]}}}static from_json_string(e){const t=JSON.parse(e);return E.from_json(t)}static from_json(e){_.logger.debug("Creating Document from JSON");const t=e.version,s=-1!==t.indexOf("+")||-1!==t.indexOf("-"),o=`Library versions: JS (${l.version}) / Python (${t})`;s||l.version.replace(/-(dev|rc)\./,"$1")==t?_.logger.debug(o):(_.logger.warn("JS/Python version mismatch"),_.logger.warn(o));const n=new i.ModelResolver;null!=e.defs&&M.resolve_defs(e.defs,n);const r=e.roots,a=r.root_ids,c=r.references,d=E._instantiate_references_json(c,new Map,n);E._initialize_references_json(c,new Map,d,new Map);const h=new E({resolver:n});for(const e of a){const t=d.get(e);null!=t&&h.add_root(t)}return h.set_title(e.title),h}replace_with_json(e){E.from_json(e).destructively_move(this)}create_json_patch_string(e){return JSON.stringify(this.create_json_patch(e))}create_json_patch(e){for(const t of e)if(t.document!=this)throw new Error("Cannot create a patch using events from a different document");const t=new d.Serializer,s=t.to_serializable(e);for(const e of this._all_models.values())t.remove_def(e);return{events:s,references:[...t.definitions]}}apply_json_patch(e,t=new Map,s){const o=e.references,n=e.events,r=E._instantiate_references_json(o,this._all_models,this._resolver);t instanceof Map||(t=new Map(t));for(const e of n)switch(e.kind){case"RootAdded":case"RootRemoved":case"ModelChanged":{const t=e.model.id,s=this._all_models.get(t);if(null!=s)r.set(t,s);else if(!r.has(t))throw _.logger.warn(`Got an event for unknown model ${e.model}"`),new Error("event model wasn't known");break}}const i=new Map(this._all_models),l=new Map;for(const[e,t]of r)i.has(e)||l.set(e,t);E._initialize_references_json(o,i,l,t);for(const e of n)switch(e.kind){case"MessageSent":{const{msg_type:s,msg_data:o}=e;let n;if(void 0===o){if(1!=t.size)throw new Error("expected exactly one buffer");{const[[,e]]=t;n=e}}else n=E._resolve_refs(o,i,l,t);this._trigger_on_message(s,n);break}case"ModelChanged":{const o=e.model.id,n=this._all_models.get(o);if(null==n)throw new Error(`Cannot apply patch to ${o} which is not in the document`);const r=e.attr,_=E._resolve_refs(e.new,i,l,t);n.setv({[r]:_},{setter_id:s});break}case"ColumnDataChanged":{const o=e.column_source.id,n=this._all_models.get(o);if(null==n)throw new Error(`Cannot stream to ${o} which is not in the document`);const r=E._resolve_refs(e.new,new Map,new Map,t);if(null!=e.cols)for(const e in n.data)e in r||(r[e]=n.data[e]);n.setv({data:r},{setter_id:s,check_eq:!1});break}case"ColumnsStreamed":{const t=e.column_source.id,o=this._all_models.get(t);if(null==o)throw new Error(`Cannot stream to ${t} which is not in the document`);if(!(o instanceof y.ColumnDataSource))throw new Error("Cannot stream to non-ColumnDataSource");const n=e.data,r=e.rollover;o.stream(n,r,s);break}case"ColumnsPatched":{const t=e.column_source.id,o=this._all_models.get(t);if(null==o)throw new Error(`Cannot patch ${t} which is not in the document`);if(!(o instanceof y.ColumnDataSource))throw new Error("Cannot patch non-ColumnDataSource");const n=e.patches;o.patch(n,s);break}case"RootAdded":{const t=e.model.id,o=r.get(t);this.add_root(o,s);break}case"RootRemoved":{const t=e.model.id,o=r.get(t);this.remove_root(o,s);break}case"TitleChanged":this.set_title(e.title,s);break;default:throw new Error("Unknown patch event "+JSON.stringify(e))}}}s.Document=E,E.__name__="Document"}, +function _(e,o,s,r,t){r();const l=e(1),d=e(8),i=e(13),n=e(14);s.overrides={};const a=new Map;s.Models=e=>{const o=s.Models.get(e);if(null!=o)return o;throw new Error(`Model '${e}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`)},s.Models.get=e=>{var o;return null!==(o=s.overrides[e])&&void 0!==o?o:a.get(e)},s.Models.register=(e,o)=>{s.overrides[e]=o},s.Models.unregister=e=>{delete s.overrides[e]},s.Models.register_models=(e,o=!1,s)=>{var r;if(null!=e)for(const t of d.isArray(e)?e:i.values(e))if(r=t,d.isObject(r)&&r.prototype instanceof n.HasProps){const e=t.__qualified__;o||!a.has(e)?a.set(e,t):null!=s?s(e):console.warn(`Model '${e}' was already registered`)}},s.register_models=s.Models.register_models,s.Models.registered_names=()=>[...a.keys()];class u{constructor(){this._known_models=new Map}get(e,o){var r;const t=null!==(r=s.Models.get(e))&&void 0!==r?r:this._known_models.get(e);if(null!=t)return t;if(void 0!==o)return o;throw new Error(`Model '${e}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`)}register(e){const o=e.__qualified__;null==this.get(o,null)?this._known_models.set(o,e):console.warn(`Model '${o}' was already registered with this resolver`)}}s.ModelResolver=u,u.__name__="ModelResolver";const _=l.__importStar(e(38));s.register_models(_)}, +function _(n,r,t,e,i){e(); +// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +// Underscore may be freely distributed under the MIT license. +const o=n(9),u=Object.prototype.toString;function c(n){return!0===n||!1===n||"[object Boolean]"===u.call(n)}function f(n){return"[object Number]"===u.call(n)}function a(n){return"[object String]"===u.call(n)}function l(n){const r=typeof n;return"function"===r||"object"===r&&!!n}function s(n){return l(n)&&void 0!==n[Symbol.iterator]}t.isBoolean=c,t.isNumber=f,t.isInteger=function(n){return f(n)&&Number.isInteger(n)},t.isString=a,t.isPrimitive=function(n){return null===n||c(n)||f(n)||a(n)},t.isFunction=function(n){return"[object Function]"===u.call(n)},t.isArray=function(n){return Array.isArray(n)},t.isArrayOf=function(n,r){return o.every(n,r)},t.isArrayableOf=function(n,r){for(let t=0,e=n.length;t0,"'step' must be a positive number"),null==t&&(t=n,n=0);const{max:r,ceil:o,abs:i}=Math,c=n<=t?e:-e,f=r(o(i(t-n)/e),0),s=new Array(f);for(let t=0;t=0?t:n.length+t]},e.zip=function(...n){if(0==n.length)return[];const t=c.min(n.map((n=>n.length))),e=n.length,r=new Array(t);for(let o=0;on.length))),r=Array(e);for(let n=0;nn[t]))},e.argmax=function(n){return c.max_by(m(n.length),(t=>n[t]))},e.sort_by=function(n,t){const e=n.map(((n,e)=>({value:n,index:e,key:t(n)})));return e.sort(((n,t)=>{const e=n.key,r=t.key;if(e!==r){if(e>r||void 0===e)return 1;if(en.value))},e.uniq=function(n){const t=new Set;for(const e of n)t.add(e);return[...t]},e.uniq_by=function(n,t){const e=[],r=[];for(const o of n){const n=t(o);l(r,n)||(r.push(n),e.push(o))}return e},e.union=function(...n){const t=new Set;for(const e of n)for(const n of e)t.add(n);return[...t]},e.intersection=function(n,...t){const e=[];n:for(const r of n)if(!l(e,r)){for(const n of t)if(!l(n,r))continue n;e.push(r)}return e},e.difference=function(n,...t){const e=a(t);return n.filter((n=>!l(e,n)))},e.remove_at=function(n,t){const e=s(n);return e.splice(t,1),e},e.remove_by=function(n,t){for(let e=0;e2*u;)n-=2*u;return n}function c(n,r){return a(n-r)}function f(){return Math.random()}function i(n){switch(n){case"deg":return u/180;case"rad":return 1;case"grad":return u/200;case"turn":return 2*u}}t.angle_norm=a,t.angle_dist=c,t.angle_between=function(n,r,t,e=!1){const o=c(r,t);if(0==o)return!1;if(o==2*u)return!0;const f=a(n),i=c(r,f)<=o&&c(f,t)<=o;return e?!i:i},t.random=f,t.randomIn=function(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))},t.atan2=function(n,r){return Math.atan2(r[1]-n[1],r[0]-n[0])},t.radians=function(n){return n*(u/180)},t.degrees=function(n){return n/(u/180)},t.resolve_angle=function(n,r){return-i(r)*n},t.to_radians_coeff=i,t.rnorm=function(n,r){let t,e;for(;t=f(),e=f(),e=(2*e-1)*Math.sqrt(1/Math.E*2),!(-4*t*t*Math.log(t)>=e*e););let o=e/t;return o=n+r*o,o},t.clamp=function(n,r,t){return nt?t:n},t.log=function(n,r=Math.E){return Math.log(n)/Math.log(r)}}, +function _(r,n,e,o,s){o();class t extends Error{}e.AssertionError=t,t.__name__="AssertionError",e.assert=function(r,n){if(!(!0===r||!1!==r&&r()))throw new t(null!=n?n:"Assertion failed")},e.unreachable=function(){throw new Error("unreachable code")}}, +function _(n,t,e,r,o){r();const i=n(10);function l(n,t,e,...r){const o=n.length;t<0&&(t+=o),t<0?t=0:t>o&&(t=o),null==e||e>o-t?e=o-t:e<0&&(e=0);const i=o-e+r.length,l=new n.constructor(i);let u=0;for(;u0?0:r-1;for(;o>=0&&ot[t.length-1])return t.length;let e=0,r=t.length-1;for(;r-e!=1;){const o=e+Math.floor((r-e)/2);n>=t[o]?e=o:r=o}return e}e.is_empty=function(n){return 0==n.length},e.copy=function(n){return Array.isArray(n)?n.slice():new n.constructor(n)},e.splice=l,e.head=u,e.insert=function(n,t,e){return l(n,e,0,t)},e.append=function(n,t){return l(n,n.length,0,t)},e.prepend=function(n,t){return l(n,0,0,t)},e.indexOf=function(n,t){for(let e=0,r=n.length;ee&&(e=t);return e},e.minmax=function(n){let t,e=1/0,r=-1/0;for(let o=0,i=n.length;or&&(r=t));return[e,r]},e.min_by=function(n,t){if(0==n.length)throw new Error("min_by() called with an empty array");let e=n[0],r=t(e);for(let o=1,i=n.length;or&&(e=i,r=l)}return e},e.sum=function(n){let t=0;for(let e=0,r=n.length;et[r]=n+e),0),t},e.every=function(n,t){for(let e=0,r=n.length;e(n-t)/r))}}, +function _(t,e,n,c,o){c();const s=t(9),{hasOwnProperty:r}=Object.prototype;function u(t){return Object.keys(t).length}n.keys=Object.keys,n.values=Object.values,n.entries=Object.entries,n.extend=Object.assign,n.clone=function(t){return Object.assign({},t)},n.merge=function(t,e){const n=Object.create(Object.prototype),c=s.concat([Object.keys(t),Object.keys(e)]);for(const o of c){const c=r.call(t,o)?t[o]:[],u=r.call(e,o)?e[o]:[];n[o]=s.union(c,u)}return n},n.size=u,n.isEmpty=function(t){return 0==u(t)},n.to_object=function(t){const e={};for(const[n,c]of t)e[n]=c;return e}}, +function _(t,e,s,n,r){n();const i=t(1),o=t(15),c=t(17),a=i.__importStar(t(18)),_=i.__importStar(t(21)),h=t(34),u=t(13),l=t(8),f=t(26),p=t(30),d=t(35),g=t(26),y=t(36),v=t(37),m=i.__importStar(t(21));class b extends(o.Signalable()){constructor(t={}){var e,s;super(),this._subtype=void 0,this.document=null,this.destroyed=new o.Signal0(this,"destroyed"),this.change=new o.Signal0(this,"change"),this.transformchange=new o.Signal0(this,"transformchange"),this.exprchange=new o.Signal0(this,"exprchange"),this.properties={},this._pending=!1,this._changing=!1;const n=t instanceof Map?t.get.bind(t):e=>t[e];this.id=null!==(e=n("id"))&&void 0!==e?e:h.uniqueId();for(const[t,{type:e,default_value:s,options:r}]of u.entries(this._props)){let i;e instanceof a.PropertyAlias?Object.defineProperty(this.properties,t,{get:()=>this.properties[e.attr],configurable:!1,enumerable:!1}):(i=e instanceof _.Kind?new a.PrimitiveProperty(this,t,e,s,n(t),r):new e(this,t,_.Any,s,n(t),r),this.properties[t]=i)}null!==(s=n("__deferred__"))&&void 0!==s&&s||(this.finalize(),this.connect_signals())}get is_syncable(){return!0}set type(t){console.warn("prototype.type = 'ModelName' is deprecated, use static __name__ instead"),this.constructor.__name__=t}get type(){return this.constructor.__qualified__}static get __qualified__(){const{__module__:t,__name__:e}=this;return null!=t?`${t}.${e}`:e}static get[Symbol.toStringTag](){return this.__name__}static init_HasProps(){this.prototype._props={},this.prototype._mixins=[]}static _fix_default(t,e){if(void 0===t||l.isFunction(t))return t;if(l.isPrimitive(t))return()=>t;{const e=new v.Cloner;return()=>e.clone(t)}}static define(t){for(const[e,s]of u.entries(l.isFunction(t)?t(m):t)){if(null!=this.prototype._props[e])throw new Error(`attempted to redefine property '${this.prototype.type}.${e}'`);if(null!=this.prototype[e])throw new Error(`attempted to redefine attribute '${this.prototype.type}.${e}'`);Object.defineProperty(this.prototype,e,{get(){return this.properties[e].get_value()},set(t){return this.setv({[e]:t}),this},configurable:!1,enumerable:!0});const[t,n,r={}]=s,i={type:t,default_value:this._fix_default(n,e),options:r},o=Object.assign({},this.prototype._props);o[e]=i,this.prototype._props=o}}static internal(t){const e={};for(const[s,n]of u.entries(l.isFunction(t)?t(m):t)){const[t,r,i={}]=n;e[s]=[t,r,Object.assign(Object.assign({},i),{internal:!0})]}this.define(e)}static mixins(t){function e(t,e){const s={};for(const[n,r]of u.entries(e))s[t+n]=r;return s}const s={},n=[];for(const r of l.isArray(t)?t:[t])if(l.isArray(r)){const[t,i]=r;u.extend(s,e(t,i)),n.push([t,i])}else{const t=r;u.extend(s,t),n.push(["",t])}this.define(s),this.prototype._mixins=[...this.prototype._mixins,...n]}static override(t){for(const[e,s]of u.entries(t)){const t=this._fix_default(s,e),n=this.prototype._props[e];if(null==n)throw new Error(`attempted to override nonexistent '${this.prototype.type}.${e}'`);const r=Object.assign({},this.prototype._props);r[e]=Object.assign(Object.assign({},n),{default_value:t}),this.prototype._props=r}}toString(){return`${this.type}(${this.id})`}property(t){const e=this.properties[t];if(null!=e)return e;throw new Error(`unknown property ${this.type}.${t}`)}get attributes(){const t={};for(const e of this)t[e.attr]=e.get_value();return t}[v.clone](t){const e=new Map;for(const s of this)s.dirty&&e.set(s.attr,t.clone(s.get_value()));return new this.constructor(e)}[g.equals](t,e){for(const s of this){const n=t.property(s.attr);if(e.eq(s.get_value(),n.get_value()))return!1}return!0}[y.pretty](t){const e=t.token,s=[];for(const n of this)if(n.dirty){const r=n.get_value();s.push(`${n.attr}${e(":")} ${t.to_string(r)}`)}return`${this.constructor.__qualified__}${e("(")}${e("{")}${s.join(`${e(",")} `)}${e("}")}${e(")")}`}[p.serialize](t){const e=this.ref();t.add_ref(this,e);const s=this.struct();for(const e of this)e.syncable&&(t.include_defaults||e.dirty)&&(s.attributes[e.attr]=t.to_serializable(e.get_value()));return t.add_def(this,s),e}finalize(){for(const t of this){if(!(t instanceof a.VectorSpec||t instanceof a.ScalarSpec))continue;const e=t.get_value();if(null!=e){const{transform:t,expr:s}=e;null!=t&&this.connect(t.change,(()=>this.transformchange.emit())),null!=s&&this.connect(s.change,(()=>this.exprchange.emit()))}}this.initialize()}initialize(){}connect_signals(){}disconnect_signals(){o.Signal.disconnectReceiver(this)}destroy(){this.disconnect_signals(),this.destroyed.emit()}clone(){return(new v.Cloner).clone(this)}_setv(t,e){const s=e.check_eq,n=[],r=this._changing;this._changing=!0;for(const[e,r]of t)!1!==s&&f.is_equal(e.get_value(),r)||(e.set_value(r),n.push(e));n.length>0&&(this._pending=!0);for(const t of n)t.change.emit();if(!r){if(!e.no_change)for(;this._pending;)this._pending=!1,this.change.emit();this._pending=!1,this._changing=!1}}setv(t,e={}){const s=u.entries(t);if(0==s.length)return;if(!0===e.silent){for(const[t,e]of s)this.properties[t].set_value(e);return}const n=new Map,r=new Map;for(const[t,e]of s){const s=this.properties[t];n.set(s,e),r.set(s,s.get_value())}this._setv(n,e);const{document:i}=this;if(null!=i){const t=[];for(const[e,s]of r)t.push([e,s,e.get_value()]);for(const[,e,s]of t)if(this._needs_invalidate(e,s)){i._invalidate_all_models();break}this._push_changes(t,e)}}getv(t){return this.property(t).get_value()}ref(){return{id:this.id}}struct(){const t={type:this.type,id:this.id,attributes:{}};return null!=this._subtype&&(t.subtype=this._subtype),t}set_subtype(t){this._subtype=t}*[Symbol.iterator](){yield*u.values(this.properties)}*syncable_properties(){for(const t of this)t.syncable&&(yield t)}serializable_attributes(){const t={};for(const e of this.syncable_properties())t[e.attr]=e.get_value();return t}static _json_record_references(t,e,s,n){const{recursive:r}=n;if(c.is_ref(e)){const n=t.get_model_by_id(e.id);null==n||s.has(n)||b._value_record_references(n,s,{recursive:r})}else if(l.isArray(e))for(const n of e)b._json_record_references(t,n,s,{recursive:r});else if(l.isPlainObject(e))for(const n of u.values(e))b._json_record_references(t,n,s,{recursive:r})}static _value_record_references(t,e,s){const{recursive:n}=s;if(t instanceof b){if(!e.has(t)&&(e.add(t),n))for(const s of t.syncable_properties()){const t=s.get_value();b._value_record_references(t,e,{recursive:n})}}else if(l.isArray(t))for(const s of t)b._value_record_references(s,e,{recursive:n});else if(l.isPlainObject(t))for(const s of u.values(t))b._value_record_references(s,e,{recursive:n})}references(){const t=new Set;return b._value_record_references(this,t,{recursive:!0}),t}_doc_attached(){}_doc_detached(){}attach_document(t){if(null!=this.document&&this.document!=t)throw new Error("models must be owned by only a single document");this.document=t,this._doc_attached()}detach_document(){this._doc_detached(),this.document=null}_needs_invalidate(t,e){const s=new Set;b._value_record_references(e,s,{recursive:!1});const n=new Set;b._value_record_references(t,n,{recursive:!1});for(const t of s)if(!n.has(t))return!0;for(const t of n)if(!s.has(t))return!0;return!1}_push_changes(t,e={}){if(!this.is_syncable)return;const{document:s}=this;if(null==s)return;const{setter_id:n}=e,r=[];for(const[e,i,o]of t)e.syncable&&r.push(new d.ModelChangedEvent(s,this,e.attr,i,o,n));if(0!=r.length){let t;1==r.length?[t]=r:t=new d.DocumentEventBatch(s,r,n),s._trigger_on_change(t)}}on_change(t,e){for(const s of l.isArray(t)?t:[t])this.connect(s.change,e)}}s.HasProps=b,b.init_HasProps()}, +function _(n,t,e,l,s){l();const i=n(16),o=n(9);class c{constructor(n,t){this.sender=n,this.name=t}connect(n,t=null){u.has(this.sender)||u.set(this.sender,[]);const e=u.get(this.sender);if(null!=g(e,this,n,t))return!1;const l=null!=t?t:n;a.has(l)||a.set(l,[]);const s=a.get(l),i={signal:this,slot:n,context:t};return e.push(i),s.push(i),!0}disconnect(n,t=null){const e=u.get(this.sender);if(null==e||0===e.length)return!1;const l=g(e,this,n,t);if(null==l)return!1;const s=null!=t?t:n,i=a.get(s);return l.signal=null,d(e),d(i),!0}emit(n){var t;const e=null!==(t=u.get(this.sender))&&void 0!==t?t:[];for(const{signal:t,slot:l,context:s}of e)t===this&&l.call(s,n,this.sender)}}e.Signal=c,c.__name__="Signal";class r extends c{emit(){super.emit(void 0)}}e.Signal0=r,r.__name__="Signal0",function(n){function t(n,t){const e=u.get(n);if(null==e||0===e.length)return;const l=a.get(t);if(null!=l&&0!==l.length){for(const t of l){if(null==t.signal)return;t.signal.sender===n&&(t.signal=null)}d(e),d(l)}}function e(n){var t;const e=u.get(n);if(null!=e&&0!==e.length){for(const n of e){if(null==n.signal)return;const e=null!==(t=n.context)&&void 0!==t?t:n.slot;n.signal=null,d(a.get(e))}d(e)}}function l(n,t,e){const l=a.get(n);if(null!=l&&0!==l.length){for(const n of l){if(null==n.signal)return;if(null!=t&&n.slot!=t)continue;const l=n.signal.sender;null!=e&&e.has(l)||(n.signal=null,d(u.get(l)))}d(l)}}function s(n){const t=u.get(n);if(null!=t&&0!==t.length){for(const n of t)n.signal=null;d(t)}const e=a.get(n);if(null!=e&&0!==e.length){for(const n of e)n.signal=null;d(e)}}n.disconnect_between=t,n.disconnect_sender=e,n.disconnect_receiver=l,n.disconnect_all=s,n.disconnectBetween=t,n.disconnectSender=e,n.disconnectReceiver=l,n.disconnectAll=s}(c||(e.Signal=c={})),e.Signalable=function(){return class{connect(n,t){return n.connect(t,this)}disconnect(n,t){return n.disconnect(t,this)}}};const u=new WeakMap,a=new WeakMap;function g(n,t,e,l){return o.find(n,(n=>n.signal===t&&n.slot===e&&n.context===l))}const f=new Set;function d(n){0===f.size&&(async()=>{await i.defer(),function(){for(const n of f)o.remove_by(n,(n=>null==n.signal));f.clear()}()})(),f.add(n)}}, +function _(e,n,t,s,o){s();const a=new MessageChannel,l=new Map;a.port1.onmessage=e=>{const n=e.data,t=l.get(n);if(null!=t)try{t()}finally{l.delete(n)}};let r=1;t.defer=function(){return new Promise((e=>{const n=r++;l.set(n,e),a.port2.postMessage(n)}))}}, +function _(n,t,i,e,c){e();const r=n(8),s=n(13);i.is_ref=function(n){if(r.isPlainObject(n)){const t=s.keys(n);return 1==t.length&&"id"==t[0]}return!1}}, +function _(e,t,n,a,r){a(),n.YCoordinateSeqSeqSeqSpec=n.XCoordinateSeqSeqSeqSpec=n.YCoordinateSeqSpec=n.XCoordinateSeqSpec=n.YCoordinateSpec=n.XCoordinateSpec=n.CoordinateSeqSeqSeqSpec=n.CoordinateSeqSpec=n.CoordinateSpec=n.BaseCoordinateSpec=n.NumberUnitsSpec=n.UnitsSpec=n.DataSpec=n.VectorSpec=n.TextBaselineScalar=n.TextAlignScalar=n.FontStyleScalar=n.FontSizeScalar=n.FontScalar=n.LineDashScalar=n.LineCapScalar=n.LineJoinScalar=n.ArrayScalar=n.NullStringScalar=n.StringScalar=n.NumberScalar=n.ColorScalar=n.AnyScalar=n.ScalarSpec=n.VerticalAlign=n.UpdateMode=n.TooltipAttachment=n.TickLabelOrientation=n.TextureRepetition=n.TextBaseline=n.TextAlign=n.TapBehavior=n.StepMode=n.StartEnd=n.SpatialUnits=n.Sort=n.SizingMode=n.Side=n.RoundingFunction=n.ResetPolicy=n.RenderMode=n.RenderLevel=n.RadiusDimension=n.PointPolicy=n.Place=void 0,n.TextBaselineSpec=n.TextAlignSpec=n.FontStyleSpec=n.FontSizeSpec=n.FontSpec=n.LineDashSpec=n.LineCapSpec=n.LineJoinSpec=n.MarkerSpec=n.ArraySpec=n.NullStringSpec=n.StringSpec=n.AnySpec=n.NDArraySpec=n.ColorSpec=n.NumberSpec=n.BooleanSpec=n.ScreenDistanceSpec=n.NullDistanceSpec=n.DistanceSpec=n.AngleSpec=void 0;const i=e(1),s=e(15),l=e(19),o=i.__importStar(e(20)),c=e(24),_=e(9),u=e(12),d=e(10),S=e(22),p=e(27),m=e(8),h=e(28),v=e(29),y=e(33);function x(e){try{return JSON.stringify(e)}catch(t){return e.toString()}}function g(e){return m.isPlainObject(e)&&(void 0===e.value?0:1)+(void 0===e.field?0:1)+(void 0===e.expr?0:1)==1}r("Uniform",y.Uniform),r("UniformScalar",y.UniformScalar),r("UniformVector",y.UniformVector),n.isSpec=g;class f{constructor(e,t,n,a,r,i={}){var l;let o;if(this.obj=e,this.attr=t,this.kind=n,this.default_value=a,this._dirty=!1,this.change=new s.Signal0(this.obj,"change"),this.internal=null!==(l=i.internal)&&void 0!==l&&l,this.on_update=i.on_update,void 0!==r)o=r,this._dirty=!0;else{const t=this._default_override();if(void 0!==t)o=t;else{if(void 0===a)return void(this.spec={value:null});o=a(e)}}this._update(o)}get is_value(){return void 0!==this.spec.value}get syncable(){return!this.internal}get_value(){return this.spec.value}set_value(e){this._update(e),this._dirty=!0}_default_override(){}get dirty(){return this._dirty}_update(e){var t;this.validate(e),this.spec={value:e},null===(t=this.on_update)||void 0===t||t.call(this,e,this.obj)}toString(){return`Prop(${this.obj}.${this.attr}, spec: ${x(this.spec)})`}normalize(e){return e}validate(e){if(!this.valid(e))throw new Error(`${this.obj}.${this.attr} given invalid value: ${x(e)}`)}valid(e){return this.kind.valid(e)}_value(e=!0){if(!this.is_value)throw new Error("attempted to retrieve property value for property without value specification");let t=this.normalize([this.spec.value])[0];return null!=this.spec.transform&&e&&(t=this.spec.transform.compute(t)),t}}n.Property=f,f.__name__="Property";class A{constructor(e){this.attr=e}}n.PropertyAlias=A,A.__name__="PropertyAlias",n.Alias=function(e){return new A(e)};class C extends f{}n.PrimitiveProperty=C,C.__name__="PrimitiveProperty";class L extends f{}n.Any=L,L.__name__="Any";class T extends f{valid(e){return m.isArray(e)||m.isTypedArray(e)}}n.Array=T,T.__name__="Array";class P extends f{valid(e){return m.isBoolean(e)}}n.Boolean=P,P.__name__="Boolean";class b extends f{valid(e){return S.is_Color(e)}}n.Color=b,b.__name__="Color";class w extends f{}n.Instance=w,w.__name__="Instance";class q extends f{valid(e){return m.isNumber(e)}}n.Number=q,q.__name__="Number";class N extends q{valid(e){return m.isNumber(e)&&(0|e)==e}}n.Int=N,N.__name__="Int";class B extends q{}n.Angle=B,B.__name__="Angle";class D extends q{valid(e){return m.isNumber(e)&&0<=e&&e<=1}}n.Percent=D,D.__name__="Percent";class F extends f{valid(e){return m.isString(e)}}n.String=F,F.__name__="String";class z extends f{valid(e){return null===e||m.isString(e)}}n.NullString=z,z.__name__="NullString";class U extends F{}n.FontSize=U,U.__name__="FontSize";class M extends F{_default_override(){return h.settings.dev?"Bokeh":void 0}}n.Font=M,M.__name__="Font";class R extends f{valid(e){return m.isString(e)&&_.includes(this.enum_values,e)}}function k(e){return class extends R{get enum_values(){return[...e]}}}n.EnumProperty=R,R.__name__="EnumProperty",n.Enum=k;class O extends R{get enum_values(){return[...o.Direction]}normalize(e){const t=new Uint8Array(e.length);for(let n=0;n0){let o=r[e];return null==o&&(r[e]=o=new v(e,l)),o}throw new TypeError("Logger.get() expects a non-empty string name and an optional log-level")}get level(){return this.get_level()}get_level(){return this._log_level}set_level(e){if(e instanceof i)this._log_level=e;else{if(!s.isString(e)||null==v.log_levels[e])throw new Error("Logger.set_level() expects a log-level object or a string name of a log-level");this._log_level=v.log_levels[e]}const l=`[${this._name}]`;for(const[e,o]of g.entries(v.log_levels))o.level","*"),t.HTTPMethod=a.Enum("POST","GET"),t.HexTileOrientation=a.Enum("pointytop","flattop"),t.HoverMode=a.Enum("mouse","hline","vline"),t.LatLon=a.Enum("lat","lon"),t.LegendClickPolicy=a.Enum("none","hide","mute"),t.LegendLocation=t.Anchor,t.LineCap=a.Enum("butt","round","square"),t.LineJoin=a.Enum("miter","round","bevel"),t.LineDash=a.Enum("solid","dashed","dotted","dotdash","dashdot"),t.LinePolicy=a.Enum("prev","next","nearest","interp","none"),t.Location=a.Enum("above","below","left","right"),t.Logo=a.Enum("normal","grey"),t.MarkerType=a.Enum("asterisk","circle","circle_cross","circle_dot","circle_x","circle_y","cross","dash","diamond","diamond_cross","diamond_dot","dot","hex","hex_dot","inverted_triangle","plus","square","square_cross","square_dot","square_pin","square_x","star","star_dot","triangle","triangle_dot","triangle_pin","x","y"),t.MutedPolicy=a.Enum("show","ignore"),t.Orientation=a.Enum("vertical","horizontal"),t.OutputBackend=a.Enum("canvas","svg","webgl"),t.PaddingUnits=a.Enum("percent","absolute"),t.Place=a.Enum("above","below","left","right","center"),t.PointPolicy=a.Enum("snap_to_data","follow_mouse","none"),t.RadiusDimension=a.Enum("x","y","max","min"),t.RenderLevel=a.Enum("image","underlay","glyph","guide","annotation","overlay"),t.RenderMode=a.Enum("canvas","css"),t.ResetPolicy=a.Enum("standard","event_only"),t.RoundingFunction=a.Enum("round","nearest","floor","rounddown","ceil","roundup"),t.SelectionMode=a.Enum("replace","append","intersect","subtract"),t.Side=a.Enum("above","below","left","right"),t.SizingMode=a.Enum("stretch_width","stretch_height","stretch_both","scale_width","scale_height","scale_both","fixed"),t.Sort=a.Enum("ascending","descending"),t.SpatialUnits=a.Enum("screen","data"),t.StartEnd=a.Enum("start","end"),t.StepMode=a.Enum("after","before","center"),t.TapBehavior=a.Enum("select","inspect"),t.TextAlign=a.Enum("left","right","center"),t.TextBaseline=a.Enum("top","middle","bottom","alphabetic","hanging","ideographic"),t.TextureRepetition=a.Enum("repeat","repeat_x","repeat_y","no_repeat"),t.TickLabelOrientation=a.Enum("vertical","horizontal","parallel","normal"),t.TooltipAttachment=a.Enum("horizontal","vertical","left","right","above","below"),t.UpdateMode=a.Enum("replace","append"),t.VerticalAlign=a.Enum("top","middle","bottom")}, +function _(e,n,t,s,r){s();const i=e(1).__importStar(e(8)),a=e(22),l=e(13),_=window.Map,{hasOwnProperty:u}=Object.prototype;class d{}t.Kind=d,d.__name__="Kind",function(e){class n extends d{valid(e){return!0}}n.__name__="Any",e.Any=n;class t extends d{valid(e){return!0}}t.__name__="Unknown",e.Unknown=t;class s extends d{valid(e){return i.isBoolean(e)}}s.__name__="Boolean",e.Boolean=s;class r extends d{constructor(e){super(),this.obj_type=e}valid(e){return!0}}r.__name__="Ref",e.Ref=r;class c extends d{valid(e){return!0}}c.__name__="AnyRef",e.AnyRef=c;class o extends d{valid(e){return i.isNumber(e)}}o.__name__="Number",e.Number=o;class p extends o{valid(e){return super.valid(e)&&i.isInteger(e)}}p.__name__="Int",e.Int=p;class y extends o{valid(e){return super.valid(e)&&0<=e&&e<=1}}y.__name__="Percent",e.Percent=y;class m extends d{constructor(e){super(),this.types=e,this.types=e}valid(e){return this.types.some((n=>n.valid(e)))}}m.__name__="Or",e.Or=m;class v extends d{constructor(e){super(),this.types=e,this.types=e}valid(e){if(!i.isArray(e))return!1;for(let n=0;nthis.item_type.valid(e)))}}f.__name__="Array",e.Array=f;class K extends d{valid(e){return null===e}}K.__name__="Null",e.Null=K;class b extends d{constructor(e){super(),this.base_type=e}valid(e){return null===e||this.base_type.valid(e)}}b.__name__="Nullable",e.Nullable=b;class A extends d{constructor(e){super(),this.base_type=e}valid(e){return void 0===e||this.base_type.valid(e)}}A.__name__="Opt",e.Opt=A;class x extends d{valid(e){return i.isString(e)}}x.__name__="String",e.String=x;class S extends d{constructor(e){super(),this.values=new Set(e)}valid(e){return this.values.has(e)}*[Symbol.iterator](){yield*this.values}}S.__name__="Enum",e.Enum=S;class N extends d{constructor(e){super(),this.item_type=e}valid(e){if(!i.isPlainObject(e))return!1;for(const n in e)if(u.call(e,n)){const t=e[n];if(!this.item_type.valid(t))return!1}return!0}}N.__name__="Dict",e.Dict=N;class O extends d{constructor(e,n){super(),this.key_type=e,this.item_type=n}valid(e){if(!(e instanceof _))return!1;for(const[n,t]of e.entries())if(!this.key_type.valid(n)||!this.item_type.valid(t))return!1;return!0}}O.__name__="Map",e.Map=O;class g extends d{valid(e){return a.is_Color(e)}}g.__name__="Color",e.Color=g;class P extends d{valid(e){return i.isFunction(e)}}P.__name__="Function",e.Function=P}(t.Kinds||(t.Kinds={})),t.Any=new t.Kinds.Any,t.Unknown=new t.Kinds.Unknown,t.Boolean=new t.Kinds.Boolean,t.Number=new t.Kinds.Number,t.Int=new t.Kinds.Int,t.String=new t.Kinds.String,t.Null=new t.Kinds.Null;t.Nullable=e=>new t.Kinds.Nullable(e);t.Opt=e=>new t.Kinds.Opt(e);t.Or=(...e)=>new t.Kinds.Or(e);t.Tuple=(...e)=>new t.Kinds.Tuple(e);t.Struct=e=>new t.Kinds.Struct(e),t.Arrayable=new t.Kinds.Arrayable;t.Array=e=>new t.Kinds.Array(e);t.Dict=e=>new t.Kinds.Dict(e);t.Map=(e,n)=>new t.Kinds.Map(e,n);t.Enum=(...e)=>new t.Kinds.Enum(e);t.Ref=e=>new t.Kinds.Ref(e);t.AnyRef=()=>new t.Kinds.AnyRef;t.Function=()=>new t.Kinds.Function,t.Percent=new t.Kinds.Percent,t.Alpha=t.Percent,t.Color=new t.Kinds.Color,t.Auto=t.Enum("auto"),t.FontSize=t.String,t.Font=t.String,t.Angle=t.Number}, +function _(n,t,r,e,s){e();const u=n(23),c=n(10),l=n(8),{round:i}=Math;function o(n){return c.clamp(i(n),0,255)}function a(){return[0,0,0,0]}function f(n){return[n>>24&255,n>>16&255,n>>8&255,255&n]}function d(n,t){var r;let e,s,u,c;return null==n?[e,s,u,c]=[0,0,0,0]:l.isInteger(n)?[e,s,u,c]=f(n):l.isString(n)?[e,s,u,c]=null!==(r=_(n))&&void 0!==r?r:[0,0,0,0]:([e,s,u,c=1]=n,c=o(255*c)),255==c&&null!=t&&(c=o(255*t)),[e,s,u,c]}r.transparent=a,r.encode_rgba=function([n,t,r,e]){return n<<24|t<<16|r<<8|e},r.decode_rgba=f,r.compose_alpha=function(n,t){return 255==(255&n)?4294967040&n|o(255*t):n},r.color2rgba=d;const h={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"a",11:"b",12:"c",13:"d",14:"e",15:"f"};function g(n){return h[n>>4]+h[15&n]}r.color2css=function(n,t){const[r,e,s,u]=d(n,t);return`rgba(${r}, ${e}, ${s}, ${u/255})`},r.color2hex=function(n,t){const[r,e,s,u]=d(n,t),c=`#${g(r)}${g(e)}${g(s)}`;return 255==u?c:`${c}${g(u)}`},r.color2hexrgb=function(n){const[t,r,e]=d(n);return`#${g(t)}${g(r)}${g(e)}`};const b=/^rgba?\(\s*([^\s,]+?)\s+([^\s,]+?)\s+([^\s,]+?)(?:\s*\/\s*([^\s,]+?))?\s*\)$/,m=/^rgba?\(\s*([^\s,]+?)\s*,\s*([^\s,]+?)\s*,\s*([^\s,]+?)(?:\s*,\s*([^\s,]+?))?\s*\)$/,$=(()=>{const n=document.createElement("canvas");n.width=1,n.height=1;const t=n.getContext("2d"),r=t.createLinearGradient(0,0,1,1);return n=>{t.fillStyle=r,t.fillStyle=n;const e=t.fillStyle;return e!=r?e:null}})();function _(n){var t;if(!(n=n.trim().toLowerCase()))return null;if("transparent"==n)return[0,0,0,0];if(u.is_named_color(n))return f(u.named_colors[n]);if("#"==n[0]){const t=Number("0x"+n.substr(1));if(isNaN(t))return null;switch(n.length-1){case 3:{const n=t>>8&15,r=t>>4&15,e=t>>0&15;return[n<<4|n,r<<4|r,e<<4|e,255]}case 4:{const n=t>>12&15,r=t>>8&15,e=t>>4&15,s=t>>0&15;return[n<<4|n,r<<4|r,e<<4|e,s<<4|s]}case 6:return[t>>16&255,t>>8&255,t>>0&255,255];case 8:return[t>>24&255,t>>16&255,t>>8&255,t>>0&255]}}else if(n.startsWith("rgb")){const r=null!==(t=n.match(b))&&void 0!==t?t:n.match(m);if(null!=r){let[,n,t,e,s="1"]=r;const u=n.endsWith("%"),c=t.endsWith("%"),l=e.endsWith("%"),i=s.endsWith("%");if(!(u&&c&&l)&&(u||c||l))return null;u&&(n=n.slice(0,-1)),c&&(t=t.slice(0,-1)),l&&(e=e.slice(0,-1)),i&&(s=s.slice(0,-1));let a=Number(n),f=Number(t),d=Number(e),h=Number(s);return isNaN(a+f+d+h)?null:(u&&(a=a/100*255),c&&(f=f/100*255),l&&(d=d/100*255),h=255*(i?h/100:h),a=o(a),f=o(f),d=o(d),h=o(h),[a,f,d,h])}}else{const t=$(n);if(null!=t)return _(t)}return null}r.css4_parse=_,r.is_Color=function(n){return!!l.isInteger(n)||(!(!l.isString(n)||null==_(n))||!(!l.isArray(n)||3!=n.length&&4!=n.length))},r.is_dark=function([n,t,r]){return 1-(.299*n+.587*t+.114*r)/255>=.6}}, +function _(e,r,l,a,i){a();l.named_colors={aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},l.is_named_color=function(e){return e in l.named_colors}}, +function _(r,t,n,a,o){a(),n.GeneratorFunction=Object.getPrototypeOf((function*(){})).constructor,n.ColorArray=Uint32Array,n.RGBAArray=Uint8ClampedArray,n.infer_type=function(r,t){return r instanceof Float64Array||r instanceof Array||t instanceof Float64Array||t instanceof Array?Float64Array:Float32Array},n.ScreenArray=Float32Array,n.to_screen=function(r){return r instanceof Float32Array?r:new Float32Array(r)},o("Indices",r(25).BitSet)}, +function _(t,s,r,e,i){e();const n=t(26),o=t(11);class a{constructor(t,s=0){this.size=t,this[Symbol.toStringTag]="BitSet",this._count=null,this._nwords=Math.ceil(t/32),0==s||1==s?(this._array=new Uint32Array(this._nwords),1==s&&this._array.fill(4294967295)):(o.assert(s.length==this._nwords,"Initializer size mismatch"),this._array=s)}clone(){return new a(this.size,new Uint32Array(this._array))}[n.equals](t,s){if(!s.eq(this.size,t.size))return!1;const{_nwords:r}=this,e=this.size%r,i=0==e?r:r-1;for(let s=0;s>>5,r=31&t;return!!(this._array[s]>>r&1)}set(t,s=!0){this._check_bounds(t),this._count=null;const r=t>>>5,e=31&t;s?this._array[r]|=1<>>t&1&&(e+=1)}return e}*ones(){const{_array:t,_nwords:s,size:r}=this;for(let e=0,i=0;i>>t&1&&(yield e);else e+=32}}*zeros(){const{_array:t,_nwords:s,size:r}=this;for(let e=0,i=0;i>>t&1||(yield e);else e+=32}}_check_size(t){o.assert(this.size==t.size,"Size mismatch")}add(t){this._check_size(t);for(let s=0;s{if(a(t)&&a(e))return t[r.equals](e,this);switch(n){case"[object Array]":case"[object Uint8Array]":case"[object Int8Array]":case"[object Uint16Array]":case"[object Int16Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":return this.arrays(t,e);case"[object Map]":return this.maps(t,e);case"[object Set]":return this.sets(t,e);case"[object Object]":if(t.constructor==e.constructor&&(null==t.constructor||t.constructor===Object))return this.objects(t,e);case"[object Function]":if(t.constructor==e.constructor&&t.constructor===Function)return this.eq(`${t}`,`${e}`)}if(t instanceof Node)return this.nodes(t,e);throw Error(`can't compare objects of type ${n}`)})();return s.pop(),o.pop(),u}numbers(t,e){return Object.is(t,e)}arrays(t,e){const{length:r}=t;if(r!=e.length)return!1;for(let n=0;n{const n=navigator.userAgent;return n.includes("MSIE")||n.includes("Trident")||n.includes("Edge")})(),e.is_mobile="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0),e.is_little_endian=(()=>{const n=new ArrayBuffer(4),i=new Uint8Array(n);new Uint32Array(n)[1]=168496141;let e=!0;return 10==i[4]&&11==i[5]&&12==i[6]&&13==i[7]&&(e=!1),e})(),e.BYTE_ORDER=e.is_little_endian?"little":"big",e.to_big_endian=function(n){if(e.is_little_endian){const i=new Uint32Array(n.length),e=new DataView(i.buffer);let t=0;for(const i of n)e.setUint32(t,i),t+=4;return i}return n}}, +function _(e,t,r,i,s){i();class _{constructor(){this._dev=!1,this._wireframe=!1}set dev(e){this._dev=e}get dev(){return this._dev}set wireframe(e){this._wireframe=e}get wireframe(){return this._wireframe}}r.Settings=_,_.__name__="Settings",r.settings=new _}, +function _(t,e,s,r,n){var a,i,h,u,l,c,o,y;r();const p=t(8),_=t(11),A=t(26),d=t(30),D=t(31),N=Symbol("__ndarray__");class f extends Uint8Array{constructor(t,e){super(t),this[a]=!0,this.dtype="uint8",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(a=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Uint8NDArray=f,f.__name__="Uint8NDArray";class m extends Int8Array{constructor(t,e){super(t),this[i]=!0,this.dtype="int8",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(i=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Int8NDArray=m,m.__name__="Int8NDArray";class g extends Uint16Array{constructor(t,e){super(t),this[h]=!0,this.dtype="uint16",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(h=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Uint16NDArray=g,g.__name__="Uint16NDArray";class q extends Int16Array{constructor(t,e){super(t),this[u]=!0,this.dtype="int16",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(u=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Int16NDArray=q,q.__name__="Int16NDArray";class I extends Uint32Array{constructor(t,e){super(t),this[l]=!0,this.dtype="uint32",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(l=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Uint32NDArray=I,I.__name__="Uint32NDArray";class U extends Int32Array{constructor(t,e){super(t),this[c]=!0,this.dtype="int32",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(c=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Int32NDArray=U,U.__name__="Int32NDArray";class w extends Float32Array{constructor(t,e){super(t),this[o]=!0,this.dtype="float32",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(o=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}s.Float32NDArray=w,w.__name__="Float32NDArray";class x extends Float64Array{constructor(t,e){super(t),this[y]=!0,this.dtype="float64",this.shape=null!=e?e:z(t)?t.shape:[this.length],this.dimension=this.shape.length}[(y=N,A.equals)](t,e){return e.eq(this.shape,t.shape)&&e.arrays(this,t)}[d.serialize](t){return D.encode_NDArray(this)}}function z(t){return p.isObject(t)&&void 0!==t[N]}s.Float64NDArray=x,x.__name__="Float64NDArray",s.is_NDArray=z,s.ndarray=function(t,e={}){let{dtype:s}=e;null==s&&(s=t instanceof ArrayBuffer||p.isArray(t)?"float64":(()=>{switch(!0){case t instanceof Uint8Array:return"uint8";case t instanceof Int8Array:return"int8";case t instanceof Uint16Array:return"uint16";case t instanceof Int16Array:return"int16";case t instanceof Uint32Array:return"uint32";case t instanceof Int32Array:return"int32";case t instanceof Float32Array:return"float32";case t instanceof Float64Array:return"float64";default:_.unreachable()}})());const{shape:r}=e;switch(s){case"uint8":return new f(t,r);case"int8":return new m(t,r);case"uint16":return new g(t,r);case"int16":return new q(t,r);case"uint32":return new I(t,r);case"int32":return new U(t,r);case"float32":return new w(t,r);case"float64":return new x(t,r)}}}, +function _(e,r,t,i,s){i();const n=e(11),a=e(13),l=e(8);t.serialize=Symbol("serialize");class o extends Error{}t.SerializationError=o,o.__name__="SerializationError";class f{constructor(e){var r;this._references=new Map,this._definitions=new Map,this._refmap=new Map,this.include_defaults=null===(r=null==e?void 0:e.include_defaults)||void 0===r||r}get_ref(e){return this._references.get(e)}add_ref(e,r){n.assert(!this._references.has(e)),this._references.set(e,r)}add_def(e,r){const t=this.get_ref(e);n.assert(null!=t),this._definitions.set(e,r),this._refmap.set(t,r)}get objects(){return new Set(this._references.keys())}get references(){return new Set(this._references.values())}get definitions(){return new Set(this._definitions.values())}resolve_ref(e){return this._refmap.get(e)}remove_ref(e){return this._references.delete(e)}remove_def(e){return this._definitions.delete(e)}to_serializable(e){const r=this.get_ref(e);if(null!=r)return r;if(function(e){return l.isObject(e)&&void 0!==e[t.serialize]}(e))return e[t.serialize](this);if(l.isArray(e)||l.isTypedArray(e)){const r=e.length,t=new Array(r);for(let i=0;i{switch(t){case"uint8":return new u.Uint8NDArray(a,n);case"int8":return new u.Int8NDArray(a,n);case"uint16":return new u.Uint16NDArray(a,n);case"int16":return new u.Int16NDArray(a,n);case"uint32":return new u.Uint32NDArray(a,n);case"int32":return new u.Int32NDArray(a,n);case"float32":return new u.Float32NDArray(a,n);case"float64":return new u.Float64NDArray(a,n)}})();return _!==s.BYTE_ORDER&&i.swap(f),f},n.encode_NDArray=function(r,e){const n={order:s.BYTE_ORDER,dtype:r.dtype,shape:r.shape};if(null!=e){const t=`${e.size}`;return e.set(t,r.buffer),Object.assign({__buffer__:t},n)}{const e=i.buffer_to_base64(r.buffer);return Object.assign({__ndarray__:e},n)}}}, +function _(t,e,n,r,f){r(),n.buffer_to_base64=function(t){const e=new Uint8Array(t),n=Array.from(e).map((t=>String.fromCharCode(t)));return btoa(n.join(""))},n.base64_to_buffer=function(t){const e=atob(t),n=e.length,r=new Uint8Array(n);for(let t=0,f=n;t"'`])/g,(t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"`":return"`";default:return t}}))},r.unescape=function(t){return t.replace(/&(amp|lt|gt|quot|#x27|#x60);/g,((t,e)=>{switch(e){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';case"#x27":return"'";case"#x60":return"`";default:return e}}))},r.use_strict=function(t){return`'use strict';\n${t}`},r.to_fixed=function(t,e){return t.toFixed(e).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,"")}}, +function _(e,t,s,n,o){n();const i=e(30);class r{constructor(e){this.document=e}}s.DocumentEvent=r,r.__name__="DocumentEvent";class a extends r{constructor(e,t,s){super(e),this.events=t,this.setter_id=s}}s.DocumentEventBatch=a,a.__name__="DocumentEventBatch";class d extends r{}s.DocumentChangedEvent=d,d.__name__="DocumentChangedEvent";class l extends d{constructor(e,t,s){super(e),this.msg_type=t,this.msg_data=s}[i.serialize](e){const t=this.msg_data,s=e.to_serializable(t);return{kind:"MessageSent",msg_type:this.msg_type,msg_data:s}}}s.MessageSentEvent=l,l.__name__="MessageSentEvent";class _ extends d{constructor(e,t,s,n,o,i,r){super(e),this.model=t,this.attr=s,this.old=n,this.new_=o,this.setter_id=i,this.hint=r}[i.serialize](e){if(null!=this.hint)return e.to_serializable(this.hint);const t=this.new_,s=e.to_serializable(t);return this.model!=t&&e.remove_def(this.model),{kind:"ModelChanged",model:this.model.ref(),attr:this.attr,new:s}}}s.ModelChangedEvent=_,_.__name__="ModelChangedEvent";class c extends d{constructor(e,t,s){super(e),this.column_source=t,this.patches=s}[i.serialize](e){return{kind:"ColumnsPatched",column_source:this.column_source,patches:this.patches}}}s.ColumnsPatchedEvent=c,c.__name__="ColumnsPatchedEvent";class h extends d{constructor(e,t,s,n){super(e),this.column_source=t,this.data=s,this.rollover=n}[i.serialize](e){return{kind:"ColumnsStreamed",column_source:this.column_source,data:this.data,rollover:this.rollover}}}s.ColumnsStreamedEvent=h,h.__name__="ColumnsStreamedEvent";class m extends d{constructor(e,t,s){super(e),this.title=t,this.setter_id=s}[i.serialize](e){return{kind:"TitleChanged",title:this.title}}}s.TitleChangedEvent=m,m.__name__="TitleChangedEvent";class u extends d{constructor(e,t,s){super(e),this.model=t,this.setter_id=s}[i.serialize](e){return{kind:"RootAdded",model:e.to_serializable(this.model)}}}s.RootAddedEvent=u,u.__name__="RootAddedEvent";class v extends d{constructor(e,t,s){super(e),this.model=t,this.setter_id=s}[i.serialize](e){return{kind:"RootRemoved",model:this.model.ref()}}}s.RootRemovedEvent=v,v.__name__="RootRemovedEvent"}, +function _(t,r,n,i,e){i();const s=t(8),o=t(13);n.pretty=Symbol("pretty");class c{constructor(t){this.precision=null==t?void 0:t.precision}to_string(t){return function(t){return s.isObject(t)&&void 0!==t[n.pretty]}(t)?t[n.pretty](this):s.isBoolean(t)?this.boolean(t):s.isNumber(t)?this.number(t):s.isString(t)?this.string(t):s.isArray(t)?this.array(t):s.isIterable(t)?this.iterable(t):s.isPlainObject(t)?this.object(t):`${t}`}token(t){return t}boolean(t){return`${t}`}number(t){return null!=this.precision?t.toFixed(this.precision):`${t}`}string(t){return`"${t.replace(/'/g,"\\'")}"`}array(t){const r=this.token,n=[];for(const r of t)n.push(this.to_string(r));return`${r("[")}${n.join(`${r(",")} `)}${r("]")}`}iterable(t){var r;const n=this.token,i=null!==(r=Object(t)[Symbol.toStringTag])&&void 0!==r?r:"Object",e=this.array(t);return`${i}${n("(")}${e}${n(")")}`}object(t){const r=this.token,n=[];for(const[i,e]of o.entries(t))n.push(`${i}${r(":")} ${this.to_string(e)}`);return`${r("{")}${n.join(`${r(",")} `)}${r("}")}`}}n.Printer=c,c.__name__="Printer",n.to_string=function(t,r){return new c(r).to_string(t)}}, +function _(n,o,r,e,t){e();const l=n(13),i=n(8);function c(n){return i.isObject(n)&&void 0!==n[r.clone]}r.clone=Symbol("clone"),r.is_Cloneable=c;class s extends Error{}r.CloningError=s,s.__name__="CloningError";class a{constructor(){}clone(n){if(c(n))return n[r.clone](this);if(i.isArray(n)){const o=n.length,r=new Array(o);for(let e=0;e{null!=this.layout&&(this.layout.visible=this.model.visible,this.plot_view.request_layout())}))}get needs_clip(){return null==this.layout}serializable_state(){const t=super.serializable_state();return null==this.layout?t:Object.assign(Object.assign({},t),{bbox:this.layout.bbox.box})}}i.AnnotationView=a,a.__name__="AnnotationView";class l extends o.Renderer{constructor(t){super(t)}static init_Annotation(){this.override({level:"annotation"})}}i.Annotation=l,l.__name__="Annotation",l.init_Annotation()}, +function _(e,i,t,n,s){n();const r=e(1),a=e(42),_=r.__importStar(e(45)),o=e(20),l=e(53),d=e(54);class h extends a.View{get coordinates(){const{_coordinates:e}=this;return null!=e?e:this._coordinates=this._initialize_coordinates()}initialize(){super.initialize(),this.visuals=new _.Visuals(this),this.needs_webgl_blit=!1}connect_signals(){super.connect_signals();const{x_range_name:e,y_range_name:i}=this.model.properties;this.on_change([e,i],(()=>this._initialize_coordinates()))}_initialize_coordinates(){const{x_range_name:e,y_range_name:i}=this.model,{frame:t}=this.plot_view,n=t.x_scales.get(e),s=t.y_scales.get(i);return new d.CoordinateTransform(n,s)}get plot_view(){return this.parent}get plot_model(){return this.parent.model}get layer(){const{overlays:e,primary:i}=this.canvas;return"overlay"==this.model.level?e:i}get canvas(){return this.plot_view.canvas_view}request_render(){this.request_paint()}request_paint(){this.plot_view.request_paint(this)}notify_finished(){this.plot_view.notify_finished()}get needs_clip(){return!1}get has_webgl(){return!1}render(){this.model.visible&&this._render(),this._has_finished=!0}renderer_view(e){}}t.RendererView=h,h.__name__="RendererView";class c extends l.Model{constructor(e){super(e)}static init_Renderer(){this.define((({Boolean:e,String:i})=>({level:[o.RenderLevel,"image"],visible:[e,!0],x_range_name:[i,"default"],y_range_name:[i,"default"]})))}}t.Renderer=c,c.__name__="Renderer",c.init_Renderer()}, +function _(t,e,s,i,n){i();const r=t(1),o=t(15),h=t(43),l=t(8),a=r.__importDefault(t(44));class _{constructor(t){this.removed=new o.Signal0(this,"removed"),this._ready=Promise.resolve(void 0),this._slots=new WeakMap;const{model:e,parent:s}=t;this.model=e,this.parent=s,this.root=null==s?this:s.root,this.removed.emit()}get ready(){return this._ready}connect(t,e){let s=this._slots.get(e);return null==s&&(s=(t,s)=>{const i=Promise.resolve(e.call(this,t,s));this._ready=this._ready.then((()=>i))},this._slots.set(e,s)),t.connect(s,this)}disconnect(t,e){return t.disconnect(e,this)}initialize(){this._has_finished=!1,this.is_root&&(this._stylesheet=h.stylesheet);for(const t of this.styles())this.stylesheet.append(t)}async lazy_initialize(){}remove(){this.disconnect_signals(),this.removed.emit()}toString(){return`${this.model.type}View(${this.model.id})`}serializable_state(){return{type:this.model.type}}get is_root(){return null==this.parent}assert_root(){if(!this.is_root)throw new Error(`${this.toString()} is not a root layout`)}has_finished(){return this._has_finished}get is_idle(){return this.has_finished()}connect_signals(){}disconnect_signals(){o.Signal.disconnect_receiver(this)}on_change(t,e){for(const s of l.isArray(t)?t:[t])this.connect(s.change,e)}cursor(t,e){return null}get stylesheet(){return this.is_root?this._stylesheet:this.root.stylesheet}styles(){return[a.default]}}s.View=_,_.__name__="View"}, +function _(t,e,n,i,o){i();const s=t(8),l=t(13),r=t=>(e={},...n)=>{const i=document.createElement(t);i.classList.add("bk");for(let[t,n]of l.entries(e))if(null!=n&&(!s.isBoolean(n)||n))if("class"===t&&(s.isString(n)&&(n=n.split(/\s+/)),s.isArray(n)))for(const t of n)null!=t&&i.classList.add(t);else if("style"===t&&s.isPlainObject(n))for(const[t,e]of l.entries(n))i.style[t]=e;else if("data"===t&&s.isPlainObject(n))for(const[t,e]of l.entries(n))i.dataset[t]=e;else i.setAttribute(t,n);function o(t){if(s.isString(t))i.appendChild(document.createTextNode(t));else if(t instanceof Node)i.appendChild(t);else if(t instanceof NodeList||t instanceof HTMLCollection)for(const e of t)i.appendChild(e);else if(null!=t&&!1!==t)throw new Error(`expected a DOM element, string, false or null, got ${JSON.stringify(t)}`)}for(const t of n)if(s.isArray(t))for(const e of t)o(e);else o(t);return i};function a(t){const e=t.parentNode;null!=e&&e.removeChild(t)}function c(t,...e){const n=t.firstChild;for(const i of e)t.insertBefore(i,n)}function d(t,e){var n,i,o;const s=Element.prototype;return(null!==(o=null!==(i=null!==(n=s.matches)&&void 0!==n?n:s.webkitMatchesSelector)&&void 0!==i?i:s.mozMatchesSelector)&&void 0!==o?o:s.msMatchesSelector).call(t,e)}function h(t){return parseFloat(t)||0}function u(t){const e=getComputedStyle(t);return{border:{top:h(e.borderTopWidth),bottom:h(e.borderBottomWidth),left:h(e.borderLeftWidth),right:h(e.borderRightWidth)},margin:{top:h(e.marginTop),bottom:h(e.marginBottom),left:h(e.marginLeft),right:h(e.marginRight)},padding:{top:h(e.paddingTop),bottom:h(e.paddingBottom),left:h(e.paddingLeft),right:h(e.paddingRight)}}}function f(t){const e=t.getBoundingClientRect();return{width:Math.ceil(e.width),height:Math.ceil(e.height)}}n.createElement=function(t,e,...n){return r(t)(e,...n)},n.div=r("div"),n.span=r("span"),n.canvas=r("canvas"),n.link=r("link"),n.style=r("style"),n.a=r("a"),n.p=r("p"),n.i=r("i"),n.pre=r("pre"),n.button=r("button"),n.label=r("label"),n.input=r("input"),n.select=r("select"),n.option=r("option"),n.optgroup=r("optgroup"),n.textarea=r("textarea"),n.nbsp=function(){return document.createTextNode(" ")},n.append=function(t,...e){for(const n of e)t.appendChild(n)},n.remove=a,n.removeElement=a,n.replaceWith=function(t,e){const n=t.parentNode;null!=n&&n.replaceChild(e,t)},n.prepend=c,n.empty=function(t,e=!1){let n;for(;n=t.firstChild;)t.removeChild(n);if(e&&t instanceof Element)for(const e of t.attributes)t.removeAttributeNode(e)},n.display=function(t){t.style.display=""},n.undisplay=function(t){t.style.display="none"},n.show=function(t){t.style.visibility=""},n.hide=function(t){t.style.visibility="hidden"},n.offset=function(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset-document.documentElement.clientTop,left:e.left+window.pageXOffset-document.documentElement.clientLeft}},n.matches=d,n.parent=function(t,e){let n=t;for(;n=n.parentElement;)if(d(n,e))return n;return null},n.extents=u,n.size=f,n.scroll_size=function(t){return{width:Math.ceil(t.scrollWidth),height:Math.ceil(t.scrollHeight)}},n.outer_size=function(t){const{margin:{left:e,right:n,top:i,bottom:o}}=u(t),{width:s,height:l}=f(t);return{width:Math.ceil(s+e+n),height:Math.ceil(l+i+o)}},n.content_size=function(t){const{left:e,top:n}=t.getBoundingClientRect(),{padding:i}=u(t);let o=0,s=0;for(const l of t.children){const t=l.getBoundingClientRect();o=Math.max(o,Math.ceil(t.left-e-i.left+t.width)),s=Math.max(s,Math.ceil(t.top-n-i.top+t.height))}return{width:o,height:s}},n.position=function(t,e,n){const{style:i}=t;if(i.left=`${e.x}px`,i.top=`${e.y}px`,i.width=`${e.width}px`,i.height=`${e.height}px`,null==n)i.margin="";else{const{top:t,right:e,bottom:o,left:s}=n;i.margin=`${t}px ${e}px ${o}px ${s}px`}},n.children=function(t){return Array.from(t.children)};class p{constructor(t){this.el=t,this.classList=t.classList}get values(){const t=[];for(let e=0;e{document.addEventListener("DOMContentLoaded",(()=>t()),{once:!0})}))}}, +function _(o,i,t,e,r){e(),t.root="bk-root",t.default=".bk-root{position:relative;width:auto;height:auto;z-index:0;box-sizing:border-box;font-family:Helvetica, Arial, sans-serif;font-size:13px;}.bk-root .bk,.bk-root .bk:before,.bk-root .bk:after{box-sizing:inherit;margin:0;border:0;padding:0;background-image:none;font-family:inherit;font-size:100%;line-height:1.42857143;}.bk-root pre.bk{font-family:Courier, monospace;}"}, +function _(e,t,r,a,c){a();const l=e(1),n=e(46);c("Line",n.Line),c("LineScalar",n.LineScalar),c("LineVector",n.LineVector);const i=e(49);c("Fill",i.Fill),c("FillScalar",i.FillScalar),c("FillVector",i.FillVector);const s=e(50);c("Text",s.Text),c("TextScalar",s.TextScalar),c("TextVector",s.TextVector);const o=e(51);c("Hatch",o.Hatch),c("HatchScalar",o.HatchScalar),c("HatchVector",o.HatchVector);const u=l.__importStar(e(48)),V=e(47);c("VisualProperties",V.VisualProperties),c("VisualUniforms",V.VisualUniforms);class h{constructor(e){this._visuals=[];for(const[t,r]of e.model._mixins){const a=(()=>{switch(r){case u.Line:return new n.Line(e,t);case u.LineScalar:return new n.LineScalar(e,t);case u.LineVector:return new n.LineVector(e,t);case u.Fill:return new i.Fill(e,t);case u.FillScalar:return new i.FillScalar(e,t);case u.FillVector:return new i.FillVector(e,t);case u.Text:return new s.Text(e,t);case u.TextScalar:return new s.TextScalar(e,t);case u.TextVector:return new s.TextVector(e,t);case u.Hatch:return new o.Hatch(e,t);case u.HatchScalar:return new o.HatchScalar(e,t);case u.HatchVector:return new o.HatchVector(e,t);default:throw new Error("unknown visual")}})();this._visuals.push(a),Object.defineProperty(this,t+a.type,{get:()=>a,configurable:!1,enumerable:!0})}}*[Symbol.iterator](){yield*this._visuals}}r.Visuals=h,h.__name__="Visuals"}, +function _(e,t,i,l,s){l();const n=e(1),a=e(47),o=n.__importStar(e(48)),r=e(22),_=e(8);function h(e){if(_.isArray(e))return e;switch(e){case"solid":return[];case"dashed":return[6];case"dotted":return[2,4];case"dotdash":return[2,4,6,4];case"dashdot":return[6,4,2,4];default:return e.split(" ").map(Number).filter(_.isInteger)}}i.resolve_line_dash=h;class c extends a.VisualProperties{get doit(){const e=this.line_color.get_value(),t=this.line_alpha.get_value(),i=this.line_width.get_value();return!(null==e||0==t||0==i)}set_value(e){const t=this.line_color.get_value(),i=this.line_alpha.get_value();e.strokeStyle=r.color2css(t,i),e.lineWidth=this.line_width.get_value(),e.lineJoin=this.line_join.get_value(),e.lineCap=this.line_cap.get_value(),e.lineDash=h(this.line_dash.get_value()),e.lineDashOffset=this.line_dash_offset.get_value()}}i.Line=c,c.__name__="Line";class u extends a.VisualUniforms{get doit(){const e=this.line_color.value,t=this.line_alpha.value,i=this.line_width.value;return!(0==e||0==t||0==i)}set_value(e){const t=this.line_color.value,i=this.line_alpha.value;e.strokeStyle=r.color2css(t,i),e.lineWidth=this.line_width.value,e.lineJoin=this.line_join.value,e.lineCap=this.line_cap.value,e.lineDash=h(this.line_dash.value),e.lineDashOffset=this.line_dash_offset.value}}i.LineScalar=u,u.__name__="LineScalar";class d extends a.VisualUniforms{get doit(){const{line_color:e}=this;if(e.is_Scalar()&&0==e.value)return!1;const{line_alpha:t}=this;if(t.is_Scalar()&&0==t.value)return!1;const{line_width:i}=this;return!i.is_Scalar()||0!=i.value}set_vectorize(e,t){const i=this.line_color.get(t),l=this.line_alpha.get(t),s=this.line_width.get(t),n=this.line_join.get(t),a=this.line_cap.get(t),o=this.line_dash.get(t),_=this.line_dash_offset.get(t);e.strokeStyle=r.color2css(i,l),e.lineWidth=s,e.lineJoin=n,e.lineCap=a,e.lineDash=h(o),e.lineDashOffset=_}}i.LineVector=d,d.__name__="LineVector",c.prototype.type="line",c.prototype.attrs=Object.keys(o.Line),u.prototype.type="line",u.prototype.attrs=Object.keys(o.LineScalar),d.prototype.type="line",d.prototype.attrs=Object.keys(o.LineVector)}, +function _(t,s,o,i,r){i();class e{constructor(t,s=""){this.obj=t,this.prefix=s;const o=this;this._props=[];for(const i of this.attrs){const r=t.model.properties[s+i];r.change.connect((()=>this.update())),o[i]=r,this._props.push(r)}this.update()}*[Symbol.iterator](){yield*this._props}update(){}}o.VisualProperties=e,e.__name__="VisualProperties";class p{constructor(t,s=""){this.obj=t,this.prefix=s;for(const o of this.attrs)Object.defineProperty(this,o,{get:()=>t[s+o]})}*[Symbol.iterator](){for(const t of this.attrs)yield this.obj.model.properties[this.prefix+t]}update(){}}o.VisualUniforms=p,p.__name__="VisualUniforms"}, +function _(e,l,t,a,c){a();const r=e(1),o=r.__importStar(e(18)),n=e(20),i=r.__importStar(e(21)),_=e(13);t.Line={line_color:[i.Nullable(i.Color),"black"],line_alpha:[i.Alpha,1],line_width:[i.Number,1],line_join:[n.LineJoin,"bevel"],line_cap:[n.LineCap,"butt"],line_dash:[i.Or(n.LineDash,i.Array(i.Number)),[]],line_dash_offset:[i.Number,0]},t.Fill={fill_color:[i.Nullable(i.Color),"gray"],fill_alpha:[i.Alpha,1]},t.Hatch={hatch_color:[i.Nullable(i.Color),"black"],hatch_alpha:[i.Alpha,1],hatch_scale:[i.Number,12],hatch_pattern:[i.Nullable(i.Or(n.HatchPatternType,i.String)),null],hatch_weight:[i.Number,1],hatch_extra:[i.Dict(i.AnyRef()),{}]},t.Text={text_color:[i.Nullable(i.Color),"#444444"],text_alpha:[i.Alpha,1],text_font:[o.Font,"helvetica"],text_font_size:[i.FontSize,"16px"],text_font_style:[n.FontStyle,"normal"],text_align:[n.TextAlign,"left"],text_baseline:[n.TextBaseline,"bottom"],text_line_height:[i.Number,1.2]},t.LineScalar={line_color:[o.ColorScalar,"black"],line_alpha:[o.NumberScalar,1],line_width:[o.NumberScalar,1],line_join:[o.LineJoinScalar,"bevel"],line_cap:[o.LineCapScalar,"butt"],line_dash:[o.LineDashScalar,[]],line_dash_offset:[o.NumberScalar,0]},t.FillScalar={fill_color:[o.ColorScalar,"gray"],fill_alpha:[o.NumberScalar,1]},t.HatchScalar={hatch_color:[o.ColorScalar,"black"],hatch_alpha:[o.NumberScalar,1],hatch_scale:[o.NumberScalar,12],hatch_pattern:[o.NullStringScalar,null],hatch_weight:[o.NumberScalar,1],hatch_extra:[o.AnyScalar,{}]},t.TextScalar={text_color:[o.ColorScalar,"#444444"],text_alpha:[o.NumberScalar,1],text_font:[o.FontScalar,"helvetica"],text_font_size:[o.FontSizeScalar,"16px"],text_font_style:[o.FontStyleScalar,"normal"],text_align:[o.TextAlignScalar,"left"],text_baseline:[o.TextBaselineScalar,"bottom"],text_line_height:[o.NumberScalar,1.2]},t.LineVector={line_color:[o.ColorSpec,"black"],line_alpha:[o.NumberSpec,1],line_width:[o.NumberSpec,1],line_join:[o.LineJoinSpec,"bevel"],line_cap:[o.LineCapSpec,"butt"],line_dash:[o.LineDashSpec,[]],line_dash_offset:[o.NumberSpec,0]},t.FillVector={fill_color:[o.ColorSpec,"gray"],fill_alpha:[o.NumberSpec,1]},t.HatchVector={hatch_color:[o.ColorSpec,"black"],hatch_alpha:[o.NumberSpec,1],hatch_scale:[o.NumberSpec,12],hatch_pattern:[o.NullStringSpec,null],hatch_weight:[o.NumberSpec,1],hatch_extra:[o.AnyScalar,{}]},t.TextVector={text_color:[o.ColorSpec,"#444444"],text_alpha:[o.NumberSpec,1],text_font:[o.FontSpec,"helvetica"],text_font_size:[o.FontSizeSpec,"16px"],text_font_style:[o.FontStyleSpec,"normal"],text_align:[o.TextAlignSpec,"left"],text_baseline:[o.TextBaselineSpec,"bottom"],text_line_height:[o.NumberSpec,1.2]},t.attrs_of=function(e,l,t,a=!1){const c={};for(const r of _.keys(t)){const t=`${l}${r}`,o=e[t];c[a?t:r]=o}return c}}, +function _(l,t,e,i,s){i();const o=l(1),a=l(47),r=o.__importStar(l(48)),c=l(22);class _ extends a.VisualProperties{get doit(){const l=this.fill_color.get_value(),t=this.fill_alpha.get_value();return!(null==l||0==t)}set_value(l){const t=this.fill_color.get_value(),e=this.fill_alpha.get_value();l.fillStyle=c.color2css(t,e)}}e.Fill=_,_.__name__="Fill";class n extends a.VisualUniforms{get doit(){const l=this.fill_color.value,t=this.fill_alpha.value;return!(0==l||0==t)}set_value(l){const t=this.fill_color.value,e=this.fill_alpha.value;l.fillStyle=c.color2css(t,e)}}e.FillScalar=n,n.__name__="FillScalar";class p extends a.VisualUniforms{get doit(){const{fill_color:l}=this;if(l.is_Scalar()&&0==l.value)return!1;const{fill_alpha:t}=this;return!t.is_Scalar()||0!=t.value}set_vectorize(l,t){const e=this.fill_color.get(t),i=this.fill_alpha.get(t);l.fillStyle=c.color2css(e,i)}}e.FillVector=p,p.__name__="FillVector",_.prototype.type="fill",_.prototype.attrs=Object.keys(r.Fill),n.prototype.type="fill",n.prototype.attrs=Object.keys(r.FillScalar),p.prototype.type="fill",p.prototype.attrs=Object.keys(r.FillVector)}, +function _(t,e,s,l,a){l();const o=t(1),_=t(47),i=o.__importStar(t(48)),n=t(22);class x extends _.VisualProperties{get doit(){const t=this.text_color.get_value(),e=this.text_alpha.get_value();return!(null==t||0==e)}set_value(t){const e=this.text_color.get_value(),s=this.text_alpha.get_value();t.fillStyle=n.color2css(e,s),t.font=this.font_value(),t.textAlign=this.text_align.get_value(),t.textBaseline=this.text_baseline.get_value()}font_value(){return`${this.text_font_style.get_value()} ${this.text_font_size.get_value()} ${this.text_font.get_value()}`}}s.Text=x,x.__name__="Text";class r extends _.VisualUniforms{get doit(){const t=this.text_color.value,e=this.text_alpha.value;return!(0==t||0==e)}set_value(t){const e=this.text_color.value,s=this.text_alpha.value,l=this.font_value(),a=this.text_align.value,o=this.text_baseline.value;t.fillStyle=n.color2css(e,s),t.font=l,t.textAlign=a,t.textBaseline=o}font_value(){return`${this.text_font_style.value} ${this.text_font_size.value} ${this.text_font.value}`}}s.TextScalar=r,r.__name__="TextScalar";class u extends _.VisualUniforms{get doit(){const{text_color:t}=this;if(t.is_Scalar()&&0==t.value)return!1;const{text_alpha:e}=this;return!e.is_Scalar()||0!=e.value}set_vectorize(t,e){const s=this.text_color.get(e),l=this.text_alpha.get(e),a=this.font_value(e),o=this.text_align.get(e),_=this.text_baseline.get(e);t.fillStyle=n.color2css(s,l),t.font=a,t.textAlign=o,t.textBaseline=_}font_value(t){return`${this.text_font_style.get(t)} ${this.text_font_size.get(t)} ${this.text_font.get(t)}`}}s.TextVector=u,u.__name__="TextVector",x.prototype.type="text",x.prototype.attrs=Object.keys(i.Text),r.prototype.type="text",r.prototype.attrs=Object.keys(i.TextScalar),u.prototype.type="text",u.prototype.attrs=Object.keys(i.TextVector)}, +function _(t,e,a,h,r){h();const i=t(1),s=t(47),c=t(52),n=i.__importStar(t(18)),_=i.__importStar(t(48));class l extends s.VisualProperties{constructor(){super(...arguments),this._update_iteration=0}update(){if(this._update_iteration++,this._hatch_image=null,!this.doit)return;const t=this.hatch_color.get_value(),e=this.hatch_alpha.get_value(),a=this.hatch_scale.get_value(),h=this.hatch_pattern.get_value(),r=this.hatch_weight.get_value(),i=t=>{this._hatch_image=t},s=this.hatch_extra.get_value()[h];if(null!=s){const h=s.get_pattern(t,e,a,r);if(h instanceof Promise){const{_update_iteration:t}=this;h.then((e=>{this._update_iteration==t&&(i(e),this.obj.request_render())}))}else i(h)}else{const s=this.obj.canvas.create_layer(),n=c.get_pattern(s,h,t,e,a,r);i(n)}}get doit(){const t=this.hatch_color.get_value(),e=this.hatch_alpha.get_value(),a=this.hatch_pattern.get_value();return!(null==t||0==e||" "==a||"blank"==a||null==a)}set_value(t){const e=this.pattern(t);t.fillStyle=null!=e?e:"transparent"}pattern(t){const e=this._hatch_image;return null==e?null:t.createPattern(e,this.repetition())}repetition(){const t=this.hatch_pattern.get_value(),e=this.hatch_extra.get_value()[t];if(null==e)return"repeat";switch(e.repetition){case"repeat":return"repeat";case"repeat_x":return"repeat-x";case"repeat_y":return"repeat-y";case"no_repeat":return"no-repeat"}}}a.Hatch=l,l.__name__="Hatch";class o extends s.VisualUniforms{constructor(){super(...arguments),this._static_doit=!1,this._update_iteration=0}_compute_static_doit(){const t=this.hatch_color.value,e=this.hatch_alpha.value,a=this.hatch_pattern.value;return!(null==t||0==e||" "==a||"blank"==a||null==a)}update(){this._update_iteration++;const t=this.hatch_color.length;if(this._hatch_image=new n.UniformScalar(null,t),this._static_doit=this._compute_static_doit(),!this._static_doit)return;const e=this.hatch_color.value,a=this.hatch_alpha.value,h=this.hatch_scale.value,r=this.hatch_pattern.value,i=this.hatch_weight.value,s=e=>{this._hatch_image=new n.UniformScalar(e,t)},_=this.hatch_extra.value[r];if(null!=_){const t=_.get_pattern(e,a,h,i);if(t instanceof Promise){const{_update_iteration:e}=this;t.then((t=>{this._update_iteration==e&&(s(t),this.obj.request_render())}))}else s(t)}else{const t=this.obj.canvas.create_layer(),n=c.get_pattern(t,r,e,a,h,i);s(n)}}get doit(){return this._static_doit}set_value(t){var e;t.fillStyle=null!==(e=this.pattern(t))&&void 0!==e?e:"transparent"}pattern(t){const e=this._hatch_image.value;return null==e?null:t.createPattern(e,this.repetition())}repetition(){const t=this.hatch_pattern.value,e=this.hatch_extra.value[t];if(null==e)return"repeat";switch(e.repetition){case"repeat":return"repeat";case"repeat_x":return"repeat-x";case"repeat_y":return"repeat-y";case"no_repeat":return"no-repeat"}}}a.HatchScalar=o,o.__name__="HatchScalar";class u extends s.VisualUniforms{constructor(){super(...arguments),this._static_doit=!1,this._update_iteration=0}_compute_static_doit(){const{hatch_color:t}=this;if(t.is_Scalar()&&0==t.value)return!1;const{hatch_alpha:e}=this;if(e.is_Scalar()&&0==e.value)return!1;const{hatch_pattern:a}=this;if(a.is_Scalar()){const t=a.value;if(" "==t||"blank"==t||null==t)return!1}return!0}update(){this._update_iteration++;const t=this.hatch_color.length;if(this._hatch_image=new n.UniformScalar(null,t),this._static_doit=this._compute_static_doit(),!this._static_doit)return;const e=(t,e,a,h,r,i)=>{const s=this.hatch_extra.value[t];if(null!=s){const t=s.get_pattern(e,a,h,r);if(t instanceof Promise){const{_update_iteration:e}=this;t.then((t=>{this._update_iteration==e&&(i(t),this.obj.request_render())}))}else i(t)}else{const s=this.obj.canvas.create_layer(),n=c.get_pattern(s,t,e,a,h,r);i(n)}};if(this.hatch_color.is_Scalar()&&this.hatch_alpha.is_Scalar()&&this.hatch_scale.is_Scalar()&&this.hatch_pattern.is_Scalar()&&this.hatch_weight.is_Scalar()){const a=this.hatch_color.value,h=this.hatch_alpha.value,r=this.hatch_scale.value;e(this.hatch_pattern.value,a,h,r,this.hatch_weight.value,(e=>{this._hatch_image=new n.UniformScalar(e,t)}))}else{const a=new Array(t);a.fill(null),this._hatch_image=new n.UniformVector(a);for(let h=0;h{a[h]=t}))}}}get doit(){return this._static_doit}set_vectorize(t,e){var a;t.fillStyle=null!==(a=this.pattern(t,e))&&void 0!==a?a:"transparent"}pattern(t,e){const a=this._hatch_image.get(e);return null==a?null:t.createPattern(a,this.repetition(e))}repetition(t){const e=this.hatch_pattern.get(t),a=this.hatch_extra.value[e];if(null==a)return"repeat";switch(a.repetition){case"repeat":return"repeat";case"repeat_x":return"repeat-x";case"repeat_y":return"repeat-y";case"no_repeat":return"no-repeat"}}}a.HatchVector=u,u.__name__="HatchVector",l.prototype.type="hatch",l.prototype.attrs=Object.keys(_.Hatch),o.prototype.type="hatch",o.prototype.attrs=Object.keys(_.HatchScalar),u.prototype.type="hatch",u.prototype.attrs=Object.keys(_.HatchVector)}, +function _(e,o,a,s,r){s();const i=e(22);function l(e,o,a){e.moveTo(0,a+.5),e.lineTo(o,a+.5),e.stroke()}function n(e,o,a){e.moveTo(a+.5,0),e.lineTo(a+.5,o),e.stroke()}function t(e,o){e.moveTo(0,o),e.lineTo(o,0),e.stroke(),e.moveTo(0,0),e.lineTo(o,o),e.stroke()}a.hatch_aliases={" ":"blank",".":"dot",o:"ring","-":"horizontal_line","|":"vertical_line","+":"cross",'"':"horizontal_dash",":":"vertical_dash","@":"spiral","/":"right_diagonal_line","\\":"left_diagonal_line",x:"diagonal_cross",",":"right_diagonal_dash","`":"left_diagonal_dash",v:"horizontal_wave",">":"vertical_wave","*":"criss_cross"},a.get_pattern=function(e,o,s,r,c,k){return e.resize(c,c),e.prepare(),function(e,o,s,r,c,k){var _;const T=c,v=T/2,h=v/2,d=i.color2css(s,r);switch(e.strokeStyle=d,e.fillStyle=d,e.lineCap="square",e.lineWidth=k,null!==(_=a.hatch_aliases[o])&&void 0!==_?_:o){case"blank":break;case"dot":e.arc(v,v,v/2,0,2*Math.PI,!0),e.fill();break;case"ring":e.arc(v,v,v/2,0,2*Math.PI,!0),e.stroke();break;case"horizontal_line":l(e,T,v);break;case"vertical_line":n(e,T,v);break;case"cross":l(e,T,v),n(e,T,v);break;case"horizontal_dash":l(e,v,v);break;case"vertical_dash":n(e,v,v);break;case"spiral":{const o=T/30;e.moveTo(v,v);for(let a=0;a<360;a++){const s=.1*a,r=v+o*s*Math.cos(s),i=v+o*s*Math.sin(s);e.lineTo(r,i)}e.stroke();break}case"right_diagonal_line":e.moveTo(.5-h,T),e.lineTo(h+.5,0),e.stroke(),e.moveTo(h+.5,T),e.lineTo(3*h+.5,0),e.stroke(),e.moveTo(3*h+.5,T),e.lineTo(5*h+.5,0),e.stroke(),e.stroke();break;case"left_diagonal_line":e.moveTo(h+.5,T),e.lineTo(.5-h,0),e.stroke(),e.moveTo(3*h+.5,T),e.lineTo(h+.5,0),e.stroke(),e.moveTo(5*h+.5,T),e.lineTo(3*h+.5,0),e.stroke(),e.stroke();break;case"diagonal_cross":t(e,T);break;case"right_diagonal_dash":e.moveTo(h+.5,3*h+.5),e.lineTo(3*h+.5,h+.5),e.stroke();break;case"left_diagonal_dash":e.moveTo(h+.5,h+.5),e.lineTo(3*h+.5,3*h+.5),e.stroke();break;case"horizontal_wave":e.moveTo(0,h),e.lineTo(v,3*h),e.lineTo(T,h),e.stroke();break;case"vertical_wave":e.moveTo(h,0),e.lineTo(3*h,v),e.lineTo(h,T),e.stroke();break;case"criss_cross":t(e,T),l(e,T,v),n(e,T,v)}}(e.ctx,o,s,r,c,k),e.canvas}}, +function _(e,t,s,n,c){n();const a=e(14),i=e(8),r=e(13),l=e(19);class o extends a.HasProps{constructor(e){super(e)}get is_syncable(){return this.syncable}static init_Model(){this.define((({Any:e,Unknown:t,Boolean:s,String:n,Array:c,Dict:a,Nullable:i})=>({tags:[c(t),[]],name:[i(n),null],js_property_callbacks:[a(c(e)),{}],js_event_callbacks:[a(c(e)),{}],subscribed_events:[c(n),[]],syncable:[s,!0]})))}initialize(){super.initialize(),this._js_callbacks=new Map}connect_signals(){super.connect_signals(),this._update_property_callbacks(),this.connect(this.properties.js_property_callbacks.change,(()=>this._update_property_callbacks())),this.connect(this.properties.js_event_callbacks.change,(()=>this._update_event_callbacks())),this.connect(this.properties.subscribed_events.change,(()=>this._update_event_callbacks()))}_process_event(e){var t;for(const s of null!==(t=this.js_event_callbacks[e.event_name])&&void 0!==t?t:[])s.execute(e);null!=this.document&&this.subscribed_events.some((t=>t==e.event_name))&&this.document.event_manager.send_event(e)}trigger_event(e){null!=this.document&&(e.origin=this,this.document.event_manager.trigger(e))}_update_event_callbacks(){null!=this.document?this.document.event_manager.subscribed_models.add(this):l.logger.warn("WARNING: Document not defined for updating event callbacks")}_update_property_callbacks(){const e=e=>{const[t,s=null]=e.split(":");return null!=s?this.properties[s][t]:this[t]};for(const[t,s]of this._js_callbacks){const n=e(t);for(const e of s)this.disconnect(n,e)}this._js_callbacks.clear();for(const[t,s]of r.entries(this.js_property_callbacks)){const n=s.map((e=>()=>e.execute(this)));this._js_callbacks.set(t,n);const c=e(t);for(const e of n)this.connect(c,e)}}_doc_attached(){r.isEmpty(this.js_event_callbacks)&&0==this.subscribed_events.length||this._update_event_callbacks()}_doc_detached(){this.document.event_manager.subscribed_models.delete(this)}select(e){if(i.isString(e))return[...this.references()].filter((t=>t instanceof o&&t.name===e));if(e.prototype instanceof a.HasProps)return[...this.references()].filter((t=>t instanceof e));throw new Error("invalid selector")}select_one(e){const t=this.select(e);switch(t.length){case 0:return null;case 1:return t[0];default:throw new Error("found more than one object matching given selector")}}}s.Model=o,o.__name__="Model",o.init_Model()}, +function _(s,e,_,t,a){t();class r{constructor(s,e){this.x_scale=s,this.y_scale=e,this.x_range=this.x_scale.source_range,this.y_range=this.y_scale.source_range,this.ranges=[this.x_range,this.y_range],this.scales=[this.x_scale,this.y_scale]}map_to_screen(s,e){return[this.x_scale.v_compute(s),this.y_scale.v_compute(e)]}map_from_screen(s,e){return[this.x_scale.v_invert(s),this.y_scale.v_invert(e)]}}_.CoordinateTransform=r,r.__name__="CoordinateTransform"}, +function _(t,e,s,a,i){a();const n=t(1),_=t(56),r=t(133),o=t(48),l=t(20),d=t(24),h=t(122),c=n.__importStar(t(18)),u=t(10);class v extends _.DataAnnotationView{async lazy_initialize(){await super.lazy_initialize();const{start:t,end:e}=this.model;null!=t&&(this.start=await h.build_view(t,{parent:this})),null!=e&&(this.end=await h.build_view(e,{parent:this}))}set_data(t){var e,s;super.set_data(t),null===(e=this.start)||void 0===e||e.set_data(t),null===(s=this.end)||void 0===s||s.set_data(t)}remove(){var t,e;null===(t=this.start)||void 0===t||t.remove(),null===(e=this.end)||void 0===e||e.remove(),super.remove()}map_data(){const{frame:t}=this.plot_view;"data"==this.model.start_units?(this._sx_start=this.coordinates.x_scale.v_compute(this._x_start),this._sy_start=this.coordinates.y_scale.v_compute(this._y_start)):(this._sx_start=t.bbox.xview.v_compute(this._x_start),this._sy_start=t.bbox.yview.v_compute(this._y_start)),"data"==this.model.end_units?(this._sx_end=this.coordinates.x_scale.v_compute(this._x_end),this._sy_end=this.coordinates.y_scale.v_compute(this._y_end)):(this._sx_end=t.bbox.xview.v_compute(this._x_end),this._sy_end=t.bbox.yview.v_compute(this._y_end));const{_sx_start:e,_sy_start:s,_sx_end:a,_sy_end:i}=this,n=e.length,_=this._angles=new d.ScreenArray(n);for(let t=0;t({x_start:[c.XCoordinateSpec,{field:"x_start"}],y_start:[c.YCoordinateSpec,{field:"y_start"}],start_units:[l.SpatialUnits,"data"],start:[e(t(r.ArrowHead)),null],x_end:[c.XCoordinateSpec,{field:"x_end"}],y_end:[c.YCoordinateSpec,{field:"y_end"}],end_units:[l.SpatialUnits,"data"],end:[e(t(r.ArrowHead)),()=>new r.OpenHead]})))}}s.Arrow=p,p.__name__="Arrow",p.init_Arrow()}, +function _(t,n,s,a,e){a();const i=t(1),o=t(40),c=t(57),_=t(130),r=t(65),l=i.__importStar(t(18));class h extends o.AnnotationView{constructor(){super(...arguments),this._initial_set_data=!1}connect_signals(){super.connect_signals();const t=()=>{this.set_data(this.model.source),this.request_render()};this.connect(this.model.change,t),this.connect(this.model.source.streaming,t),this.connect(this.model.source.patching,t),this.connect(this.model.source.change,t)}set_data(t){const n=this;for(const s of this.model)if(s instanceof l.VectorSpec||s instanceof l.ScalarSpec)if(s instanceof l.BaseCoordinateSpec){const a=s.array(t);n[`_${s.attr}`]=a}else{const a=s.uniform(t);n[`${s.attr}`]=a}this.plot_model.use_map&&(null!=n._x&&r.inplace.project_xy(n._x,n._y),null!=n._xs&&r.inplace.project_xsys(n._xs,n._ys));for(const t of this.visuals)t.update()}_render(){this._initial_set_data||(this.set_data(this.model.source),this._initial_set_data=!0),this.map_data(),this.paint(this.layer.ctx)}}s.DataAnnotationView=h,h.__name__="DataAnnotationView";class u extends o.Annotation{constructor(t){super(t)}static init_DataAnnotation(){this.define((({Ref:t})=>({source:[t(c.ColumnarDataSource),()=>new _.ColumnDataSource]})))}}s.DataAnnotation=u,u.__name__="DataAnnotation",u.init_DataAnnotation()}, +function _(t,e,n,a,i){a();const s=t(58),r=t(15),l=t(19),o=t(60),c=t(8),u=t(9),h=t(13),g=t(59),d=t(129),_=t(29);class m extends s.DataSource{constructor(t){super(t)}get_array(t){let e=this.data[t];return null==e?this.data[t]=e=[]:c.isArray(e)||(this.data[t]=e=Array.from(e)),e}static init_ColumnarDataSource(){this.define((({Ref:t})=>({selection_policy:[t(d.SelectionPolicy),()=>new d.UnionRenderers]}))),this.internal((({AnyRef:t})=>({selection_manager:[t(),t=>new o.SelectionManager({source:t})],inspected:[t(),()=>new g.Selection]})))}initialize(){super.initialize(),this._select=new r.Signal0(this,"select"),this.inspect=new r.Signal(this,"inspect"),this.streaming=new r.Signal0(this,"streaming"),this.patching=new r.Signal(this,"patching")}get_column(t){const e=this.data[t];return null!=e?e:null}columns(){return h.keys(this.data)}get_length(t=!0){const e=u.uniq(h.values(this.data).map((t=>_.is_NDArray(t)?t.shape[0]:t.length)));switch(e.length){case 0:return null;case 1:return e[0];default:{const n="data source has columns of inconsistent lengths";if(t)return l.logger.warn(n),e.sort()[0];throw new Error(n)}}}get length(){var t;return null!==(t=this.get_length())&&void 0!==t?t:0}clear(){const t={};for(const e of this.columns())t[e]=new this.data[e].constructor(0);this.data=t}}n.ColumnarDataSource=m,m.__name__="ColumnarDataSource",m.init_ColumnarDataSource()}, +function _(e,t,c,n,a){n();const o=e(53),i=e(59);class s extends o.Model{constructor(e){super(e)}static init_DataSource(){this.define((({Ref:e})=>({selected:[e(i.Selection),()=>new i.Selection]})))}}c.DataSource=s,s.__name__="DataSource",s.init_DataSource()}, +function _(i,e,s,t,n){t();const l=i(53),c=i(9),h=i(13);class d extends l.Model{constructor(i){super(i)}get_view(){return this.view}static init_Selection(){this.define((({Int:i,Array:e,Dict:s})=>({indices:[e(i),[]],line_indices:[e(i),[]],multiline_indices:[s(e(i)),{}]}))),this.internal((({Int:i,Array:e,AnyRef:s,Struct:t,Nullable:n})=>({selected_glyphs:[e(s()),[]],view:[n(s()),null],image_indices:[e(t({index:i,dim1:i,dim2:i,flat_index:i})),[]]})))}get selected_glyph(){return this.selected_glyphs.length>0?this.selected_glyphs[0]:null}add_to_selected_glyphs(i){this.selected_glyphs.push(i)}update(i,e=!0,s="replace"){switch(s){case"replace":this.indices=i.indices,this.line_indices=i.line_indices,this.selected_glyphs=i.selected_glyphs,this.view=i.view,this.multiline_indices=i.multiline_indices,this.image_indices=i.image_indices;break;case"append":this.update_through_union(i);break;case"intersect":this.update_through_intersection(i);break;case"subtract":this.update_through_subtraction(i)}}clear(){this.indices=[],this.line_indices=[],this.multiline_indices={},this.view=null,this.selected_glyphs=[]}is_empty(){return 0==this.indices.length&&0==this.line_indices.length&&0==this.image_indices.length}update_through_union(i){this.indices=c.union(this.indices,i.indices),this.selected_glyphs=c.union(i.selected_glyphs,this.selected_glyphs),this.line_indices=c.union(i.line_indices,this.line_indices),this.view=i.view,this.multiline_indices=h.merge(i.multiline_indices,this.multiline_indices)}update_through_intersection(i){this.indices=c.intersection(this.indices,i.indices),this.selected_glyphs=c.union(i.selected_glyphs,this.selected_glyphs),this.line_indices=c.union(i.line_indices,this.line_indices),this.view=i.view,this.multiline_indices=h.merge(i.multiline_indices,this.multiline_indices)}update_through_subtraction(i){this.indices=c.difference(this.indices,i.indices),this.selected_glyphs=c.union(i.selected_glyphs,this.selected_glyphs),this.line_indices=c.union(i.line_indices,this.line_indices),this.view=i.view,this.multiline_indices=h.merge(i.multiline_indices,this.multiline_indices)}}s.Selection=d,d.__name__="Selection",d.init_Selection()}, +function _(e,t,s,n,i){n();const o=e(14),c=e(59),r=e(61),l=e(123);class p extends o.HasProps{constructor(e){super(e),this.inspectors=new Map}static init_SelectionManager(){this.internal((({AnyRef:e})=>({source:[e()]})))}select(e,t,s,n="replace"){const i=[],o=[];for(const t of e)t instanceof r.GlyphRendererView?i.push(t):t instanceof l.GraphRendererView&&o.push(t);let c=!1;for(const e of o){const i=e.model.selection_policy.hit_test(t,e);c=c||e.model.selection_policy.do_selection(i,e.model,s,n)}if(i.length>0){const e=this.source.selection_policy.hit_test(t,i);c=c||this.source.selection_policy.do_selection(e,this.source,s,n)}return c}inspect(e,t){let s=!1;if(e instanceof r.GlyphRendererView){const n=e.hit_test(t);if(null!=n){s=!n.is_empty();const i=this.get_or_create_inspector(e.model);i.update(n,!0,"replace"),this.source.setv({inspected:i},{silent:!0}),this.source.inspect.emit([e.model,{geometry:t}])}}else if(e instanceof l.GraphRendererView){const n=e.model.inspection_policy.hit_test(t,e);s=s||e.model.inspection_policy.do_inspection(n,t,e,!1,"replace")}return s}clear(e){this.source.selected.clear(),null!=e&&this.get_or_create_inspector(e.model).clear()}get_or_create_inspector(e){let t=this.inspectors.get(e);return null==t&&(t=new c.Selection,this.inspectors.set(e,t)),t}}s.SelectionManager=p,p.__name__="SelectionManager",p.init_SelectionManager()}, +function _(e,t,i,s,l){s();const h=e(62),n=e(63),o=e(116),a=e(117),c=e(119),d=e(98),_=e(57),r=e(120),p=e(24),g=e(12),u=e(9),y=e(13),m=e(122),v=e(104),f={fill:{},line:{}},w={fill:{fill_alpha:.3,fill_color:"grey"},line:{line_alpha:.3,line_color:"grey"}},b={fill:{fill_alpha:.2},line:{}};class V extends h.DataRendererView{get glyph_view(){return this.glyph}async lazy_initialize(){var e,t;await super.lazy_initialize();const i=this.model.glyph;this.glyph=await this.build_glyph_view(i);const s="fill"in this.glyph.visuals,l="line"in this.glyph.visuals,h=Object.assign({},i.attributes);function n(e){const t=y.clone(h);return s&&y.extend(t,e.fill),l&&y.extend(t,e.line),new i.constructor(t)}delete h.id;let{selection_glyph:o}=this.model;null==o?o=n({fill:{},line:{}}):"auto"==o&&(o=n(f)),this.selection_glyph=await this.build_glyph_view(o);let{nonselection_glyph:a}=this.model;null==a?a=n({fill:{},line:{}}):"auto"==a&&(a=n(b)),this.nonselection_glyph=await this.build_glyph_view(a);const{hover_glyph:c}=this.model;null!=c&&(this.hover_glyph=await this.build_glyph_view(c));const{muted_glyph:d}=this.model;null!=d&&(this.muted_glyph=await this.build_glyph_view(d));const _=n(w);this.decimated_glyph=await this.build_glyph_view(_),this.selection_glyph.set_base(this.glyph),this.nonselection_glyph.set_base(this.glyph),null===(e=this.hover_glyph)||void 0===e||e.set_base(this.glyph),null===(t=this.muted_glyph)||void 0===t||t.set_base(this.glyph),this.decimated_glyph.set_base(this.glyph),this.set_data()}async build_glyph_view(e){return m.build_view(e,{parent:this})}remove(){var e,t;this.glyph.remove(),this.selection_glyph.remove(),this.nonselection_glyph.remove(),null===(e=this.hover_glyph)||void 0===e||e.remove(),null===(t=this.muted_glyph)||void 0===t||t.remove(),this.decimated_glyph.remove(),super.remove()}connect_signals(){super.connect_signals();const e=()=>this.request_render(),t=()=>this.update_data();this.connect(this.model.change,e),this.connect(this.glyph.model.change,t),this.connect(this.selection_glyph.model.change,t),this.connect(this.nonselection_glyph.model.change,t),null!=this.hover_glyph&&this.connect(this.hover_glyph.model.change,t),null!=this.muted_glyph&&this.connect(this.muted_glyph.model.change,t),this.connect(this.decimated_glyph.model.change,t),this.connect(this.model.data_source.change,t),this.connect(this.model.data_source.streaming,t),this.connect(this.model.data_source.patching,(e=>this.update_data(e))),this.connect(this.model.data_source.selected.change,e),this.connect(this.model.data_source._select,e),null!=this.hover_glyph&&this.connect(this.model.data_source.inspect,e),this.connect(this.model.properties.view.change,t),this.connect(this.model.view.properties.indices.change,t),this.connect(this.model.view.properties.masked.change,(()=>this.set_visuals())),this.connect(this.model.properties.visible.change,(()=>this.plot_view.invalidate_dataranges=!0));const{x_ranges:i,y_ranges:s}=this.plot_view.frame;for(const[,e]of i)e instanceof v.FactorRange&&this.connect(e.change,t);for(const[,e]of s)e instanceof v.FactorRange&&this.connect(e.change,t);const{transformchange:l,exprchange:h}=this.model.glyph;this.connect(l,t),this.connect(h,t)}_update_masked_indices(){const e=this.glyph.mask_data();return this.model.view.masked=e,e}update_data(e){this.set_data(e),this.request_render()}set_data(e){const t=this.model.data_source;this.all_indices=this.model.view.indices;const{all_indices:i}=this;this.glyph.set_data(t,i,e),this.set_visuals(),this._update_masked_indices();const{lod_factor:s}=this.plot_model,l=this.all_indices.count;this.decimated=new p.Indices(l);for(let e=0;e!d||d.is_empty()?[]:d.selected_glyph?this.model.view.convert_indices_from_subset(i):d.indices.length>0?d.indices:Object.keys(d.multiline_indices).map((e=>parseInt(e))))()),r=g.filter(i,(e=>_.has(t[e]))),{lod_threshold:p}=this.plot_model;let y,m,v;if(null!=this.model.document&&this.model.document.interactive_duration()>0&&!e&&null!=p&&t.length>p?(i=[...this.decimated],y=this.decimated_glyph,m=this.decimated_glyph,v=this.selection_glyph):(y=this.model.muted&&null!=this.muted_glyph?this.muted_glyph:this.glyph,m=this.nonselection_glyph,v=this.selection_glyph),null!=this.hover_glyph&&r.length&&(i=u.difference(i,r)),h.length){const e={};for(const t of h)e[t]=!0;const l=new Array,o=new Array;if(this.glyph instanceof n.LineView)for(const i of t)null!=e[i]?l.push(i):o.push(i);else for(const s of i)null!=e[t[s]]?l.push(s):o.push(s);m.render(s,o),v.render(s,l),null!=this.hover_glyph&&(this.glyph instanceof n.LineView?this.hover_glyph.render(s,this.model.view.convert_indices_from_subset(r)):this.hover_glyph.render(s,r))}else if(this.glyph instanceof n.LineView)this.hover_glyph&&r.length?this.hover_glyph.render(s,this.model.view.convert_indices_from_subset(r)):y.render(s,t);else if(this.glyph instanceof o.PatchView||this.glyph instanceof a.HAreaView||this.glyph instanceof c.VAreaView)if(0==d.selected_glyphs.length||null==this.hover_glyph)y.render(s,t);else for(const e of d.selected_glyphs)e==this.glyph.model&&this.hover_glyph.render(s,t);else y.render(s,i),this.hover_glyph&&r.length&&this.hover_glyph.render(s,r);s.restore()}draw_legend(e,t,i,s,l,h,n,o){0!=this.glyph.data_size&&(null==o&&(o=this.model.get_reference_point(h,n)),this.glyph.draw_legend_for_index(e,{x0:t,x1:i,y0:s,y1:l},o))}hit_test(e){if(!this.model.visible)return null;const t=this.glyph.hit_test(e);return null==t?null:this.model.view.convert_selection_from_subset(t)}}i.GlyphRendererView=V,V.__name__="GlyphRendererView";class G extends h.DataRenderer{constructor(e){super(e)}static init_GlyphRenderer(){this.prototype.default_view=V,this.define((({Boolean:e,Auto:t,Or:i,Ref:s,Null:l,Nullable:h})=>({data_source:[s(_.ColumnarDataSource)],view:[s(r.CDSView),e=>new r.CDSView({source:e.data_source})],glyph:[s(d.Glyph)],hover_glyph:[h(s(d.Glyph)),null],nonselection_glyph:[i(s(d.Glyph),t,l),"auto"],selection_glyph:[i(s(d.Glyph),t,l),"auto"],muted_glyph:[h(s(d.Glyph)),null],muted:[e,!1]})))}initialize(){super.initialize(),this.view.source!=this.data_source&&(this.view.source=this.data_source,this.view.compute_indices())}get_reference_point(e,t){if(null!=e){const i=this.data_source.get_column(e);if(null!=i)for(const[e,s]of Object.entries(this.view.indices_map))if(i[parseInt(e)]==t)return s}return 0}get_selection_manager(){return this.data_source.selection_manager}}i.GlyphRenderer=G,G.__name__="GlyphRenderer",G.init_GlyphRenderer()}, +function _(e,r,t,a,n){a();const s=e(41);class i extends s.RendererView{get xscale(){return this.coordinates.x_scale}get yscale(){return this.coordinates.y_scale}}t.DataRendererView=i,i.__name__="DataRendererView";class _ extends s.Renderer{constructor(e){super(e)}static init_DataRenderer(){this.override({level:"glyph"})}get selection_manager(){return this.get_selection_manager()}}t.DataRenderer=_,_.__name__="DataRenderer",_.init_DataRenderer()}, +function _(e,i,t,s,n){s();const l=e(1),_=e(64),r=e(106),h=e(108),o=l.__importStar(e(48)),a=l.__importStar(e(107)),c=e(59);class d extends _.XYGlyphView{initialize(){super.initialize();const{webgl:e}=this.renderer.plot_view.canvas_view;null!=e&&(this.glglyph=new h.LineGL(e.gl,this))}_render(e,i,t){const{sx:s,sy:n}=null!=t?t:this;let l=!0;e.beginPath();for(const t of i){const i=s[t],_=n[t];isFinite(i+_)?l?(e.moveTo(i,_),l=!1):e.lineTo(i,_):l=!0}this.visuals.line.set_value(e),e.stroke()}_hit_point(e){const i=new c.Selection,t={x:e.sx,y:e.sy};let s=9999;const n=Math.max(2,this.line_width.value/2);for(let e=0,l=this.sx.length-1;e({x:[p.XCoordinateSpec,{field:"x"}],y:[p.YCoordinateSpec,{field:"y"}]})))}}i.XYGlyph=d,d.__name__="XYGlyph",d.init_XYGlyph()}, +function _(n,t,e,o,r){o();const c=n(1),l=c.__importDefault(n(66)),i=c.__importDefault(n(67)),u=n(24),a=new i.default("GOOGLE"),s=new i.default("WGS84"),f=l.default(s,a);e.wgs84_mercator={compute:(n,t)=>isFinite(n)&&isFinite(t)?f.forward([n,t]):[NaN,NaN],invert:(n,t)=>isFinite(n)&&isFinite(t)?f.inverse([n,t]):[NaN,NaN]};const _={lon:[-20026376.39,20026376.39],lat:[-20048966.1,20048966.1]},p={lon:[-180,180],lat:[-85.06,85.06]},{min:g,max:h}=Math;function m(n,t){const o=g(n.length,t.length),r=u.infer_type(n,t),c=new r(o),l=new r(o);return e.inplace.project_xy(n,t,c,l),[c,l]}e.clip_mercator=function(n,t,e){const[o,r]=_[e];return[h(n,o),g(t,r)]},e.in_bounds=function(n,t){const[e,o]=p[t];return e2?void 0!==e.name&&"geocent"===e.name||void 0!==n.name&&"geocent"===n.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(t.splice(3)):[r.x,r.y,t[2]].concat(t.splice(3)):[r.x,r.y].concat(t.splice(2)):[r.x,r.y]):(o=c.default(e,n,t),2===(a=Object.keys(t)).length||a.forEach((function(r){if(void 0!==e.name&&"geocent"===e.name||void 0!==n.name&&"geocent"===n.name){if("x"===r||"y"===r||"z"===r)return}else if("x"===r||"y"===r)return;o[r]=t[r]})),o)}function l(e){return e instanceof i.default?e:e.oProj?e.oProj:i.default(e)}t.default=function(e,n,t){e=l(e);var r,o=!1;return void 0===n?(n=e,e=u,o=!0):(void 0!==n.x||Array.isArray(n))&&(t=n,n=e,e=u,o=!0),n=l(n),t?f(e,n,t):(r={forward:function(t){return f(e,n,t)},inverse:function(t){return f(n,e,t)}},o&&(r.oProj=n),r)}}, +function _(t,e,a,s,i){s();const u=t(1),l=u.__importDefault(t(68)),o=u.__importDefault(t(79)),r=u.__importDefault(t(80)),f=t(88),p=u.__importDefault(t(90)),d=u.__importDefault(t(91)),m=u.__importDefault(t(75));function n(t,e){if(!(this instanceof n))return new n(t);e=e||function(t){if(t)throw t};var a=l.default(t);if("object"==typeof a){var s=n.projections.get(a.projName);if(s){if(a.datumCode&&"none"!==a.datumCode){var i=m.default(p.default,a.datumCode);i&&(a.datum_params=i.towgs84?i.towgs84.split(","):null,a.ellps=i.ellipse,a.datumName=i.datumName?i.datumName:a.datumCode)}a.k0=a.k0||1,a.axis=a.axis||"enu",a.ellps=a.ellps||"wgs84";var u=f.sphere(a.a,a.b,a.rf,a.ellps,a.sphere),r=f.eccentricity(u.a,u.b,u.rf,a.R_A),h=a.datum||d.default(a.datumCode,a.datum_params,u.a,u.b,r.es,r.ep2);o.default(this,a),o.default(this,s),this.a=u.a,this.b=u.b,this.rf=u.rf,this.sphere=u.sphere,this.es=r.es,this.e=r.e,this.ep2=r.ep2,this.datum=h,this.init(),e(null,this)}else e(t)}else e(t)}n.projections=r.default,n.projections.start(),a.default=n}, +function _(t,r,n,u,e){u();const f=t(1),i=f.__importDefault(t(69)),a=f.__importDefault(t(76)),o=f.__importDefault(t(71)),l=f.__importDefault(t(75));var C=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var d=["3857","900913","3785","102113"];n.default=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in i.default}(t))return i.default[t];if(function(t){return C.some((function(r){return t.indexOf(r)>-1}))}(t)){var r=a.default(t);if(function(t){var r=l.default(t,"authority");if(r){var n=l.default(r,"epsg");return n&&d.indexOf(n)>-1}}(r))return i.default["EPSG:3857"];var n=function(t){var r=l.default(t,"extension");if(r)return l.default(r,"proj4")}(r);return n?o.default(n):r}return function(t){return"+"===t[0]}(t)?o.default(t):void 0}}, +function _(t,r,i,e,n){e();const f=t(1),a=f.__importDefault(t(70)),l=f.__importDefault(t(71)),u=f.__importDefault(t(76));function o(t){var r=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?o[t]=l.default(arguments[1]):o[t]=u.default(arguments[1]):o[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?o.apply(r,t):o(t)}));if("string"==typeof t){if(t in o)return o[t]}else"EPSG"in t?o["EPSG:"+t.EPSG]=t:"ESRI"in t?o["ESRI:"+t.ESRI]=t:"IAU2000"in t?o["IAU2000:"+t.IAU2000]=t:console.log(t);return}}a.default(o),i.default=o}, +function _(t,l,G,S,e){S(),G.default=function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}}, +function _(t,n,o,a,u){a();const e=t(1),r=t(72),i=e.__importDefault(t(73)),f=e.__importDefault(t(74)),l=e.__importDefault(t(75));o.default=function(t){var n,o,a,u={},e=t.split("+").map((function(t){return t.trim()})).filter((function(t){return t})).reduce((function(t,n){var o=n.split("=");return o.push(!0),t[o[0].toLowerCase()]=o[1],t}),{}),c={proj:"projName",datum:"datumCode",rf:function(t){u.rf=parseFloat(t)},lat_0:function(t){u.lat0=t*r.D2R},lat_1:function(t){u.lat1=t*r.D2R},lat_2:function(t){u.lat2=t*r.D2R},lat_ts:function(t){u.lat_ts=t*r.D2R},lon_0:function(t){u.long0=t*r.D2R},lon_1:function(t){u.long1=t*r.D2R},lon_2:function(t){u.long2=t*r.D2R},alpha:function(t){u.alpha=parseFloat(t)*r.D2R},lonc:function(t){u.longc=t*r.D2R},x_0:function(t){u.x0=parseFloat(t)},y_0:function(t){u.y0=parseFloat(t)},k_0:function(t){u.k0=parseFloat(t)},k:function(t){u.k0=parseFloat(t)},a:function(t){u.a=parseFloat(t)},b:function(t){u.b=parseFloat(t)},r_a:function(){u.R_A=!0},zone:function(t){u.zone=parseInt(t,10)},south:function(){u.utmSouth=!0},towgs84:function(t){u.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){u.to_meter=parseFloat(t)},units:function(t){u.units=t;var n=l.default(f.default,t);n&&(u.to_meter=n.to_meter)},from_greenwich:function(t){u.from_greenwich=t*r.D2R},pm:function(t){var n=l.default(i.default,t);u.from_greenwich=(n||parseFloat(t))*r.D2R},nadgrids:function(t){"@null"===t?u.datumCode="none":u.nadgrids=t},axis:function(t){var n="ewnsud";3===t.length&&-1!==n.indexOf(t.substr(0,1))&&-1!==n.indexOf(t.substr(1,1))&&-1!==n.indexOf(t.substr(2,1))&&(u.axis=t)}};for(n in e)o=e[n],n in c?"function"==typeof(a=c[n])?a(o):u[a]=o:u[n]=o;return"string"==typeof u.datumCode&&"WGS84"!==u.datumCode&&(u.datumCode=u.datumCode.toLowerCase()),u}}, +function _(P,A,_,D,I){D(),_.PJD_3PARAM=1,_.PJD_7PARAM=2,_.PJD_WGS84=4,_.PJD_NODATUM=5,_.SEC_TO_RAD=484813681109536e-20,_.HALF_PI=Math.PI/2,_.SIXTH=.16666666666666666,_.RA4=.04722222222222222,_.RA6=.022156084656084655,_.EPSLN=1e-10,_.D2R=.017453292519943295,_.R2D=57.29577951308232,_.FORTPI=Math.PI/4,_.TWO_PI=2*Math.PI,_.SPI=3.14159265359}, +function _(o,r,a,e,s){e();var n={};a.default=n,n.greenwich=0,n.lisbon=-9.131906111111,n.paris=2.337229166667,n.bogota=-74.080916666667,n.madrid=-3.687938888889,n.rome=12.452333333333,n.bern=7.439583333333,n.jakarta=106.807719444444,n.ferro=-17.666666666667,n.brussels=4.367975,n.stockholm=18.058277777778,n.athens=23.7163375,n.oslo=10.722916666667}, +function _(t,e,f,o,u){o(),f.default={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}}}, +function _(e,r,t,a,n){a();var o=/[\s_\-\/\(\)]/g;t.default=function(e,r){if(e[r])return e[r];for(var t,a=Object.keys(e),n=r.toLowerCase().replace(o,""),f=-1;++f0?90:-90),e.lat_ts=e.lat1)}(d),d}}, +function _(t,e,r,i,s){i(),r.default=function(t){return new d(t).output()};var h=/\s/,o=/[A-Za-z]/,n=/[A-Za-z84]/,a=/[,\]]/,u=/[\d\.E\-\+]/;function d(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}d.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;h.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},d.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(a.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},d.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},d.prototype.number=function(t){if(!u.test(t)){if(a.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},d.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},d.prototype.keyword=function(t){if(n.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!a.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},d.prototype.neutral=function(t){if(o.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(u.test(t))return this.word=t,void(this.state=3);if(!a.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},d.prototype.output=function(){for(;this.place90&&a*o.R2D<-90&&h*o.R2D>180&&h*o.R2D<-180)return null;if(Math.abs(Math.abs(a)-o.HALF_PI)<=o.EPSLN)return null;if(this.sphere)i=this.x0+this.a*this.k0*n.default(h-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(o.FORTPI+.5*a));else{var e=Math.sin(a),r=l.default(this.e,a,e);i=this.x0+this.a*this.k0*n.default(h-this.long0),s=this.y0-this.a*this.k0*Math.log(r)}return t.x=i,t.y=s,t}function M(t){var i,s,h=t.x-this.x0,a=t.y-this.y0;if(this.sphere)s=o.HALF_PI-2*Math.atan(Math.exp(-a/(this.a*this.k0)));else{var e=Math.exp(-a/(this.a*this.k0));if(-9999===(s=u.default(this.e,e)))return null}return i=n.default(this.long0+h/(this.a*this.k0)),t.x=i,t.y=s,t}s.init=f,s.forward=_,s.inverse=M,s.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],s.default={init:f,forward:_,inverse:M,names:s.names}}, +function _(t,n,r,u,a){u(),r.default=function(t,n,r){var u=t*n;return r/Math.sqrt(1-u*u)}}, +function _(t,n,u,a,f){a();const e=t(1),o=t(72),_=e.__importDefault(t(84));u.default=function(t){return Math.abs(t)<=o.SPI?t:t-_.default(t)*o.TWO_PI}}, +function _(n,t,u,f,c){f(),u.default=function(n){return n<0?-1:1}}, +function _(t,n,a,o,u){o();const c=t(72);a.default=function(t,n,a){var o=t*a,u=.5*t;return o=Math.pow((1-o)/(1+o),u),Math.tan(.5*(c.HALF_PI-n))/o}}, +function _(t,a,n,r,f){r();const h=t(72);n.default=function(t,a){for(var n,r,f=.5*t,o=h.HALF_PI-2*Math.atan(a),u=0;u<=15;u++)if(n=t*Math.sin(o),o+=r=h.HALF_PI-2*Math.atan(a*Math.pow((1-n)/(1+n),f))-o,Math.abs(r)<=1e-10)return o;return-9999}}, +function _(n,i,e,t,r){function a(){}function f(n){return n}t(),e.init=a,e.forward=f,e.inverse=f,e.names=["longlat","identity"],e.default={init:a,forward:f,inverse:f,names:e.names}}, +function _(t,r,e,a,n){a();const f=t(1),i=t(72),u=f.__importStar(t(89)),c=f.__importDefault(t(75));e.eccentricity=function(t,r,e,a){var n=t*t,f=r*r,u=(n-f)/n,c=0;return a?(n=(t*=1-u*(i.SIXTH+u*(i.RA4+u*i.RA6)))*t,u=0):c=Math.sqrt(u),{es:u,e:c,ep2:(n-f)/f}},e.sphere=function(t,r,e,a,n){if(!t){var f=c.default(u.default,a);f||(f=u.WGS84),t=f.a,r=f.b,e=f.rf}return e&&!r&&(r=(1-1/e)*t),(0===e||Math.abs(t-r)3&&(0===r.datum_params[3]&&0===r.datum_params[4]&&0===r.datum_params[5]&&0===r.datum_params[6]||(r.datum_type=p.PJD_7PARAM,r.datum_params[3]*=p.SEC_TO_RAD,r.datum_params[4]*=p.SEC_TO_RAD,r.datum_params[5]*=p.SEC_TO_RAD,r.datum_params[6]=r.datum_params[6]/1e6+1))),r.a=_,r.b=t,r.es=u,r.ep2=d,r}}, +function _(t,e,a,r,u){r();const m=t(1),_=t(72),o=m.__importDefault(t(93)),d=m.__importDefault(t(95)),f=m.__importDefault(t(67)),n=m.__importDefault(t(96)),i=m.__importDefault(t(97));a.default=function t(e,a,r){var u;if(Array.isArray(r)&&(r=n.default(r)),i.default(r),e.datum&&a.datum&&function(t,e){return(t.datum.datum_type===_.PJD_3PARAM||t.datum.datum_type===_.PJD_7PARAM)&&"WGS84"!==e.datumCode||(e.datum.datum_type===_.PJD_3PARAM||e.datum.datum_type===_.PJD_7PARAM)&&"WGS84"!==t.datumCode}(e,a)&&(r=t(e,u=new f.default("WGS84"),r),e=u),"enu"!==e.axis&&(r=d.default(e,!1,r)),"longlat"===e.projName)r={x:r.x*_.D2R,y:r.y*_.D2R,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),!(r=e.inverse(r)))return;return e.from_greenwich&&(r.x+=e.from_greenwich),r=o.default(e.datum,a.datum,r),a.from_greenwich&&(r={x:r.x-a.from_greenwich,y:r.y,z:r.z||0}),"longlat"===a.projName?r={x:r.x*_.R2D,y:r.y*_.R2D,z:r.z||0}:(r=a.forward(r),a.to_meter&&(r={x:r.x/a.to_meter,y:r.y/a.to_meter,z:r.z||0})),"enu"!==a.axis?d.default(a,!0,r):r}}, +function _(t,e,a,u,c){u();const m=t(72),o=t(94);function _(t){return t===m.PJD_3PARAM||t===m.PJD_7PARAM}a.default=function(t,e,a){return o.compareDatums(t,e)||t.datum_type===m.PJD_NODATUM||e.datum_type===m.PJD_NODATUM?a:t.es!==e.es||t.a!==e.a||_(t.datum_type)||_(e.datum_type)?(a=o.geodeticToGeocentric(a,t.es,t.a),_(t.datum_type)&&(a=o.geocentricToWgs84(a,t.datum_type,t.datum_params)),_(e.datum_type)&&(a=o.geocentricFromWgs84(a,e.datum_type,e.datum_params)),o.geocentricToGeodetic(a,e.es,e.a,e.b)):a}}, +function _(a,t,r,m,s){m();const u=a(72);r.compareDatums=function(a,t){return a.datum_type===t.datum_type&&(!(a.a!==t.a||Math.abs(a.es-t.es)>5e-11)&&(a.datum_type===u.PJD_3PARAM?a.datum_params[0]===t.datum_params[0]&&a.datum_params[1]===t.datum_params[1]&&a.datum_params[2]===t.datum_params[2]:a.datum_type!==u.PJD_7PARAM||a.datum_params[0]===t.datum_params[0]&&a.datum_params[1]===t.datum_params[1]&&a.datum_params[2]===t.datum_params[2]&&a.datum_params[3]===t.datum_params[3]&&a.datum_params[4]===t.datum_params[4]&&a.datum_params[5]===t.datum_params[5]&&a.datum_params[6]===t.datum_params[6]))},r.geodeticToGeocentric=function(a,t,r){var m,s,_,e,n=a.x,d=a.y,i=a.z?a.z:0;if(d<-u.HALF_PI&&d>-1.001*u.HALF_PI)d=-u.HALF_PI;else if(d>u.HALF_PI&&d<1.001*u.HALF_PI)d=u.HALF_PI;else{if(d<-u.HALF_PI)return{x:-1/0,y:-1/0,z:a.z};if(d>u.HALF_PI)return{x:1/0,y:1/0,z:a.z}}return n>Math.PI&&(n-=2*Math.PI),s=Math.sin(d),e=Math.cos(d),_=s*s,{x:((m=r/Math.sqrt(1-t*_))+i)*e*Math.cos(n),y:(m+i)*e*Math.sin(n),z:(m*(1-t)+i)*s}},r.geocentricToGeodetic=function(a,t,r,m){var s,_,e,n,d,i,p,P,y,z,M,o,A,c,x,h=1e-12,f=a.x,I=a.y,F=a.z?a.z:0;if(s=Math.sqrt(f*f+I*I),_=Math.sqrt(f*f+I*I+F*F),s/r1e-24&&A<30);return{x:c,y:Math.atan(M/Math.abs(z)),z:x}},r.geocentricToWgs84=function(a,t,r){if(t===u.PJD_3PARAM)return{x:a.x+r[0],y:a.y+r[1],z:a.z+r[2]};if(t===u.PJD_7PARAM){var m=r[0],s=r[1],_=r[2],e=r[3],n=r[4],d=r[5],i=r[6];return{x:i*(a.x-d*a.y+n*a.z)+m,y:i*(d*a.x+a.y-e*a.z)+s,z:i*(-n*a.x+e*a.y+a.z)+_}}},r.geocentricFromWgs84=function(a,t,r){if(t===u.PJD_3PARAM)return{x:a.x-r[0],y:a.y-r[1],z:a.z-r[2]};if(t===u.PJD_7PARAM){var m=r[0],s=r[1],_=r[2],e=r[3],n=r[4],d=r[5],i=r[6],p=(a.x-m)/i,P=(a.y-s)/i,y=(a.z-_)/i;return{x:p+d*P-n*y,y:-d*p+P+e*y,z:n*p-e*P+y}}}}, +function _(e,a,i,r,s){r(),i.default=function(e,a,i){var r,s,n,c=i.x,d=i.y,f=i.z||0,u={};for(n=0;n<3;n++)if(!a||2!==n||void 0!==i.z)switch(0===n?(r=c,s=-1!=="ew".indexOf(e.axis[n])?"x":"y"):1===n?(r=d,s=-1!=="ns".indexOf(e.axis[n])?"y":"x"):(r=f,s="z"),e.axis[n]){case"e":u[s]=r;break;case"w":u[s]=-r;break;case"n":u[s]=r;break;case"s":u[s]=-r;break;case"u":void 0!==i[s]&&(u.z=r);break;case"d":void 0!==i[s]&&(u.z=-r);break;default:return null}return u}}, +function _(n,t,e,u,f){u(),e.default=function(n){var t={x:n[0],y:n[1]};return n.length>2&&(t.z=n[2]),n.length>3&&(t.m=n[3]),t}}, +function _(e,i,n,t,r){function o(e){if("function"==typeof Number.isFinite){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof e||e!=e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}t(),n.default=function(e){o(e.x),o(e.y)}}, +function _(e,t,s,i,n){i();const r=e(1),a=r.__importStar(e(18)),o=r.__importStar(e(99)),_=r.__importStar(e(45)),l=e(42),c=e(53),h=e(19),d=e(24),u=e(8),f=e(100),p=e(12),g=e(26),y=e(101),x=e(104),v=e(59),{abs:b,ceil:m}=Math;class w extends l.View{constructor(){super(...arguments),this._index=null,this._data_size=null,this._nohit_warned=new Set}get renderer(){return this.parent}get has_webgl(){return null!=this.glglyph}get index(){const{_index:e}=this;if(null!=e)return e;throw new Error(`${this}.index_data() wasn't called`)}get data_size(){const{_data_size:e}=this;if(null!=e)return e;throw new Error(`${this}.set_data() wasn't called`)}initialize(){super.initialize(),this.visuals=new _.Visuals(this)}request_render(){this.parent.request_render()}get canvas(){return this.renderer.parent.canvas_view}render(e,t,s){var i;null!=this.glglyph&&(this.renderer.needs_webgl_blit=this.glglyph.render(e,t,null!==(i=this.base)&&void 0!==i?i:this),this.renderer.needs_webgl_blit)||(e.beginPath(),this._render(e,t,null!=s?s:this.base))}has_finished(){return!0}notify_finished(){this.renderer.notify_finished()}_bounds(e){return e}bounds(){return this._bounds(this.index.bbox)}log_bounds(){const{x0:e,x1:t}=this.index.bounds(o.positive_x()),{y0:s,y1:i}=this.index.bounds(o.positive_y());return this._bounds({x0:e,y0:s,x1:t,y1:i})}get_anchor_point(e,t,[s,i]){switch(e){case"center":case"center_center":{const[e,n]=this.scenterxy(t,s,i);return{x:e,y:n}}default:return null}}scenterx(e,t,s){return this.scenterxy(e,t,s)[0]}scentery(e,t,s){return this.scenterxy(e,t,s)[1]}sdist(e,t,s,i="edge",n=!1){const r=t.length,a=new d.ScreenArray(r),o=e.s_compute;if("center"==i)for(let e=0;em(e))),a}draw_legend_for_index(e,t,s){}hit_test(e){switch(e.type){case"point":if(null!=this._hit_point)return this._hit_point(e);break;case"span":if(null!=this._hit_span)return this._hit_span(e);break;case"rect":if(null!=this._hit_rect)return this._hit_rect(e);break;case"poly":if(null!=this._hit_poly)return this._hit_poly(e)}return this._nohit_warned.has(e.type)||(h.logger.debug(`'${e.type}' selection not available for ${this.model.type}`),this._nohit_warned.add(e.type)),null}_hit_rect_against_index(e){const{sx0:t,sx1:s,sy0:i,sy1:n}=e,[r,a]=this.renderer.coordinates.x_scale.r_invert(t,s),[o,_]=this.renderer.coordinates.y_scale.r_invert(i,n),l=[...this.index.indices({x0:r,x1:a,y0:o,y1:_})];return new v.Selection({indices:l})}_project_data(){}*_iter_visuals(){for(const e of this.visuals)for(const t of e)(t instanceof a.VectorSpec||t instanceof a.ScalarSpec)&&(yield t)}set_base(e){e!=this&&e instanceof this.constructor&&(this.base=e)}_configure(e,t){Object.defineProperty(this,u.isString(e)?e:e.attr,Object.assign({configurable:!0,enumerable:!0},t))}set_visuals(e,t){var s;for(const s of this._iter_visuals()){const{base:i}=this;if(null!=i){const e=i.model.properties[s.attr];if(null!=e&&g.is_equal(s.get_value(),e.get_value())){this._configure(s,{get:()=>i[`${s.attr}`]});continue}}const n=s.uniform(e).select(t);this._configure(s,{value:n})}for(const e of this.visuals)e.update();null===(s=this.glglyph)||void 0===s||s.set_visuals_changed()}set_data(e,t,s){var i;const{x_range:n,y_range:r}=this.renderer.coordinates,o=new Set(this._iter_visuals());this._data_size=t.count;for(const s of this.model)if((s instanceof a.VectorSpec||s instanceof a.ScalarSpec)&&!o.has(s))if(s instanceof a.BaseCoordinateSpec){const i=s.array(e);let o=t.select(i);const _="x"==s.dimension?n:r;if(_ instanceof x.FactorRange)if(s instanceof a.CoordinateSpec)o=_.v_synthetic(o);else if(s instanceof a.CoordinateSeqSpec)for(let e=0;e=0&&r>=0))throw new Error(`invalid bbox {x: ${i}, y: ${e}, width: ${h}, height: ${r}}`);this.x0=i,this.y0=e,this.x1=i+h,this.y1=e+r}else{let i,e,h,r;if("width"in t)if("left"in t)i=t.left,e=i+t.width;else if("right"in t)e=t.right,i=e-t.width;else{const h=t.width/2;i=t.hcenter-h,e=t.hcenter+h}else i=t.left,e=t.right;if("height"in t)if("top"in t)h=t.top,r=h+t.height;else if("bottom"in t)r=t.bottom,h=r-t.height;else{const i=t.height/2;h=t.vcenter-i,r=t.vcenter+i}else h=t.top,r=t.bottom;if(!(i<=e&&h<=r))throw new Error(`invalid bbox {left: ${i}, top: ${h}, right: ${e}, bottom: ${r}}`);this.x0=i,this.y0=h,this.x1=e,this.y1=r}}static from_rect({left:t,right:i,top:e,bottom:h}){return new o({x0:Math.min(t,i),y0:Math.min(e,h),x1:Math.max(t,i),y1:Math.max(e,h)})}equals(t){return this.x0==t.x0&&this.y0==t.y0&&this.x1==t.x1&&this.y1==t.y1}[n.equals](t,i){return i.eq(this.x0,t.x0)&&i.eq(this.y0,t.y0)&&i.eq(this.x1,t.x1)&&i.eq(this.y1,t.y1)}toString(){return`BBox({left: ${this.left}, top: ${this.top}, width: ${this.width}, height: ${this.height}})`}get left(){return this.x0}get top(){return this.y0}get right(){return this.x1}get bottom(){return this.y1}get p0(){return[this.x0,this.y0]}get p1(){return[this.x1,this.y1]}get x(){return this.x0}get y(){return this.y0}get width(){return this.x1-this.x0}get height(){return this.y1-this.y0}get size(){return{width:this.width,height:this.height}}get rect(){const{x0:t,y0:i,x1:e,y1:h}=this;return{p0:{x:t,y:i},p1:{x:e,y:i},p2:{x:e,y:h},p3:{x:t,y:h}}}get box(){const{x:t,y:i,width:e,height:h}=this;return{x:t,y:i,width:e,height:h}}get h_range(){return{start:this.x0,end:this.x1}}get v_range(){return{start:this.y0,end:this.y1}}get ranges(){return[this.h_range,this.v_range]}get aspect(){return this.width/this.height}get hcenter(){return(this.left+this.right)/2}get vcenter(){return(this.top+this.bottom)/2}get area(){return this.width*this.height}relative(){const{width:t,height:i}=this;return new o({x:0,y:0,width:t,height:i})}translate(t,i){const{x:e,y:h,width:r,height:s}=this;return new o({x:t+e,y:i+h,width:r,height:s})}relativize(t,i){return[t-this.x,i-this.y]}contains(t,i){return this.x0<=t&&t<=this.x1&&this.y0<=i&&i<=this.y1}clip(t,i){return tthis.x1&&(t=this.x1),ithis.y1&&(i=this.y1),[t,i]}grow_by(t){return new o({left:this.left-t,right:this.right+t,top:this.top-t,bottom:this.bottom+t})}shrink_by(t){return new o({left:this.left+t,right:this.right-t,top:this.top+t,bottom:this.bottom-t})}union(t){return new o({x0:x(this.x0,t.x0),y0:x(this.y0,t.y0),x1:y(this.x1,t.x1),y1:y(this.y1,t.y1)})}intersection(t){return this.intersects(t)?new o({x0:y(this.x0,t.x0),y0:y(this.y0,t.y0),x1:x(this.x1,t.x1),y1:x(this.y1,t.y1)}):null}intersects(t){return!(t.x1this.x1||t.y1this.y1)}get xview(){return{compute:t=>this.left+t,v_compute:t=>{const i=new s.ScreenArray(t.length),e=this.left;for(let h=0;hthis.bottom-t,v_compute:t=>{const i=new s.ScreenArray(t.length),e=this.bottom;for(let h=0;h{const s=new Uint32Array(r);for(let n=0;n>1;i[s]>n?e=s:t=s+1}return i[t]}class r extends o.default{search_indices(n,i,t,e){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let s=this._boxes.length-4;const o=[],x=new d.Indices(this.numItems);for(;void 0!==s;){const d=Math.min(s+4*this.nodeSize,h(s,this._levelBounds));for(let h=s;h>2];tthis._boxes[h+2]||i>this._boxes[h+3]||(s<4*this.numItems?x.set(d):o.push(d)))}s=o.pop()}return x}}r.__name__="_FlatBush";class l{constructor(n){this.index=null,n>0&&(this.index=new r(n))}add(n,i,t,e){var s;null===(s=this.index)||void 0===s||s.add(n,i,t,e)}add_empty(){var n;null===(n=this.index)||void 0===n||n.add(1/0,1/0,-1/0,-1/0)}finish(){var n;null===(n=this.index)||void 0===n||n.finish()}_normalize(n){let{x0:i,y0:t,x1:e,y1:s}=n;return i>e&&([i,e]=[e,i]),t>s&&([t,s]=[s,t]),{x0:i,y0:t,x1:e,y1:s}}get bbox(){if(null==this.index)return x.empty();{const{minX:n,minY:i,maxX:t,maxY:e}=this.index;return{x0:n,y0:i,x1:t,y1:e}}}indices(n){if(null==this.index)return new d.Indices(0);{const{x0:i,y0:t,x1:e,y1:s}=this._normalize(n);return this.index.search_indices(i,t,e,s)}}bounds(n){const i=x.empty();for(const t of this.indices(n)){const n=this.index._boxes,e=n[4*t+0],s=n[4*t+1],o=n[4*t+2],d=n[4*t+3];oi.x1&&(i.x1=e),di.y1&&(i.y1=s)}return i}}t.SpatialIndex=l,l.__name__="SpatialIndex"}, +function _(t,s,i,e,h){e();const n=t(1).__importDefault(t(103)),o=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class r{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[s,i]=new Uint8Array(t,0,2);if(251!==s)throw new Error("Data does not appear to be in a Flatbush format.");if(i>>4!=3)throw new Error(`Got v${i>>4} data when expected v3.`);const[e]=new Uint16Array(t,2,1),[h]=new Uint32Array(t,4,1);return new r(h,e,o[15&i],t)}constructor(t,s=16,i=Float64Array,e){if(void 0===t)throw new Error("Missing required argument: numItems.");if(isNaN(t)||t<=0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+s,2),65535);let h=t,r=h;this._levelBounds=[4*h];do{h=Math.ceil(h/this.nodeSize),r+=h,this._levelBounds.push(4*r)}while(1!==h);this.ArrayType=i||Float64Array,this.IndexArrayType=r<16384?Uint16Array:Uint32Array;const a=o.indexOf(this.ArrayType),_=4*r*this.ArrayType.BYTES_PER_ELEMENT;if(a<0)throw new Error(`Unexpected typed array class: ${i}.`);e&&e instanceof ArrayBuffer?(this.data=e,this._boxes=new this.ArrayType(this.data,8,4*r),this._indices=new this.IndexArrayType(this.data,8+_,r),this._pos=4*r,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1]):(this.data=new ArrayBuffer(8+_+r*this.IndexArrayType.BYTES_PER_ELEMENT),this._boxes=new this.ArrayType(this.data,8,4*r),this._indices=new this.IndexArrayType(this.data,8+_,r),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(this.data,0,2).set([251,48+a]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=t),this._queue=new n.default}add(t,s,i,e){const h=this._pos>>2;return this._indices[h]=h,this._boxes[this._pos++]=t,this._boxes[this._pos++]=s,this._boxes[this._pos++]=i,this._boxes[this._pos++]=e,tthis.maxX&&(this.maxX=i),e>this.maxY&&(this.maxY=e),h}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);if(this.numItems<=this.nodeSize)return this._boxes[this._pos++]=this.minX,this._boxes[this._pos++]=this.minY,this._boxes[this._pos++]=this.maxX,void(this._boxes[this._pos++]=this.maxY);const t=this.maxX-this.minX,s=this.maxY-this.minY,i=new Uint32Array(this.numItems);for(let e=0;e>2]=t,this._boxes[this._pos++]=e,this._boxes[this._pos++]=h,this._boxes[this._pos++]=n,this._boxes[this._pos++]=o}}}search(t,s,i,e,h){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let n=this._boxes.length-4;const o=[],r=[];for(;void 0!==n;){const a=Math.min(n+4*this.nodeSize,_(n,this._levelBounds));for(let _=n;_>2];ithis._boxes[_+2]||s>this._boxes[_+3]||(n<4*this.numItems?(void 0===h||h(a))&&r.push(a):o.push(a)))}n=o.pop()}return r}neighbors(t,s,i=1/0,e=1/0,h){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let n=this._boxes.length-4;const o=this._queue,r=[],x=e*e;for(;void 0!==n;){const e=Math.min(n+4*this.nodeSize,_(n,this._levelBounds));for(let i=n;i>2],r=a(t,this._boxes[i],this._boxes[i+2]),_=a(s,this._boxes[i+1],this._boxes[i+3]),x=r*r+_*_;n<4*this.numItems?(void 0===h||h(e))&&o.push(-e-1,x):o.push(e,x)}for(;o.length&&o.peek()<0;){if(o.peekValue()>x)return o.clear(),r;if(r.push(-o.pop()-1),r.length===i)return o.clear(),r}n=o.pop()}return o.clear(),r}}function a(t,s,i){return t>1;s[h]>t?e=h:i=h+1}return s[i]}function x(t,s,i,e,h,n){if(Math.floor(e/n)>=Math.floor(h/n))return;const o=t[e+h>>1];let r=e-1,a=h+1;for(;;){do{r++}while(t[r]o);if(r>=a)break;d(t,s,i,r,a)}x(t,s,i,e,a,n),x(t,s,i,a+1,h,n)}function d(t,s,i,e,h){const n=t[e];t[e]=t[h],t[h]=n;const o=4*e,r=4*h,a=s[o],_=s[o+1],x=s[o+2],d=s[o+3];s[o]=s[r],s[o+1]=s[r+1],s[o+2]=s[r+2],s[o+3]=s[r+3],s[r]=a,s[r+1]=_,s[r+2]=x,s[r+3]=d;const m=i[e];i[e]=i[h],i[h]=m}function m(t,s){let i=t^s,e=65535^i,h=65535^(t|s),n=t&(65535^s),o=i|e>>1,r=i>>1^i,a=h>>1^e&n>>1^h,_=i&h>>1^n>>1^n;i=o,e=r,h=a,n=_,o=i&i>>2^e&e>>2,r=i&e>>2^e&(i^e)>>2,a^=i&h>>2^e&n>>2,_^=e&h>>2^(i^e)&n>>2,i=o,e=r,h=a,n=_,o=i&i>>4^e&e>>4,r=i&e>>4^e&(i^e)>>4,a^=i&h>>4^e&n>>4,_^=e&h>>4^(i^e)&n>>4,i=o,e=r,h=a,n=_,a^=i&h>>8^e&n>>8,_^=e&h>>8^(i^e)&n>>8,i=a^a>>1,e=_^_>>1;let x=t^s,d=e|65535^(x|i);return x=16711935&(x|x<<8),x=252645135&(x|x<<4),x=858993459&(x|x<<2),x=1431655765&(x|x<<1),d=16711935&(d|d<<8),d=252645135&(d|d<<4),d=858993459&(d|d<<2),d=1431655765&(d|d<<1),(d<<1|x)>>>0}i.default=r}, +function _(s,t,i,h,e){h();i.default=class{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(s,t){let i=this.length++;for(this.ids[i]=s,this.values[i]=t;i>0;){const s=i-1>>1,h=this.values[s];if(t>=h)break;this.ids[i]=this.ids[s],this.values[i]=h,i=s}this.ids[i]=s,this.values[i]=t}pop(){if(0===this.length)return;const s=this.ids[0];if(this.length--,this.length>0){const s=this.ids[0]=this.ids[this.length],t=this.values[0]=this.values[this.length],i=this.length>>1;let h=0;for(;h=t)break;this.ids[h]=e,this.values[h]=l,h=s}this.ids[h]=s,this.values[h]=t}return s}peek(){if(0!==this.length)return this.ids[0]}peekValue(){if(0!==this.length)return this.values[0]}}}, +function _(t,n,e,i,s){i();const r=t(105),a=t(20),o=t(21),g=t(24),p=t(9),c=t(8),l=t(11);function u(t,n,e=0){const i=new Map;for(let s=0;sa.get(t).value)));r.set(t,{value:l/s,mapping:a}),o+=s+n+c}return[r,(a.size-1)*n+g]}function d(t,n,e,i,s=0){var r;const a=new Map,o=new Map;for(const[n,e,i]of t){const t=null!==(r=o.get(n))&&void 0!==r?r:[];o.set(n,[...t,[e,i]])}let g=s,c=0;for(const[t,s]of o){const r=s.length,[o,l]=h(s,e,i,g);c+=l;const u=p.sum(s.map((([t])=>o.get(t).value)));a.set(t,{value:u/r,mapping:o}),g+=r+n+l}return[a,(o.size-1)*n+c]}e.Factor=o.Or(o.String,o.Tuple(o.String,o.String),o.Tuple(o.String,o.String,o.String)),e.FactorSeq=o.Or(o.Array(o.String),o.Array(o.Tuple(o.String,o.String)),o.Array(o.Tuple(o.String,o.String,o.String))),e.map_one_level=u,e.map_two_levels=h,e.map_three_levels=d;class _ extends r.Range{constructor(t){super(t)}static init_FactorRange(){this.define((({Number:t})=>({factors:[e.FactorSeq,[]],factor_padding:[t,0],subgroup_padding:[t,.8],group_padding:[t,1.4],range_padding:[t,0],range_padding_units:[a.PaddingUnits,"percent"],start:[t],end:[t]}))),this.internal((({Number:t,String:n,Array:e,Tuple:i,Nullable:s})=>({levels:[t],mids:[s(e(i(n,n))),null],tops:[s(e(n)),null]})))}get min(){return this.start}get max(){return this.end}initialize(){super.initialize(),this._init(!0)}connect_signals(){super.connect_signals(),this.connect(this.properties.factors.change,(()=>this.reset())),this.connect(this.properties.factor_padding.change,(()=>this.reset())),this.connect(this.properties.group_padding.change,(()=>this.reset())),this.connect(this.properties.subgroup_padding.change,(()=>this.reset())),this.connect(this.properties.range_padding.change,(()=>this.reset())),this.connect(this.properties.range_padding_units.change,(()=>this.reset()))}reset(){this._init(!1),this.change.emit()}_lookup(t){switch(t.length){case 1:{const[n]=t,e=this._mapping.get(n);return null!=e?e.value:NaN}case 2:{const[n,e]=t,i=this._mapping.get(n);if(null!=i){const t=i.mapping.get(e);if(null!=t)return t.value}return NaN}case 3:{const[n,e,i]=t,s=this._mapping.get(n);if(null!=s){const t=s.mapping.get(e);if(null!=t){const n=t.mapping.get(i);if(null!=n)return n.value}}return NaN}default:l.unreachable()}}synthetic(t){if(c.isNumber(t))return t;if(c.isString(t))return this._lookup([t]);let n=0;const e=t[t.length-1];return c.isNumber(e)&&(n=e,t=t.slice(0,-1)),this._lookup(t)+n}v_synthetic(t){const n=t.length,e=new g.ScreenArray(n);for(let i=0;i{if(p.every(this.factors,c.isString)){const t=this.factors,[n,e]=u(t,this.factor_padding);return{levels:1,mapping:n,tops:null,mids:null,inside_padding:e}}if(p.every(this.factors,(t=>c.isArray(t)&&2==t.length&&c.isString(t[0])&&c.isString(t[1])))){const t=this.factors,[n,e]=h(t,this.group_padding,this.factor_padding),i=[...n.keys()];return{levels:2,mapping:n,tops:i,mids:null,inside_padding:e}}if(p.every(this.factors,(t=>c.isArray(t)&&3==t.length&&c.isString(t[0])&&c.isString(t[1])&&c.isString(t[2])))){const t=this.factors,[n,e]=d(t,this.group_padding,this.subgroup_padding,this.factor_padding),i=[...n.keys()],s=[];for(const[t,e]of n)for(const n of e.mapping.keys())s.push([t,n]);return{levels:3,mapping:n,tops:i,mids:s,inside_padding:e}}l.unreachable()})();this._mapping=e,this.tops=i,this.mids=s;let a=0,o=this.factors.length+r;if("percent"==this.range_padding_units){const t=(o-a)*this.range_padding/2;a-=t,o+=t}else a-=this.range_padding,o+=this.range_padding;this.setv({start:a,end:o,levels:n},{silent:t}),"auto"==this.bounds&&this.setv({bounds:[a,o]},{silent:!0})}}e.FactorRange=_,_.__name__="FactorRange",_.init_FactorRange()}, +function _(e,t,i,n,s){n();const a=e(53);class l extends a.Model{constructor(e){super(e),this.have_updated_interactively=!1}static init_Range(){this.define((({Number:e,Tuple:t,Or:i,Auto:n,Nullable:s})=>({bounds:[s(i(t(s(e),s(e)),n)),null],min_interval:[s(e),null],max_interval:[s(e),null]}))),this.internal((({Array:e,AnyRef:t})=>({plots:[e(t()),[]]})))}get is_reversed(){return this.start>this.end}get is_valid(){return isFinite(this.min)&&isFinite(this.max)}}i.Range=l,l.__name__="Range",l.init_Range()}, +function _(e,t,i,n,l){n();const o=e(1).__importStar(e(107));function a(e,t,{x0:i,x1:n,y0:l,y1:o},a){t.save(),t.beginPath(),t.moveTo(i,(l+o)/2),t.lineTo(n,(l+o)/2),e.line.doit&&(e.line.set_vectorize(t,a),t.stroke()),t.restore()}function r(e,t,{x0:i,x1:n,y0:l,y1:o},a){var r,c;const s=.1*Math.abs(n-i),_=.1*Math.abs(o-l),v=i+s,d=n-s,h=l+_,g=o-_;t.beginPath(),t.rect(v,h,d-v,g-h),e.fill.doit&&(e.fill.set_vectorize(t,a),t.fill()),(null===(r=e.hatch)||void 0===r?void 0:r.doit)&&(e.hatch.set_vectorize(t,a),t.fill()),(null===(c=e.line)||void 0===c?void 0:c.doit)&&(e.line.set_vectorize(t,a),t.stroke())}i.generic_line_scalar_legend=function(e,t,{x0:i,x1:n,y0:l,y1:o}){t.save(),t.beginPath(),t.moveTo(i,(l+o)/2),t.lineTo(n,(l+o)/2),e.line.doit&&(e.line.set_value(t),t.stroke()),t.restore()},i.generic_line_vector_legend=a,i.generic_line_legend=a,i.generic_area_scalar_legend=function(e,t,{x0:i,x1:n,y0:l,y1:o}){var a,r;const c=.1*Math.abs(n-i),s=.1*Math.abs(o-l),_=i+c,v=n-c,d=l+s,h=o-s;t.beginPath(),t.rect(_,d,v-_,h-d),e.fill.doit&&(e.fill.set_value(t),t.fill()),(null===(a=e.hatch)||void 0===a?void 0:a.doit)&&(e.hatch.set_value(t),t.fill()),(null===(r=e.line)||void 0===r?void 0:r.doit)&&(e.line.set_value(t),t.stroke())},i.generic_area_vector_legend=r,i.generic_area_legend=r,i.line_interpolation=function(e,t,i,n,l,a){const{sx:r,sy:c}=t;let s,_,v,d;"point"==t.type?([v,d]=e.yscale.r_invert(c-1,c+1),[s,_]=e.xscale.r_invert(r-1,r+1)):"v"==t.direction?([v,d]=e.yscale.r_invert(c,c),[s,_]=[Math.min(i-1,l-1),Math.max(i+1,l+1)]):([s,_]=e.xscale.r_invert(r,r),[v,d]=[Math.min(n-1,a-1),Math.max(n+1,a+1)]);const{x:h,y:g}=o.check_2_segments_intersect(s,v,_,d,i,n,l,a);return[h,g]}}, +function _(t,n,e,i,r){function s(t,n){return(t.x-n.x)**2+(t.y-n.y)**2}function o(t,n,e){const i=s(n,e);if(0==i)return s(t,n);const r=((t.x-n.x)*(e.x-n.x)+(t.y-n.y)*(e.y-n.y))/i;if(r<0)return s(t,n);if(r>1)return s(t,e);return s(t,{x:n.x+r*(e.x-n.x),y:n.y+r*(e.y-n.y)})}i(),e.point_in_poly=function(t,n,e,i){let r=!1,s=e[e.length-1],o=i[i.length-1];for(let u=0;u0&&_<1&&h>0&&h<1,x:t+_*(e-t),y:n+_*(i-n)}}}}, +function _(t,e,s,i,a){i();const o=t(1),n=t(109),_=t(113),r=o.__importDefault(t(114)),h=o.__importDefault(t(115)),l=t(22),g=t(46);class u{constructor(t){this._atlas=new Map,this._width=256,this._height=256,this.tex=new n.Texture2d(t),this.tex.set_wrapping(t.REPEAT,t.REPEAT),this.tex.set_interpolation(t.NEAREST,t.NEAREST),this.tex.set_size([this._width,this._height],t.RGBA),this.tex.set_data([0,0],[this._width,this._height],new Uint8Array(4*this._width*this._height)),this.get_atlas_data([1])}get_atlas_data(t){const e=t.join("-");let s=this._atlas.get(e);if(null==s){const[i,a]=this.make_pattern(t),o=this._atlas.size;this.tex.set_data([0,o],[this._width,1],new Uint8Array(i.map((t=>t+10)))),s=[o/this._height,a],this._atlas.set(e,s)}return s}make_pattern(t){t.length>1&&t.length%2&&(t=t.concat(t));let e=0;for(const s of t)e+=s;const s=[];let i=0;for(let e=0,a=t.length+2;es[h]?-1:0,n=s[h-1],i=s[h]),o[4*t+0]=s[h],o[4*t+1]=_,o[4*t+2]=n,o[4*t+3]=i}return[o,e]}}u.__name__="DashAtlas";const f={miter:0,round:1,bevel:2},c={"":0,none:0,".":0,round:1,")":1,"(":1,o:1,"triangle in":2,"<":2,"triangle out":3,">":3,square:4,"[":4,"]":4,"=":4,butt:5,"|":5};class d extends _.BaseGLGlyph{constructor(t,e){super(t,e),this.glyph=e,this._scale_aspect=0;const s=r.default,i=h.default;this.prog=new n.Program(t),this.prog.set_shaders(s,i),this.index_buffer=new n.IndexBuffer(t),this.vbo_position=new n.VertexBuffer(t),this.vbo_tangents=new n.VertexBuffer(t),this.vbo_segment=new n.VertexBuffer(t),this.vbo_angles=new n.VertexBuffer(t),this.vbo_texcoord=new n.VertexBuffer(t),this.dash_atlas=new u(t)}draw(t,e,s){const i=e.glglyph;if(i.data_changed&&(i._set_data(),i.data_changed=!1),this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1),i._update_scale(1,1),this._scale_aspect=1,this.prog.set_attribute("a_position","vec2",i.vbo_position),this.prog.set_attribute("a_tangents","vec4",i.vbo_tangents),this.prog.set_attribute("a_segment","vec2",i.vbo_segment),this.prog.set_attribute("a_angles","vec2",i.vbo_angles),this.prog.set_attribute("a_texcoord","vec2",i.vbo_texcoord),this.prog.set_uniform("u_length","float",[i.cumsum]),this.prog.set_texture("u_dash_atlas",this.dash_atlas.tex),this.prog.set_uniform("u_pixel_ratio","float",[s.pixel_ratio]),this.prog.set_uniform("u_canvas_size","vec2",[s.width,s.height]),this.prog.set_uniform("u_scale_aspect","vec2",[1,1]),this.prog.set_uniform("u_scale_length","float",[Math.sqrt(2)]),this.I_triangles=i.I_triangles,this.I_triangles.length<65535)this.index_buffer.set_size(2*this.I_triangles.length),this.index_buffer.set_data(0,new Uint16Array(this.I_triangles)),this.prog.draw(this.gl.TRIANGLES,this.index_buffer);else{t=Array.from(this.I_triangles);const e=this.I_triangles.length,s=64008,a=[];for(let t=0,i=Math.ceil(e/s);t1)for(let e=0;e0||console.log(`Variable ${t} is not an active attribute`));else if(this._unset_variables.has(t)&&this._unset_variables.delete(t),this.activate(),i instanceof r.VertexBuffer){const[r,o]=this.ATYPEINFO[e],l="vertexAttribPointer",_=[r,o,n,s,a];this._attributes.set(t,[i.handle,h,l,_])}else{const s=this.ATYPEMAP[e];this._attributes.set(t,[null,h,s,i])}}_pre_draw(){this.activate();for(const[t,e,i]of this._samplers.values())this.gl.activeTexture(this.gl.TEXTURE0+i),this.gl.bindTexture(t,e);for(const[t,e,i,s]of this._attributes.values())null!=t?(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t),this.gl.enableVertexAttribArray(e),this.gl[i].apply(this.gl,[e,...s])):(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.disableVertexAttribArray(e),this.gl[i].apply(this.gl,[e,...s]));this._validated||(this._validated=!0,this._validate())}_validate(){if(this._unset_variables.size&&console.log(`Program has unset variables: ${this._unset_variables}`),this.gl.validateProgram(this.handle),!this.gl.getProgramParameter(this.handle,this.gl.VALIDATE_STATUS))throw console.log(this.gl.getProgramInfoLog(this.handle)),new Error("Program validation error")}draw(t,e){if(!this._linked)throw new Error("Cannot draw program if code has not been set");if(e instanceof r.IndexBuffer){this._pre_draw(),e.activate();const i=e.buffer_size/2,s=this.gl.UNSIGNED_SHORT;this.gl.drawElements(t,i,s,0),e.deactivate()}else{const[i,s]=e;0!=s&&(this._pre_draw(),this.gl.drawArrays(t,i,s))}}}i.Program=n,n.__name__="Program"}, +function _(t,e,s,i,a){i();class r{constructor(t){this.gl=t,this._usage=35048,this.buffer_size=0,this.handle=this.gl.createBuffer()}delete(){this.gl.deleteBuffer(this.handle)}activate(){this.gl.bindBuffer(this._target,this.handle)}deactivate(){this.gl.bindBuffer(this._target,null)}set_size(t){t!=this.buffer_size&&(this.activate(),this.gl.bufferData(this._target,t,this._usage),this.buffer_size=t)}set_data(t,e){this.activate(),this.gl.bufferSubData(this._target,t,e)}}s.Buffer=r,r.__name__="Buffer";class f extends r{constructor(){super(...arguments),this._target=34962}}s.VertexBuffer=f,f.__name__="VertexBuffer";class h extends r{constructor(){super(...arguments),this._target=34963}}s.IndexBuffer=h,h.__name__="IndexBuffer"}, +function _(t,e,i,a,r){a();const s=t(11);class h{constructor(t){this.gl=t,this._target=3553,this._types={Int8Array:5120,Uint8Array:5121,Int16Array:5122,Uint16Array:5123,Int32Array:5124,Uint32Array:5125,Float32Array:5126},this.handle=this.gl.createTexture()}delete(){this.gl.deleteTexture(this.handle)}activate(){this.gl.bindTexture(this._target,this.handle)}deactivate(){this.gl.bindTexture(this._target,0)}_get_alignment(t){const e=[4,8,2,1];for(const i of e)if(t%i==0)return i;s.unreachable()}set_wrapping(t,e){this.activate(),this.gl.texParameterf(this._target,this.gl.TEXTURE_WRAP_S,t),this.gl.texParameterf(this._target,this.gl.TEXTURE_WRAP_T,e)}set_interpolation(t,e){this.activate(),this.gl.texParameterf(this._target,this.gl.TEXTURE_MIN_FILTER,t),this.gl.texParameterf(this._target,this.gl.TEXTURE_MAG_FILTER,e)}set_size([t,e],i){var a,r,s;t==(null===(a=this._shape_format)||void 0===a?void 0:a.width)&&e==(null===(r=this._shape_format)||void 0===r?void 0:r.height)&&i==(null===(s=this._shape_format)||void 0===s?void 0:s.format)||(this._shape_format={width:t,height:e,format:i},this.activate(),this.gl.texImage2D(this._target,0,i,t,e,0,i,this.gl.UNSIGNED_BYTE,null))}set_data(t,[e,i],a){this.activate();const{format:r}=this._shape_format,[s,h]=t,l=this._types[a.constructor.name];if(null==l)throw new Error(`Type ${a.constructor.name} not allowed for texture`);const _=this._get_alignment(e);4!=_&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,_),this.gl.texSubImage2D(this._target,0,s,h,e,i,r,l,a),4!=_&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,4)}}i.Texture2d=h,h.__name__="Texture2d"}, +function _(e,t,s,i,h){i();class a{constructor(e,t){this.gl=e,this.glyph=t,this.nvertices=0,this.size_changed=!1,this.data_changed=!1,this.visuals_changed=!1}set_data_changed(){const{data_size:e}=this.glyph;e!=this.nvertices&&(this.nvertices=e,this.size_changed=!0),this.data_changed=!0}set_visuals_changed(){this.visuals_changed=!0}render(e,t,s){if(0==t.length)return!0;const{width:i,height:h}=this.glyph.renderer.plot_view.canvas_view.webgl.canvas,a={pixel_ratio:this.glyph.renderer.plot_view.canvas_view.pixel_ratio,width:i,height:h};return this.draw(t,s,a),!0}}s.BaseGLGlyph=a,a.__name__="BaseGLGlyph"}, +function _(n,e,t,a,i){a();t.default="\nprecision mediump float;\n\nconst float PI = 3.14159265358979323846264;\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\n\nuniform float u_pixel_ratio;\nuniform vec2 u_canvas_size, u_offset;\nuniform vec2 u_scale_aspect;\nuniform float u_scale_length;\n\nuniform vec4 u_color;\nuniform float u_antialias;\nuniform float u_length;\nuniform float u_linewidth;\nuniform float u_dash_index;\nuniform float u_closed;\n\nattribute vec2 a_position;\nattribute vec4 a_tangents;\nattribute vec2 a_segment;\nattribute vec2 a_angles;\nattribute vec2 a_texcoord;\n\nvarying vec4 v_color;\nvarying vec2 v_segment;\nvarying vec2 v_angles;\nvarying vec2 v_texcoord;\nvarying vec2 v_miter;\nvarying float v_length;\nvarying float v_linewidth;\n\nfloat cross(in vec2 v1, in vec2 v2)\n{\n return v1.x*v2.y - v1.y*v2.x;\n}\n\nfloat signed_distance(in vec2 v1, in vec2 v2, in vec2 v3)\n{\n return cross(v2-v1,v1-v3) / length(v2-v1);\n}\n\nvoid rotate( in vec2 v, in float alpha, out vec2 result )\n{\n float c = cos(alpha);\n float s = sin(alpha);\n result = vec2( c*v.x - s*v.y,\n s*v.x + c*v.y );\n}\n\nvoid main()\n{\n bool closed = (u_closed > 0.0);\n\n // Attributes and uniforms to varyings\n v_color = u_color;\n v_linewidth = u_linewidth;\n v_segment = a_segment * u_scale_length;\n v_length = u_length * u_scale_length;\n\n // Scale to map to pixel coordinates. The original algorithm from the paper\n // assumed isotropic scale. We obviously do not have this.\n vec2 abs_scale_aspect = abs(u_scale_aspect);\n vec2 abs_scale = u_scale_length * abs_scale_aspect;\n\n // Correct angles for aspect ratio\n vec2 av;\n av = vec2(1.0, tan(a_angles.x)) / abs_scale_aspect;\n v_angles.x = atan(av.y, av.x);\n av = vec2(1.0, tan(a_angles.y)) / abs_scale_aspect;\n v_angles.y = atan(av.y, av.x);\n\n // Thickness below 1 pixel are represented using a 1 pixel thickness\n // and a modified alpha\n v_color.a = min(v_linewidth, v_color.a);\n v_linewidth = max(v_linewidth, 1.0);\n\n // If color is fully transparent we just will discard the fragment anyway\n if( v_color.a <= 0.0 ) {\n gl_Position = vec4(0.0,0.0,0.0,1.0);\n return;\n }\n\n // This is the actual half width of the line\n float w = ceil(u_antialias+v_linewidth)/2.0;\n\n vec2 position = a_position;\n\n vec2 t1 = normalize(a_tangents.xy * abs_scale_aspect); // note the scaling for aspect ratio here\n vec2 t2 = normalize(a_tangents.zw * abs_scale_aspect);\n float u = a_texcoord.x;\n float v = a_texcoord.y;\n vec2 o1 = vec2( +t1.y, -t1.x);\n vec2 o2 = vec2( +t2.y, -t2.x);\n\n // This is a join\n // ----------------------------------------------------------------\n if( t1 != t2 ) {\n float angle = atan (t1.x*t2.y-t1.y*t2.x, t1.x*t2.x+t1.y*t2.y); // Angle needs recalculation for some reason\n vec2 t = normalize(t1+t2);\n vec2 o = vec2( + t.y, - t.x);\n\n if ( u_dash_index > 0.0 )\n {\n // Broken angle\n // ----------------------------------------------------------------\n if( (abs(angle) > THETA) ) {\n position += v * w * o / cos(angle/2.0);\n float s = sign(angle);\n if( angle < 0.0 ) {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n if( v == 1.0 ) {\n position -= 2.0 * w * t1 / sin(angle);\n u -= 2.0 * w / sin(angle);\n }\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n if( v == 1.0 ) {\n position += 2.0 * w * t2 / sin(angle);\n u += 2.0*w / sin(angle);\n }\n }\n } else {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n if( v == -1.0 ) {\n position += 2.0 * w * t1 / sin(angle);\n u += 2.0 * w / sin(angle);\n }\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n if( v == -1.0 ) {\n position -= 2.0 * w * t2 / sin(angle);\n u -= 2.0*w / sin(angle);\n }\n }\n }\n // Continuous angle\n // ------------------------------------------------------------\n } else {\n position += v * w * o / cos(angle/2.0);\n if( u == +1.0 ) u = v_segment.y;\n else u = v_segment.x;\n }\n }\n\n // Solid line\n // --------------------------------------------------------------------\n else\n {\n position.xy += v * w * o / cos(angle/2.0);\n if( angle < 0.0 ) {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n }\n } else {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n }\n }\n }\n\n // This is a line start or end (t1 == t2)\n // ------------------------------------------------------------------------\n } else {\n position += v * w * o1;\n if( u == -1.0 ) {\n u = v_segment.x - w;\n position -= w * t1;\n } else {\n u = v_segment.y + w;\n position += w * t2;\n }\n }\n\n // Miter distance\n // ------------------------------------------------------------------------\n vec2 t;\n vec2 curr = a_position * abs_scale;\n if( a_texcoord.x < 0.0 ) {\n vec2 next = curr + t2*(v_segment.y-v_segment.x);\n\n rotate( t1, +v_angles.x/2.0, t);\n v_miter.x = signed_distance(curr, curr+t, position);\n\n rotate( t2, +v_angles.y/2.0, t);\n v_miter.y = signed_distance(next, next+t, position);\n } else {\n vec2 prev = curr - t1*(v_segment.y-v_segment.x);\n\n rotate( t1, -v_angles.x/2.0,t);\n v_miter.x = signed_distance(prev, prev+t, position);\n\n rotate( t2, -v_angles.y/2.0,t);\n v_miter.y = signed_distance(curr, curr+t, position);\n }\n\n if (!closed && v_segment.x <= 0.0) {\n v_miter.x = 1e10;\n }\n if (!closed && v_segment.y >= v_length)\n {\n v_miter.y = 1e10;\n }\n\n v_texcoord = vec2( u, v*w );\n\n // Calculate position in device coordinates. Note that we\n // already scaled with abs scale above.\n vec2 normpos = position * sign(u_scale_aspect);\n normpos += 0.5; // make up for Bokeh's offset\n normpos /= u_canvas_size / u_pixel_ratio; // in 0..1\n gl_Position = vec4(normpos*2.0-1.0, 0.0, 1.0);\n gl_Position.y *= -1.0;\n}\n"}, +function _(n,t,e,s,a){s();e.default="\nprecision mediump float;\n\nconst float PI = 3.14159265358979323846264;\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\n\nuniform sampler2D u_dash_atlas;\n\nuniform vec2 u_linecaps;\nuniform float u_miter_limit;\nuniform float u_linejoin;\nuniform float u_antialias;\nuniform float u_dash_phase;\nuniform float u_dash_period;\nuniform float u_dash_index;\nuniform vec2 u_dash_caps;\nuniform float u_closed;\n\nvarying vec4 v_color;\nvarying vec2 v_segment;\nvarying vec2 v_angles;\nvarying vec2 v_texcoord;\nvarying vec2 v_miter;\nvarying float v_length;\nvarying float v_linewidth;\n\n// Compute distance to cap ----------------------------------------------------\nfloat cap( int type, float dx, float dy, float t, float linewidth )\n{\n float d = 0.0;\n dx = abs(dx);\n dy = abs(dy);\n if (type == 0) discard; // None\n else if (type == 1) d = sqrt(dx*dx+dy*dy); // Round\n else if (type == 3) d = (dx+abs(dy)); // Triangle in\n else if (type == 2) d = max(abs(dy),(t+dx-abs(dy))); // Triangle out\n else if (type == 4) d = max(dx,dy); // Square\n else if (type == 5) d = max(dx+t,dy); // Butt\n return d;\n}\n\n// Compute distance to join -------------------------------------------------\nfloat join( in int type, in float d, in vec2 segment, in vec2 texcoord, in vec2 miter,\n in float linewidth )\n{\n // texcoord.x is distance from start\n // texcoord.y is distance from centerline\n // segment.x and y indicate the limits (as for texcoord.x) for this segment\n\n float dx = texcoord.x;\n\n // Round join\n if( type == 1 ) {\n if (dx < segment.x) {\n d = max(d,length( texcoord - vec2(segment.x,0.0)));\n //d = length( texcoord - vec2(segment.x,0.0));\n } else if (dx > segment.y) {\n d = max(d,length( texcoord - vec2(segment.y,0.0)));\n //d = length( texcoord - vec2(segment.y,0.0));\n }\n }\n // Bevel join\n else if ( type == 2 ) {\n if (dx < segment.x) {\n vec2 x = texcoord - vec2(segment.x,0.0);\n d = max(d, max(abs(x.x), abs(x.y)));\n\n } else if (dx > segment.y) {\n vec2 x = texcoord - vec2(segment.y,0.0);\n d = max(d, max(abs(x.x), abs(x.y)));\n }\n /* Original code for bevel which does not work for us\n if( (dx < segment.x) || (dx > segment.y) )\n d = max(d, min(abs(x.x),abs(x.y)));\n */\n }\n\n return d;\n}\n\nvoid main()\n{\n // If color is fully transparent we just discard the fragment\n if( v_color.a <= 0.0 ) {\n discard;\n }\n\n // Test if dash pattern is the solid one (0)\n bool solid = (u_dash_index == 0.0);\n\n // Test if path is closed\n bool closed = (u_closed > 0.0);\n\n vec4 color = v_color;\n float dx = v_texcoord.x;\n float dy = v_texcoord.y;\n float t = v_linewidth/2.0-u_antialias;\n float width = 1.0; //v_linewidth; original code had dashes scale with line width, we do not\n float d = 0.0;\n\n vec2 linecaps = u_linecaps;\n vec2 dash_caps = u_dash_caps;\n float line_start = 0.0;\n float line_stop = v_length;\n\n // Apply miter limit; fragments too far into the miter are simply discarded\n if( (dx < v_segment.x) || (dx > v_segment.y) ) {\n float into_miter = max(v_segment.x - dx, dx - v_segment.y);\n if (into_miter > u_miter_limit*v_linewidth/2.0)\n discard;\n }\n\n // Solid line --------------------------------------------------------------\n if( solid ) {\n d = abs(dy);\n if( (!closed) && (dx < line_start) ) {\n d = cap( int(u_linecaps.x), abs(dx), abs(dy), t, v_linewidth );\n }\n else if( (!closed) && (dx > line_stop) ) {\n d = cap( int(u_linecaps.y), abs(dx)-line_stop, abs(dy), t, v_linewidth );\n }\n else {\n d = join( int(u_linejoin), abs(dy), v_segment, v_texcoord, v_miter, v_linewidth );\n }\n\n // Dash line --------------------------------------------------------------\n } else {\n float segment_start = v_segment.x;\n float segment_stop = v_segment.y;\n float segment_center= (segment_start+segment_stop)/2.0;\n float freq = u_dash_period*width;\n float u = mod( dx + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n float dash_center= tex.x * width;\n float dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n float dash_start = dx - u + _start;\n float dash_stop = dx - u + _stop;\n\n // Compute extents of the first dash (the one relative to v_segment.x)\n // Note: this could be computed in the vertex shader\n if( (dash_stop < segment_start) && (dash_caps.x != 5.0) ) {\n float u = mod(segment_start + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n dash_center= tex.x * width;\n //dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n dash_start = segment_start - u + _start;\n dash_stop = segment_start - u + _stop;\n }\n\n // Compute extents of the last dash (the one relatives to v_segment.y)\n // Note: This could be computed in the vertex shader\n else if( (dash_start > segment_stop) && (dash_caps.y != 5.0) ) {\n float u = mod(segment_stop + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n dash_center= tex.x * width;\n //dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n dash_start = segment_stop - u + _start;\n dash_stop = segment_stop - u + _stop;\n }\n\n // This test if the we are dealing with a discontinuous angle\n bool discontinuous = ((dx < segment_center) && abs(v_angles.x) > THETA) ||\n ((dx >= segment_center) && abs(v_angles.y) > THETA);\n //if( dx < line_start) discontinuous = false;\n //if( dx > line_stop) discontinuous = false;\n\n float d_join = join( int(u_linejoin), abs(dy),\n v_segment, v_texcoord, v_miter, v_linewidth );\n\n // When path is closed, we do not have room for linecaps, so we make room\n // by shortening the total length\n if (closed) {\n line_start += v_linewidth/2.0;\n line_stop -= v_linewidth/2.0;\n }\n\n // We also need to take antialias area into account\n //line_start += u_antialias;\n //line_stop -= u_antialias;\n\n // Check is dash stop is before line start\n if( dash_stop <= line_start ) {\n discard;\n }\n // Check is dash start is beyond line stop\n if( dash_start >= line_stop ) {\n discard;\n }\n\n // Check if current dash start is beyond segment stop\n if( discontinuous ) {\n // Dash start is beyond segment, we discard\n if( (dash_start > segment_stop) ) {\n discard;\n //gl_FragColor = vec4(1.0,0.0,0.0,.25); return;\n }\n\n // Dash stop is before segment, we discard\n if( (dash_stop < segment_start) ) {\n discard; //gl_FragColor = vec4(0.0,1.0,0.0,.25); return;\n }\n\n // Special case for round caps (nicer with this)\n if( dash_caps.x == 1.0 ) {\n if( (u > _stop) && (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0)) {\n discard;\n }\n }\n\n // Special case for round caps (nicer with this)\n if( dash_caps.y == 1.0 ) {\n if( (u < _start) && (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0)) {\n discard;\n }\n }\n\n // Special case for triangle caps (in & out) and square\n // We make sure the cap stop at crossing frontier\n if( (dash_caps.x != 1.0) && (dash_caps.x != 5.0) ) {\n if( (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0) ) {\n float a = v_angles.x/2.0;\n float x = (segment_start-dx)*cos(a) - dy*sin(a);\n float y = (segment_start-dx)*sin(a) + dy*cos(a);\n if( x > 0.0 ) discard;\n // We transform the cap into square to avoid holes\n dash_caps.x = 4.0;\n }\n }\n\n // Special case for triangle caps (in & out) and square\n // We make sure the cap stop at crossing frontier\n if( (dash_caps.y != 1.0) && (dash_caps.y != 5.0) ) {\n if( (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0) ) {\n float a = v_angles.y/2.0;\n float x = (dx-segment_stop)*cos(a) - dy*sin(a);\n float y = (dx-segment_stop)*sin(a) + dy*cos(a);\n if( x > 0.0 ) discard;\n // We transform the caps into square to avoid holes\n dash_caps.y = 4.0;\n }\n }\n }\n\n // Line cap at start\n if( (dx < line_start) && (dash_start < line_start) && (dash_stop > line_start) ) {\n d = cap( int(linecaps.x), dx-line_start, dy, t, v_linewidth);\n }\n // Line cap at stop\n else if( (dx > line_stop) && (dash_stop > line_stop) && (dash_start < line_stop) ) {\n d = cap( int(linecaps.y), dx-line_stop, dy, t, v_linewidth);\n }\n // Dash cap left - dash_type = -1, 0 or 1, but there may be roundoff errors\n else if( dash_type < -0.5 ) {\n d = cap( int(dash_caps.y), abs(u-dash_center), dy, t, v_linewidth);\n if( (dx > line_start) && (dx < line_stop) )\n d = max(d,d_join);\n }\n // Dash cap right\n else if( dash_type > 0.5 ) {\n d = cap( int(dash_caps.x), abs(dash_center-u), dy, t, v_linewidth);\n if( (dx > line_start) && (dx < line_stop) )\n d = max(d,d_join);\n }\n // Dash body (plain)\n else {// if( dash_type > -0.5 && dash_type < 0.5) {\n d = abs(dy);\n }\n\n // Line join\n if( (dx > line_start) && (dx < line_stop)) {\n if( (dx <= segment_start) && (dash_start <= segment_start)\n && (dash_stop >= segment_start) ) {\n d = d_join;\n // Antialias at outer border\n float angle = PI/2.+v_angles.x;\n float f = abs( (segment_start - dx)*cos(angle) - dy*sin(angle));\n d = max(f,d);\n }\n else if( (dx > segment_stop) && (dash_start <= segment_stop)\n && (dash_stop >= segment_stop) ) {\n d = d_join;\n // Antialias at outer border\n float angle = PI/2.+v_angles.y;\n float f = abs((dx - segment_stop)*cos(angle) - dy*sin(angle));\n d = max(f,d);\n }\n else if( dx < (segment_start - v_linewidth/2.)) {\n discard;\n }\n else if( dx > (segment_stop + v_linewidth/2.)) {\n discard;\n }\n }\n else if( dx < (segment_start - v_linewidth/2.)) {\n discard;\n }\n else if( dx > (segment_stop + v_linewidth/2.)) {\n discard;\n }\n }\n\n // Distance to border ------------------------------------------------------\n d = d - t;\n if( d < 0.0 ) {\n gl_FragColor = color;\n } else {\n d /= u_antialias;\n gl_FragColor = vec4(color.rgb, exp(-d*d)*color.a);\n }\n}\n"}, +function _(i,t,s,e,l){e();const a=i(1),n=i(64),_=i(106),o=a.__importStar(i(107)),h=a.__importStar(i(48)),c=i(59);class r extends n.XYGlyphView{_inner_loop(i,t,s,e,l){for(const a of t){const t=s[a],n=e[a];0!=a?isNaN(t+n)?(i.closePath(),l.apply(i),i.beginPath()):i.lineTo(t,n):(i.beginPath(),i.moveTo(t,n))}i.closePath(),l.call(i)}_render(i,t,s){const{sx:e,sy:l}=null!=s?s:this;this.visuals.fill.doit&&(this.visuals.fill.set_value(i),this._inner_loop(i,t,e,l,i.fill)),this.visuals.hatch.doit&&(this.visuals.hatch.set_value(i),this._inner_loop(i,t,e,l,i.fill)),this.visuals.line.doit&&(this.visuals.line.set_value(i),this._inner_loop(i,t,e,l,i.stroke))}draw_legend_for_index(i,t,s){_.generic_area_scalar_legend(this.visuals,i,t)}_hit_point(i){const t=new c.Selection;return o.point_in_poly(i.sx,i.sy,this.sx,this.sy)&&(t.add_to_selected_glyphs(this.model),t.view=this),t}}s.PatchView=r,r.__name__="PatchView";class p extends n.XYGlyph{constructor(i){super(i)}static init_Patch(){this.prototype.default_view=r,this.mixins([h.LineScalar,h.FillScalar,h.HatchScalar])}}s.Patch=p,p.__name__="Patch",p.init_Patch()}, +function _(t,e,s,i,n){i();const a=t(1),r=t(24),h=t(118),_=a.__importStar(t(107)),l=a.__importStar(t(18)),o=t(59);class c extends h.AreaView{_index_data(t){const{min:e,max:s}=Math,{data_size:i}=this;for(let n=0;n=0;e--)t.lineTo(s[e],i[e]);t.closePath(),n.call(t)}_render(t,e,s){const{sx1:i,sx2:n,sy:a}=null!=s?s:this;this.visuals.fill.doit&&(this.visuals.fill.set_value(t),this._inner(t,i,n,a,t.fill)),this.visuals.hatch.doit&&(this.visuals.hatch.set_value(t),this._inner(t,i,n,a,t.fill))}_hit_point(t){const e=this.sy.length,s=new r.ScreenArray(2*e),i=new r.ScreenArray(2*e);for(let t=0,n=e;t({x1:[l.XCoordinateSpec,{field:"x1"}],x2:[l.XCoordinateSpec,{field:"x2"}],y:[l.YCoordinateSpec,{field:"y"}]})))}}s.HArea=d,d.__name__="HArea",d.init_HArea()}, +function _(e,a,_,i,r){i();const s=e(1),n=e(98),t=e(106),c=s.__importStar(e(48));class l extends n.GlyphView{draw_legend_for_index(e,a,_){t.generic_area_scalar_legend(this.visuals,e,a)}}_.AreaView=l,l.__name__="AreaView";class d extends n.Glyph{constructor(e){super(e)}static init_Area(){this.mixins([c.FillScalar,c.HatchScalar])}}_.Area=d,d.__name__="Area",d.init_Area()}, +function _(t,e,s,i,n){i();const a=t(1),r=t(24),h=t(118),_=a.__importStar(t(107)),l=a.__importStar(t(18)),o=t(59);class c extends h.AreaView{_index_data(t){const{min:e,max:s}=Math,{data_size:i}=this;for(let n=0;n=0;s--)t.lineTo(e[s],i[s]);t.closePath(),n.call(t)}_render(t,e,s){const{sx:i,sy1:n,sy2:a}=null!=s?s:this;this.visuals.fill.doit&&(this.visuals.fill.set_value(t),this._inner(t,i,n,a,t.fill)),this.visuals.hatch.doit&&(this.visuals.hatch.set_value(t),this._inner(t,i,n,a,t.fill))}scenterxy(t){return[this.sx[t],(this.sy1[t]+this.sy2[t])/2]}_hit_point(t){const e=this.sx.length,s=new r.ScreenArray(2*e),i=new r.ScreenArray(2*e);for(let t=0,n=e;t({x:[l.XCoordinateSpec,{field:"x"}],y1:[l.YCoordinateSpec,{field:"y1"}],y2:[l.YCoordinateSpec,{field:"y2"}]})))}}s.VArea=d,d.__name__="VArea",d.init_VArea()}, +function _(i,e,s,t,n){t();const c=i(53),o=i(59),r=i(24),a=i(121),u=i(57);class _ extends c.Model{constructor(i){super(i)}static init_CDSView(){this.define((({Array:i,Ref:e})=>({filters:[i(e(a.Filter)),[]],source:[e(u.ColumnarDataSource)]}))),this.internal((({Int:i,Dict:e,Ref:s,Nullable:t})=>({indices:[s(r.Indices)],indices_map:[e(i),{}],masked:[t(s(r.Indices)),null]})))}initialize(){super.initialize(),this.compute_indices()}connect_signals(){super.connect_signals(),this.connect(this.properties.filters.change,(()=>this.compute_indices()));const i=()=>{const i=()=>this.compute_indices();null!=this.source&&(this.connect(this.source.change,i),this.source instanceof u.ColumnarDataSource&&(this.connect(this.source.streaming,i),this.connect(this.source.patching,i)))};let e=null!=this.source;e?i():this.connect(this.properties.source.change,(()=>{e||(i(),e=!0)}))}compute_indices(){var i;const{source:e}=this;if(null==e)return;const s=null!==(i=e.get_length())&&void 0!==i?i:1,t=r.Indices.all_set(s);for(const i of this.filters)t.intersect(i.compute_indices(e));this.indices=t,this._indices=[...t],this.indices_map_to_subset()}indices_map_to_subset(){this.indices_map={};for(let i=0;ithis._indices[i]));return new o.Selection(Object.assign(Object.assign({},i.attributes),{indices:e}))}convert_selection_to_subset(i){const e=i.indices.map((i=>this.indices_map[i]));return new o.Selection(Object.assign(Object.assign({},i.attributes),{indices:e}))}convert_indices_from_subset(i){return i.map((i=>this._indices[i]))}}s.CDSView=_,_.__name__="CDSView",_.init_CDSView()}, +function _(e,t,n,s,c){s();const o=e(53);class r extends o.Model{constructor(e){super(e)}}n.Filter=r,r.__name__="Filter"}, +function _(n,e,t,i,o){i();const s=n(9);async function c(n,e,t){const i=new n(Object.assign(Object.assign({},t),{model:e}));return i.initialize(),await i.lazy_initialize(),i}t.build_view=async function(n,e={parent:null},t=(n=>n.default_view)){const i=await c(t(n),n,e);return i.connect_signals(),i},t.build_views=async function(n,e,t={parent:null},i=(n=>n.default_view)){const o=s.difference([...n.keys()],e);for(const e of o)n.get(e).remove(),n.delete(e);const a=[],f=e.filter((e=>!n.has(e)));for(const e of f){const o=await c(i(e),e,t);n.set(e,o),a.push(o)}for(const n of a)n.connect_signals();return a},t.remove_views=function(n){for(const[e,t]of n)t.remove(),n.delete(e)}}, +function _(e,r,n,t,i){t();const s=e(62),o=e(61),l=e(124),d=e(125),a=e(126),p=e(122),_=e(64),h=e(127),c=e(128),u=e(11);class y extends s.DataRendererView{get glyph_view(){return this.node_view.glyph}async lazy_initialize(){await super.lazy_initialize();const e=this.model;let r=null,n=null;const t=new class extends l.Expression{_v_compute(n){u.assert(null==r);const[t]=r=e.layout_provider.get_edge_coordinates(n);return t}},i=new class extends l.Expression{_v_compute(e){u.assert(null!=r);const[,n]=r;return r=null,n}},s=new class extends l.Expression{_v_compute(r){u.assert(null==n);const[t]=n=e.layout_provider.get_node_coordinates(r);return t}},o=new class extends l.Expression{_v_compute(e){u.assert(null!=n);const[,r]=n;return n=null,r}},{edge_renderer:d,node_renderer:a}=this.model;if(!(d.glyph instanceof h.MultiLine||d.glyph instanceof c.Patches))throw new Error(`${this}.edge_renderer.glyph must be a MultiLine glyph`);if(!(a.glyph instanceof _.XYGlyph))throw new Error(`${this}.node_renderer.glyph must be a XYGlyph glyph`);d.glyph.properties.xs.internal=!0,d.glyph.properties.ys.internal=!0,a.glyph.properties.x.internal=!0,a.glyph.properties.y.internal=!0,d.glyph.xs={expr:t},d.glyph.ys={expr:i},a.glyph.x={expr:s},a.glyph.y={expr:o};const{parent:y}=this;this.edge_view=await p.build_view(d,{parent:y}),this.node_view=await p.build_view(a,{parent:y})}connect_signals(){super.connect_signals(),this.connect(this.model.layout_provider.change,(()=>{this.edge_view.set_data(),this.node_view.set_data(),this.request_render()}))}remove(){this.edge_view.remove(),this.node_view.remove(),super.remove()}_render(){this.edge_view.render(),this.node_view.render()}renderer_view(e){if(e instanceof o.GlyphRenderer){if(e==this.edge_view.model)return this.edge_view;if(e==this.node_view.model)return this.node_view}return super.renderer_view(e)}}n.GraphRendererView=y,y.__name__="GraphRendererView";class g extends s.DataRenderer{constructor(e){super(e)}static init_GraphRenderer(){this.prototype.default_view=y,this.define((({Ref:e})=>({layout_provider:[e(d.LayoutProvider)],node_renderer:[e(o.GlyphRenderer)],edge_renderer:[e(o.GlyphRenderer)],selection_policy:[e(a.GraphHitTestPolicy),()=>new a.NodesOnly],inspection_policy:[e(a.GraphHitTestPolicy),()=>new a.NodesOnly]})))}get_selection_manager(){return this.node_renderer.data_source.selection_manager}}n.GraphRenderer=g,g.__name__="GraphRenderer",g.init_GraphRenderer()}, +function _(e,t,s,n,i){n();const c=e(53);class l extends c.Model{constructor(e){super(e)}initialize(){super.initialize(),this._connected=new Set,this._result=new Map}v_compute(e){this._connected.has(e)||(this.connect(e.change,(()=>this._result.delete(e))),this.connect(e.patching,(()=>this._result.delete(e))),this.connect(e.streaming,(()=>this._result.delete(e))),this._connected.add(e));let t=this._result.get(e);return null==t&&(t=this._v_compute(e),this._result.set(e,t)),t}}s.Expression=l,l.__name__="Expression";class h extends c.Model{constructor(e){super(e)}initialize(){super.initialize(),this._connected=new Set,this._result=new Map}compute(e){this._connected.has(e)||(this.connect(e.change,(()=>this._result.delete(e))),this.connect(e.patching,(()=>this._result.delete(e))),this.connect(e.streaming,(()=>this._result.delete(e))),this._connected.add(e));let t=this._result.get(e);return null==t&&(t=this._compute(e),this._result.set(e,t)),t}}s.ScalarExpression=h,h.__name__="ScalarExpression"}, +function _(o,e,r,t,n){t();const s=o(53);class c extends s.Model{constructor(o){super(o)}}r.LayoutProvider=c,c.__name__="LayoutProvider"}, +function _(e,t,d,n,s){n();const o=e(53),r=e(12),_=e(9),i=e(59);class c extends o.Model{constructor(e){super(e)}_hit_test(e,t,d){if(!t.model.visible)return null;const n=d.glyph.hit_test(e);return null==n?null:d.model.view.convert_selection_from_subset(n)}}d.GraphHitTestPolicy=c,c.__name__="GraphHitTestPolicy";class a extends c{constructor(e){super(e)}hit_test(e,t){return this._hit_test(e,t,t.edge_view)}do_selection(e,t,d,n){if(null==e)return!1;const s=t.edge_renderer.data_source.selected;return s.update(e,d,n),t.edge_renderer.data_source._select.emit(),!s.is_empty()}do_inspection(e,t,d,n,s){if(null==e)return!1;const{edge_renderer:o}=d.model,r=o.get_selection_manager().get_or_create_inspector(d.edge_view.model);return r.update(e,n,s),d.edge_view.model.data_source.setv({inspected:r},{silent:!0}),d.edge_view.model.data_source.inspect.emit([d.edge_view.model,{geometry:t}]),!r.is_empty()}}d.EdgesOnly=a,a.__name__="EdgesOnly";class l extends c{constructor(e){super(e)}hit_test(e,t){return this._hit_test(e,t,t.node_view)}do_selection(e,t,d,n){if(null==e)return!1;const s=t.node_renderer.data_source.selected;return s.update(e,d,n),t.node_renderer.data_source._select.emit(),!s.is_empty()}do_inspection(e,t,d,n,s){if(null==e)return!1;const{node_renderer:o}=d.model,r=o.get_selection_manager().get_or_create_inspector(d.node_view.model);return r.update(e,n,s),d.node_view.model.data_source.setv({inspected:r},{silent:!0}),d.node_view.model.data_source.inspect.emit([d.node_view.model,{geometry:t}]),!r.is_empty()}}d.NodesOnly=l,l.__name__="NodesOnly";class u extends c{constructor(e){super(e)}hit_test(e,t){return this._hit_test(e,t,t.node_view)}get_linked_edges(e,t,d){let n=[];"selection"==d?n=e.selected.indices.map((t=>e.data.index[t])):"inspection"==d&&(n=e.inspected.indices.map((t=>e.data.index[t])));const s=[];for(let e=0;er.indexOf(e.data.index,t)));return new i.Selection({indices:o})}do_selection(e,t,d,n){if(null==e)return!1;const s=t.edge_renderer.data_source.selected;s.update(e,d,n);const o=t.node_renderer.data_source.selected,r=this.get_linked_nodes(t.node_renderer.data_source,t.edge_renderer.data_source,"selection");return o.update(r,d,n),t.edge_renderer.data_source._select.emit(),!s.is_empty()}do_inspection(e,t,d,n,s){if(null==e)return!1;const o=d.edge_view.model.data_source.selection_manager.get_or_create_inspector(d.edge_view.model);o.update(e,n,s),d.edge_view.model.data_source.setv({inspected:o},{silent:!0});const r=d.node_view.model.data_source.selection_manager.get_or_create_inspector(d.node_view.model),_=this.get_linked_nodes(d.node_view.model.data_source,d.edge_view.model.data_source,"inspection");return r.update(_,n,s),d.node_view.model.data_source.setv({inspected:r},{silent:!0}),d.edge_view.model.data_source.inspect.emit([d.edge_view.model,{geometry:t}]),!o.is_empty()}}d.EdgesAndLinkedNodes=m,m.__name__="EdgesAndLinkedNodes"}, +function _(t,e,i,n,s){n();const o=t(1),l=t(65),r=t(48),_=o.__importStar(t(107)),c=o.__importStar(t(18)),h=t(12),a=t(13),d=t(98),x=t(106),y=t(59);class g extends d.GlyphView{_project_data(){l.inplace.project_xy(this._xs.array,this._ys.array)}_index_data(t){const{data_size:e}=this;for(let i=0;i0&&o.set(t,i)}return new y.Selection({indices:[...o.keys()],multiline_indices:a.to_object(o)})}get_interpolation_hit(t,e,i){const n=this._xs.get(t),s=this._ys.get(t),o=n[e],l=s[e],r=n[e+1],_=s[e+1];return x.line_interpolation(this.renderer,i,o,l,r,_)}draw_legend_for_index(t,e,i){x.generic_line_vector_legend(this.visuals,t,e,i)}scenterxy(){throw new Error(`${this}.scenterxy() is not implemented`)}}i.MultiLineView=g,g.__name__="MultiLineView";class u extends d.Glyph{constructor(t){super(t)}static init_MultiLine(){this.prototype.default_view=g,this.define((({})=>({xs:[c.XCoordinateSeqSpec,{field:"xs"}],ys:[c.YCoordinateSeqSpec,{field:"ys"}]}))),this.mixins(r.LineVector)}}i.MultiLine=u,u.__name__="MultiLine",u.init_MultiLine()}, +function _(e,t,s,i,n){i();const r=e(1),o=e(98),a=e(106),_=e(12),c=e(48),l=r.__importStar(e(107)),h=r.__importStar(e(18)),d=e(59),y=e(11),p=e(65);class x extends o.GlyphView{_project_data(){p.inplace.project_xy(this._xs.array,this._ys.array)}_index_data(e){const{data_size:t}=this;for(let s=0;s({xs:[h.XCoordinateSeqSpec,{field:"xs"}],ys:[h.YCoordinateSeqSpec,{field:"ys"}]}))),this.mixins([c.LineVector,c.FillVector,c.HatchVector])}}s.Patches=f,f.__name__="Patches",f.init_Patches()}, +function _(e,t,n,s,o){s();const r=e(53);class c extends r.Model{do_selection(e,t,n,s){return null!=e&&(t.selected.update(e,n,s),t._select.emit(),!t.selected.is_empty())}}n.SelectionPolicy=c,c.__name__="SelectionPolicy";class l extends c{hit_test(e,t){const n=[];for(const s of t){const t=s.hit_test(e);null!=t&&n.push(t)}if(n.length>0){const e=n[0];for(const t of n)e.update_through_intersection(t);return e}return null}}n.IntersectRenderers=l,l.__name__="IntersectRenderers";class _ extends c{hit_test(e,t){const n=[];for(const s of t){const t=s.hit_test(e);null!=t&&n.push(t)}if(n.length>0){const e=n[0];for(const t of n)e.update_through_union(t);return e}return null}}n.UnionRenderers=_,_.__name__="UnionRenderers"}, +function _(t,n,e,s,o){s();const r=t(1),i=t(57),l=t(8),c=t(13),a=r.__importStar(t(131)),u=t(132),h=t(35);function d(t,n,e){if(l.isArray(t)){const s=t.concat(n);return null!=e&&s.length>e?s.slice(-e):s}if(l.isTypedArray(t)){const s=t.length+n.length;if(null!=e&&s>e){const o=s-e,r=t.length;let i;t.length({data:[t(n),{}]})))}stream(t,n,e){const{data:s}=this;for(const[e,o]of c.entries(t))s[e]=d(s[e],o,n);if(this.setv({data:s},{silent:!0}),this.streaming.emit(),null!=this.document){const s=new h.ColumnsStreamedEvent(this.document,this.ref(),t,n);this.document._notify_change(this,"data",null,null,{setter_id:e,hint:s})}}patch(t,n){const{data:e}=this;let s=new Set;for(const[n,o]of c.entries(t))s=u.union(s,m(e[n],o));if(this.setv({data:e},{silent:!0}),this.patching.emit([...s]),null!=this.document){const e=new h.ColumnsPatchedEvent(this.document,this.ref(),t);this.document._notify_change(this,"data",null,null,{setter_id:n,hint:e})}}}e.ColumnDataSource=_,_.__name__="ColumnDataSource",_.init_ColumnDataSource()}, +function _(t,n,o,e,c){e(),o.concat=function(t,...n){let o=t.length;for(const t of n)o+=t.length;const e=new t.constructor(o);e.set(t,0);let c=t.length;for(const t of n)e.set(t,c),c+=t.length;return e}}, +function _(n,o,t,e,f){function c(...n){const o=new Set;for(const t of n)for(const n of t)o.add(n);return o}e(),t.union=c,t.intersection=function(n,...o){const t=new Set;n:for(const e of n){for(const n of o)if(!n.has(e))continue n;t.add(e)}return t},t.difference=function(n,...o){const t=new Set(n);for(const n of c(...o))t.delete(n);return t}}, +function _(e,i,t,s,o){s();const n=e(1),a=e(53),l=e(42),r=n.__importStar(e(45)),_=e(48),c=n.__importStar(e(18));class d extends l.View{initialize(){super.initialize(),this.visuals=new r.Visuals(this)}request_render(){this.parent.request_render()}get canvas(){return this.parent.canvas}set_data(e){const i=this;for(const t of this.model){if(!(t instanceof c.VectorSpec||t instanceof c.ScalarSpec))continue;const s=t.uniform(e);i[`${t.attr}`]=s}}}t.ArrowHeadView=d,d.__name__="ArrowHeadView";class h extends a.Model{constructor(e){super(e)}static init_ArrowHead(){this.define((()=>({size:[c.NumberSpec,25]})))}}t.ArrowHead=h,h.__name__="ArrowHead",h.init_ArrowHead();class v extends d{clip(e,i){this.visuals.line.set_vectorize(e,i);const t=this.size.get(i);e.moveTo(.5*t,t),e.lineTo(.5*t,-2),e.lineTo(-.5*t,-2),e.lineTo(-.5*t,t),e.lineTo(0,0),e.lineTo(.5*t,t)}render(e,i){if(this.visuals.line.doit){this.visuals.line.set_vectorize(e,i);const t=this.size.get(i);e.beginPath(),e.moveTo(.5*t,t),e.lineTo(0,0),e.lineTo(-.5*t,t),e.stroke()}}}t.OpenHeadView=v,v.__name__="OpenHeadView";class u extends h{constructor(e){super(e)}static init_OpenHead(){this.prototype.default_view=v,this.mixins(_.LineVector)}}t.OpenHead=u,u.__name__="OpenHead",u.init_OpenHead();class m extends d{clip(e,i){this.visuals.line.set_vectorize(e,i);const t=this.size.get(i);e.moveTo(.5*t,t),e.lineTo(.5*t,-2),e.lineTo(-.5*t,-2),e.lineTo(-.5*t,t),e.lineTo(.5*t,t)}render(e,i){this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(e,i),this._normal(e,i),e.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(e,i),this._normal(e,i),e.stroke())}_normal(e,i){const t=this.size.get(i);e.beginPath(),e.moveTo(.5*t,t),e.lineTo(0,0),e.lineTo(-.5*t,t),e.closePath()}}t.NormalHeadView=m,m.__name__="NormalHeadView";class T extends h{constructor(e){super(e)}static init_NormalHead(){this.prototype.default_view=m,this.mixins([_.LineVector,_.FillVector]),this.override({fill_color:"black"})}}t.NormalHead=T,T.__name__="NormalHead",T.init_NormalHead();class p extends d{clip(e,i){this.visuals.line.set_vectorize(e,i);const t=this.size.get(i);e.moveTo(.5*t,t),e.lineTo(.5*t,-2),e.lineTo(-.5*t,-2),e.lineTo(-.5*t,t),e.lineTo(0,.5*t),e.lineTo(.5*t,t)}render(e,i){this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(e,i),this._vee(e,i),e.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(e,i),this._vee(e,i),e.stroke())}_vee(e,i){const t=this.size.get(i);e.beginPath(),e.moveTo(.5*t,t),e.lineTo(0,0),e.lineTo(-.5*t,t),e.lineTo(0,.5*t),e.closePath()}}t.VeeHeadView=p,p.__name__="VeeHeadView";class H extends h{constructor(e){super(e)}static init_VeeHead(){this.prototype.default_view=p,this.mixins([_.LineVector,_.FillVector]),this.override({fill_color:"black"})}}t.VeeHead=H,H.__name__="VeeHead",H.init_VeeHead();class V extends d{render(e,i){if(this.visuals.line.doit){this.visuals.line.set_vectorize(e,i);const t=this.size.get(i);e.beginPath(),e.moveTo(.5*t,0),e.lineTo(-.5*t,0),e.stroke()}}clip(e,i){}}t.TeeHeadView=V,V.__name__="TeeHeadView";class f extends h{constructor(e){super(e)}static init_TeeHead(){this.prototype.default_view=V,this.mixins(_.LineVector)}}t.TeeHead=f,f.__name__="TeeHead",f.init_TeeHead()}, +function _(s,e,i,t,l){t();const _=s(1),o=s(135),r=_.__importStar(s(48));class h extends o.UpperLowerView{paint(s){s.beginPath(),s.moveTo(this._lower_sx[0],this._lower_sy[0]);for(let e=0,i=this._lower_sx.length;e=0;e--)s.lineTo(this._upper_sx[e],this._upper_sy[e]);s.closePath(),this.visuals.fill.doit&&(this.visuals.fill.set_value(s),s.fill()),s.beginPath(),s.moveTo(this._lower_sx[0],this._lower_sy[0]);for(let e=0,i=this._lower_sx.length;e({dimension:[n.Dimension,"height"],lower:[h,{field:"lower"}],upper:[h,{field:"upper"}],base:[h,{field:"base"}]})))}}i.UpperLower=d,d.__name__="UpperLower",d.init_UpperLower()}, +function _(t,i,o,n,e){n();const s=t(1),l=t(40),a=s.__importStar(t(48)),r=t(20),h=t(99);o.EDGE_TOLERANCE=2.5;class c extends l.AnnotationView{constructor(){super(...arguments),this.bbox=new h.BBox}connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render()))}_render(){const{left:t,right:i,top:o,bottom:n}=this.model;if(null==t&&null==i&&null==o&&null==n)return;const{frame:e}=this.plot_view,s=this.coordinates.x_scale,l=this.coordinates.y_scale,a=(t,i,o,n,e)=>{let s;return s=null!=t?this.model.screen?t:"data"==i?o.compute(t):n.compute(t):e,s};this.bbox=h.BBox.from_rect({left:a(t,this.model.left_units,s,e.bbox.xview,e.bbox.left),right:a(i,this.model.right_units,s,e.bbox.xview,e.bbox.right),top:a(o,this.model.top_units,l,e.bbox.yview,e.bbox.top),bottom:a(n,this.model.bottom_units,l,e.bbox.yview,e.bbox.bottom)}),this._paint_box()}_paint_box(){const{ctx:t}=this.layer;t.save();const{left:i,top:o,width:n,height:e}=this.bbox;t.beginPath(),t.rect(i,o,n,e),this.visuals.fill.doit&&(this.visuals.fill.set_value(t),t.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_value(t),t.fill()),this.visuals.line.doit&&(this.visuals.line.set_value(t),t.stroke()),t.restore()}interactive_bbox(){const t=this.model.line_width+o.EDGE_TOLERANCE;return this.bbox.grow_by(t)}interactive_hit(t,i){if(null==this.model.in_cursor)return!1;return this.interactive_bbox().contains(t,i)}cursor(t,i){const{left:o,right:n,bottom:e,top:s}=this.bbox;return Math.abs(t-o)<3||Math.abs(t-n)<3?this.model.ew_cursor:Math.abs(i-e)<3||Math.abs(i-s)<3?this.model.ns_cursor:this.bbox.contains(t,i)?this.model.in_cursor:null}}o.BoxAnnotationView=c,c.__name__="BoxAnnotationView";class u extends l.Annotation{constructor(t){super(t)}static init_BoxAnnotation(){this.prototype.default_view=c,this.mixins([a.Line,a.Fill,a.Hatch]),this.define((({Number:t,Nullable:i})=>({top:[i(t),null],top_units:[r.SpatialUnits,"data"],bottom:[i(t),null],bottom_units:[r.SpatialUnits,"data"],left:[i(t),null],left_units:[r.SpatialUnits,"data"],right:[i(t),null],right_units:[r.SpatialUnits,"data"],render_mode:[r.RenderMode,"canvas"]}))),this.internal((({Boolean:t,String:i,Nullable:o})=>({screen:[t,!1],ew_cursor:[o(i),null],ns_cursor:[o(i),null],in_cursor:[o(i),null]}))),this.override({fill_color:"#fff9ba",fill_alpha:.4,line_color:"#cccccc",line_alpha:.3})}update({left:t,right:i,top:o,bottom:n}){this.setv({left:t,right:i,top:o,bottom:n,screen:!0})}}o.BoxAnnotation=u,u.__name__="BoxAnnotation",u.init_BoxAnnotation()}, +function _(t,e,i,a,n){a();const o=t(1),r=t(40),s=t(138),l=t(144),_=t(162),c=t(165),h=t(198),u=t(166),p=t(205),m=t(169),g=t(203),d=t(202),f=t(209),w=t(217),b=t(220),v=t(20),y=o.__importStar(t(48)),k=t(9),x=t(221),C=t(222),j=t(225),z=t(140),L=t(11),S=t(122),M=t(8);class T extends r.AnnotationView{get orientation(){return this._orientation}initialize(){super.initialize();const{ticker:t,formatter:e,color_mapper:i}=this.model;this._ticker="auto"!=t?t:(()=>{switch(!0){case i instanceof f.LogColorMapper:return new h.LogTicker;case i instanceof f.ScanningColorMapper:return new h.BinnedTicker({mapper:i});case i instanceof f.CategoricalColorMapper:return new h.CategoricalTicker;default:return new h.BasicTicker}})(),this._formatter="auto"!=e?e:(()=>{switch(!0){case this._ticker instanceof h.LogTicker:return new p.LogTickFormatter;case i instanceof f.CategoricalColorMapper:return new p.CategoricalTickFormatter;default:return new p.BasicTickFormatter}})(),this._major_range=(()=>{if(i instanceof f.CategoricalColorMapper){const{factors:t}=i;return new b.FactorRange({factors:t})}if(i instanceof d.ContinuousColorMapper){const{min:t,max:e}=i.metrics;return new b.Range1d({start:t,end:e})}L.unreachable()})(),this._major_scale=(()=>{if(i instanceof f.LinearColorMapper)return new w.LinearScale;if(i instanceof f.LogColorMapper)return new w.LogScale;if(i instanceof f.ScanningColorMapper){const{binning:t}=i.metrics;return new w.LinearInterpolationScale({binning:t})}if(i instanceof f.CategoricalColorMapper)return new w.CategoricalScale;L.unreachable()})(),this._minor_range=new b.Range1d({start:0,end:1}),this._minor_scale=new w.LinearScale;const a=y.attrs_of(this.model,"major_label_",y.Text,!0),n=y.attrs_of(this.model,"major_tick_",y.Line,!0),o=y.attrs_of(this.model,"minor_tick_",y.Line,!0),r=y.attrs_of(this.model,"title_",y.Text),l=i instanceof f.CategoricalColorMapper?_.CategoricalAxis:i instanceof f.LogColorMapper?_.LogAxis:_.LinearAxis;this._axis=new l(Object.assign(Object.assign(Object.assign({ticker:this._ticker,formatter:this._formatter,major_tick_in:this.model.major_tick_in,major_tick_out:this.model.major_tick_out,minor_tick_in:this.model.minor_tick_in,minor_tick_out:this.model.minor_tick_out,major_label_standoff:this.model.label_standoff,major_label_overrides:this.model.major_label_overrides,major_label_policy:this.model.major_label_policy,axis_line_color:null},a),n),o));const{title:c}=this.model;c&&(this._title=new s.Title(Object.assign({text:c,standoff:this.model.title_standoff},r)))}async lazy_initialize(){await super.lazy_initialize();const t=this,e={get parent(){return t.parent},get root(){return t.root},get frame(){return t._frame},get canvas_view(){return t.parent.canvas_view},request_layout(){t.parent.request_layout()}};this._axis_view=await S.build_view(this._axis,{parent:e}),null!=this._title&&(this._title_view=await S.build_view(this._title,{parent:e}))}remove(){var t;null===(t=this._title_view)||void 0===t||t.remove(),this._axis_view.remove(),super.remove()}connect_signals(){super.connect_signals(),this.connect(this._ticker.change,(()=>this.request_render())),this.connect(this._formatter.change,(()=>this.request_render())),this.connect(this.model.color_mapper.metrics_change,(()=>{const t=this._major_range,e=this._major_scale,{color_mapper:i}=this.model;if(i instanceof d.ContinuousColorMapper&&t instanceof b.Range1d){const{min:e,max:a}=i.metrics;t.setv({start:e,end:a})}if(i instanceof f.ScanningColorMapper&&e instanceof w.LinearInterpolationScale){const{binning:t}=i.metrics;e.binning=t}this._set_canvas_image(),this.plot_view.request_layout()}))}_set_canvas_image(){const{orientation:t}=this,e=(()=>{const{palette:e}=this.model.color_mapper;return"vertical"==t?k.reversed(e):e})(),[i,a]="vertical"==t?[1,e.length]:[e.length,1],n=this._image=document.createElement("canvas");n.width=i,n.height=a;const o=n.getContext("2d"),r=o.getImageData(0,0,i,a),s=new f.LinearColorMapper({palette:e}).rgba_mapper.v_compute(k.range(0,e.length));r.data.set(s),o.putImageData(r,0,0)}update_layout(){const{location:t,width:e,height:i,padding:a,margin:n}=this.model,[o,r]=(()=>{if(!M.isString(t))return["end","start"];switch(t){case"top_left":return["start","start"];case"top":case"top_center":return["start","center"];case"top_right":return["start","end"];case"bottom_left":return["end","start"];case"bottom":case"bottom_center":return["end","center"];case"bottom_right":return["end","end"];case"left":case"center_left":return["center","start"];case"center":case"center_center":return["center","center"];case"right":case"center_right":return["center","end"]}})(),s=this._orientation=(()=>{const{orientation:t}=this.model;return"auto"==t?null!=this.panel?this.panel.is_horizontal?"horizontal":"vertical":"start"==r||"end"==r||"center"==r&&"center"==o?"vertical":"horizontal":t})(),_=new C.NodeLayout,c=new C.VStack,h=new C.VStack,u=new C.HStack,p=new C.HStack;_.absolute=!0,c.absolute=!0,h.absolute=!0,u.absolute=!0,p.absolute=!0;const[m,g,d,f]=(()=>"horizontal"==s?[this._major_scale,this._minor_scale,this._major_range,this._minor_range]:[this._minor_scale,this._major_scale,this._minor_range,this._major_range])();this._frame=new l.CartesianFrame(m,g,d,f),_.on_resize((t=>this._frame.set_geometry(t)));const w=new j.BorderLayout;this._inner_layout=w,w.absolute=!0,w.center_panel=_,w.top_panel=c,w.bottom_panel=h,w.left_panel=u,w.right_panel=p;const b={left:a,right:a,top:a,bottom:a},v=(()=>{if(null==this.panel){if(M.isString(t))return{left:n,right:n,top:n,bottom:n};{const[e,i]=t;return{left:e,right:n,top:n,bottom:i}}}if(!M.isString(t)){const[e,i]=t;return{left:e,right:0,top:0,bottom:i}}})();let y,k,L,S;if(w.padding=b,null!=this.panel?(y="max",k=void 0,L=void 0,S=void 0):"auto"==("horizontal"==s?e:i)?(y="fixed",k=25*this.model.color_mapper.palette.length,L={percent:.3},S={percent:.8}):(y="fit",k=void 0),"horizontal"==s){const t="auto"==e?void 0:e,a="auto"==i?25:i;w.set_sizing({width_policy:y,height_policy:"min",width:k,min_width:L,max_width:S,halign:r,valign:o,margin:v}),w.center_panel.set_sizing({width_policy:"auto"==e?"fit":"fixed",height_policy:"fixed",width:t,height:a})}else{const t="auto"==e?25:e,a="auto"==i?void 0:i;w.set_sizing({width_policy:"min",height_policy:y,height:k,min_height:L,max_height:S,halign:r,valign:o,margin:v}),w.center_panel.set_sizing({width_policy:"fixed",height_policy:"auto"==i?"fit":"fixed",width:t,height:a})}c.set_sizing({width_policy:"fit",height_policy:"min"}),h.set_sizing({width_policy:"fit",height_policy:"min"}),u.set_sizing({width_policy:"min",height_policy:"fit"}),p.set_sizing({width_policy:"min",height_policy:"fit"});const{_title_view:T}=this;null!=T&&("horizontal"==s?(T.panel=new z.Panel("above"),T.update_layout(),c.children.push(T.layout)):(T.panel=new z.Panel("left"),T.update_layout(),u.children.push(T.layout)));const{panel:B}=this,A=null!=B&&s==B.orientation?B.side:"horizontal"==s?"below":"right",O=(()=>{switch(A){case"above":return c;case"below":return h;case"left":return u;case"right":return p}})(),{_axis_view:R}=this;if(R.panel=new z.Panel(A),R.update_layout(),O.children.push(R.layout),null!=this.panel){const t=new x.Grid([{layout:w,row:0,col:0}]);t.absolute=!0,"horizontal"==s?t.set_sizing({width_policy:"max",height_policy:"min"}):t.set_sizing({width_policy:"min",height_policy:"max"}),this.layout=t}else this.layout=this._inner_layout;const{visible:F}=this.model;this.layout.sizing.visible=F,this._set_canvas_image()}_render(){var t;const{ctx:e}=this.layer;e.save(),this._paint_bbox(e,this._inner_layout.bbox),this._paint_image(e,this._inner_layout.center_panel.bbox),null===(t=this._title_view)||void 0===t||t.render(),this._axis_view.render(),e.restore()}_paint_bbox(t,e){const{x:i,y:a}=e;let{width:n,height:o}=e;i+n>=this.parent.canvas_view.bbox.width&&(n-=1),a+o>=this.parent.canvas_view.bbox.height&&(o-=1),t.save(),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(t),t.fillRect(i,a,n,o)),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(t),t.strokeRect(i,a,n,o)),t.restore()}_paint_image(t,e){const{x:i,y:a,width:n,height:o}=e;t.save(),t.setImageSmoothingEnabled(!1),t.globalAlpha=this.model.scale_alpha,t.drawImage(this._image,i,a,n,o),this.visuals.bar_line.doit&&(this.visuals.bar_line.set_value(t),t.strokeRect(i,a,n,o)),t.restore()}serializable_state(){const t=super.serializable_state(),{children:e=[]}=t,i=o.__rest(t,["children"]);return null!=this._title_view&&e.push(this._title_view.serializable_state()),e.push(this._axis_view.serializable_state()),Object.assign(Object.assign({},i),{children:e})}}i.ColorBarView=T,T.__name__="ColorBarView";class B extends r.Annotation{constructor(t){super(t)}static init_ColorBar(){this.prototype.default_view=T,this.mixins([["major_label_",y.Text],["title_",y.Text],["major_tick_",y.Line],["minor_tick_",y.Line],["border_",y.Line],["bar_",y.Line],["background_",y.Fill]]),this.define((({Alpha:t,Number:e,String:i,Tuple:a,Dict:n,Or:o,Ref:r,Auto:s,Nullable:l})=>({location:[o(v.Anchor,a(e,e)),"top_right"],orientation:[o(v.Orientation,s),"auto"],title:[l(i),null],title_standoff:[e,2],width:[o(e,s),"auto"],height:[o(e,s),"auto"],scale_alpha:[t,1],ticker:[o(r(c.Ticker),s),"auto"],formatter:[o(r(u.TickFormatter),s),"auto"],major_label_overrides:[n(i),{}],major_label_policy:[r(m.LabelingPolicy),()=>new m.NoOverlap],color_mapper:[r(g.ColorMapper)],label_standoff:[e,5],margin:[e,30],padding:[e,10],major_tick_in:[e,5],major_tick_out:[e,0],minor_tick_in:[e,0],minor_tick_out:[e,0]}))),this.override({background_fill_color:"#ffffff",background_fill_alpha:.95,bar_line_color:null,border_line_color:null,major_label_text_font_size:"11px",major_tick_line_color:"#ffffff",minor_tick_line_color:null,title_text_font_size:"13px",title_text_font_style:"italic"})}}i.ColorBar=B,B.__name__="ColorBar",B.init_ColorBar()}, +function _(t,e,i,s,l){s();const o=t(1),a=t(139),n=t(20),r=t(143),c=o.__importStar(t(48));class h extends a.TextAnnotationView{_get_location(){const t=this.model.offset,e=this.model.standoff/2;let i,s;const{bbox:l}=this.layout;switch(this.panel.side){case"above":case"below":switch(this.model.vertical_align){case"top":s=l.top+e;break;case"middle":s=l.vcenter;break;case"bottom":s=l.bottom-e}switch(this.model.align){case"left":i=l.left+t;break;case"center":i=l.hcenter;break;case"right":i=l.right-t}break;case"left":switch(this.model.vertical_align){case"top":i=l.left+e;break;case"middle":i=l.hcenter;break;case"bottom":i=l.right-e}switch(this.model.align){case"left":s=l.bottom-t;break;case"center":s=l.vcenter;break;case"right":s=l.top+t}break;case"right":switch(this.model.vertical_align){case"top":i=l.right-e;break;case"middle":i=l.hcenter;break;case"bottom":i=l.left+e}switch(this.model.align){case"left":s=l.top+t;break;case"center":s=l.vcenter;break;case"right":s=l.bottom-t}}return[i,s]}_render(){const{text:t}=this.model;if(null==t||0==t.length)return;this.model.text_baseline=this.model.vertical_align,this.model.text_align=this.model.align;const[e,i]=this._get_location(),s=this.panel.get_label_angle_heuristic("parallel");("canvas"==this.model.render_mode?this._canvas_text.bind(this):this._css_text.bind(this))(this.layer.ctx,t,e,i,s)}_get_size(){const{text:t}=this.model;if(null==t||0==t.length)return{width:0,height:0};{const{ctx:e}=this.layer;this.visuals.text.set_value(e);const{width:i}=this.layer.ctx.measureText(t),{height:s}=r.font_metrics(e.font);return{width:i,height:2+s*this.model.text_line_height+this.model.standoff}}}}i.TitleView=h,h.__name__="TitleView";class _ extends a.TextAnnotation{constructor(t){super(t)}static init_Title(){this.prototype.default_view=h,this.mixins([c.Text,["border_",c.Line],["background_",c.Fill]]),this.define((({Number:t,String:e})=>({text:[e,""],vertical_align:[n.VerticalAlign,"bottom"],align:[n.TextAlign,"left"],offset:[t,0],standoff:[t,10]}))),this.prototype._props.text_align.options.internal=!0,this.prototype._props.text_baseline.options.internal=!0,this.override({text_font_size:"13px",text_font_style:"bold",text_line_height:1,background_fill_color:null,border_line_color:null})}}i.Title=_,_.__name__="Title",_.init_Title()}, +function _(e,t,s,i,n){i();const l=e(40),a=e(43),o=e(20),r=e(140),d=e(143),c=e(11);class _ extends l.AnnotationView{update_layout(){const{panel:e}=this;this.layout=null!=e?new r.SideLayout(e,(()=>this.get_size()),!0):void 0}initialize(){super.initialize(),"css"==this.model.render_mode&&(this.el=a.div(),this.plot_view.canvas_view.add_overlay(this.el))}remove(){null!=this.el&&a.remove(this.el),super.remove()}connect_signals(){super.connect_signals(),"css"==this.model.render_mode?this.connect(this.model.change,(()=>this.render())):this.connect(this.model.change,(()=>this.request_render()))}render(){this.model.visible||"css"!=this.model.render_mode||a.undisplay(this.el),super.render()}_calculate_text_dimensions(e,t){const{width:s}=e.measureText(t),{height:i}=d.font_metrics(this.visuals.text.font_value());return[s,i]}_calculate_bounding_box_dimensions(e,t){const[s,i]=this._calculate_text_dimensions(e,t);let n,l;switch(e.textAlign){case"left":n=0;break;case"center":n=-s/2;break;case"right":n=-s;break;default:c.unreachable()}switch(e.textBaseline){case"top":l=0;break;case"middle":l=-.5*i;break;case"bottom":l=-1*i;break;case"alphabetic":l=-.8*i;break;case"hanging":l=-.17*i;break;case"ideographic":l=-.83*i;break;default:c.unreachable()}return[n,l,s,i]}_canvas_text(e,t,s,i,n){this.visuals.text.set_value(e);const l=this._calculate_bounding_box_dimensions(e,t);e.save(),e.beginPath(),e.translate(s,i),n&&e.rotate(n),e.rect(l[0],l[1],l[2],l[3]),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(e),e.fill()),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(e),e.stroke()),this.visuals.text.doit&&(this.visuals.text.set_value(e),e.fillText(t,0,0)),e.restore()}_css_text(e,t,s,i,n){const{el:l}=this;c.assert(null!=l),a.undisplay(l),this.visuals.text.set_value(e);const[o,r]=this._calculate_bounding_box_dimensions(e,t);l.style.position="absolute",l.style.left=`${s+o}px`,l.style.top=`${i+r}px`,l.style.color=e.fillStyle,l.style.font=e.font,l.style.lineHeight="normal",n&&(l.style.transform=`rotate(${n}rad)`),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(e),l.style.backgroundColor=e.fillStyle),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(e),l.style.borderStyle=e.lineDash.length<2?"solid":"dashed",l.style.borderWidth=`${e.lineWidth}px`,l.style.borderColor=e.strokeStyle),l.textContent=t,a.display(l)}}s.TextAnnotationView=_,_.__name__="TextAnnotationView";class u extends l.Annotation{constructor(e){super(e)}static init_TextAnnotation(){this.define((()=>({render_mode:[o.RenderMode,"canvas"]})))}}s.TextAnnotation=u,u.__name__="TextAnnotation",u.init_TextAnnotation()}, +function _(t,e,i,l,r){l();const a=t(141),o=t(142),n=t(8),h=Math.PI/2,s={above:{parallel:0,normal:-h,horizontal:0,vertical:-h},below:{parallel:0,normal:h,horizontal:0,vertical:h},left:{parallel:-h,normal:0,horizontal:0,vertical:-h},right:{parallel:h,normal:0,horizontal:0,vertical:h}},c={above:{parallel:"bottom",normal:"center",horizontal:"bottom",vertical:"center"},below:{parallel:"top",normal:"center",horizontal:"top",vertical:"center"},left:{parallel:"bottom",normal:"center",horizontal:"center",vertical:"bottom"},right:{parallel:"bottom",normal:"center",horizontal:"center",vertical:"bottom"}},g={above:{parallel:"center",normal:"left",horizontal:"center",vertical:"left"},below:{parallel:"center",normal:"left",horizontal:"center",vertical:"left"},left:{parallel:"center",normal:"right",horizontal:"right",vertical:"center"},right:{parallel:"center",normal:"left",horizontal:"left",vertical:"center"}},_={above:"right",below:"left",left:"right",right:"left"},b={above:"left",below:"right",left:"right",right:"left"};class z{constructor(t){this.side=t}get dimension(){return"above"==this.side||"below"==this.side?0:1}get normals(){switch(this.side){case"above":return[0,-1];case"below":return[0,1];case"left":return[-1,0];case"right":return[1,0]}}get orientation(){return this.is_horizontal?"horizontal":"vertical"}get is_horizontal(){return 0==this.dimension}get is_vertical(){return 1==this.dimension}get_label_text_heuristics(t){const{side:e}=this;return n.isString(t)?{vertical_align:c[e][t],align:g[e][t]}:{vertical_align:"center",align:(t<0?_:b)[e]}}get_label_angle_heuristic(t){return n.isString(t)?s[this.side][t]:-t}}i.Panel=z,z.__name__="Panel";class m extends o.ContentLayoutable{constructor(t,e,i=!1){super(),this.panel=t,this.get_size=e,this.rotate=i,this.panel.is_horizontal?this.set_sizing({width_policy:"max",height_policy:"fixed"}):this.set_sizing({width_policy:"fixed",height_policy:"max"})}_content_size(){const{width:t,height:e}=this.get_size();return!this.rotate||this.panel.is_horizontal?new a.Sizeable({width:t,height:e}):new a.Sizeable({width:e,height:t})}has_size_changed(){const{width:t,height:e}=this._content_size();return this.panel.is_horizontal?this.bbox.height!=e:this.bbox.width!=t}}i.SideLayout=m,m.__name__="SideLayout"}, +function _(h,t,i,e,w){e();const n=h(21),{min:d,max:s}=Math;class g{constructor(h={}){this.width=null!=h.width?h.width:0,this.height=null!=h.height?h.height:0}bounded_to({width:h,height:t}){return new g({width:this.width==1/0&&null!=h?h:this.width,height:this.height==1/0&&null!=t?t:this.height})}expanded_to({width:h,height:t}){return new g({width:h!=1/0?s(this.width,h):this.width,height:t!=1/0?s(this.height,t):this.height})}expand_to({width:h,height:t}){this.width=s(this.width,h),this.height=s(this.height,t)}narrowed_to({width:h,height:t}){return new g({width:d(this.width,h),height:d(this.height,t)})}narrow_to({width:h,height:t}){this.width=d(this.width,h),this.height=d(this.height,t)}grow_by({left:h,right:t,top:i,bottom:e}){const w=this.width+h+t,n=this.height+i+e;return new g({width:w,height:n})}shrink_by({left:h,right:t,top:i,bottom:e}){const w=s(this.width-h-t,0),n=s(this.height-i-e,0);return new g({width:w,height:n})}map(h,t){return new g({width:h(this.width),height:(null!=t?t:h)(this.height)})}}i.Sizeable=g,g.__name__="Sizeable",i.SizingPolicy=n.Enum("fixed","fit","min","max")}, +function _(i,t,h,e,n){e();const s=i(141),r=i(99),g=i(8),{min:l,max:a,round:_}=Math;class o{constructor(){this.absolute=!1,this._bbox=new r.BBox,this._inner_bbox=new r.BBox,this._dirty=!1,this._handlers=[]}*[Symbol.iterator](){}get bbox(){return this._bbox}get inner_bbox(){return this._inner_bbox}get sizing(){return this._sizing}set visible(i){this._sizing.visible=i,this._dirty=!0}set_sizing(i){var t,h,e,n,s;const r=null!==(t=i.width_policy)&&void 0!==t?t:"fit",g=i.width,l=i.min_width,a=i.max_width,_=null!==(h=i.height_policy)&&void 0!==h?h:"fit",o=i.height,d=i.min_height,u=i.max_height,c=i.aspect,w=null!==(e=i.margin)&&void 0!==e?e:{top:0,right:0,bottom:0,left:0},m=!1!==i.visible,x=null!==(n=i.halign)&&void 0!==n?n:"start",b=null!==(s=i.valign)&&void 0!==s?s:"start";this._sizing={width_policy:r,min_width:l,width:g,max_width:a,height_policy:_,min_height:d,height:o,max_height:u,aspect:c,margin:w,visible:m,halign:x,valign:b,size:{width:g,height:o}},this._init()}_init(){}_set_geometry(i,t){this._bbox=i,this._inner_bbox=t}set_geometry(i,t){this._set_geometry(i,null!=t?t:i);for(const i of this._handlers)i(this._bbox,this._inner_bbox)}on_resize(i){this._handlers.push(i)}is_width_expanding(){return"max"==this.sizing.width_policy}is_height_expanding(){return"max"==this.sizing.height_policy}apply_aspect(i,{width:t,height:h}){const{aspect:e}=this.sizing;if(null!=e){const{width_policy:n,height_policy:s}=this.sizing,r=(i,t)=>{const h={max:4,fit:3,min:2,fixed:1};return h[i]>h[t]};if("fixed"!=n&&"fixed"!=s)if(n==s){const n=t,s=_(t/e),r=_(h*e),g=h;Math.abs(i.width-n)+Math.abs(i.height-s)<=Math.abs(i.width-r)+Math.abs(i.height-g)?(t=n,h=s):(t=r,h=g)}else r(n,s)?h=_(t/e):t=_(h*e);else"fixed"==n?h=_(t/e):"fixed"==s&&(t=_(h*e))}return{width:t,height:h}}measure(i){if(!this.sizing.visible)return{width:0,height:0};const t=new s.Sizeable(i).shrink_by(this.sizing.margin).map((i=>i==1/0&&"fixed"==this.sizing.width_policy&&null!=this.sizing.width?this.sizing.width:i),(i=>i==1/0&&"fixed"==this.sizing.height_policy&&null!=this.sizing.height?this.sizing.height:i)),h=this._measure(t),e=this.clip_size(h,t),n=this.apply_aspect(t,e);return Object.assign(Object.assign({},h),n)}compute(i={}){const t={width:null!=i.width&&this.is_width_expanding()?i.width:1/0,height:null!=i.height&&this.is_height_expanding()?i.height:1/0},h=this.measure(t),{width:e,height:n}=h,s=new r.BBox({left:0,top:0,width:e,height:n});let g;if(null!=h.inner){const{left:i,top:t,right:s,bottom:l}=h.inner;g=new r.BBox({left:i,top:t,right:e-s,bottom:n-l})}this.set_geometry(s,g)}get xview(){return this.bbox.xview}get yview(){return this.bbox.yview}clip_size(i,t){function h(i,t,h,e){return null==h?h=0:g.isNumber(h)||(h=Math.round(h.percent*t)),null==e?e=1/0:g.isNumber(e)||(e=Math.round(e.percent*t)),a(h,l(i,e))}return{width:h(i.width,t.width,this.sizing.min_width,this.sizing.max_width),height:h(i.height,t.height,this.sizing.min_height,this.sizing.max_height)}}has_size_changed(){const{_dirty:i}=this;return this._dirty=!1,i}}h.Layoutable=o,o.__name__="Layoutable";class d extends o{_measure(i){const{width_policy:t,height_policy:h}=this.sizing;return{width:(()=>{const{width:h}=this.sizing;if(i.width==1/0)return null!=h?h:0;switch(t){case"fixed":return null!=h?h:0;case"min":return null!=h?l(i.width,h):0;case"fit":return null!=h?l(i.width,h):i.width;case"max":return null!=h?a(i.width,h):i.width}})(),height:(()=>{const{height:t}=this.sizing;if(i.height==1/0)return null!=t?t:0;switch(h){case"fixed":return null!=t?t:0;case"min":return null!=t?l(i.height,t):0;case"fit":return null!=t?l(i.height,t):i.height;case"max":return null!=t?a(i.height,t):i.height}})()}}}h.LayoutItem=d,d.__name__="LayoutItem";class u extends o{_measure(i){const t=this._content_size(),h=i.bounded_to(this.sizing.size).bounded_to(t);return{width:(()=>{switch(this.sizing.width_policy){case"fixed":return null!=this.sizing.width?this.sizing.width:t.width;case"min":return t.width;case"fit":return h.width;case"max":return Math.max(t.width,h.width)}})(),height:(()=>{switch(this.sizing.height_policy){case"fixed":return null!=this.sizing.height?this.sizing.height:t.height;case"min":return t.height;case"fit":return h.height;case"max":return Math.max(t.height,h.height)}})()}}}h.ContentLayoutable=u,u.__name__="ContentLayoutable"}, +function _(t,e,n,r,a){r();const l=t(11),c=(()=>{try{return"undefined"!=typeof OffscreenCanvas&&null!=new OffscreenCanvas(0,0).getContext("2d")}catch(t){return!1}})()?(t,e)=>new OffscreenCanvas(t,e):(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},o=(()=>{const t=c(0,0).getContext("2d");return e=>{t.font=e;const n=t.measureText("M"),r=t.measureText("x"),a=t.measureText("Ã…Åšg|"),c=a.fontBoundingBoxAscent,o=a.fontBoundingBoxDescent;if(null!=c&&null!=o)return{height:c+o,ascent:c,descent:o,cap_height:n.actualBoundingBoxAscent,x_height:r.actualBoundingBoxAscent};const s=a.actualBoundingBoxAscent,u=a.actualBoundingBoxDescent;if(null!=s&&null!=u)return{height:s+u,ascent:s,descent:u,cap_height:n.actualBoundingBoxAscent,x_height:r.actualBoundingBoxAscent};l.unreachable()}})(),s=(()=>{const t=c(0,0).getContext("2d");return(e,n)=>{t.font=n;const r=t.measureText(e),a=r.actualBoundingBoxAscent,c=r.actualBoundingBoxDescent;if(null!=a&&null!=c)return{width:r.width,height:a+c,ascent:a,descent:c};l.unreachable()}})(),u=(()=>{const t=document.createElement("canvas"),e=t.getContext("2d");let n=-1,r=-1;return(a,l=1)=>{e.font=a;const{width:c}=e.measureText("M"),o=c*l,s=Math.ceil(o),u=Math.ceil(2*o),i=Math.ceil(1.5*o);n{let e=0;for(let n=0;n<=i;n++)for(let r=0;r{let e=t.length-4;for(let n=u;n>=i;n--)for(let r=0;r{const t=document.createElement("canvas"),e=t.getContext("2d");let n=-1,r=-1;return(a,l,c=1)=>{e.font=l;const{width:o}=e.measureText("M"),s=o*c,u=Math.ceil(s),i=Math.ceil(2*s),f=Math.ceil(1.5*s);(n{let e=0;for(let n=0;n<=f;n++)for(let r=0;r{let e=t.length-4;for(let n=i;n>=f;n--)for(let r=0;r{try{return o("normal 10px sans-serif"),o}catch(t){return u}})(),h=(()=>{try{return s("A","normal 10px sans-serif"),s}catch(t){return i}})(),g=new Map;function d(t){let e=g.get(t);return null==e&&(e={font:f(t),glyphs:new Map},g.set(t,e)),e.font}n.font_metrics=d,n.glyph_metrics=function(t,e){let n=g.get(e);null==n&&(d(e),n=g.get(e));let r=n.glyphs.get(t);return null==r&&(r=h(t,e),n.glyphs.set(t,r)),r}}, +function _(e,t,s,_,a){_();const r=e(145),n=e(157),g=e(156),i=e(159),c=e(104),h=e(99),o=e(13),l=e(11);class x{constructor(e,t,s,_,a={},r={}){this.in_x_scale=e,this.in_y_scale=t,this.x_range=s,this.y_range=_,this.extra_x_ranges=a,this.extra_y_ranges=r,this._bbox=new h.BBox,l.assert(null==e.source_range&&null==e.target_range),l.assert(null==t.source_range&&null==t.target_range),this._configure_scales()}get bbox(){return this._bbox}_get_ranges(e,t){return new Map(o.entries(Object.assign(Object.assign({},t),{default:e})))}_get_scales(e,t,s){const _=new Map;for(const[a,g]of t){if(g instanceof c.FactorRange!=e instanceof r.CategoricalScale)throw new Error(`Range ${g.type} is incompatible is Scale ${e.type}`);e instanceof n.LogScale&&g instanceof i.DataRange1d&&(g.scale_hint="log");const t=e.clone();t.setv({source_range:g,target_range:s}),_.set(a,t)}return _}_configure_frame_ranges(){const{bbox:e}=this;this._x_target=new g.Range1d({start:e.left,end:e.right}),this._y_target=new g.Range1d({start:e.bottom,end:e.top})}_configure_scales(){this._configure_frame_ranges(),this._x_ranges=this._get_ranges(this.x_range,this.extra_x_ranges),this._y_ranges=this._get_ranges(this.y_range,this.extra_y_ranges),this._x_scales=this._get_scales(this.in_x_scale,this._x_ranges,this._x_target),this._y_scales=this._get_scales(this.in_y_scale,this._y_ranges,this._y_target)}_update_scales(){this._configure_frame_ranges();for(const[,e]of this._x_scales)e.target_range=this._x_target;for(const[,e]of this._y_scales)e.target_range=this._y_target}set_geometry(e){this._bbox=e,this._update_scales()}get x_target(){return this._x_target}get y_target(){return this._y_target}get x_ranges(){return this._x_ranges}get y_ranges(){return this._y_ranges}get x_scales(){return this._x_scales}get y_scales(){return this._y_scales}get x_scale(){return this._x_scales.get("default")}get y_scale(){return this._y_scales.get("default")}get xscales(){return o.to_object(this.x_scales)}get yscales(){return o.to_object(this.y_scales)}}s.CartesianFrame=x,x.__name__="CartesianFrame"}, +function _(e,t,r,n,_){n();const c=e(146);class s extends c.Scale{constructor(e){super(e)}get s_compute(){const[e,t]=this._linear_compute_state(),r=this.source_range;return n=>e*r.synthetic(n)+t}compute(e){return super._linear_compute(this.source_range.synthetic(e))}v_compute(e){return super._linear_v_compute(this.source_range.v_synthetic(e))}invert(e){return this._linear_invert(e)}v_invert(e){return this._linear_v_invert(e)}}r.CategoricalScale=s,s.__name__="CategoricalScale"}, +function _(t,e,r,n,s){n();const i=t(147),_=t(105),a=t(156),c=t(24);class o extends i.Transform{constructor(t){super(t)}static init_Scale(){this.internal((({Ref:t})=>({source_range:[t(_.Range)],target_range:[t(a.Range1d)]})))}r_compute(t,e){return this.target_range.is_reversed?[this.compute(e),this.compute(t)]:[this.compute(t),this.compute(e)]}r_invert(t,e){return this.target_range.is_reversed?[this.invert(e),this.invert(t)]:[this.invert(t),this.invert(e)]}_linear_compute(t){const[e,r]=this._linear_compute_state();return e*t+r}_linear_v_compute(t){const[e,r]=this._linear_compute_state(),n=new c.ScreenArray(t.length);for(let s=0;s({args:[s(t),{}],func:[r,""],v_func:[r,""]})))}get names(){return o.keys(this.args)}get values(){return o.values(this.args)}_make_transform(t,r){return new Function(...this.names,t,u.use_strict(r))}get scalar_transform(){return this._make_transform("x",this.func)}get vector_transform(){return this._make_transform("xs",this.v_func)}compute(t){return this.scalar_transform(...this.values,t)}v_compute(t){return this.vector_transform(...this.values,t)}}s.CustomJSTransform=m,m.__name__="CustomJSTransform",m.init_CustomJSTransform()}, +function _(n,s,o,r,c){r();const e=n(53);class t extends e.Model{constructor(n){super(n)}}o.Transform=t,t.__name__="Transform"}, +function _(e,t,n,o,s){o();const i=e(151);class r extends i.RangeTransform{constructor(e){super(e)}static init_Dodge(){this.define((({Number:e})=>({value:[e,0]})))}_compute(e){return e+this.value}}n.Dodge=r,r.__name__="Dodge",r.init_Dodge()}, +function _(e,n,t,r,s){r();const a=e(149),i=e(105),o=e(104),c=e(24),f=e(8);class u extends a.Transform{constructor(e){super(e)}static init_RangeTransform(){this.define((({Ref:e,Nullable:n})=>({range:[n(e(i.Range)),null]})))}v_compute(e){let n;if(this.range instanceof o.FactorRange)n=this.range.v_synthetic(e);else{if(!f.isArrayableOf(e,f.isNumber))throw new Error("unexpected");n=e}const t=new(c.infer_type(n))(n.length);for(let e=0;e({x:[s(r,o(e))],y:[s(r,o(e))],data:[a(n(i.ColumnarDataSource)),null],clip:[t,!0]})))}connect_signals(){super.connect_signals(),this.connect(this.change,(()=>this._sorted_dirty=!0))}v_compute(t){const e=new(a.infer_type(t))(t.length);for(let r=0;rs*(e[t]-e[r]))),this._x_sorted=new(a.infer_type(e))(n),this._y_sorted=new(a.infer_type(r))(n);for(let t=0;t({mean:[t,0],width:[t,1],distribution:[o.Distribution,"uniform"]})))}v_compute(t){return null!=this.previous_values&&this.previous_values.length==t.length||(this.previous_values=super.v_compute(t)),this.previous_values}_compute(t){switch(this.distribution){case"uniform":return t+this.mean+(a.random()-.5)*this.width;case"normal":return t+a.rnorm(this.mean,this.width)}}}e.Jitter=h,h.__name__="Jitter",h.init_Jitter()}, +function _(t,s,_,r,e){r();const i=t(9),o=t(152);class n extends o.Interpolator{constructor(t){super(t)}compute(t){if(this.sort(!1),this.clip){if(tthis._x_sorted[this._x_sorted.length-1])return NaN}else{if(tthis._x_sorted[this._x_sorted.length-1])return this._y_sorted[this._y_sorted.length-1]}if(t==this._x_sorted[0])return this._y_sorted[0];const s=i.find_last_index(this._x_sorted,(s=>s({mode:[_.StepMode,"after"]})))}compute(t){if(this.sort(!1),this.clip){if(tthis._x_sorted[this._x_sorted.length-1])return NaN}else{if(tthis._x_sorted[this._x_sorted.length-1])return this._y_sorted[this._y_sorted.length-1]}let e;switch(this.mode){case"after":e=n.find_last_index(this._x_sorted,(e=>t>=e));break;case"before":e=n.find_index(this._x_sorted,(e=>t<=e));break;case"center":{const s=n.map(this._x_sorted,(e=>Math.abs(e-t))),r=n.min(s);e=n.find_index(s,(t=>r===t));break}default:throw new Error(`unknown mode: ${this.mode}`)}return-1!=e?this._y_sorted[e]:NaN}}s.StepInterpolator=d,d.__name__="StepInterpolator",d.init_StepInterpolator()}, +function _(t,e,s,n,i){n();const a=t(105);class r extends a.Range{constructor(t){super(t)}static init_Range1d(){this.define((({Number:t,Nullable:e})=>({start:[t,0],end:[t,1],reset_start:[e(t),null,{on_update(t,e){e._reset_start=null!=t?t:e.start}}],reset_end:[e(t),null,{on_update(t,e){e._reset_end=null!=t?t:e.end}}]})))}_set_auto_bounds(){if("auto"==this.bounds){const t=Math.min(this._reset_start,this._reset_end),e=Math.max(this._reset_start,this._reset_end);this.setv({bounds:[t,e]},{silent:!0})}}initialize(){super.initialize(),this._set_auto_bounds()}get min(){return Math.min(this.start,this.end)}get max(){return Math.max(this.start,this.end)}reset(){this._set_auto_bounds();const{_reset_start:t,_reset_end:e}=this;this.start!=t||this.end!=e?this.setv({start:t,end:e}):this.change.emit()}map(t){return new r({start:t(this.start),end:t(this.end)})}widen(t){let{start:e,end:s}=this;return this.is_reversed?(e+=t,s-=t):(e-=t,s+=t),new r({start:e,end:s})}}s.Range1d=r,r.__name__="Range1d",r.init_Range1d()}, +function _(t,e,o,n,s){n();const a=t(158),r=t(24);class c extends a.ContinuousScale{constructor(t){super(t)}get s_compute(){const[t,e,o,n]=this._compute_state();return s=>{if(0==o)return 0;{const a=(Math.log(s)-n)/o;return isFinite(a)?a*t+e:NaN}}}compute(t){const[e,o,n,s]=this._compute_state();let a;if(0==n)a=0;else{const r=(Math.log(t)-s)/n;a=isFinite(r)?r*e+o:NaN}return a}v_compute(t){const[e,o,n,s]=this._compute_state(),a=new r.ScreenArray(t.length);if(0==n)for(let e=0;e({start:[i],end:[i],range_padding:[i,.1],range_padding_units:[_.PaddingUnits,"percent"],flipped:[t,!1],follow:[n(_.StartEnd),null],follow_interval:[n(i),null],default_span:[i,2],only_visible:[t,!1]}))),this.internal((({Enum:t})=>({scale_hint:[t("log","auto"),"auto"]})))}initialize(){super.initialize(),this._initial_start=this.start,this._initial_end=this.end,this._initial_range_padding=this.range_padding,this._initial_range_padding_units=this.range_padding_units,this._initial_follow=this.follow,this._initial_follow_interval=this.follow_interval,this._initial_default_span=this.default_span,this._plot_bounds=new Map}get min(){return Math.min(this.start,this.end)}get max(){return Math.max(this.start,this.end)}computed_renderers(){const{renderers:t,names:i}=this,n=o.concat(this.plots.map((t=>t.data_renderers)));return d.compute_renderers(0==t.length?"auto":t,n,i)}_compute_plot_bounds(t,i){let n=r.empty();for(const a of t){const t=i.get(a);null==t||!a.visible&&this.only_visible||(n=r.union(n,t))}return n}adjust_bounds_for_aspect(t,i){const n=r.empty();let a=t.x1-t.x0;a<=0&&(a=1);let e=t.y1-t.y0;e<=0&&(e=1);const s=.5*(t.x1+t.x0),l=.5*(t.y1+t.y0);return al&&("start"==this.follow?e=a+s*l:"end"==this.follow&&(a=e-s*l)),[a,e]}update(t,i,n,a){if(this.have_updated_interactively)return;const e=this.computed_renderers();let s=this._compute_plot_bounds(e,t);null!=a&&(s=this.adjust_bounds_for_aspect(s,a)),this._plot_bounds.set(n,s);const[l,_]=this._compute_min_max(this._plot_bounds.values(),i);let[o,h]=this._compute_range(l,_);null!=this._initial_start&&("log"==this.scale_hint?this._initial_start>0&&(o=this._initial_start):o=this._initial_start),null!=this._initial_end&&("log"==this.scale_hint?this._initial_end>0&&(h=this._initial_end):h=this._initial_end);let r=!1;"auto"==this.bounds&&(this.setv({bounds:[o,h]},{silent:!0}),r=!0);const[d,u]=[this.start,this.end];if(o!=d||h!=u){const t={};o!=d&&(t.start=o),h!=u&&(t.end=h),this.setv(t),r=!1}r&&this.change.emit()}reset(){this.have_updated_interactively=!1,this.setv({range_padding:this._initial_range_padding,range_padding_units:this._initial_range_padding_units,follow:this._initial_follow,follow_interval:this._initial_follow_interval,default_span:this._initial_default_span},{silent:!0}),this.change.emit()}}n.DataRange1d=u,u.__name__="DataRange1d",u.init_DataRange1d()}, +function _(a,e,n,t,r){t();const s=a(105),i=a(62);class R extends s.Range{constructor(a){super(a)}static init_DataRange(){this.define((({String:a,Array:e,Ref:n})=>({names:[e(a),[]],renderers:[e(n(i.DataRenderer)),[]]})))}}n.DataRange=R,R.__name__="DataRange",R.init_DataRange()}, +function _(n,e,t,r,u){r();const l=n(9);t.compute_renderers=function(n,e,t){if(null==n)return[];let r="auto"==n?e:n;return t.length>0&&(r=r.filter((n=>l.includes(t,n.name)))),r}}, +function _(i,s,x,A,o){A(),o("Axis",i(163).Axis),o("CategoricalAxis",i(170).CategoricalAxis),o("ContinuousAxis",i(173).ContinuousAxis),o("DatetimeAxis",i(174).DatetimeAxis),o("LinearAxis",i(175).LinearAxis),o("LogAxis",i(192).LogAxis),o("MercatorAxis",i(195).MercatorAxis)}, +function _(t,e,i,s,o){s();const n=t(1),a=t(164),l=t(165),r=t(166),_=t(169),c=n.__importStar(t(48)),h=t(20),b=t(24),m=t(140),d=t(9),u=t(8),x=t(167),g=t(104),{abs:f}=Math;class p extends a.GuideRendererView{update_layout(){this.layout=new m.SideLayout(this.panel,(()=>this.get_size()),!0)}get_size(){const{visible:t,fixed_location:e}=this.model;if(t&&null==e&&this.is_renderable){const{extents:t}=this;return{width:0,height:Math.round(t.tick+t.tick_label+t.axis_label)}}return{width:0,height:0}}get is_renderable(){const[t,e]=this.ranges;return t.is_valid&&e.is_valid}_render(){var t;if(!this.is_renderable)return;const{tick_coords:e,extents:i}=this,s=this.layer.ctx;s.save(),this._draw_rule(s,i),this._draw_major_ticks(s,i,e),this._draw_minor_ticks(s,i,e),this._draw_major_labels(s,i,e),this._draw_axis_label(s,i,e),null===(t=this._paint)||void 0===t||t.call(this,s,i,e),s.restore()}connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.plot_view.request_layout()))}get needs_clip(){return null!=this.model.fixed_location}_draw_rule(t,e){if(!this.visuals.axis_line.doit)return;const[i,s]=this.rule_coords,[o,n]=this.coordinates.map_to_screen(i,s),[a,l]=this.normals,[r,_]=this.offsets;this.visuals.axis_line.set_value(t),t.beginPath();for(let e=0;e0?o+s+3:0}_draw_axis_label(t,e,i){const s=this.model.axis_label;if(!s||null!=this.model.fixed_location)return;const o=new x.TextBox({text:s});o.angle=this.panel.get_label_angle_heuristic("parallel"),o.visuals=this.visuals.axis_label_text;const[n,a]=(()=>{const{bbox:t}=this.layout;switch(this.panel.side){case"above":return[t.hcenter,t.bottom];case"below":return[t.hcenter,t.top];case"left":return[t.right,t.vcenter];case"right":return[t.left,t.vcenter]}})(),[l,r]=this.normals,_=e.tick+e.tick_label+this.model.axis_label_standoff,{vertical_align:c,align:h}=this.panel.get_label_text_heuristics("parallel");o.position={sx:n+l*_,sy:a+r*_,x_anchor:h,y_anchor:c},o.align=h,o.paint(t)}_draw_ticks(t,e,i,s,o){if(!o.doit)return;const[n,a]=e,[l,r]=this.coordinates.map_to_screen(n,a),[_,c]=this.normals,[h,b]=this.offsets,[m,d]=[_*(h-i),c*(b-i)],[u,x]=[_*(h+s),c*(b+s)];o.set_value(t),t.beginPath();for(let e=0;et.bbox())),O=(()=>{const[t]=this.ranges;return t.is_reversed?0==this.dimension?(t,e)=>T[t].left-T[e].right:(t,e)=>T[e].top-T[t].bottom:0==this.dimension?(t,e)=>T[e].left-T[t].right:(t,e)=>T[t].top-T[e].bottom})(),{major_label_policy:A}=this.model,M=A.filter(v,T,O),z=[...M.ones()];if(0!=z.length){const t=this.parent.canvas_view.bbox,e=e=>{const i=T[e];if(i.left<0){const t=-i.left,{position:s}=y[e];y[e].position=Object.assign(Object.assign({},s),{sx:s.sx+t})}else if(i.right>t.width){const s=i.right-t.width,{position:o}=y[e];y[e].position=Object.assign(Object.assign({},o),{sx:o.sx-s})}},i=e=>{const i=T[e];if(i.top<0){const t=-i.top,{position:s}=y[e];y[e].position=Object.assign(Object.assign({},s),{sy:s.sy+t})}else if(i.bottom>t.height){const s=i.bottom-t.height,{position:o}=y[e];y[e].position=Object.assign(Object.assign({},o),{sy:o.sy-s})}},s=z[0],o=z[z.length-1];0==this.dimension?(e(s),e(o)):(i(s),i(o))}for(const e of M){y[e].paint(t)}}_tick_extent(){return this.model.major_tick_out}_tick_label_extents(){const t=this.tick_coords.major,e=this.compute_labels(t[this.dimension]),i=this.model.major_label_orientation,s=this.model.major_label_standoff,o=this.visuals.major_label_text;return[this._oriented_labels_extent(e,i,s,o)]}get extents(){const t=this._tick_label_extents();return{tick:this._tick_extent(),tick_labels:t,tick_label:d.sum(t),axis_label:this._axis_label_extent()}}_oriented_labels_extent(t,e,i,s){if(0==t.length)return 0;const o=this.panel.get_label_angle_heuristic(e);t.visuals=s,t.angle=o;const n=t.max_size(),a=0==this.dimension?n.height:n.width;return a>0?i+a+3:0}get normals(){return this.panel.normals}get dimension(){return this.panel.dimension}compute_labels(t){const e=this.model.formatter.format_graphics(t,this),{major_label_overrides:i}=this.model;for(let s=0;sf(a-l)?(t=_(r(o,n),a),s=r(_(o,n),l)):(t=r(o,n),s=_(o,n)),[t,s]}}get rule_coords(){const t=this.dimension,e=(t+1)%2,[i]=this.ranges,[s,o]=this.computed_bounds,n=[new Array(2),new Array(2)];return n[t][0]=Math.max(s,i.min),n[t][1]=Math.min(o,i.max),n[t][0]>n[t][1]&&(n[t][0]=n[t][1]=NaN),n[e][0]=this.loc,n[e][1]=this.loc,n}get tick_coords(){const t=this.dimension,e=(t+1)%2,[i]=this.ranges,[s,o]=this.computed_bounds,n=this.model.ticker.get_ticks(s,o,i,this.loc),a=n.major,l=n.minor,r=[[],[]],_=[[],[]],[c,h]=[i.min,i.max];for(let i=0;ih||(r[t].push(a[i]),r[e].push(this.loc));for(let i=0;ih||(_[t].push(l[i]),_[e].push(this.loc));return{major:r,minor:_}}get loc(){const{fixed_location:t}=this.model;if(null!=t){if(u.isNumber(t))return t;const[,e]=this.ranges;if(e instanceof g.FactorRange)return e.synthetic(t);throw new Error("unexpected")}const[,e]=this.ranges;switch(this.panel.side){case"left":case"below":return e.start;case"right":case"above":return e.end}}serializable_state(){return Object.assign(Object.assign({},super.serializable_state()),{bbox:this.layout.bbox.box})}}i.AxisView=p,p.__name__="AxisView";class k extends a.GuideRenderer{constructor(t){super(t)}static init_Axis(){this.prototype.default_view=p,this.mixins([["axis_",c.Line],["major_tick_",c.Line],["minor_tick_",c.Line],["major_label_",c.Text],["axis_label_",c.Text]]),this.define((({Any:t,Int:e,Number:i,String:s,Ref:o,Dict:n,Tuple:a,Or:c,Nullable:b,Auto:m})=>({bounds:[c(a(i,i),m),"auto"],ticker:[o(l.Ticker)],formatter:[o(r.TickFormatter)],axis_label:[b(s),""],axis_label_standoff:[e,5],major_label_standoff:[e,5],major_label_orientation:[c(h.TickLabelOrientation,i),"horizontal"],major_label_overrides:[n(s),{}],major_label_policy:[o(_.LabelingPolicy),()=>new _.AllLabels],major_tick_in:[i,2],major_tick_out:[i,6],minor_tick_in:[i,0],minor_tick_out:[i,4],fixed_location:[b(c(i,t)),null]}))),this.override({axis_line_color:"black",major_tick_line_color:"black",minor_tick_line_color:"black",major_label_text_font_size:"11px",major_label_text_align:"center",major_label_text_baseline:"alphabetic",axis_label_text_font_size:"13px",axis_label_text_font_style:"italic"})}}i.Axis=k,k.__name__="Axis",k.init_Axis()}, +function _(e,r,d,i,n){i();const s=e(41);class t extends s.RendererView{}d.GuideRendererView=t,t.__name__="GuideRendererView";class _ extends s.Renderer{constructor(e){super(e)}static init_GuideRenderer(){this.override({level:"guide"})}}d.GuideRenderer=_,_.__name__="GuideRenderer",_.init_GuideRenderer()}, +function _(c,e,n,s,o){s();const r=c(53);class t extends r.Model{constructor(c){super(c)}}n.Ticker=t,t.__name__="Ticker"}, +function _(t,o,r,e,c){e();const n=t(53),a=t(167);class m extends n.Model{constructor(t){super(t)}format_graphics(t,o){return this.doFormat(t,o).map((t=>new a.TextBox({text:t})))}compute(t,o){return this.doFormat([t],null!=o?o:{loc:0})[0]}v_compute(t,o){return this.doFormat(t,null!=o?o:{loc:0})}}r.TickFormatter=m,m.__name__="TickFormatter"}, +function _(t,e,s,i,n){i();const h=t(99),o=t(143),r=t(9),a=t(8),c=t(168),_=t(22);s.text_width=(()=>{const t=document.createElement("canvas").getContext("2d");let e="";return(s,i)=>(i!=e&&(e=i,t.font=i),t.measureText(s).width)})();class l{constructor(){this._position={sx:0,sy:0},this.font_size_scale=1}set position(t){this._position=t}get position(){return this._position}infer_text_height(){return"ascent_descent"}bbox(){const{p0:t,p1:e,p2:s,p3:i}=this.rect(),n=Math.min(t.x,e.x,s.x,i.x),o=Math.min(t.y,e.y,s.y,i.y),r=Math.max(t.x,e.x,s.x,i.x),a=Math.max(t.y,e.y,s.y,i.y);return new h.BBox({left:n,right:r,top:o,bottom:a})}size(){const{width:t,height:e}=this._size(),{angle:s}=this;if(s){const i=Math.cos(Math.abs(s)),n=Math.sin(Math.abs(s));return{width:Math.abs(t*i+e*n),height:Math.abs(t*n+e*i)}}return{width:t,height:e}}rect(){const t=this._rect(),{angle:e}=this;if(e){const{sx:s,sy:i}=this.position,n=new c.AffineTransform;return n.translate(s,i),n.rotate(e),n.translate(-s,-i),n.apply_rect(t)}return t}paint_rect(t){const{p0:e,p1:s,p2:i,p3:n}=this.rect();t.save(),t.strokeStyle="red",t.lineWidth=1,t.beginPath();const{round:h}=Math;t.moveTo(h(e.x),h(e.y)),t.lineTo(h(s.x),h(s.y)),t.lineTo(h(i.x),h(i.y)),t.lineTo(h(n.x),h(n.y)),t.closePath(),t.stroke(),t.restore()}paint_bbox(t){const{x:e,y:s,width:i,height:n}=this.bbox();t.save(),t.strokeStyle="blue",t.lineWidth=1,t.beginPath();const{round:h}=Math;t.moveTo(h(e),h(s)),t.lineTo(h(e),h(s+n)),t.lineTo(h(e+i),h(s+n)),t.lineTo(h(e+i),h(s)),t.closePath(),t.stroke(),t.restore()}}s.GraphicsBox=l,l.__name__="GraphicsBox";class x extends l{constructor({text:t}){super(),this.align="left",this.text=t}set visuals(t){const e=t.text_color.get_value(),s=t.text_alpha.get_value(),i=t.text_font_style.get_value();let n=t.text_font_size.get_value();const h=t.text_font.get_value(),{font_size_scale:o}=this;if(1!=o){const t=n.match(/^\s*(\d+(\.\d+)?)(\w+)\s*$/);if(null!=t){const[,e,,s]=t,i=Number(e);isNaN(i)||(n=`${i*o}${s}`)}}const r=`${i} ${n} ${h}`;this.font=r,this.color=_.color2css(e,s),this.line_height=t.text_line_height.get_value()}infer_text_height(){if(this.text.includes("\n"))return"ascent_descent";return function(t){for(const e of new Set(t))if(!("0"<=e&&e<="9"))switch(e){case",":case".":case"+":case"-":case"−":case"e":continue;default:return!1}return!0}(this.text)?"cap":"ascent_descent"}_text_line(t){var e;const s=null!==(e=this.text_height_metric)&&void 0!==e?e:this.infer_text_height(),i=(()=>{switch(s){case"x":case"x_descent":return t.x_height;case"cap":case"cap_descent":return t.cap_height;case"ascent":case"ascent_descent":return t.ascent}})(),n=(()=>{switch(s){case"x":case"cap":case"ascent":return 0;case"x_descent":case"cap_descent":case"ascent_descent":return t.descent}})();return{height:i+n,ascent:i,descent:n}}get nlines(){return this.text.split("\n").length}_size(){var t,e;const{font:i}=this,n=o.font_metrics(i),h=(this.line_height-1)*n.height,a=""==this.text,c=this.text.split("\n"),_=c.length,l=c.map((t=>s.text_width(t,i))),x=this._text_line(n).height*_,u="%"==(null===(t=this.width)||void 0===t?void 0:t.unit)?this.width.value:1,p="%"==(null===(e=this.height)||void 0===e?void 0:e.unit)?this.height.value:1;return{width:r.max(l)*u,height:a?0:(x+h*(_-1))*p,metrics:n}}_computed_position(t,e,s){const{width:i,height:n}=t,{sx:h,sy:o,x_anchor:r="left",y_anchor:c="center"}=this.position;return{x:h-(()=>{if(a.isNumber(r))return r*i;switch(r){case"left":return 0;case"center":return.5*i;case"right":return i}})(),y:o-(()=>{var t;if(a.isNumber(c))return c*n;switch(c){case"top":return 0;case"center":return.5*n;case"bottom":return n;case"baseline":if(1!=s)return.5*n;switch(null!==(t=this.text_height_metric)&&void 0!==t?t:this.infer_text_height()){case"x":case"x_descent":return e.x_height;case"cap":case"cap_descent":return e.cap_height;case"ascent":case"ascent_descent":return e.ascent}}})()}}_rect(){const{width:t,height:e,metrics:s}=this._size(),i=this.text.split("\n").length,{x:n,y:o}=this._computed_position({width:t,height:e},s,i);return new h.BBox({x:n,y:o,width:t,height:e}).rect}paint(t){var e,i;const{font:n}=this,h=o.font_metrics(n),a=(this.line_height-1)*h.height,c=this.text.split("\n"),_=c.length,l=c.map((t=>s.text_width(t,n))),x=this._text_line(h),u=x.height*_,p="%"==(null===(e=this.width)||void 0===e?void 0:e.unit)?this.width.value:1,g="%"==(null===(i=this.height)||void 0===i?void 0:i.unit)?this.height.value:1,f=r.max(l)*p,d=(u+a*(_-1))*g;t.save(),t.fillStyle=this.color,t.font=this.font,t.textAlign="left",t.textBaseline="alphabetic";const{sx:m,sy:b}=this.position,{align:y}=this,{angle:w}=this;w&&(t.translate(m,b),t.rotate(w),t.translate(-m,-b));let{x:v,y:z}=this._computed_position({width:f,height:d},h,_);if("justify"==y)for(let e=0;e<_;e++){let i=v;const h=c[e].split(" "),o=h.length,_=h.map((t=>s.text_width(t,n))),l=(f-r.sum(_))/(o-1);for(let e=0;e{switch(y){case"left":return 0;case"center":return.5*(f-l[e]);case"right":return f-l[e]}})();t.fillStyle=this.color,t.fillText(c[e],s,z+x.ascent),z+=x.height+a}t.restore()}}s.TextBox=x,x.__name__="TextBox";class u extends l{constructor(t,e){super(),this.base=t,this.expo=e}get children(){return[this.base,this.expo]}set position(t){this._position=t;const e=this.base.size(),s=this.expo.size(),i=this._shift_scale()*e.height,n=Math.max(e.height,i+s.height);this.base.position={sx:0,x_anchor:"left",sy:n,y_anchor:"bottom"},this.expo.position={sx:e.width,x_anchor:"left",sy:i,y_anchor:"bottom"}}get position(){return this._position}set visuals(t){this.expo.font_size_scale=.7,this.base.visuals=t,this.expo.visuals=t}_shift_scale(){if(this.base instanceof x&&1==this.base.nlines){const{x_height:t,cap_height:e}=o.font_metrics(this.base.font);return t/e}return 2/3}infer_text_height(){return this.base.infer_text_height()}_rect(){const t=this.base.bbox(),e=this.expo.bbox(),s=t.union(e),{x:i,y:n}=this._computed_position();return s.translate(i,n).rect}_size(){const t=this.base.size(),e=this.expo.size();return{width:t.width+e.width,height:Math.max(t.height,this._shift_scale()*t.height+e.height)}}paint(t){t.save();const{angle:e}=this;if(e){const{sx:s,sy:i}=this.position;t.translate(s,i),t.rotate(e),t.translate(-s,-i)}const{x:s,y:i}=this._computed_position();t.translate(s,i),this.base.paint(t),this.expo.paint(t),t.restore()}paint_bbox(t){super.paint_bbox(t);const{x:e,y:s}=this._computed_position();t.save(),t.translate(e,s);for(const e of this.children)e.paint_bbox(t);t.restore()}_computed_position(){const{width:t,height:e}=this._size(),{sx:s,sy:i,x_anchor:n="left",y_anchor:h="center"}=this.position;return{x:s-(()=>{if(a.isNumber(n))return n*t;switch(n){case"left":return 0;case"center":return.5*t;case"right":return t}})(),y:i-(()=>{if(a.isNumber(h))return h*e;switch(h){case"top":return 0;case"center":return.5*e;case"bottom":return e;case"baseline":return.5*e}})()}}}s.BaseExpo=u,u.__name__="BaseExpo";class p{constructor(t){this.items=t}get length(){return this.items.length}set visuals(t){for(const e of this.items)e.visuals=t;const e={x:0,cap:1,ascent:2,x_descent:3,cap_descent:4,ascent_descent:5},s=r.max_by(this.items.map((t=>t.infer_text_height())),(t=>e[t]));for(const t of this.items)t.text_height_metric=s}set angle(t){for(const e of this.items)e.angle=t}max_size(){let t=0,e=0;for(const s of this.items){const i=s.size();t=Math.max(t,i.width),e=Math.max(e,i.height)}return{width:t,height:e}}}s.GraphicsBoxes=p,p.__name__="GraphicsBoxes"}, +function _(t,s,r,n,i){n();const{sin:e,cos:a}=Math;class h{constructor(t=1,s=0,r=0,n=1,i=0,e=0){this.a=t,this.b=s,this.c=r,this.d=n,this.e=i,this.f=e}toString(){const{a:t,b:s,c:r,d:n,e:i,f:e}=this;return`matrix(${t}, ${s}, ${r}, ${n}, ${i}, ${e})`}clone(){const{a:t,b:s,c:r,d:n,e:i,f:e}=this;return new h(t,s,r,n,i,e)}get is_identity(){const{a:t,b:s,c:r,d:n,e:i,f:e}=this;return 1==t&&0==s&&0==r&&1==n&&0==i&&0==e}apply_point(t){const[s,r]=this.apply(t.x,t.y);return{x:s,y:r}}apply_rect(t){return{p0:this.apply_point(t.p0),p1:this.apply_point(t.p1),p2:this.apply_point(t.p2),p3:this.apply_point(t.p3)}}apply(t,s){const{a:r,b:n,c:i,d:e,e:a,f:h}=this;return[r*t+i*s+a,n*t+e*s+h]}iv_apply(t,s){const{a:r,b:n,c:i,d:e,e:a,f:h}=this,p=t.length;for(let o=0;o({min_distance:[e,5]})))}filter(e,n,s){const{min_distance:t}=this;let i=null;for(const n of e)null!=i&&s(i,n)({args:[s(e),{}],code:[n,""]})))}get names(){return c.keys(this.args)}get values(){return c.values(this.args)}get func(){const e=o.use_strict(this.code);return new a.GeneratorFunction("indices","bboxes","distance",...this.names,e)}filter(e,n,s){const t=Object.create(null),i=this.func.call(t,e,n,s,...this.values);let l=i.next();if(l.done&&void 0!==l.value){const{value:n}=l;return n instanceof a.Indices?n:void 0===n?e:r.isIterable(n)?a.Indices.from_indices(e.size,n):a.Indices.all_unset(e.size)}{const n=[];do{n.push(l.value),l=i.next()}while(!l.done);return a.Indices.from_indices(e.size,n)}}}s.CustomLabelingPolicy=m,m.__name__="CustomLabelingPolicy",m.init_CustomLabelingPolicy()}, +function _(t,s,e,o,i){o();const a=t(1),r=t(163),l=t(171),_=t(172),n=a.__importStar(t(48)),c=t(20),p=t(167),h=t(8);class m extends r.AxisView{_paint(t,s,e){this._draw_group_separators(t,s,e)}_draw_group_separators(t,s,e){const[o]=this.ranges,[i,a]=this.computed_bounds;if(!o.tops||o.tops.length<2||!this.visuals.separator_line.doit)return;const r=this.dimension,l=(r+1)%2,_=[[],[]];let n=0;for(let t=0;ti&&cnew p.GraphicsBoxes(t.map((t=>h.isString(t)?new p.TextBox({text:t}):t))),_=t=>l(this.model.formatter.doFormat(t,this));if(1==t.levels){const t=_(i.major);r.push([t,a.major,this.model.major_label_orientation,this.visuals.major_label_text])}else if(2==t.levels){const t=_(i.major.map((t=>t[1])));r.push([t,a.major,this.model.major_label_orientation,this.visuals.major_label_text]),r.push([l(i.tops),a.tops,this.model.group_label_orientation,this.visuals.group_text])}else if(3==t.levels){const t=_(i.major.map((t=>t[2]))),s=i.mids.map((t=>t[1]));r.push([t,a.major,this.model.major_label_orientation,this.visuals.major_label_text]),r.push([l(s),a.mids,this.model.subgroup_label_orientation,this.visuals.subgroup_text]),r.push([l(i.tops),a.tops,this.model.group_label_orientation,this.visuals.group_text])}return r}get tick_coords(){const t=this.dimension,s=(t+1)%2,[e]=this.ranges,[o,i]=this.computed_bounds,a=this.model.ticker.get_ticks(o,i,e,this.loc),r={major:[[],[]],mids:[[],[]],tops:[[],[]],minor:[[],[]]};return r.major[t]=a.major,r.major[s]=a.major.map((()=>this.loc)),3==e.levels&&(r.mids[t]=a.mids,r.mids[s]=a.mids.map((()=>this.loc))),e.levels>1&&(r.tops[t]=a.tops,r.tops[s]=a.tops.map((()=>this.loc))),r}}e.CategoricalAxisView=m,m.__name__="CategoricalAxisView";class u extends r.Axis{constructor(t){super(t)}static init_CategoricalAxis(){this.prototype.default_view=m,this.mixins([["separator_",n.Line],["group_",n.Text],["subgroup_",n.Text]]),this.define((({Number:t,Or:s})=>({group_label_orientation:[s(c.TickLabelOrientation,t),"parallel"],subgroup_label_orientation:[s(c.TickLabelOrientation,t),"parallel"]}))),this.override({ticker:()=>new l.CategoricalTicker,formatter:()=>new _.CategoricalTickFormatter,separator_line_color:"lightgrey",separator_line_width:2,group_text_font_style:"bold",group_text_font_size:"11px",group_text_color:"grey",subgroup_text_font_style:"bold",subgroup_text_font_size:"11px"})}}e.CategoricalAxis=u,u.__name__="CategoricalAxis",u.init_CategoricalAxis()}, +function _(t,c,o,s,e){s();const r=t(165);class i extends r.Ticker{constructor(t){super(t)}get_ticks(t,c,o,s){var e,r;return{major:this._collect(o.factors,o,t,c),minor:[],tops:this._collect(null!==(e=o.tops)&&void 0!==e?e:[],o,t,c),mids:this._collect(null!==(r=o.mids)&&void 0!==r?r:[],o,t,c)}}_collect(t,c,o,s){const e=[];for(const r of t){const t=c.synthetic(r);t>o&&tnew m.DatetimeTicker,formatter:()=>new r.DatetimeTickFormatter})}}i.DatetimeAxis=c,c.__name__="DatetimeAxis",c.init_DatetimeAxis()}, +function _(i,e,s,n,t){n();const r=i(173),a=i(176),o=i(177);class c extends r.ContinuousAxisView{}s.LinearAxisView=c,c.__name__="LinearAxisView";class _ extends r.ContinuousAxis{constructor(i){super(i)}static init_LinearAxis(){this.prototype.default_view=c,this.override({ticker:()=>new o.BasicTicker,formatter:()=>new a.BasicTickFormatter})}}s.LinearAxis=_,_.__name__="LinearAxis",_.init_LinearAxis()}, +function _(i,t,e,n,o){n();const s=i(166),r=i(34);function c(i){let t="";for(const e of i)t+="-"==e?"−":e;return t}e.unicode_replace=c;class _ extends s.TickFormatter{constructor(i){super(i),this.last_precision=3}static init_BasicTickFormatter(){this.define((({Boolean:i,Int:t,Auto:e,Or:n})=>({precision:[n(t,e),"auto"],use_scientific:[i,!0],power_limit_high:[t,5],power_limit_low:[t,-3]})))}get scientific_limit_low(){return 10**this.power_limit_low}get scientific_limit_high(){return 10**this.power_limit_high}_need_sci(i){if(!this.use_scientific)return!1;const{scientific_limit_high:t}=this,{scientific_limit_low:e}=this,n=i.length<2?0:Math.abs(i[1]-i[0])/1e4;for(const o of i){const i=Math.abs(o);if(!(i<=n)&&(i>=t||i<=e))return!0}return!1}_format_with_precision(i,t,e){return t?i.map((i=>c(i.toExponential(e)))):i.map((i=>c(r.to_fixed(i,e))))}_auto_precision(i,t){const e=new Array(i.length),n=this.last_precision<=15;i:for(let o=this.last_precision;n?o<=15:o>=1;n?o++:o--){if(t){e[0]=i[0].toExponential(o);for(let t=1;t({base:[t,10],mantissas:[i(t),[1,2,5]],min_interval:[t,0],max_interval:[a(t),null]})))}get_min_interval(){return this.min_interval}get_max_interval(){var t;return null!==(t=this.max_interval)&&void 0!==t?t:1/0}initialize(){super.initialize();const t=r.nth(this.mantissas,-1)/this.base,i=r.nth(this.mantissas,0)*this.base;this.extended_mantissas=[t,...this.mantissas,i],this.base_factor=0===this.get_min_interval()?1:this.get_min_interval()}get_interval(t,i,a){const e=i-t,s=this.get_ideal_interval(t,i,a),n=Math.floor(_.log(s/this.base_factor,this.base)),l=this.base**n*this.base_factor,h=this.extended_mantissas,m=h.map((t=>Math.abs(a-e/(t*l)))),v=h[r.argmin(m)]*l;return _.clamp(v,this.get_min_interval(),this.get_max_interval())}}a.AdaptiveTicker=l,l.__name__="AdaptiveTicker",l.init_AdaptiveTicker()}, +function _(t,i,n,s,e){s();const o=t(165),r=t(9);class c extends o.Ticker{constructor(t){super(t)}static init_ContinuousTicker(){this.define((({Int:t})=>({num_minor_ticks:[t,5],desired_num_ticks:[t,6]})))}get_ticks(t,i,n,s){return this.get_ticks_no_defaults(t,i,s,this.desired_num_ticks)}get_ticks_no_defaults(t,i,n,s){const e=this.get_interval(t,i,s),o=Math.floor(t/e),c=Math.ceil(i/e);let _;_=isFinite(o)&&isFinite(c)?r.range(o,c+1):[];const u=_.map((t=>t*e)).filter((n=>t<=n&&n<=i)),a=this.num_minor_ticks,f=[];if(a>0&&u.length>0){const n=e/a,s=r.range(0,a).map((t=>t*n));for(const n of s.slice(1)){const s=u[0]-n;t<=s&&s<=i&&f.push(s)}for(const n of u)for(const e of s){const s=n+e;t<=s&&s<=i&&f.push(s)}}return{major:u,minor:f}}get_ideal_interval(t,i,n){return(i-t)/n}}n.ContinuousTicker=c,c.__name__="ContinuousTicker",c.init_ContinuousTicker()}, +function _(t,s,e,i,n){i();const r=t(1).__importDefault(t(181)),o=t(166),a=t(19),c=t(182),m=t(9),u=t(8);function h(t){return r.default(t,"%Y %m %d %H %M %S").split(/\s+/).map((t=>parseInt(t,10)))}function d(t,s){if(u.isFunction(s))return s(t);{const e=c.sprintf("$1%06d",function(t){return Math.round(t/1e3%1*1e6)}(t));return-1==(s=s.replace(/((^|[^%])(%%)*)%f/,e)).indexOf("%")?s:r.default(t,s)}}const l=["microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"];class f extends o.TickFormatter{constructor(t){super(t),this.strip_leading_zeros=!0}static init_DatetimeTickFormatter(){this.define((({String:t,Array:s})=>({microseconds:[s(t),["%fus"]],milliseconds:[s(t),["%3Nms","%S.%3Ns"]],seconds:[s(t),["%Ss"]],minsec:[s(t),[":%M:%S"]],minutes:[s(t),[":%M","%Mm"]],hourmin:[s(t),["%H:%M"]],hours:[s(t),["%Hh","%H:%M"]],days:[s(t),["%m/%d","%a%d"]],months:[s(t),["%m/%Y","%b %Y"]],years:[s(t),["%Y"]]})))}initialize(){super.initialize(),this._update_width_formats()}_update_width_formats(){const t=+r.default(new Date),s=function(s){const e=s.map((s=>d(t,s).length)),i=m.sort_by(m.zip(e,s),(([t])=>t));return m.unzip(i)};this._width_formats={microseconds:s(this.microseconds),milliseconds:s(this.milliseconds),seconds:s(this.seconds),minsec:s(this.minsec),minutes:s(this.minutes),hourmin:s(this.hourmin),hours:s(this.hours),days:s(this.days),months:s(this.months),years:s(this.years)}}_get_resolution_str(t,s){const e=1.1*t;switch(!1){case!(e<.001):return"microseconds";case!(e<1):return"milliseconds";case!(e<60):return s>=60?"minsec":"seconds";case!(e<3600):return s>=3600?"hourmin":"minutes";case!(e<86400):return"hours";case!(e<2678400):return"days";case!(e<31536e3):return"months";default:return"years"}}doFormat(t,s){if(0==t.length)return[];const e=Math.abs(t[t.length-1]-t[0])/1e3,i=e/(t.length-1),n=this._get_resolution_str(i,e),[,[r]]=this._width_formats[n],o=[],c=l.indexOf(n),m={};for(const t of l)m[t]=0;m.seconds=5,m.minsec=4,m.minutes=4,m.hourmin=3,m.hours=3;for(const s of t){let t,e;try{e=h(s),t=d(s,r)}catch(t){a.logger.warn(`unable to format tick for timestamp value ${s}`),a.logger.warn(` - ${t}`),o.push("ERR");continue}let i=!1,u=c;for(;0==e[m[l[u]]];){let r;if(u+=1,u==l.length)break;if(("minsec"==n||"hourmin"==n)&&!i){if("minsec"==n&&0==e[4]&&0!=e[5]||"hourmin"==n&&0==e[3]&&0!=e[4]){r=this._width_formats[l[c-1]][1][0],t=d(s,r);break}i=!0}r=this._width_formats[l[u]][1][0],t=d(s,r)}if(this.strip_leading_zeros){let s=t.replace(/^0+/g,"");s!=t&&isNaN(parseInt(s))&&(s=`0${s}`),o.push(s)}else o.push(t)}return o}}e.DatetimeTickFormatter=f,f.__name__="DatetimeTickFormatter",f.init_DatetimeTickFormatter()}, +function _(e,t,n,r,o){!function(e){"object"==typeof t&&t.exports?t.exports=e():"function"==typeof define?define(e):this.tz=e()}((function(){function e(e,t,n){var r,o=t.day[1];do{r=new Date(Date.UTC(n,t.month,Math.abs(o++)))}while(t.day[0]<7&&r.getUTCDay()!=t.day[0]);return(r={clock:t.clock,sort:r.getTime(),rule:t,save:6e4*t.save,offset:e.offset})[r.clock]=r.sort+6e4*t.time,r.posix?r.wallclock=r[r.clock]+(e.offset+t.saved):r.posix=r[r.clock]-(e.offset+t.saved),r}function t(t,n,r){var o,a,u,i,l,s,c,f=t[t.zone],h=[],T=new Date(r).getUTCFullYear(),g=1;for(o=1,a=f.length;o=T-g;--c)for(o=0,a=s.length;o=h[o][n]&&h[o][h[o].clock]>u[h[o].clock]&&(i=h[o])}return i&&((l=/^(.*)\/(.*)$/.exec(u.format))?i.abbrev=l[i.save?2:1]:i.abbrev=u.format.replace(/%s/,i.rule.letter)),i||u}function n(e,n){return"UTC"==e.zone?n:(e.entry=t(e,"posix",n),n+e.entry.offset+e.entry.save)}function r(e,n){return"UTC"==e.zone?n:(e.entry=r=t(e,"wallclock",n),0<(o=n-r.wallclock)&&o9)t+=s*l[c-10];else{if(a=new Date(n(e,t)),c<7)for(;s;)a.setUTCDate(a.getUTCDate()+i),a.getUTCDay()==c&&(s-=i);else 7==c?a.setUTCFullYear(a.getUTCFullYear()+s):8==c?a.setUTCMonth(a.getUTCMonth()+s):a.setUTCDate(a.getUTCDate()+s);null==(t=r(e,a.getTime()))&&(t=r(e,a.getTime()+864e5*i)-864e5*i)}return t}var a={clock:function(){return+new Date},zone:"UTC",entry:{abbrev:"UTC",offset:0,save:0},UTC:1,z:function(e,t,n,r){var o,a,u=this.entry.offset+this.entry.save,i=Math.abs(u/1e3),l=[],s=3600;for(o=0;o<3;o++)l.push(("0"+Math.floor(i/s)).slice(-2)),i%=s,s/=60;return"^"!=n||u?("^"==n&&(r=3),3==r?(a=(a=l.join(":")).replace(/:00$/,""),"^"!=n&&(a=a.replace(/:00$/,""))):r?(a=l.slice(0,r+1).join(":"),"^"==n&&(a=a.replace(/:00$/,""))):a=l.slice(0,2).join(""),a=(a=(u<0?"-":"+")+a).replace(/([-+])(0)/,{_:" $1","-":"$1"}[n]||"$1$2")):"Z"},"%":function(e){return"%"},n:function(e){return"\n"},t:function(e){return"\t"},U:function(e){return s(e,0)},W:function(e){return s(e,1)},V:function(e){return c(e)[0]},G:function(e){return c(e)[1]},g:function(e){return c(e)[1]%100},j:function(e){return Math.floor((e.getTime()-Date.UTC(e.getUTCFullYear(),0))/864e5)+1},s:function(e){return Math.floor(e.getTime()/1e3)},C:function(e){return Math.floor(e.getUTCFullYear()/100)},N:function(e){return e.getTime()%1e3*1e6},m:function(e){return e.getUTCMonth()+1},Y:function(e){return e.getUTCFullYear()},y:function(e){return e.getUTCFullYear()%100},H:function(e){return e.getUTCHours()},M:function(e){return e.getUTCMinutes()},S:function(e){return e.getUTCSeconds()},e:function(e){return e.getUTCDate()},d:function(e){return e.getUTCDate()},u:function(e){return e.getUTCDay()||7},w:function(e){return e.getUTCDay()},l:function(e){return e.getUTCHours()%12||12},I:function(e){return e.getUTCHours()%12||12},k:function(e){return e.getUTCHours()},Z:function(e){return this.entry.abbrev},a:function(e){return this[this.locale].day.abbrev[e.getUTCDay()]},A:function(e){return this[this.locale].day.full[e.getUTCDay()]},h:function(e){return this[this.locale].month.abbrev[e.getUTCMonth()]},b:function(e){return this[this.locale].month.abbrev[e.getUTCMonth()]},B:function(e){return this[this.locale].month.full[e.getUTCMonth()]},P:function(e){return this[this.locale].meridiem[Math.floor(e.getUTCHours()/12)].toLowerCase()},p:function(e){return this[this.locale].meridiem[Math.floor(e.getUTCHours()/12)]},R:function(e,t){return this.convert([t,"%H:%M"])},T:function(e,t){return this.convert([t,"%H:%M:%S"])},D:function(e,t){return this.convert([t,"%m/%d/%y"])},F:function(e,t){return this.convert([t,"%Y-%m-%d"])},x:function(e,t){return this.convert([t,this[this.locale].date])},r:function(e,t){return this.convert([t,this[this.locale].time12||"%I:%M:%S"])},X:function(e,t){return this.convert([t,this[this.locale].time24])},c:function(e,t){return this.convert([t,this[this.locale].dateTime])},convert:function(e){if(!e.length)return"1.0.23";var t,a,u,l,s,c=Object.create(this),f=[];for(t=0;t=o?Math.floor((n-o)/7)+1:0}function c(e){var t,n,r;return n=e.getUTCFullYear(),t=new Date(Date.UTC(n,0)).getUTCDay(),(r=s(e,1)+(t>1&&t<=4?1:0))?53!=r||4==t||3==t&&29==new Date(n,1,29).getDate()?[r,e.getUTCFullYear()]:[1,e.getUTCFullYear()+1]:(n=e.getUTCFullYear()-1,[r=4==(t=new Date(Date.UTC(n,0)).getUTCDay())||3==t&&29==new Date(n,1,29).getDate()?53:52,e.getUTCFullYear()-1])}return u=u.toLowerCase().split("|"),"delmHMSUWVgCIky".replace(/./g,(function(e){a[e].pad=2})),a.N.pad=9,a.j.pad=3,a.k.style="_",a.l.style="_",a.e.style="_",function(){return a.convert(arguments)}}))}, +function _(r,t,n,e,i){e();const u=r(1),a=u.__importStar(r(183)),f=r(184),o=u.__importDefault(r(181)),l=r(21),s=r(8);function c(r,...t){return f.sprintf(r,...t)}function m(r,t,n){if(s.isNumber(r)){return c((()=>{switch(!1){case Math.floor(r)!=r:return"%d";case!(Math.abs(r)>.1&&Math.abs(r)<1e3):return"%0.3f";default:return"%0.3e"}})(),r)}return`${r}`}function p(r,t,e){if(null==t)return m;if(null!=e&&r in e){const t=e[r];if(s.isString(t)){if(t in n.DEFAULT_FORMATTERS)return n.DEFAULT_FORMATTERS[t];throw new Error(`Unknown tooltip field formatter type '${t}'`)}return function(r,n,e){return t.format(r,n,e)}}return n.DEFAULT_FORMATTERS.numeral}function d(r,t,n,e){if("$"==r[0]){return function(r,t){if(r in t)return t[r];throw new Error(`Unknown special variable '$${r}'`)}(r.substring(1),e)}return function(r,t,n){const e=t.get_column(r);if(null==e)return null;if(s.isNumber(n))return e[n];const i=e[n.index];if(s.isTypedArray(i)||s.isArray(i))return s.isArray(i[0])?i[n.dim2][n.dim1]:i[n.flat_index];return i}(r.substring(1).replace(/[{}]/g,""),t,n)}n.FormatterType=l.Enum("numeral","printf","datetime"),n.DEFAULT_FORMATTERS={numeral:(r,t,n)=>a.format(r,t),datetime:(r,t,n)=>o.default(r,t),printf:(r,t,n)=>c(t,r)},n.sprintf=c,n.basic_formatter=m,n.get_formatter=p,n.get_value=d,n.replace_placeholders=function(r,t,n,e,i={},u){let a,f;if(s.isString(r)?(a=r,f=!1):(a=r.html,f=!0),a=a.replace(/@\$name/g,(r=>`@{${i.name}}`)),a=a.replace(/((?:\$\w+)|(?:@\w+)|(?:@{(?:[^{}]+)}))(?:{([^{}]+)})?/g,((r,a,o)=>{const l=d(a,t,n,i);if(null==l)return u?u("???"):"???";if("safe"==o)return f=!0,`${l}`;const s=`${p(a,o,e)(l,o,i)}`;return u?u(s):s})),f){return[...(new DOMParser).parseFromString(a,"text/html").body.childNodes]}return a}}, +function _(e,n,t,r,i){ +/*! + * numbro.js + * version : 1.6.2 + * author : Företagsplatsen AB + * license : MIT + * http://www.foretagsplatsen.se + */ +var a,o={},l=o,u="en-US",c=null,s="0,0";void 0!==n&&n.exports;function f(e){this._value=e}function d(e){var n,t="";for(n=0;n-1?function(e,n){var t,r,i,a;return t=(a=e.toString()).split("e")[0],i=a.split("e")[1],a=t.split(".")[0]+(r=t.split(".")[1]||"")+d(i-r.length),n>0&&(a+="."+d(n)),a}(e,n):(t(e*o)/o).toFixed(n),r&&(i=new RegExp("0{1,"+r+"}$"),a=a.replace(i,"")),a}function p(e,n,t){return n.indexOf("$")>-1?function(e,n,t){var r,i,a=n,l=a.indexOf("$"),c=a.indexOf("("),s=a.indexOf("+"),f=a.indexOf("-"),d="",h="";-1===a.indexOf("$")?"infix"===o[u].currency.position?(h=o[u].currency.symbol,o[u].currency.spaceSeparated&&(h=" "+h+" ")):o[u].currency.spaceSeparated&&(d=" "):a.indexOf(" $")>-1?(d=" ",a=a.replace(" $","")):a.indexOf("$ ")>-1?(d=" ",a=a.replace("$ ","")):a=a.replace("$","");if(i=m(e,a,t,h),-1===n.indexOf("$"))switch(o[u].currency.position){case"postfix":i.indexOf(")")>-1?((i=i.split("")).splice(-1,0,d+o[u].currency.symbol),i=i.join("")):i=i+d+o[u].currency.symbol;break;case"infix":break;case"prefix":i.indexOf("(")>-1||i.indexOf("-")>-1?(i=i.split(""),r=Math.max(c,f)+1,i.splice(r,0,o[u].currency.symbol+d),i=i.join("")):i=o[u].currency.symbol+d+i;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else l<=1?i.indexOf("(")>-1||i.indexOf("+")>-1||i.indexOf("-")>-1?(r=1,(l-1?((i=i.split("")).splice(-1,0,d+o[u].currency.symbol),i=i.join("")):i=i+d+o[u].currency.symbol;return i}(e,n,t):n.indexOf("%")>-1?function(e,n,t){var r,i="";e*=100,n.indexOf(" %")>-1?(i=" ",n=n.replace(" %","")):n=n.replace("%","");(r=m(e,n,t)).indexOf(")")>-1?((r=r.split("")).splice(-1,0,i+"%"),r=r.join("")):r=r+i+"%";return r}(e,n,t):n.indexOf(":")>-1?function(e){var n=Math.floor(e/60/60),t=Math.floor((e-60*n*60)/60),r=Math.round(e-60*n*60-60*t);return n+":"+(t<10?"0"+t:t)+":"+(r<10?"0"+r:r)}(e):m(e,n,t)}function m(e,n,t,r){var i,a,l,s,f,d,p,m,x,g,O,b,w,y,M,v,$,B=!1,E=!1,F=!1,k="",U=!1,N=!1,S=!1,j=!1,D=!1,C="",L="",T=Math.abs(e),K=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],G=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],I="",P=!1,R=!1;if(0===e&&null!==c)return c;if(!isFinite(e))return""+e;if(0===n.indexOf("{")){var W=n.indexOf("}");if(-1===W)throw Error('Format should also contain a "}"');b=n.slice(1,W),n=n.slice(W+1)}else b="";if(n.indexOf("}")===n.length-1){var Y=n.indexOf("{");if(-1===Y)throw Error('Format should also contain a "{"');w=n.slice(Y+1,-1),n=n.slice(0,Y+1)}else w="";if(v=null===($=-1===n.indexOf(".")?n.match(/([0-9]+).*/):n.match(/([0-9]+)\..*/))?-1:$[1].length,-1!==n.indexOf("-")&&(P=!0),n.indexOf("(")>-1?(B=!0,n=n.slice(1,-1)):n.indexOf("+")>-1&&(E=!0,n=n.replace(/\+/g,"")),n.indexOf("a")>-1){if(g=n.split(".")[0].match(/[0-9]+/g)||["0"],g=parseInt(g[0],10),U=n.indexOf("aK")>=0,N=n.indexOf("aM")>=0,S=n.indexOf("aB")>=0,j=n.indexOf("aT")>=0,D=U||N||S||j,n.indexOf(" a")>-1?(k=" ",n=n.replace(" a","")):n=n.replace("a",""),p=0===(p=(f=Math.floor(Math.log(T)/Math.LN10)+1)%3)?3:p,g&&0!==T&&(d=Math.floor(Math.log(T)/Math.LN10)+1-g,m=3*~~((Math.min(g,f)-p)/3),T/=Math.pow(10,m),-1===n.indexOf(".")&&g>3))for(n+="[.]",M=(M=0===d?0:3*~~(d/3)-d)<0?M+3:M,i=0;i=Math.pow(10,12)&&!D||j?(k+=o[u].abbreviations.trillion,e/=Math.pow(10,12)):T=Math.pow(10,9)&&!D||S?(k+=o[u].abbreviations.billion,e/=Math.pow(10,9)):T=Math.pow(10,6)&&!D||N?(k+=o[u].abbreviations.million,e/=Math.pow(10,6)):(T=Math.pow(10,3)&&!D||U)&&(k+=o[u].abbreviations.thousand,e/=Math.pow(10,3)))}if(n.indexOf("b")>-1)for(n.indexOf(" b")>-1?(C=" ",n=n.replace(" b","")):n=n.replace("b",""),s=0;s<=K.length;s++)if(a=Math.pow(1024,s),l=Math.pow(1024,s+1),e>=a&&e0&&(e/=a);break}if(n.indexOf("d")>-1)for(n.indexOf(" d")>-1?(C=" ",n=n.replace(" d","")):n=n.replace("d",""),s=0;s<=G.length;s++)if(a=Math.pow(1e3,s),l=Math.pow(1e3,s+1),e>=a&&e0&&(e/=a);break}if(n.indexOf("o")>-1&&(n.indexOf(" o")>-1?(L=" ",n=n.replace(" o","")):n=n.replace("o",""),o[u].ordinal&&(L+=o[u].ordinal(e))),n.indexOf("[.]")>-1&&(F=!0,n=n.replace("[.]",".")),x=e.toString().split(".")[0],O=n.split(".")[1],y=n.indexOf(","),O){if(x=(I=-1!==O.indexOf("*")?h(e,e.toString().split(".")[1].length,t):O.indexOf("[")>-1?h(e,(O=(O=O.replace("]","")).split("["))[0].length+O[1].length,t,O[1].length):h(e,O.length,t)).split(".")[0],I.split(".")[1].length)I=(r?k+r:o[u].delimiters.decimal)+I.split(".")[1];else I="";F&&0===Number(I.slice(1))&&(I="")}else x=h(e,null,t);return x.indexOf("-")>-1&&(x=x.slice(1),R=!0),x.length-1&&(x=x.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[u].delimiters.thousands)),0===n.indexOf(".")&&(x=""),b+(n.indexOf("(")2)&&(o.length<2?!!o[0].match(/^\d+.*\d$/)&&!o[0].match(u):1===o[0].length?!!o[0].match(/^\d+$/)&&!o[0].match(u)&&!!o[1].match(/^\d+$/):!!o[0].match(/^\d+.*\d$/)&&!o[0].match(u)&&!!o[1].match(/^\d+$/)))))},n.exports={format:function(e,n,t,r){return null!=t&&t!==a.culture()&&a.setCulture(t),p(Number(e),null!=n?n:s,null==r?Math.round:r)}}}, +function _(e,n,t,r,i){!function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(a(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(t,r){var i,s,a,o,p,c,l,u,f,d=1,g=t.length,y="";for(s=0;s=0),o.type){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o.width?parseInt(o.width):0);break;case"e":i=o.precision?parseFloat(i).toExponential(o.precision):parseFloat(i).toExponential();break;case"f":i=o.precision?parseFloat(i).toFixed(o.precision):parseFloat(i);break;case"g":i=o.precision?String(Number(i.toPrecision(o.precision))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=o.precision?i.substring(0,o.precision):i;break;case"t":i=String(!!i),i=o.precision?i.substring(0,o.precision):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=o.precision?i.substring(0,o.precision):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o.precision?i.substring(0,o.precision):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}e.json.test(o.type)?y+=i:(!e.number.test(o.type)||u&&!o.sign?f="":(f=u?"+":"-",i=i.toString().replace(e.sign,"")),c=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",l=o.width-(f+i).length,p=o.width&&l>0?c.repeat(l):"",y+=o.align?f+i+p:"0"===c?f+p+i:p+f+i)}return y}var s=Object.create(null);function a(n){if(s[n])return s[n];for(var t,r=n,i=[],a=0;r;){if(null!==(t=e.text.exec(r)))i.push(t[0]);else if(null!==(t=e.modulo.exec(r)))i.push("%");else{if(null===(t=e.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){a|=1;var o=[],p=t[2],c=[];if(null===(c=e.key.exec(p)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(c[1]);""!==(p=p.substring(c[0].length));)if(null!==(c=e.key_access.exec(p)))o.push(c[1]);else{if(null===(c=e.index_access.exec(p)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(c[1])}t[2]=o}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return s[n]=i}void 0!==t&&(t.sprintf=n,t.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=n,window.vsprintf=r,"function"==typeof define&&define.amd&&define((function(){return{sprintf:n,vsprintf:r}})))}()}, +function _(e,i,n,t,a){t();const s=e(9),r=e(178),c=e(186),m=e(187),_=e(190),k=e(191),o=e(189);class T extends c.CompositeTicker{constructor(e){super(e)}static init_DatetimeTicker(){this.override({num_minor_ticks:0,tickers:()=>[new r.AdaptiveTicker({mantissas:[1,2,5],base:10,min_interval:0,max_interval:500*o.ONE_MILLI,num_minor_ticks:0}),new r.AdaptiveTicker({mantissas:[1,2,5,10,15,20,30],base:60,min_interval:o.ONE_SECOND,max_interval:30*o.ONE_MINUTE,num_minor_ticks:0}),new r.AdaptiveTicker({mantissas:[1,2,4,6,8,12],base:24,min_interval:o.ONE_HOUR,max_interval:12*o.ONE_HOUR,num_minor_ticks:0}),new m.DaysTicker({days:s.range(1,32)}),new m.DaysTicker({days:s.range(1,31,3)}),new m.DaysTicker({days:[1,8,15,22]}),new m.DaysTicker({days:[1,15]}),new _.MonthsTicker({months:s.range(0,12,1)}),new _.MonthsTicker({months:s.range(0,12,2)}),new _.MonthsTicker({months:s.range(0,12,4)}),new _.MonthsTicker({months:s.range(0,12,6)}),new k.YearsTicker({})]})}}n.DatetimeTicker=T,T.__name__="DatetimeTicker",T.init_DatetimeTicker()}, +function _(t,e,i,s,r){s();const n=t(179),_=t(9);class a extends n.ContinuousTicker{constructor(t){super(t)}static init_CompositeTicker(){this.define((({Array:t,Ref:e})=>({tickers:[t(e(n.ContinuousTicker)),[]]})))}get min_intervals(){return this.tickers.map((t=>t.get_min_interval()))}get max_intervals(){return this.tickers.map((t=>t.get_max_interval()))}get_min_interval(){return this.min_intervals[0]}get_max_interval(){return this.max_intervals[0]}get_best_ticker(t,e,i){const s=e-t,r=this.get_ideal_interval(t,e,i),n=[_.sorted_index(this.min_intervals,r)-1,_.sorted_index(this.max_intervals,r)],a=[this.min_intervals[n[0]],this.max_intervals[n[1]]].map((t=>Math.abs(i-s/t)));let c;if(_.is_empty(a.filter((t=>!isNaN(t)))))c=this.tickers[0];else{const t=n[_.argmin(a)];c=this.tickers[t]}return c}get_interval(t,e,i){return this.get_best_ticker(t,e,i).get_interval(t,e,i)}get_ticks_no_defaults(t,e,i,s){return this.get_best_ticker(t,e,s).get_ticks_no_defaults(t,e,i,s)}}i.CompositeTicker=a,a.__name__="CompositeTicker",a.init_CompositeTicker()}, +function _(t,e,n,i,s){i();const a=t(188),o=t(189),r=t(9);class c extends a.SingleIntervalTicker{constructor(t){super(t)}static init_DaysTicker(){this.define((({Int:t,Array:e})=>({days:[e(t),[]]}))),this.override({num_minor_ticks:0})}initialize(){super.initialize();const t=this.days;t.length>1?this.interval=(t[1]-t[0])*o.ONE_DAY:this.interval=31*o.ONE_DAY}get_ticks_no_defaults(t,e,n,i){const s=function(t,e){const n=o.last_month_no_later_than(new Date(t)),i=o.last_month_no_later_than(new Date(e));i.setUTCMonth(i.getUTCMonth()+1);const s=[],a=n;for(;s.push(o.copy_date(a)),a.setUTCMonth(a.getUTCMonth()+1),!(a>i););return s}(t,e),a=this.days,c=this.interval;return{major:r.concat(s.map((t=>((t,e)=>{const n=t.getUTCMonth(),i=[];for(const s of a){const a=o.copy_date(t);a.setUTCDate(s),new Date(a.getTime()+e/2).getUTCMonth()==n&&i.push(a)}return i})(t,c)))).map((t=>t.getTime())).filter((n=>t<=n&&n<=e)),minor:[]}}}n.DaysTicker=c,c.__name__="DaysTicker",c.init_DaysTicker()}, +function _(e,t,n,i,r){i();const l=e(179);class a extends l.ContinuousTicker{constructor(e){super(e)}static init_SingleIntervalTicker(){this.define((({Number:e})=>({interval:[e]})))}get_interval(e,t,n){return this.interval}get_min_interval(){return this.interval}get_max_interval(){return this.interval}}n.SingleIntervalTicker=a,a.__name__="SingleIntervalTicker",a.init_SingleIntervalTicker()}, +function _(t,n,e,_,E){function N(t){return new Date(t.getTime())}function O(t){const n=N(t);return n.setUTCDate(1),n.setUTCHours(0),n.setUTCMinutes(0),n.setUTCSeconds(0),n.setUTCMilliseconds(0),n}_(),e.ONE_MILLI=1,e.ONE_SECOND=1e3,e.ONE_MINUTE=60*e.ONE_SECOND,e.ONE_HOUR=60*e.ONE_MINUTE,e.ONE_DAY=24*e.ONE_HOUR,e.ONE_MONTH=30*e.ONE_DAY,e.ONE_YEAR=365*e.ONE_DAY,e.copy_date=N,e.last_month_no_later_than=O,e.last_year_no_later_than=function(t){const n=O(t);return n.setUTCMonth(0),n}}, +function _(t,e,n,i,s){i();const r=t(188),a=t(189),o=t(9);class c extends r.SingleIntervalTicker{constructor(t){super(t)}static init_MonthsTicker(){this.define((({Int:t,Array:e})=>({months:[e(t),[]]})))}initialize(){super.initialize();const t=this.months;t.length>1?this.interval=(t[1]-t[0])*a.ONE_MONTH:this.interval=12*a.ONE_MONTH}get_ticks_no_defaults(t,e,n,i){const s=function(t,e){const n=a.last_year_no_later_than(new Date(t)),i=a.last_year_no_later_than(new Date(e));i.setUTCFullYear(i.getUTCFullYear()+1);const s=[],r=n;for(;s.push(a.copy_date(r)),r.setUTCFullYear(r.getUTCFullYear()+1),!(r>i););return s}(t,e),r=this.months;return{major:o.concat(s.map((t=>r.map((e=>{const n=a.copy_date(t);return n.setUTCMonth(e),n}))))).map((t=>t.getTime())).filter((n=>t<=n&&n<=e)),minor:[]}}}n.MonthsTicker=c,c.__name__="MonthsTicker",c.init_MonthsTicker()}, +function _(e,t,a,i,r){i();const n=e(177),_=e(188),s=e(189);class c extends _.SingleIntervalTicker{constructor(e){super(e)}initialize(){super.initialize(),this.interval=s.ONE_YEAR,this.basic_ticker=new n.BasicTicker({num_minor_ticks:0})}get_ticks_no_defaults(e,t,a,i){const r=s.last_year_no_later_than(new Date(e)).getUTCFullYear(),n=s.last_year_no_later_than(new Date(t)).getUTCFullYear();return{major:this.basic_ticker.get_ticks_no_defaults(r,n,a,i).major.map((e=>Date.UTC(e,0,1))).filter((a=>e<=a&&a<=t)),minor:[]}}}a.YearsTicker=c,c.__name__="YearsTicker"}, +function _(i,s,t,e,o){e();const n=i(173),r=i(193),_=i(194);class c extends n.ContinuousAxisView{}t.LogAxisView=c,c.__name__="LogAxisView";class x extends n.ContinuousAxis{constructor(i){super(i)}static init_LogAxis(){this.prototype.default_view=c,this.override({ticker:()=>new _.LogTicker,formatter:()=>new r.LogTickFormatter})}}t.LogAxis=x,x.__name__="LogAxis",x.init_LogAxis()}, +function _(t,e,r,i,n){i();const o=t(166),a=t(176),s=t(194),c=t(167),{log:l,round:u}=Math;class _ extends o.TickFormatter{constructor(t){super(t)}static init_LogTickFormatter(){this.define((({Ref:t,Nullable:e})=>({ticker:[e(t(s.LogTicker)),null]})))}initialize(){super.initialize(),this.basic_formatter=new a.BasicTickFormatter}format_graphics(t,e){var r,i;if(0==t.length)return[];const n=null!==(i=null===(r=this.ticker)||void 0===r?void 0:r.base)&&void 0!==i?i:10,o=this._exponents(t,n);return null==o?this.basic_formatter.format_graphics(t,e):o.map((t=>{const e=new c.TextBox({text:a.unicode_replace(`${n}`)}),r=new c.TextBox({text:a.unicode_replace(`${t}`)});return new c.BaseExpo(e,r)}))}_exponents(t,e){let r=null;const i=[];for(const n of t){const t=u(l(n)/l(e));if(r==t)return null;r=t,i.push(t)}return i}doFormat(t,e){var r,i;if(0==t.length)return[];const n=null!==(i=null===(r=this.ticker)||void 0===r?void 0:r.base)&&void 0!==i?i:10,o=this._exponents(t,n);return null==o?this.basic_formatter.doFormat(t,e):o.map((t=>a.unicode_replace(`${n}^${t}`)))}}r.LogTickFormatter=_,_.__name__="LogTickFormatter",_.init_LogTickFormatter()}, +function _(t,o,e,i,s){i();const n=t(178),r=t(9);class c extends n.AdaptiveTicker{constructor(t){super(t)}static init_LogTicker(){this.override({mantissas:[1,5]})}get_ticks_no_defaults(t,o,e,i){const s=this.num_minor_ticks,n=[],c=this.base,a=Math.log(t)/Math.log(c),f=Math.log(o)/Math.log(c),l=f-a;let h;if(isFinite(l))if(l<2){const e=this.get_interval(t,o,i),c=Math.floor(t/e),a=Math.ceil(o/e);if(h=r.range(c,a+1).filter((t=>0!=t)).map((t=>t*e)).filter((e=>t<=e&&e<=o)),s>0&&h.length>0){const t=e/s,o=r.range(0,s).map((o=>o*t));for(const t of o.slice(1))n.push(h[0]-t);for(const t of h)for(const e of o)n.push(t+e)}}else{const t=Math.ceil(.999999*a),o=Math.floor(1.000001*f),e=Math.ceil((o-t)/9);if(h=r.range(t-1,o+1,e).map((t=>c**t)),s>0&&h.length>0){const t=c**e/s,o=r.range(1,s+1).map((o=>o*t));for(const t of o)n.push(h[0]/t);n.push(h[0]);for(const t of h)for(const e of o)n.push(t*e)}}else h=[];return{major:h.filter((e=>t<=e&&e<=o)),minor:n.filter((e=>t<=e&&e<=o))}}}e.LogTicker=c,c.__name__="LogTicker",c.init_LogTicker()}, +function _(e,t,i,r,s){r();const a=e(163),o=e(175),c=e(196),n=e(197);class _ extends a.AxisView{}i.MercatorAxisView=_,_.__name__="MercatorAxisView";class x extends o.LinearAxis{constructor(e){super(e)}static init_MercatorAxis(){this.prototype.default_view=_,this.override({ticker:()=>new n.MercatorTicker({dimension:"lat"}),formatter:()=>new c.MercatorTickFormatter({dimension:"lat"})})}}i.MercatorAxis=x,x.__name__="MercatorAxis",x.init_MercatorAxis()}, +function _(r,t,e,o,n){o();const i=r(176),c=r(20),a=r(65);class s extends i.BasicTickFormatter{constructor(r){super(r)}static init_MercatorTickFormatter(){this.define((({Nullable:r})=>({dimension:[r(c.LatLon),null]})))}doFormat(r,t){if(null==this.dimension)throw new Error("MercatorTickFormatter.dimension not configured");if(0==r.length)return[];const e=r.length,o=new Array(e);if("lon"==this.dimension)for(let n=0;n({dimension:[t(e.LatLon),null]})))}get_ticks_no_defaults(t,o,n,r){if(null==this.dimension)throw new Error(`${this}.dimension wasn't configured`);return[t,o]=c.clip_mercator(t,o,this.dimension),"lon"==this.dimension?this._get_ticks_lon(t,o,n,r):this._get_ticks_lat(t,o,n,r)}_get_ticks_lon(t,o,n,r){const[s]=c.wgs84_mercator.invert(t,n),[i,e]=c.wgs84_mercator.invert(o,n),_=super.get_ticks_no_defaults(s,i,n,r),a=[];for(const t of _.major)if(c.in_bounds(t,"lon")){const[o]=c.wgs84_mercator.compute(t,e);a.push(o)}const m=[];for(const t of _.minor)if(c.in_bounds(t,"lon")){const[o]=c.wgs84_mercator.compute(t,e);m.push(o)}return{major:a,minor:m}}_get_ticks_lat(t,o,n,r){const[,s]=c.wgs84_mercator.invert(n,t),[i,e]=c.wgs84_mercator.invert(n,o),_=super.get_ticks_no_defaults(s,e,n,r),a=[];for(const t of _.major)if(c.in_bounds(t,"lat")){const[,o]=c.wgs84_mercator.compute(i,t);a.push(o)}const m=[];for(const t of _.minor)if(c.in_bounds(t,"lat")){const[,o]=c.wgs84_mercator.compute(i,t);m.push(o)}return{major:a,minor:m}}}n.MercatorTicker=_,_.__name__="MercatorTicker",_.init_MercatorTicker()}, +function _(e,i,r,c,k){c(),k("AdaptiveTicker",e(178).AdaptiveTicker),k("BasicTicker",e(177).BasicTicker),k("CategoricalTicker",e(171).CategoricalTicker),k("CompositeTicker",e(186).CompositeTicker),k("ContinuousTicker",e(179).ContinuousTicker),k("DatetimeTicker",e(185).DatetimeTicker),k("DaysTicker",e(187).DaysTicker),k("FixedTicker",e(199).FixedTicker),k("LogTicker",e(194).LogTicker),k("MercatorTicker",e(197).MercatorTicker),k("MonthsTicker",e(190).MonthsTicker),k("SingleIntervalTicker",e(188).SingleIntervalTicker),k("Ticker",e(165).Ticker),k("YearsTicker",e(191).YearsTicker),k("BinnedTicker",e(200).BinnedTicker)}, +function _(i,t,e,r,n){r();const s=i(179);class _ extends s.ContinuousTicker{constructor(i){super(i)}static init_FixedTicker(){this.define((({Number:i,Array:t})=>({ticks:[t(i),[]],minor_ticks:[t(i),[]]})))}get_ticks_no_defaults(i,t,e,r){return{major:this.ticks,minor:this.minor_ticks}}get_interval(i,t,e){return 0}get_min_interval(){return 0}get_max_interval(){return 0}}e.FixedTicker=_,_.__name__="FixedTicker",_.init_FixedTicker()}, +function _(e,n,t,i,r){i();const c=e(165),o=e(201),s=e(12);class a extends c.Ticker{constructor(e){super(e)}static init_BinnedTicker(){this.define((({Number:e,Ref:n,Or:t,Auto:i})=>({mapper:[n(o.ScanningColorMapper)],num_major_ticks:[t(e,i),8]})))}get_ticks(e,n,t,i){const{binning:r}=this.mapper.metrics,c=Math.max(0,s.left_edge_index(e,r)),o=Math.min(s.left_edge_index(n,r)+1,r.length-1),a=[];for(let e=c;e<=o;e++)a.push(r[e]);const{num_major_ticks:_}=this,m=[],h="auto"==_?a.length:_,l=Math.max(1,Math.floor(a.length/h));for(let e=0;eo.binning[o.binning.length-1])return r;return e[a.left_edge_index(n,o.binning)]}}i.ScanningColorMapper=c,c.__name__="ScanningColorMapper"}, +function _(t,o,e,n,s){n();const l=t(203),i=t(61),c=t(9),a=t(8);class r extends l.ColorMapper{constructor(t){super(t),this._scan_data=null}static init_ContinuousColorMapper(){this.define((({Number:t,String:o,Ref:e,Color:n,Or:s,Tuple:l,Array:c,Nullable:a})=>({high:[a(t),null],low:[a(t),null],high_color:[a(n),null],low_color:[a(n),null],domain:[c(l(e(i.GlyphRenderer),s(o,c(o)))),[]]})))}connect_signals(){super.connect_signals();const t=()=>{for(const[t]of this.domain)this.connect(t.view.change,(()=>this.update_data())),this.connect(t.data_source.selected.change,(()=>this.update_data()))};this.connect(this.properties.domain.change,(()=>t())),t()}update_data(){const{domain:t,palette:o}=this,e=[...this._collect(t)];this._scan_data=this.scan(e,o.length),this.metrics_change.emit(),this.change.emit()}get metrics(){return null==this._scan_data&&this.update_data(),this._scan_data}*_collect(t){for(const[o,e]of t)for(const t of a.isArray(e)?e:[e]){let e=o.data_source.get_column(t);e=o.view.indices.select(e);const n=o.view.masked,s=o.data_source.selected.indices;let l;if(null!=n&&s.length>0?l=c.intersection([...n],s):null!=n?l=[...n]:s.length>0&&(l=s),null!=l&&(e=c.map(l,(t=>e[t]))),e.length>0&&!a.isNumber(e[0]))for(const t of e)yield*t;else yield*e}}_v_compute(t,o,e,n){const{nan_color:s}=n;let{low_color:l,high_color:i}=n;null==l&&(l=e[0]),null==i&&(i=e[e.length-1]);const{domain:a}=this,r=c.is_empty(a)?t:[...this._collect(a)];this._scan_data=this.scan(r,e.length),this.metrics_change.emit();for(let n=0,c=t.length;n({palette:[r(t)],nan_color:[t,"gray"]})))}v_compute(t){const r=new Array(t.length);return this._v_compute(t,r,this.palette,this._colors((t=>t))),r}get rgba_mapper(){const t=this,r=p(this.palette),e=this._colors(s);return{v_compute(n){const o=new c.ColorArray(n.length);return t._v_compute(n,o,r,e),new Uint8ClampedArray(l.to_big_endian(o).buffer)}}}_colors(t){return{nan_color:t(this.nan_color)}}}e.ColorMapper=u,u.__name__="ColorMapper",u.init_ColorMapper()}, +function _(r,e,n,s,o){s();const p=r(149);class t extends p.Transform{constructor(r){super(r)}compute(r){throw new Error("mapping single values is not supported")}}n.Mapper=t,t.__name__="Mapper"}, +function _(t,r,a,e,c){e(),c("BasicTickFormatter",t(176).BasicTickFormatter),c("CategoricalTickFormatter",t(172).CategoricalTickFormatter),c("DatetimeTickFormatter",t(180).DatetimeTickFormatter),c("FuncTickFormatter",t(206).FuncTickFormatter),c("LogTickFormatter",t(193).LogTickFormatter),c("MercatorTickFormatter",t(196).MercatorTickFormatter),c("NumeralTickFormatter",t(207).NumeralTickFormatter),c("PrintfTickFormatter",t(208).PrintfTickFormatter),c("TickFormatter",t(166).TickFormatter)}, +function _(t,n,e,s,i){s();const r=t(166),c=t(13),a=t(34);class u extends r.TickFormatter{constructor(t){super(t)}static init_FuncTickFormatter(){this.define((({Unknown:t,String:n,Dict:e})=>({args:[e(t),{}],code:[n,""]})))}get names(){return c.keys(this.args)}get values(){return c.values(this.args)}_make_func(){const t=a.use_strict(this.code);return new Function("tick","index","ticks",...this.names,t)}doFormat(t,n){const e=this._make_func().bind({});return t.map(((t,n,s)=>`${e(t,n,s,...this.values)}`))}}e.FuncTickFormatter=u,u.__name__="FuncTickFormatter",u.init_FuncTickFormatter()}, +function _(r,t,n,e,a){e();const o=r(1).__importStar(r(183)),i=r(166),u=r(20);class c extends i.TickFormatter{constructor(r){super(r)}static init_NumeralTickFormatter(){this.define((({String:r})=>({format:[r,"0,0"],language:[r,"en"],rounding:[u.RoundingFunction,"round"]})))}get _rounding_fn(){switch(this.rounding){case"round":case"nearest":return Math.round;case"floor":case"rounddown":return Math.floor;case"ceil":case"roundup":return Math.ceil}}doFormat(r,t){const{format:n,language:e,_rounding_fn:a}=this;return r.map((r=>o.format(r,n,e,a)))}}n.NumeralTickFormatter=c,c.__name__="NumeralTickFormatter",c.init_NumeralTickFormatter()}, +function _(t,r,i,n,o){n();const a=t(166),e=t(182);class c extends a.TickFormatter{constructor(t){super(t)}static init_PrintfTickFormatter(){this.define((({String:t})=>({format:[t,"%s"]})))}doFormat(t,r){return t.map((t=>e.sprintf(this.format,t)))}}i.PrintfTickFormatter=c,c.__name__="PrintfTickFormatter",c.init_PrintfTickFormatter()}, +function _(r,o,a,p,e){p(),e("CategoricalColorMapper",r(210).CategoricalColorMapper),e("CategoricalMarkerMapper",r(212).CategoricalMarkerMapper),e("CategoricalPatternMapper",r(213).CategoricalPatternMapper),e("ContinuousColorMapper",r(202).ContinuousColorMapper),e("ColorMapper",r(203).ColorMapper),e("LinearColorMapper",r(214).LinearColorMapper),e("LogColorMapper",r(215).LogColorMapper),e("ScanningColorMapper",r(201).ScanningColorMapper),e("EqHistColorMapper",r(216).EqHistColorMapper)}, +function _(t,o,a,r,e){r();const c=t(211),l=t(203),i=t(104);class s extends l.ColorMapper{constructor(t){super(t)}static init_CategoricalColorMapper(){this.define((({Number:t,Nullable:o})=>({factors:[i.FactorSeq],start:[t,0],end:[o(t),null]})))}_v_compute(t,o,a,{nan_color:r}){c.cat_v_compute(t,this.factors,a,o,this.start,this.end,r)}}a.CategoricalColorMapper=s,s.__name__="CategoricalColorMapper",s.init_CategoricalColorMapper()}, +function _(n,t,e,l,i){l();const c=n(12),u=n(8);function f(n,t){if(n.length!=t.length)return!1;for(let e=0,l=n.length;ef(n,h)))),s=_<0||_>=e.length?r:e[_],l[g]=s}}}, +function _(r,e,a,t,s){t();const c=r(211),i=r(104),l=r(204),n=r(20);class p extends l.Mapper{constructor(r){super(r)}static init_CategoricalMarkerMapper(){this.define((({Number:r,Array:e,Nullable:a})=>({factors:[i.FactorSeq],markers:[e(n.MarkerType)],start:[r,0],end:[a(r),null],default_value:[n.MarkerType,"circle"]})))}v_compute(r){const e=new Array(r.length);return c.cat_v_compute(r,this.factors,this.markers,e,this.start,this.end,this.default_value),e}}a.CategoricalMarkerMapper=p,p.__name__="CategoricalMarkerMapper",p.init_CategoricalMarkerMapper()}, +function _(t,a,e,r,n){r();const s=t(211),c=t(104),i=t(204),p=t(20);class l extends i.Mapper{constructor(t){super(t)}static init_CategoricalPatternMapper(){this.define((({Number:t,Array:a,Nullable:e})=>({factors:[c.FactorSeq],patterns:[a(p.HatchPatternType)],start:[t,0],end:[e(t),null],default_value:[p.HatchPatternType," "]})))}v_compute(t){const a=new Array(t.length);return s.cat_v_compute(t,this.factors,this.patterns,a,this.start,this.end,this.default_value),a}}e.CategoricalPatternMapper=l,l.__name__="CategoricalPatternMapper",l.init_CategoricalPatternMapper()}, +function _(n,r,o,t,a){t();const e=n(202),i=n(12);class s extends e.ContinuousColorMapper{constructor(n){super(n)}scan(n,r){const o=null!=this.low?this.low:i.min(n),t=null!=this.high?this.high:i.max(n);return{max:t,min:o,norm_factor:1/(t-o),normed_interval:1/r}}cmap(n,r,o,t,a){const e=r.length-1;if(n==a.max)return r[e];const i=(n-a.min)*a.norm_factor,s=Math.floor(i/a.normed_interval);return s<0?o:s>e?t:r[s]}}o.LinearColorMapper=s,s.__name__="LinearColorMapper"}, +function _(o,t,n,r,l){r();const a=o(202),s=o(12);class e extends a.ContinuousColorMapper{constructor(o){super(o)}scan(o,t){const n=null!=this.low?this.low:s.min(o),r=null!=this.high?this.high:s.max(o);return{max:r,min:n,scale:t/(Math.log(r)-Math.log(n))}}cmap(o,t,n,r,l){const a=t.length-1;if(o>l.max)return r;if(o==l.max)return t[a];if(oa&&(e=a),t[e]}}n.LogColorMapper=e,e.__name__="LogColorMapper"}, +function _(n,t,i,e,o){e();const s=n(201),r=n(12),a=n(9),l=n(19);class c extends s.ScanningColorMapper{constructor(n){super(n)}static init_EqHistColorMapper(){this.define((({Int:n})=>({bins:[n,65536]})))}scan(n,t){const i=null!=this.low?this.low:r.min(n),e=null!=this.high?this.high:r.max(n),o=this.bins,s=a.linspace(i,e,o+1),c=r.bin_counts(n,s),h=new Array(o);for(let n=0,t=s.length;nn/g));let m=t-1,M=[],_=0,f=2*t;for(;m!=t&&_<4&&0!=m;){const n=f/m;if(n>1e3)break;f=Math.round(Math.max(t*n,t));const i=a.range(0,f),e=r.map(u,(n=>n*(f-1)));M=r.interpolate(i,e,h);m=a.uniq(M).length-1,_++}if(0==m){M=[i,e];for(let n=0;ne*n+t}compute(e){return this._linear_compute(e)}v_compute(e){return this._linear_v_compute(e)}invert(e){return this._linear_invert(e)}v_invert(e){return this._linear_v_invert(e)}}n.LinearScale=u,u.__name__="LinearScale"}, +function _(n,e,t,r,i){r();const a=n(146),o=n(12);class c extends a.Scale{constructor(n){super(n)}static init_LinearInterpolationScale(){this.internal((({Arrayable:n})=>({binning:[n]})))}get s_compute(){throw new Error("not implemented")}compute(n){return n}v_compute(n){const{binning:e}=this,{start:t,end:r}=this.source_range,i=t,a=r,c=e.length,l=(r-t)/(c-1),s=new Float64Array(c);for(let n=0;n{if(na)return a;const t=o.left_edge_index(n,e),r=e[t],c=(n-r)/(e[t+1]-r),l=s[t];return l+c*(s[t+1]-l)}));return this._linear_v_compute(_)}invert(n){return n}v_invert(n){return new Float64Array(n)}}t.LinearInterpolationScale=c,c.__name__="LinearInterpolationScale",c.init_LinearInterpolationScale()}, +function _(a,n,e,g,R){g(),R("DataRange",a(160).DataRange),R("DataRange1d",a(159).DataRange1d),R("FactorRange",a(104).FactorRange),R("Range",a(105).Range),R("Range1d",a(156).Range1d)}, +function _(a,o,i,t,e){t();var n=a(141);e("Sizeable",n.Sizeable),e("SizingPolicy",n.SizingPolicy);var c=a(142);e("Layoutable",c.Layoutable),e("LayoutItem",c.LayoutItem);var r=a(222);e("HStack",r.HStack),e("VStack",r.VStack);var l=a(223);e("Grid",l.Grid),e("Row",l.Row),e("Column",l.Column);var S=a(224);e("ContentBox",S.ContentBox),e("VariadicBox",S.VariadicBox)}, +function _(t,e,h,i,r){i();const n=t(142),o=t(99);class s extends n.Layoutable{constructor(){super(...arguments),this.children=[]}*[Symbol.iterator](){yield*this.children}}h.Stack=s,s.__name__="Stack";class c extends s{_measure(t){let e=0,h=0;for(const t of this.children){const i=t.measure({width:0,height:0});e+=i.width,h=Math.max(h,i.height)}return{width:e,height:h}}_set_geometry(t,e){super._set_geometry(t,e);const h=this.absolute?t.top:0;let i=this.absolute?t.left:0;const{height:r}=t;for(const t of this.children){const{width:e}=t.measure({width:0,height:0});t.set_geometry(new o.BBox({left:i,width:e,top:h,height:r})),i+=e}}}h.HStack=c,c.__name__="HStack";class a extends s{_measure(t){let e=0,h=0;for(const t of this.children){const i=t.measure({width:0,height:0});e=Math.max(e,i.width),h+=i.height}return{width:e,height:h}}_set_geometry(t,e){super._set_geometry(t,e);const h=this.absolute?t.left:0;let i=this.absolute?t.top:0;const{width:r}=t;for(const t of this.children){const{height:e}=t.measure({width:0,height:0});t.set_geometry(new o.BBox({top:i,height:e,left:h,width:r})),i+=e}}}h.VStack=a,a.__name__="VStack";class l extends n.Layoutable{constructor(){super(...arguments),this.children=[]}*[Symbol.iterator](){yield*this.children}_measure(t){const{width_policy:e,height_policy:h}=this.sizing,{min:i,max:r}=Math;let n=0,o=0;for(const e of this.children){const{width:h,height:i}=e.measure(t);n=r(n,h),o=r(o,i)}return{width:(()=>{const{width:h}=this.sizing;if(t.width==1/0)return"fixed"==e&&null!=h?h:n;switch(e){case"fixed":return null!=h?h:n;case"min":return n;case"fit":return null!=h?i(t.width,h):t.width;case"max":return null!=h?r(t.width,h):t.width}})(),height:(()=>{const{height:e}=this.sizing;if(t.height==1/0)return"fixed"==h&&null!=e?e:o;switch(h){case"fixed":return null!=e?e:o;case"min":return o;case"fit":return null!=e?i(t.height,e):t.height;case"max":return null!=e?r(t.height,e):t.height}})()}}_set_geometry(t,e){super._set_geometry(t,e);const h=this.absolute?t:t.relative(),{left:i,right:r,top:n,bottom:s}=h,c=Math.round(h.vcenter),a=Math.round(h.hcenter);for(const e of this.children){const{margin:h,halign:l,valign:d}=e.sizing,{width:u,height:g,inner:_}=e.measure(t),w=(()=>{switch(`${d}_${l}`){case"start_start":return new o.BBox({left:i+h.left,top:n+h.top,width:u,height:g});case"start_center":return new o.BBox({hcenter:a,top:n+h.top,width:u,height:g});case"start_end":return new o.BBox({right:r-h.right,top:n+h.top,width:u,height:g});case"center_start":return new o.BBox({left:i+h.left,vcenter:c,width:u,height:g});case"center_center":return new o.BBox({hcenter:a,vcenter:c,width:u,height:g});case"center_end":return new o.BBox({right:r-h.right,vcenter:c,width:u,height:g});case"end_start":return new o.BBox({left:i+h.left,bottom:s-h.bottom,width:u,height:g});case"end_center":return new o.BBox({hcenter:a,bottom:s-h.bottom,width:u,height:g});case"end_end":return new o.BBox({right:r-h.right,bottom:s-h.bottom,width:u,height:g})}})(),m=null==_?w:new o.BBox({left:w.left+_.left,top:w.top+_.top,right:w.right-_.right,bottom:w.bottom-_.bottom});e.set_geometry(w,m)}}}h.NodeLayout=l,l.__name__="NodeLayout"}, +function _(t,i,s,e,o){e();const n=t(141),l=t(142),r=t(8),h=t(99),c=t(9),{max:a,round:g}=Math;class p{constructor(t){this.def=t,this._map=new Map}get(t){let i=this._map.get(t);return void 0===i&&(i=this.def(),this._map.set(t,i)),i}apply(t,i){const s=this.get(t);this._map.set(t,i(s))}}p.__name__="DefaultMap";class f{constructor(){this._items=[],this._nrows=0,this._ncols=0}get nrows(){return this._nrows}get ncols(){return this._ncols}add(t,i){const{r1:s,c1:e}=t;this._nrows=a(this._nrows,s+1),this._ncols=a(this._ncols,e+1),this._items.push({span:t,data:i})}at(t,i){return this._items.filter((({span:s})=>s.r0<=t&&t<=s.r1&&s.c0<=i&&i<=s.c1)).map((({data:t})=>t))}row(t){return this._items.filter((({span:i})=>i.r0<=t&&t<=i.r1)).map((({data:t})=>t))}col(t){return this._items.filter((({span:i})=>i.c0<=t&&t<=i.c1)).map((({data:t})=>t))}foreach(t){for(const{span:i,data:s}of this._items)t(i,s)}map(t){const i=new f;for(const{span:s,data:e}of this._items)i.add(s,t(s,e));return i}}f.__name__="Container";class _ extends l.Layoutable{constructor(t=[]){super(),this.items=t,this.rows="auto",this.cols="auto",this.spacing=0}*[Symbol.iterator](){for(const{layout:t}of this.items)yield t}is_width_expanding(){if(super.is_width_expanding())return!0;if("fixed"==this.sizing.width_policy)return!1;const{cols:t}=this._state;return c.some(t,(t=>"max"==t.policy))}is_height_expanding(){if(super.is_height_expanding())return!0;if("fixed"==this.sizing.height_policy)return!1;const{rows:t}=this._state;return c.some(t,(t=>"max"==t.policy))}_init(){var t,i,s,e;super._init();const o=new f;for(const{layout:t,row:i,col:s,row_span:e,col_span:n}of this.items)if(t.sizing.visible){const l=i,r=s,h=i+(null!=e?e:1)-1,c=s+(null!=n?n:1)-1;o.add({r0:l,c0:r,r1:h,c1:c},t)}const{nrows:n,ncols:l}=o,h=new Array(n);for(let s=0;s{var t;const i=r.isPlainObject(this.rows)?null!==(t=this.rows[s])&&void 0!==t?t:this.rows["*"]:this.rows;return null==i?{policy:"auto"}:r.isNumber(i)?{policy:"fixed",height:i}:r.isString(i)?{policy:i}:i})(),n=null!==(t=e.align)&&void 0!==t?t:"auto";if("fixed"==e.policy)h[s]={policy:"fixed",height:e.height,align:n};else if("min"==e.policy)h[s]={policy:"min",align:n};else if("fit"==e.policy||"max"==e.policy)h[s]={policy:e.policy,flex:null!==(i=e.flex)&&void 0!==i?i:1,align:n};else{if("auto"!=e.policy)throw new Error("unrechable");c.some(o.row(s),(t=>t.is_height_expanding()))?h[s]={policy:"max",flex:1,align:n}:h[s]={policy:"min",align:n}}}const a=new Array(l);for(let t=0;t{var i;const s=r.isPlainObject(this.cols)?null!==(i=this.cols[t])&&void 0!==i?i:this.cols["*"]:this.cols;return null==s?{policy:"auto"}:r.isNumber(s)?{policy:"fixed",width:s}:r.isString(s)?{policy:s}:s})(),n=null!==(s=i.align)&&void 0!==s?s:"auto";if("fixed"==i.policy)a[t]={policy:"fixed",width:i.width,align:n};else if("min"==i.policy)a[t]={policy:"min",align:n};else if("fit"==i.policy||"max"==i.policy)a[t]={policy:i.policy,flex:null!==(e=i.flex)&&void 0!==e?e:1,align:n};else{if("auto"!=i.policy)throw new Error("unrechable");c.some(o.col(t),(t=>t.is_width_expanding()))?a[t]={policy:"max",flex:1,align:n}:a[t]={policy:"min",align:n}}}const[g,p]=r.isNumber(this.spacing)?[this.spacing,this.spacing]:this.spacing;this._state={items:o,nrows:n,ncols:l,rows:h,cols:a,rspacing:g,cspacing:p}}_measure_totals(t,i){const{nrows:s,ncols:e,rspacing:o,cspacing:n}=this._state;return{height:c.sum(t)+(s-1)*o,width:c.sum(i)+(e-1)*n}}_measure_cells(t){const{items:i,nrows:s,ncols:e,rows:o,cols:l,rspacing:r,cspacing:h}=this._state,c=new Array(s);for(let t=0;t{const{r0:e,c0:f,r1:d,c1:u}=i,w=(d-e)*r,m=(u-f)*h;let y=0;for(let i=e;i<=d;i++)y+=t(i,f).height;y+=w;let x=0;for(let i=f;i<=u;i++)x+=t(e,i).width;x+=m;const b=s.measure({width:x,height:y});_.add(i,{layout:s,size_hint:b});const z=new n.Sizeable(b).grow_by(s.sizing.margin);z.height-=w,z.width-=m;const v=[];for(let t=e;t<=d;t++){const i=o[t];"fixed"==i.policy?z.height-=i.height:v.push(t)}if(z.height>0){const t=g(z.height/v.length);for(const i of v)c[i]=a(c[i],t)}const j=[];for(let t=f;t<=u;t++){const i=l[t];"fixed"==i.policy?z.width-=i.width:j.push(t)}if(z.width>0){const t=g(z.width/j.length);for(const i of j)p[i]=a(p[i],t)}}));return{size:this._measure_totals(c,p),row_heights:c,col_widths:p,size_hints:_}}_measure_grid(t){const{nrows:i,ncols:s,rows:e,cols:o,rspacing:n,cspacing:l}=this._state,r=s=>{let o;o="fixed"==this.sizing.height_policy&&null!=this.sizing.height?this.sizing.height:t.height!=1/0&&this.is_height_expanding()?Math.max(t.height,s.size.height):s.size.height;let l=0;for(let t=0;t0)for(let t=0;ti?i:e,t--}}}},h=i=>{let e;e="fixed"==this.sizing.width_policy&&null!=this.sizing.width?this.sizing.width:t.width!=1/0&&this.is_width_expanding()?t.width:i.size.width;let n=0;for(let t=0;t0)for(let t=0;ts?s:o,t--}}}},c=this._measure_cells(((t,i)=>{const s=e[t],n=o[i];return{width:"fixed"==n.policy?n.width:1/0,height:"fixed"==s.policy?s.height:1/0}}));r(c),h(c);const p=this._measure_cells(((t,i)=>({width:c.col_widths[i],height:c.row_heights[t]})));r(p),h(p);const{row_heights:f,col_widths:_}=p;return{size:this._measure_totals(f,_),row_heights:f,col_widths:_}}_measure(t){const{size:i}=this._measure_grid(t);return i}_set_geometry(t,i){super._set_geometry(t,i);const{nrows:s,ncols:e,rspacing:o,cspacing:n}=this._state,{row_heights:l,col_widths:r}=this._measure_grid(t),{size_hints:c}=this._measure_cells(((t,i)=>({width:r[i],height:l[t]}))),f=this._state.rows.map(((t,i)=>Object.assign(Object.assign({},t),{top:0,height:l[i],get bottom(){return this.top+this.height}}))),_=this._state.cols.map(((t,i)=>Object.assign(Object.assign({},t),{left:0,width:r[i],get right(){return this.left+this.width}}))),d=c.map(((t,i)=>Object.assign(Object.assign({},i),{outer:new h.BBox,inner:new h.BBox})));for(let i=0,e=this.absolute?t.top:0;i{const{layout:r,size_hint:c}=l,{sizing:a}=r,{width:p,height:d}=c,u=function(t,i){let s=(i-t)*n;for(let e=t;e<=i;e++)s+=_[e].width;return s}(i,e),w=function(t,i){let s=(i-t)*o;for(let e=t;e<=i;e++)s+=f[e].height;return s}(t,s),m=i==e&&"auto"!=_[i].align?_[i].align:a.halign,y=t==s&&"auto"!=f[t].align?f[t].align:a.valign;let x=_[i].left;"start"==m?x+=a.margin.left:"center"==m?x+=g((u-p)/2):"end"==m&&(x+=u-a.margin.right-p);let b=f[t].top;"start"==y?b+=a.margin.top:"center"==y?b+=g((w-d)/2):"end"==y&&(b+=w-a.margin.bottom-d),l.outer=new h.BBox({left:x,top:b,width:p,height:d})}));const u=f.map((()=>({start:new p((()=>0)),end:new p((()=>0))}))),w=_.map((()=>({start:new p((()=>0)),end:new p((()=>0))})));d.foreach((({r0:t,c0:i,r1:s,c1:e},{size_hint:o,outer:n})=>{const{inner:l}=o;null!=l&&(u[t].start.apply(n.top,(t=>a(t,l.top))),u[s].end.apply(f[s].bottom-n.bottom,(t=>a(t,l.bottom))),w[i].start.apply(n.left,(t=>a(t,l.left))),w[e].end.apply(_[e].right-n.right,(t=>a(t,l.right))))})),d.foreach((({r0:t,c0:i,r1:s,c1:e},o)=>{const{size_hint:n,outer:l}=o,r=t=>{const i=this.absolute?l:l.relative(),s=i.left+t.left,e=i.top+t.top,o=i.right-t.right,n=i.bottom-t.bottom;return new h.BBox({left:s,top:e,right:o,bottom:n})};if(null!=n.inner){let h=r(n.inner);if(!1!==n.align){const o=u[t].start.get(l.top),n=u[s].end.get(f[s].bottom-l.bottom),c=w[i].start.get(l.left),a=w[e].end.get(_[e].right-l.right);try{h=r({top:o,bottom:n,left:c,right:a})}catch(t){}}o.inner=h}else o.inner=l})),d.foreach(((t,{layout:i,outer:s,inner:e})=>{i.set_geometry(s,e)}))}}s.Grid=_,_.__name__="Grid";class d extends _{constructor(t){super(),this.items=t.map(((t,i)=>({layout:t,row:0,col:i}))),this.rows="fit"}}s.Row=d,d.__name__="Row";class u extends _{constructor(t){super(),this.items=t.map(((t,i)=>({layout:t,row:i,col:0}))),this.cols="fit"}}s.Column=u,u.__name__="Column"}, +function _(e,t,s,n,i){n();const a=e(142),c=e(141),o=e(43);class r extends a.ContentLayoutable{constructor(e){super(),this.content_size=o.unsized(e,(()=>new c.Sizeable(o.size(e))))}_content_size(){return this.content_size}}s.ContentBox=r,r.__name__="ContentBox";class _ extends a.Layoutable{constructor(e){super(),this.el=e}_measure(e){const t=new c.Sizeable(e).bounded_to(this.sizing.size);return o.sized(this.el,t,(()=>{const e=new c.Sizeable(o.content_size(this.el)),{border:t,padding:s}=o.extents(this.el);return e.grow_by(t).grow_by(s).map(Math.ceil)}))}}s.VariadicBox=_,_.__name__="VariadicBox";class h extends _{constructor(e){super(e),this._cache=new Map}_measure(e){const{width:t,height:s}=e,n=`${t},${s}`;let i=this._cache.get(n);return null==i&&(i=super._measure(e),this._cache.set(n,i)),i}invalidate_cache(){this._cache.clear()}}s.CachedVariadicBox=h,h.__name__="CachedVariadicBox"}, +function _(t,e,i,h,o){h();const s=t(141),r=t(142),n=t(99);class g extends r.Layoutable{constructor(){super(...arguments),this.min_border={left:0,top:0,right:0,bottom:0},this.padding={left:0,top:0,right:0,bottom:0}}*[Symbol.iterator](){yield this.top_panel,yield this.bottom_panel,yield this.left_panel,yield this.right_panel,yield this.center_panel}_measure(t){t=new s.Sizeable({width:"fixed"==this.sizing.width_policy||t.width==1/0?this.sizing.width:t.width,height:"fixed"==this.sizing.height_policy||t.height==1/0?this.sizing.height:t.height});const e=this.left_panel.measure({width:0,height:t.height}),i=Math.max(e.width,this.min_border.left)+this.padding.left,h=this.right_panel.measure({width:0,height:t.height}),o=Math.max(h.width,this.min_border.right)+this.padding.right,r=this.top_panel.measure({width:t.width,height:0}),n=Math.max(r.height,this.min_border.top)+this.padding.top,g=this.bottom_panel.measure({width:t.width,height:0}),a=Math.max(g.height,this.min_border.bottom)+this.padding.bottom,d=new s.Sizeable(t).shrink_by({left:i,right:o,top:n,bottom:a}),l=this.center_panel.measure(d);return{width:i+l.width+o,height:n+l.height+a,inner:{left:i,right:o,top:n,bottom:a},align:(()=>{const{width_policy:t,height_policy:e}=this.center_panel.sizing;return"fixed"!=t&&"fixed"!=e})()}}_set_geometry(t,e){super._set_geometry(t,e),this.center_panel.set_geometry(e);const i=this.left_panel.measure({width:0,height:t.height}),h=this.right_panel.measure({width:0,height:t.height}),o=this.top_panel.measure({width:t.width,height:0}),s=this.bottom_panel.measure({width:t.width,height:0}),{left:r,top:g,right:a,bottom:d}=e;this.top_panel.set_geometry(new n.BBox({left:r,right:a,bottom:g,height:o.height})),this.bottom_panel.set_geometry(new n.BBox({left:r,right:a,top:d,height:s.height})),this.left_panel.set_geometry(new n.BBox({top:g,bottom:d,right:r,width:i.width})),this.right_panel.set_geometry(new n.BBox({top:g,bottom:d,left:a,width:h.width}))}}i.BorderLayout=g,g.__name__="BorderLayout"}, +function _(t,e,i,s,n){s();const o=t(1),l=t(139),a=t(10),_=t(143),d=t(20),h=o.__importStar(t(48));class r extends l.TextAnnotationView{_get_size(){const{ctx:t}=this.layer;this.visuals.text.set_value(t);const{width:e}=t.measureText(this.model.text),{height:i}=_.font_metrics(t.font);return{width:e,height:i}}_render(){const{angle:t,angle_units:e}=this.model,i=a.resolve_angle(t,e),s=null!=this.layout?this.layout:this.plot_view.frame,n=this.coordinates.x_scale,o=this.coordinates.y_scale;let l="data"==this.model.x_units?n.compute(this.model.x):s.bbox.xview.compute(this.model.x),_="data"==this.model.y_units?o.compute(this.model.y):s.bbox.yview.compute(this.model.y);l+=this.model.x_offset,_-=this.model.y_offset;("canvas"==this.model.render_mode?this._canvas_text.bind(this):this._css_text.bind(this))(this.layer.ctx,this.model.text,l,_,i)}}i.LabelView=r,r.__name__="LabelView";class c extends l.TextAnnotation{constructor(t){super(t)}static init_Label(){this.prototype.default_view=r,this.mixins([h.Text,["border_",h.Line],["background_",h.Fill]]),this.define((({Number:t,String:e,Angle:i})=>({x:[t],x_units:[d.SpatialUnits,"data"],y:[t],y_units:[d.SpatialUnits,"data"],text:[e,""],angle:[i,0],angle_units:[d.AngleUnits,"rad"],x_offset:[t,0],y_offset:[t,0]}))),this.override({background_fill_color:null,border_line_color:null})}}i.Label=c,c.__name__="Label",c.init_Label()}, +function _(t,e,s,i,o){i();const l=t(1),n=t(139),a=t(56),r=t(130),_=l.__importStar(t(48)),c=t(20),h=t(43),d=l.__importStar(t(18)),u=t(143);class x extends n.TextAnnotationView{set_data(t){a.DataAnnotationView.prototype.set_data.call(this,t)}initialize(){if(super.initialize(),this.set_data(this.model.source),"css"==this.model.render_mode)for(let t=0,e=this.text.length;t{this.set_data(this.model.source),"css"==this.model.render_mode?this.render():this.request_render()};this.connect(this.model.change,t),this.connect(this.model.source.streaming,t),this.connect(this.model.source.patching,t),this.connect(this.model.source.change,t)}_calculate_text_dimensions(t,e){const{width:s}=t.measureText(e),{height:i}=u.font_metrics(this.visuals.text.font_value(0));return[s,i]}_map_data(){const t=this.coordinates.x_scale,e=this.coordinates.y_scale,s=null!=this.layout?this.layout:this.plot_view.frame;return["data"==this.model.x_units?t.v_compute(this._x):s.bbox.xview.v_compute(this._x),"data"==this.model.y_units?e.v_compute(this._y):s.bbox.yview.v_compute(this._y)]}_render(){const t="canvas"==this.model.render_mode?this._v_canvas_text.bind(this):this._v_css_text.bind(this),{ctx:e}=this.layer,[s,i]=this._map_data();for(let o=0,l=this.text.length;o({x:[d.XCoordinateSpec,{field:"x"}],y:[d.YCoordinateSpec,{field:"y"}],x_units:[c.SpatialUnits,"data"],y_units:[c.SpatialUnits,"data"],text:[d.StringSpec,{field:"text"}],angle:[d.AngleSpec,0],x_offset:[d.NumberSpec,{value:0}],y_offset:[d.NumberSpec,{value:0}],source:[t(r.ColumnDataSource),()=>new r.ColumnDataSource]}))),this.override({background_fill_color:null,border_line_color:null})}}s.LabelSet=v,v.__name__="LabelSet",v.init_LabelSet()}, +function _(t,e,i,s,l){s();const n=t(1),h=t(40),o=t(229),a=t(20),_=n.__importStar(t(48)),r=t(15),d=t(140),c=t(143),g=t(99),m=t(9),b=t(8),f=t(11);class u extends h.AnnotationView{update_layout(){const{panel:t}=this;this.layout=null!=t?new d.SideLayout(t,(()=>this.get_size())):void 0}cursor(t,e){return"none"==this.model.click_policy?null:"pointer"}get legend_padding(){return null!=this.model.border_line_color?this.model.padding:0}connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render())),this.connect(this.model.item_change,(()=>this.request_render()))}compute_legend_bbox(){const t=this.model.get_legend_names(),{glyph_height:e,glyph_width:i}=this.model,{label_height:s,label_width:l}=this.model;this.max_label_height=m.max([c.font_metrics(this.visuals.label_text.font_value()).height,s,e]);const{ctx:n}=this.layer;n.save(),this.visuals.label_text.set_value(n),this.text_widths=new Map;for(const e of t)this.text_widths.set(e,m.max([n.measureText(e).width,l]));this.visuals.title_text.set_value(n),this.title_height=this.model.title?c.font_metrics(this.visuals.title_text.font_value()).height+this.model.title_standoff:0,this.title_width=this.model.title?n.measureText(this.model.title).width:0,n.restore();const h=Math.max(m.max([...this.text_widths.values()]),0),o=this.model.margin,{legend_padding:a}=this,_=this.model.spacing,{label_standoff:r}=this.model;let d,u;if("vertical"==this.model.orientation)d=t.length*this.max_label_height+Math.max(t.length-1,0)*_+2*a+this.title_height,u=m.max([h+i+r+2*a,this.title_width+2*a]);else{let e=2*a+Math.max(t.length-1,0)*_;for(const[,t]of this.text_widths)e+=m.max([t,l])+i+r;u=m.max([this.title_width+2*a,e]),d=this.max_label_height+this.title_height+2*a}const x=null!=this.layout?this.layout:this.plot_view.frame,[p,w]=x.bbox.ranges,{location:v}=this.model;let y,k;if(b.isString(v))switch(v){case"top_left":y=p.start+o,k=w.start+o;break;case"top":case"top_center":y=(p.end+p.start)/2-u/2,k=w.start+o;break;case"top_right":y=p.end-o-u,k=w.start+o;break;case"bottom_right":y=p.end-o-u,k=w.end-o-d;break;case"bottom":case"bottom_center":y=(p.end+p.start)/2-u/2,k=w.end-o-d;break;case"bottom_left":y=p.start+o,k=w.end-o-d;break;case"left":case"center_left":y=p.start+o,k=(w.end+w.start)/2-d/2;break;case"center":case"center_center":y=(p.end+p.start)/2-u/2,k=(w.end+w.start)/2-d/2;break;case"right":case"center_right":y=p.end-o-u,k=(w.end+w.start)/2-d/2}else if(b.isArray(v)&&2==v.length){const[t,e]=v;y=x.bbox.xview.compute(t),k=x.bbox.yview.compute(e)-d}else f.unreachable();return new g.BBox({left:y,top:k,width:u,height:d})}interactive_bbox(){return this.compute_legend_bbox()}interactive_hit(t,e){return this.interactive_bbox().contains(t,e)}on_hit(t,e){let i;const{glyph_width:s}=this.model,{legend_padding:l}=this,n=this.model.spacing,{label_standoff:h}=this.model;let o=i=l;const a=this.compute_legend_bbox(),_="vertical"==this.model.orientation;for(const r of this.model.items){const d=r.get_labels_list_from_label_prop();for(const c of d){const d=a.x+o,m=a.y+i+this.title_height;let b,f;[b,f]=_?[a.width-2*l,this.max_label_height]:[this.text_widths.get(c)+s+h,this.max_label_height];if(new g.BBox({left:d,top:m,width:b,height:f}).contains(t,e)){switch(this.model.click_policy){case"hide":for(const t of r.renderers)t.visible=!t.visible;break;case"mute":for(const t of r.renderers)t.muted=!t.muted}return!0}_?i+=this.max_label_height+n:o+=this.text_widths.get(c)+s+h+n}}return!1}_render(){if(0==this.model.items.length)return;for(const t of this.model.items)t.legend=this.model;const{ctx:t}=this.layer,e=this.compute_legend_bbox();t.save(),this._draw_legend_box(t,e),this._draw_legend_items(t,e),this._draw_title(t,e),t.restore()}_draw_legend_box(t,e){t.beginPath(),t.rect(e.x,e.y,e.width,e.height),this.visuals.background_fill.set_value(t),t.fill(),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(t),t.stroke())}_draw_legend_items(t,e){const{glyph_width:i,glyph_height:s}=this.model,{legend_padding:l}=this,n=this.model.spacing,{label_standoff:h}=this.model;let o=l,a=l;const _="vertical"==this.model.orientation;for(const r of this.model.items){const d=r.get_labels_list_from_label_prop(),c=r.get_field_from_label_prop();if(0==d.length)continue;const g=(()=>{switch(this.model.click_policy){case"none":return!0;case"hide":return m.every(r.renderers,(t=>t.visible));case"mute":return m.every(r.renderers,(t=>!t.muted))}})();for(const m of d){const d=e.x+o,b=e.y+a+this.title_height,f=d+i,u=b+s;_?a+=this.max_label_height+n:o+=this.text_widths.get(m)+i+h+n,this.visuals.label_text.set_value(t),t.fillText(m,f+h,b+this.max_label_height/2);for(const e of r.renderers){const i=this.plot_view.renderer_view(e);null==i||i.draw_legend(t,d,f,b,u,c,m,r.index)}if(!g){let s,n;[s,n]=_?[e.width-2*l,this.max_label_height]:[this.text_widths.get(m)+i+h,this.max_label_height],t.beginPath(),t.rect(d,b,s,n),this.visuals.inactive_fill.set_value(t),t.fill()}}}}_draw_title(t,e){const{title:i}=this.model;i&&this.visuals.title_text.doit&&(t.save(),t.translate(e.x0,e.y0+this.title_height),this.visuals.title_text.set_value(t),t.fillText(i,this.legend_padding,this.legend_padding-this.model.title_standoff),t.restore())}_get_size(){const{width:t,height:e}=this.compute_legend_bbox();return{width:t+2*this.model.margin,height:e+2*this.model.margin}}}i.LegendView=u,u.__name__="LegendView";class x extends h.Annotation{constructor(t){super(t)}initialize(){super.initialize(),this.item_change=new r.Signal0(this,"item_change")}static init_Legend(){this.prototype.default_view=u,this.mixins([["label_",_.Text],["title_",_.Text],["inactive_",_.Fill],["border_",_.Line],["background_",_.Fill]]),this.define((({Number:t,String:e,Array:i,Tuple:s,Or:l,Ref:n,Nullable:h})=>({orientation:[a.Orientation,"vertical"],location:[l(a.LegendLocation,s(t,t)),"top_right"],title:[h(e),null],title_standoff:[t,5],label_standoff:[t,5],glyph_height:[t,20],glyph_width:[t,20],label_height:[t,20],label_width:[t,20],margin:[t,10],padding:[t,10],spacing:[t,3],items:[i(n(o.LegendItem)),[]],click_policy:[a.LegendClickPolicy,"none"]}))),this.override({border_line_color:"#e5e5e5",border_line_alpha:.5,border_line_width:1,background_fill_color:"#ffffff",background_fill_alpha:.95,inactive_fill_color:"white",inactive_fill_alpha:.7,label_text_font_size:"13px",label_text_baseline:"middle",title_text_font_size:"13px",title_text_font_style:"italic"})}get_legend_names(){const t=[];for(const e of this.items){const i=e.get_labels_list_from_label_prop();t.push(...i)}return t}}i.Legend=x,x.__name__="Legend",x.init_Legend()}, +function _(e,r,n,l,t){l();const i=e(1),s=e(53),o=e(61),_=e(57),a=e(230),u=i.__importStar(e(18)),d=e(19),c=e(9);class f extends s.Model{constructor(e){super(e)}static init_LegendItem(){this.define((({Int:e,Array:r,Ref:n,Nullable:l})=>({label:[u.NullStringSpec,null],renderers:[r(n(o.GlyphRenderer)),[]],index:[l(e),null]})))}_check_data_sources_on_renderers(){if(null!=this.get_field_from_label_prop()){if(this.renderers.length<1)return!1;const e=this.renderers[0].data_source;if(null!=e)for(const r of this.renderers)if(r.data_source!=e)return!1}return!0}_check_field_label_on_data_source(){const e=this.get_field_from_label_prop();if(null!=e){if(this.renderers.length<1)return!1;const r=this.renderers[0].data_source;if(null!=r&&!c.includes(r.columns(),e))return!1}return!0}initialize(){super.initialize(),this.legend=null,this.connect(this.change,(()=>{var e;return null===(e=this.legend)||void 0===e?void 0:e.item_change.emit()}));this._check_data_sources_on_renderers()||d.logger.error("Non matching data sources on legend item renderers");this._check_field_label_on_data_source()||d.logger.error(`Bad column name on label: ${this.label}`)}get_field_from_label_prop(){const{label:e}=this;return a.isField(e)?e.field:null}get_labels_list_from_label_prop(){if(a.isValue(this.label)){const{value:e}=this.label;return null!=e?[e]:[]}const e=this.get_field_from_label_prop();if(null!=e){let r;if(!this.renderers[0]||null==this.renderers[0].data_source)return["No source found"];if(r=this.renderers[0].data_source,r instanceof _.ColumnarDataSource){const n=r.get_column(e);return null!=n?c.uniq(Array.from(n)):["Invalid field"]}}return[]}}n.LegendItem=f,f.__name__="LegendItem",f.init_LegendItem()}, +function _(i,n,e,t,u){t();const c=i(8);e.isValue=function(i){return c.isPlainObject(i)&&"value"in i},e.isField=function(i){return c.isPlainObject(i)&&"field"in i},e.isExpr=function(i){return c.isPlainObject(i)&&"expr"in i}}, +function _(t,i,s,n,e){n();const o=t(1),l=t(40),a=o.__importStar(t(48)),c=t(20);class h extends l.AnnotationView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render()))}_render(){const{xs:t,ys:i}=this.model;if(t.length!=i.length)return;const s=t.length;if(s<3)return;const{frame:n}=this.plot_view,{ctx:e}=this.layer,o=this.coordinates.x_scale,l=this.coordinates.y_scale,{screen:a}=this.model;function c(t,i,s,n){return a?t:"data"==i?s.v_compute(t):n.v_compute(t)}const h=c(t,this.model.xs_units,o,n.bbox.xview),r=c(i,this.model.ys_units,l,n.bbox.yview);e.beginPath();for(let t=0;t({xs:[i(t),[]],xs_units:[c.SpatialUnits,"data"],ys:[i(t),[]],ys_units:[c.SpatialUnits,"data"]}))),this.internal((({Boolean:t})=>({screen:[t,!1]}))),this.override({fill_color:"#fff9ba",fill_alpha:.4,line_color:"#cccccc",line_alpha:.3})}update({xs:t,ys:i}){this.setv({xs:t,ys:i,screen:!0},{check_eq:!1})}}s.PolyAnnotation=r,r.__name__="PolyAnnotation",r.init_PolyAnnotation()}, +function _(e,t,i,n,o){n();const s=e(1),l=e(40),r=s.__importStar(e(48));class c extends l.AnnotationView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render()))}_render(){const{gradient:e,y_intercept:t}=this.model;if(null==e||null==t)return;const{frame:i}=this.plot_view,n=this.coordinates.x_scale,o=this.coordinates.y_scale;let s,l,r,c;if(0==e)s=o.compute(t),l=s,r=i.bbox.left,c=r+i.bbox.width;else{s=i.bbox.top,l=s+i.bbox.height;const a=(o.invert(s)-t)/e,_=(o.invert(l)-t)/e;r=n.compute(a),c=n.compute(_)}const{ctx:a}=this.layer;a.save(),a.beginPath(),this.visuals.line.set_value(a),a.moveTo(r,s),a.lineTo(c,l),a.stroke(),a.restore()}}i.SlopeView=c,c.__name__="SlopeView";class a extends l.Annotation{constructor(e){super(e)}static init_Slope(){this.prototype.default_view=c,this.mixins(r.Line),this.define((({Number:e,Nullable:t})=>({gradient:[t(e),null],y_intercept:[t(e),null]}))),this.override({line_color:"black"})}}i.Slope=a,a.__name__="Slope",a.init_Slope()}, +function _(e,i,t,n,o){n();const s=e(1),a=e(40),l=s.__importStar(e(48)),h=e(20);class c extends a.AnnotationView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.plot_view.request_paint(this)))}_render(){const{location:e}=this.model;if(null==e)return;const{frame:i}=this.plot_view,t=this.coordinates.x_scale,n=this.coordinates.y_scale,o=(i,t)=>"data"==this.model.location_units?i.compute(e):this.model.for_hover?e:t.compute(e);let s,a,l,h;"width"==this.model.dimension?(l=o(n,i.bbox.yview),a=i.bbox.left,h=i.bbox.width,s=this.model.line_width):(l=i.bbox.top,a=o(t,i.bbox.xview),h=this.model.line_width,s=i.bbox.height);const{ctx:c}=this.layer;c.save(),c.beginPath(),this.visuals.line.set_value(c),c.moveTo(a,l),"width"==this.model.dimension?c.lineTo(a+h,l):c.lineTo(a,l+s),c.stroke(),c.restore()}}t.SpanView=c,c.__name__="SpanView";class d extends a.Annotation{constructor(e){super(e)}static init_Span(){this.prototype.default_view=c,this.mixins(l.Line),this.define((({Number:e,Nullable:i})=>({render_mode:[h.RenderMode,"canvas"],location:[i(e),null],location_units:[h.SpatialUnits,"data"],dimension:[h.Dimension,"width"]}))),this.internal((({Boolean:e})=>({for_hover:[e,!1]}))),this.override({line_color:"black"})}}t.Span=d,d.__name__="Span",d.init_Span()}, +function _(i,e,t,o,l){o();const s=i(40),a=i(235),n=i(122),r=i(43),_=i(140),h=i(99);class b extends s.AnnotationView{constructor(){super(...arguments),this._invalidate_toolbar=!0,this._previous_bbox=new h.BBox}update_layout(){this.layout=new _.SideLayout(this.panel,(()=>this.get_size()),!0)}initialize(){super.initialize(),this.el=r.div(),this.plot_view.canvas_view.add_event(this.el)}async lazy_initialize(){await super.lazy_initialize(),this._toolbar_view=await n.build_view(this.model.toolbar,{parent:this}),this.plot_view.visibility_callbacks.push((i=>this._toolbar_view.set_visibility(i)))}remove(){this._toolbar_view.remove(),r.remove(this.el),super.remove()}render(){this.model.visible||r.undisplay(this.el),super.render()}_render(){const{bbox:i}=this.layout;this._previous_bbox.equals(i)||(r.position(this.el,i),this._previous_bbox=i),this._invalidate_toolbar&&(this.el.style.position="absolute",this.el.style.overflow="hidden",this._toolbar_view.render(),r.empty(this.el),this.el.appendChild(this._toolbar_view.el),this._invalidate_toolbar=!1),r.display(this.el)}_get_size(){const{tools:i,logo:e}=this.model.toolbar;return{width:30*i.length+(null!=e?25:0),height:30}}}t.ToolbarPanelView=b,b.__name__="ToolbarPanelView";class d extends s.Annotation{constructor(i){super(i)}static init_ToolbarPanel(){this.prototype.default_view=b,this.define((({Ref:i})=>({toolbar:[i(a.Toolbar)]})))}}t.ToolbarPanel=d,d.__name__="ToolbarPanel",d.init_ToolbarPanel()}, +function _(t,s,e,i,o){i();const c=t(8),n=t(9),a=t(13),l=t(236),r=t(237),_=t(247),p=t(248);e.Drag=l.Tool,e.Inspection=l.Tool,e.Scroll=l.Tool,e.Tap=l.Tool;const u=t=>{switch(t){case"tap":return"active_tap";case"pan":return"active_drag";case"pinch":case"scroll":return"active_scroll";case"multi":return"active_multi"}return null},h=t=>"tap"==t||"pan"==t;class v extends p.ToolbarBase{constructor(t){super(t)}static init_Toolbar(){this.prototype.default_view=p.ToolbarBaseView,this.define((({Or:t,Ref:s,Auto:i,Null:o,Nullable:c})=>({active_drag:[t(s(e.Drag),i,o),"auto"],active_inspect:[t(s(e.Inspection),i,o),"auto"],active_scroll:[t(s(e.Scroll),i,o),"auto"],active_tap:[t(s(e.Tap),i,o),"auto"],active_multi:[c(s(r.GestureTool)),null]})))}connect_signals(){super.connect_signals();const{tools:t,active_drag:s,active_inspect:e,active_scroll:i,active_tap:o,active_multi:c}=this.properties;this.on_change([t,s,e,i,o,c],(()=>this._init_tools()))}_init_tools(){if(super._init_tools(),"auto"==this.active_inspect);else if(this.active_inspect instanceof _.InspectTool){let t=!1;for(const s of this.inspectors)s!=this.active_inspect?s.active=!1:t=!0;t||(this.active_inspect=null)}else if(c.isArray(this.active_inspect)){const t=n.intersection(this.active_inspect,this.inspectors);t.length!=this.active_inspect.length&&(this.active_inspect=t);for(const t of this.inspectors)n.includes(this.active_inspect,t)||(t.active=!1)}else if(null==this.active_inspect)for(const t of this.inspectors)t.active=!1;const t=t=>{t.active?this._active_change(t):t.active=!0};for(const t of a.values(this.gestures)){t.tools=n.sort_by(t.tools,(t=>t.default_order));for(const s of t.tools)this.connect(s.properties.active.change,(()=>this._active_change(s)))}for(const[s,e]of a.entries(this.gestures)){const i=u(s);if(i){const o=this[i];"auto"==o?0!=e.tools.length&&h(s)&&t(e.tools[0]):null!=o&&(n.includes(this.tools,o)?t(o):this[i]=null)}}}}e.Toolbar=v,v.__name__="Toolbar",v.init_Toolbar()}, +function _(t,e,n,i,o){i();const s=t(42),a=t(9),r=t(53);class l extends s.View{get plot_view(){return this.parent}get plot_model(){return this.parent.model}connect_signals(){super.connect_signals(),this.connect(this.model.properties.active.change,(()=>{this.model.active?this.activate():this.deactivate()}))}activate(){}deactivate(){}}n.ToolView=l,l.__name__="ToolView";class _ extends r.Model{constructor(t){super(t)}static init_Tool(){this.prototype._known_aliases=new Map,this.define((({String:t,Nullable:e})=>({description:[e(t),null]}))),this.internal((({Boolean:t})=>({active:[t,!1]})))}get synthetic_renderers(){return[]}_get_dim_limits([t,e],[n,i],o,s){const r=o.bbox.h_range;let l;"width"==s||"both"==s?(l=[a.min([t,n]),a.max([t,n])],l=[a.max([l[0],r.start]),a.min([l[1],r.end])]):l=[r.start,r.end];const _=o.bbox.v_range;let c;return"height"==s||"both"==s?(c=[a.min([e,i]),a.max([e,i])],c=[a.max([c[0],_.start]),a.min([c[1],_.end])]):c=[_.start,_.end],[l,c]}static register_alias(t,e){this.prototype._known_aliases.set(t,e)}static from_string(t){const e=this.prototype._known_aliases.get(t);if(null!=e)return e();{const e=[...this.prototype._known_aliases.keys()];throw new Error(`unexpected tool name '${t}', possible tools are ${e.join(", ")}`)}}}n.Tool=_,_.__name__="Tool",_.init_Tool()}, +function _(e,o,t,s,n){s();const u=e(238),_=e(246);class l extends u.ButtonToolView{}t.GestureToolView=l,l.__name__="GestureToolView";class i extends u.ButtonTool{constructor(e){super(e),this.button_view=_.OnOffButtonView}}t.GestureTool=i,i.__name__="GestureTool"}, +function _(t,e,o,i,s){i();const n=t(1),l=n.__importDefault(t(239)),r=t(240),a=t(236),u=t(43),h=t(34),_=t(8),c=t(9),d=n.__importStar(t(241)),m=d,p=n.__importDefault(t(242)),g=n.__importDefault(t(243)),v=t(244);class f extends r.DOMView{initialize(){super.initialize();const t=this.model.menu;if(null!=t){const e=this.parent.model.toolbar_location,o="left"==e||"above"==e,i=this.parent.model.horizontal?"vertical":"horizontal";this._menu=new v.ContextMenu(o?c.reversed(t):t,{orientation:i,prevent_hide:t=>t.target==this.el})}this._hammer=new l.default(this.el,{touchAction:"auto",inputClass:l.default.TouchMouseInput}),this.connect(this.model.change,(()=>this.render())),this._hammer.on("tap",(t=>{var e;(null===(e=this._menu)||void 0===e?void 0:e.is_open)?this._menu.hide():t.target==this.el&&this._clicked()})),this._hammer.on("press",(()=>this._pressed()))}remove(){var t;this._hammer.destroy(),null===(t=this._menu)||void 0===t||t.remove(),super.remove()}styles(){return[...super.styles(),d.default,p.default,g.default]}css_classes(){return super.css_classes().concat(m.toolbar_button)}render(){u.empty(this.el);const t=this.model.computed_icon;_.isString(t)&&(h.startsWith(t,"data:image")?this.el.style.backgroundImage="url('"+t+"')":this.el.classList.add(t)),this.el.title=this.model.tooltip,null!=this._menu&&this.root.el.appendChild(this._menu.el)}_pressed(){var t;const{left:e,top:o,right:i,bottom:s}=this.el.getBoundingClientRect(),n=(()=>{switch(this.parent.model.toolbar_location){case"right":return{right:e,top:o};case"left":return{left:i,top:o};case"above":return{left:e,top:s};case"below":return{left:e,bottom:o}}})();null===(t=this._menu)||void 0===t||t.toggle(n)}}o.ButtonToolButtonView=f,f.__name__="ButtonToolButtonView";class b extends a.ToolView{}o.ButtonToolView=b,b.__name__="ButtonToolView";class B extends a.Tool{constructor(t){super(t)}static init_ButtonTool(){this.internal((({Boolean:t})=>({disabled:[t,!1]})))}_get_dim_tooltip(t){const{description:e,tool_name:o}=this;return null!=e?e:"both"==t?o:`${o} (${"width"==t?"x":"y"}-axis)`}get tooltip(){var t;return null!==(t=this.description)&&void 0!==t?t:this.tool_name}get computed_icon(){return this.icon}get menu(){return null}}o.ButtonTool=B,B.__name__="ButtonTool",B.init_ButtonTool()}, +function _(t,e,i,n,r){ +/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */ +!function(t,i,n,r){"use strict";var s,o=["","webkit","Moz","MS","ms","o"],a=i.createElement("div"),h=Math.round,u=Math.abs,c=Date.now;function l(t,e,i){return setTimeout(T(t,i),e)}function p(t,e,i){return!!Array.isArray(t)&&(f(t,i[e],i),!0)}function f(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==r)for(n=0;n\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=t.console&&(t.console.warn||t.console.log);return s&&s.call(t.console,r,n),e.apply(this,arguments)}}s="function"!=typeof Object.assign?function(t){if(t===r||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i-1}function S(t){return t.trim().split(/\s+/g)}function b(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;ni[e]})):n.sort()),n}function x(t,e){for(var i,n,s=e[0].toUpperCase()+e.slice(1),a=0;a1&&!i.firstMultiple?i.firstMultiple=H(e):1===s&&(i.firstMultiple=!1);var o=i.firstInput,a=i.firstMultiple,h=a?a.center:o.center,l=e.center=L(n);e.timeStamp=c(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=G(h,l),e.distance=j(h,l),function(t,e){var i=e.center,n=t.offsetDelta||{},r=t.prevDelta||{},s=t.prevInput||{};1!==e.eventType&&4!==s.eventType||(r=t.prevDelta={x:s.deltaX||0,y:s.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y});e.deltaX=r.x+(i.x-n.x),e.deltaY=r.y+(i.y-n.y)}(i,e),e.offsetDirection=V(e.deltaX,e.deltaY);var p=U(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=p.x,e.overallVelocityY=p.y,e.overallVelocity=u(p.x)>u(p.y)?p.x:p.y,e.scale=a?(f=a.pointers,v=n,j(v[0],v[1],W)/j(f[0],f[1],W)):1,e.rotation=a?function(t,e){return G(e[1],e[0],W)+G(t[1],t[0],W)}(a.pointers,n):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,s,o,a=t.lastInterval||e,h=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(h>25||a.velocity===r)){var c=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,p=U(h,c,l);n=p.x,s=p.y,i=u(p.x)>u(p.y)?p.x:p.y,o=V(c,l),t.lastInterval=e}else i=a.velocity,n=a.velocityX,s=a.velocityY,o=a.direction;e.velocity=i,e.velocityX=n,e.velocityY=s,e.direction=o}(i,e);var f,v;var d=t.element;_(e.srcEvent.target,d)&&(d=e.srcEvent.target);e.target=d}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function H(t){for(var e=[],i=0;i=u(e)?t<0?2:4:e<0?8:16}function j(t,e,i){i||(i=F);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return Math.sqrt(n*n+r*r)}function G(t,e,i){i||(i=F);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return 180*Math.atan2(r,n)/Math.PI}q.prototype={handler:function(){},init:function(){this.evEl&&I(this.element,this.evEl,this.domHandler),this.evTarget&&I(this.target,this.evTarget,this.domHandler),this.evWin&&I(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&A(this.element,this.evEl,this.domHandler),this.evTarget&&A(this.target,this.evTarget,this.domHandler),this.evWin&&A(O(this.element),this.evWin,this.domHandler)}};var Z={mousedown:1,mousemove:2,mouseup:4},B="mousedown",$="mousemove mouseup";function J(){this.evEl=B,this.evWin=$,this.pressed=!1,q.apply(this,arguments)}g(J,q,{handler:function(t){var e=Z[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:X,srcEvent:t}))}});var K={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:N,3:"pen",4:X,5:"kinect"},tt="pointerdown",et="pointermove pointerup pointercancel";function it(){this.evEl=tt,this.evWin=et,q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(tt="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),g(it,q,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),r=K[n],s=Q[t.pointerType]||t.pointerType,o=s==N,a=b(e,t.pointerId,"pointerId");1&r&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):12&r&&(i=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),i&&e.splice(a,1))}});var nt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},rt="touchstart",st="touchstart touchmove touchend touchcancel";function ot(){this.evTarget=rt,this.evWin=st,this.started=!1,q.apply(this,arguments)}function at(t,e){var i=P(t.touches),n=P(t.changedTouches);return 12&e&&(i=D(i.concat(n),"identifier",!0)),[i,n]}g(ot,q,{handler:function(t){var e=nt[t.type];if(1===e&&(this.started=!0),this.started){var i=at.call(this,t,e);12&e&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:N,srcEvent:t})}}});var ht={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ut="touchstart touchmove touchend touchcancel";function ct(){this.evTarget=ut,this.targetIds={},q.apply(this,arguments)}function lt(t,e){var i=P(t.touches),n=this.targetIds;if(3&e&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,s,o=P(t.changedTouches),a=[],h=this.target;if(s=i.filter((function(t){return _(t.target,h)})),1===e)for(r=0;r-1&&n.splice(t,1)}),2500)}}function dt(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function n(i){e.manager.emit(i,t)}i<8&&n(e.options.event+Dt(i)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),i>=8&&n(e.options.event+Dt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=bt},canEmit:function(){for(var t=0;te.threshold&&r&e.direction},attrTest:function(t){return Ot.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=xt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),g(Mt,Ot,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[It]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),g(zt,Pt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distancee.time;if(this._input=t,!n||!i||12&t.eventType&&!r)this.reset();else if(1&t.eventType)this.reset(),this._timer=l((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return bt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}}),g(Nt,Ot,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[It]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),g(Xt,Ot,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Rt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return 30&i?e=t.overallVelocity:6&i?e=t.overallVelocityX:i&Y&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&u(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=xt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),g(Yt,Pt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Et]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance{var e;null===(e=this.items[t])||void 0===e||e.handler(),this.hide()},this._on_mousedown=t=>{var e,i;const{target:n}=t;n instanceof Node&&this.el.contains(n)||(null===(i=(e=this.options).prevent_hide)||void 0===i?void 0:i.call(e,t))||this.hide()},this._on_keydown=t=>{t.keyCode==l.Keys.Esc&&this.hide()},this._on_blur=()=>{this.hide()},l.undisplay(this.el)}get is_open(){return this._open}get can_open(){return 0!=this.items.length}remove(){l.remove(this.el),this._unlisten()}_listen(){document.addEventListener("mousedown",this._on_mousedown),document.addEventListener("keydown",this._on_keydown),window.addEventListener("blur",this._on_blur)}_unlisten(){document.removeEventListener("mousedown",this._on_mousedown),document.removeEventListener("keydown",this._on_keydown),window.removeEventListener("blur",this._on_blur)}_position(t){const e=this.el.parentElement;if(null!=e){const i=e.getBoundingClientRect();this.el.style.left=null!=t.left?t.left-i.left+"px":"",this.el.style.top=null!=t.top?t.top-i.top+"px":"",this.el.style.right=null!=t.right?i.right-t.right+"px":"",this.el.style.bottom=null!=t.bottom?i.bottom-t.bottom+"px":""}}render(){var t,e;l.empty(this.el,!0);const i=null!==(t=this.options.orientation)&&void 0!==t?t:"vertical";l.classes(this.el).add("bk-context-menu",`bk-${i}`);for(const[t,i]of h.enumerate(this.items)){let n;if(null==t)n=l.div({class:d.divider});else{if(null!=t.if&&!t.if())continue;{const i=null!=t.icon?l.div({class:["bk-menu-icon",t.icon]}):null;n=l.div({class:(null===(e=t.active)||void 0===e?void 0:e.call(t))?"bk-active":null,title:t.tooltip},i,t.label)}}n.addEventListener("click",(()=>this._item_click(i))),this.el.appendChild(n)}}show(t){if(0!=this.items.length&&!this._open){if(this.render(),0==this.el.children.length)return;this._position(null!=t?t:{left:0,top:0}),l.display(this.el),this._listen(),this._open=!0}}hide(){this._open&&(this._open=!1,this._unlisten(),l.undisplay(this.el))}toggle(t){this._open?this.hide():this.show(t)}}i.ContextMenu=r,r.__name__="ContextMenu"}, +function _(n,e,o,t,r){t();const f=n(9);function*i(n,e){const o=n.length;if(e>o)return;const t=f.range(e);for(yield t.map((e=>n[e]));;){let r;for(const n of f.reversed(f.range(e)))if(t[n]!=n+o-e){r=n;break}if(null==r)return;t[r]+=1;for(const n of f.range(r+1,e))t[n]=t[n-1]+1;yield t.map((e=>n[e]))}}o.enumerate=function*(n){let e=0;for(const o of n)yield[o,e++]},o.combinations=i,o.subsets=function*(n){for(const e of f.range(n.length+1))yield*i(n,e)}}, +function _(t,e,i,n,o){n();const s=t(1),c=t(238),l=s.__importStar(t(241)),a=t(43);class _ extends c.ButtonToolButtonView{render(){super.render(),a.classes(this.el).toggle(l.active,this.model.active)}_clicked(){const{active:t}=this.model;this.model.active=!t}}i.OnOffButtonView=_,_.__name__="OnOffButtonView"}, +function _(t,e,o,n,s){n();const i=t(238),c=t(246);class l extends i.ButtonToolView{}o.InspectToolView=l,l.__name__="InspectToolView";class _ extends i.ButtonTool{constructor(t){super(t),this.event_type="move"}static init_InspectTool(){this.prototype.button_view=c.OnOffButtonView,this.define((({Boolean:t})=>({toggleable:[t,!0]}))),this.override({active:!0})}}o.InspectTool=_,_.__name__="InspectTool",_.init_InspectTool()}, +function _(t,o,e,i,s){i();const l=t(1),n=t(19),a=t(43),r=t(122),c=t(240),_=t(20),u=t(9),h=t(13),v=t(8),p=t(249),d=t(99),b=t(53),g=t(236),f=t(237),m=t(251),w=t(252),y=t(247),T=l.__importStar(t(241)),z=T,B=l.__importStar(t(253)),x=B;class L extends b.Model{constructor(t){super(t)}static init_ToolbarViewModel(){this.define((({Boolean:t,Nullable:o})=>({_visible:[o(t),null],autohide:[t,!1]})))}get visible(){return!this.autohide||null!=this._visible&&this._visible}}e.ToolbarViewModel=L,L.__name__="ToolbarViewModel",L.init_ToolbarViewModel();class M extends c.DOMView{constructor(){super(...arguments),this.layout={bbox:new d.BBox}}initialize(){super.initialize(),this._tool_button_views=new Map,this._toolbar_view_model=new L({autohide:this.model.autohide})}async lazy_initialize(){await super.lazy_initialize(),await this._build_tool_button_views()}connect_signals(){super.connect_signals(),this.connect(this.model.properties.tools.change,(async()=>{await this._build_tool_button_views(),this.render()})),this.connect(this.model.properties.autohide.change,(()=>{this._toolbar_view_model.autohide=this.model.autohide,this._on_visible_change()})),this.connect(this._toolbar_view_model.properties._visible.change,(()=>this._on_visible_change()))}styles(){return[...super.styles(),T.default,B.default]}remove(){r.remove_views(this._tool_button_views),super.remove()}async _build_tool_button_views(){const t=null!=this.model._proxied_tools?this.model._proxied_tools:this.model.tools;await r.build_views(this._tool_button_views,t,{parent:this},(t=>t.button_view))}set_visibility(t){t!=this._toolbar_view_model._visible&&(this._toolbar_view_model._visible=t)}_on_visible_change(){const t=this._toolbar_view_model.visible,o=z.toolbar_hidden;this.el.classList.contains(o)&&t?this.el.classList.remove(o):t||this.el.classList.add(o)}render(){if(a.empty(this.el),this.el.classList.add(z.toolbar),this.el.classList.add(z[this.model.toolbar_location]),this._toolbar_view_model.autohide=this.model.autohide,this._on_visible_change(),null!=this.model.logo){const t="grey"===this.model.logo?x.grey:null,o=a.a({href:"https://bokeh.org/",target:"_blank",class:[x.logo,x.logo_small,t]});this.el.appendChild(o)}for(const[,t]of this._tool_button_views)t.render();const t=[],o=t=>this._tool_button_views.get(t).el,{gestures:e}=this.model;for(const i of h.values(e))t.push(i.tools.map(o));t.push(this.model.actions.map(o)),t.push(this.model.inspectors.filter((t=>t.toggleable)).map(o));for(const o of t)if(0!==o.length){const t=a.div({class:z.button_bar},o);this.el.appendChild(t)}}update_layout(){}update_position(){}after_layout(){this._has_finished=!0}export(t,o=!0){const e="png"==t?"canvas":"svg",i=new p.CanvasLayer(e,o);return i.resize(0,0),i}}function V(){return{pan:{tools:[],active:null},scroll:{tools:[],active:null},pinch:{tools:[],active:null},tap:{tools:[],active:null},doubletap:{tools:[],active:null},press:{tools:[],active:null},pressup:{tools:[],active:null},rotate:{tools:[],active:null},move:{tools:[],active:null},multi:{tools:[],active:null}}}e.ToolbarBaseView=M,M.__name__="ToolbarBaseView";class S extends b.Model{constructor(t){super(t)}static init_ToolbarBase(){this.prototype.default_view=M,this.define((({Boolean:t,Array:o,Ref:e,Nullable:i})=>({tools:[o(e(g.Tool)),[]],logo:[i(_.Logo),"normal"],autohide:[t,!1]}))),this.internal((({Array:t,Struct:o,Ref:e,Nullable:i})=>{const s=o({tools:t(e(f.GestureTool)),active:i(e(g.Tool))});return{gestures:[o({pan:s,scroll:s,pinch:s,tap:s,doubletap:s,press:s,pressup:s,rotate:s,move:s,multi:s}),V],actions:[t(e(m.ActionTool)),[]],inspectors:[t(e(y.InspectTool)),[]],help:[t(e(w.HelpTool)),[]],toolbar_location:[_.Location,"right"]}}))}initialize(){super.initialize(),this._init_tools()}_init_tools(){const t=function(t,o){if(t.length!=o.length)return!0;const e=new Set(o.map((t=>t.id)));return u.some(t,(t=>!e.has(t.id)))},o=this.tools.filter((t=>t instanceof y.InspectTool));t(this.inspectors,o)&&(this.inspectors=o);const e=this.tools.filter((t=>t instanceof w.HelpTool));t(this.help,e)&&(this.help=e);const i=this.tools.filter((t=>t instanceof m.ActionTool));t(this.actions,i)&&(this.actions=i);const s=(t,o)=>{t in this.gestures||n.logger.warn(`Toolbar: unknown event type '${t}' for tool: ${o}`)},l={pan:{tools:[],active:null},scroll:{tools:[],active:null},pinch:{tools:[],active:null},tap:{tools:[],active:null},doubletap:{tools:[],active:null},press:{tools:[],active:null},pressup:{tools:[],active:null},rotate:{tools:[],active:null},move:{tools:[],active:null},multi:{tools:[],active:null}};for(const t of this.tools)if(t instanceof f.GestureTool&&t.event_type)if(v.isString(t.event_type))l[t.event_type].tools.push(t),s(t.event_type,t);else{l.multi.tools.push(t);for(const o of t.event_type)s(o,t)}for(const o of Object.keys(l)){const e=this.gestures[o];t(e.tools,l[o].tools)&&(e.tools=l[o].tools),e.active&&u.every(e.tools,(t=>t.id!=e.active.id))&&(e.active=null)}}get horizontal(){return"above"===this.toolbar_location||"below"===this.toolbar_location}get vertical(){return"left"===this.toolbar_location||"right"===this.toolbar_location}_active_change(t){const{event_type:o}=t;if(null==o)return;const e=v.isString(o)?[o]:o;for(const o of e)if(t.active){const e=this.gestures[o].active;null!=e&&t!=e&&(n.logger.debug(`Toolbar: deactivating tool: ${e} for event type '${o}'`),e.active=!1),this.gestures[o].active=t,n.logger.debug(`Toolbar: activating tool: ${t} for event type '${o}'`)}else this.gestures[o].active=null}}e.ToolbarBase=S,S.__name__="ToolbarBase",S.init_ToolbarBase()}, +function _(e,t,i,n,s){n();const o=e(250),a=e(99),r=e(43);function h(e){!function(e){void 0===e.lineDash&&Object.defineProperty(e,"lineDash",{get:()=>e.getLineDash(),set:t=>e.setLineDash(t)})}(e),function(e){e.setImageSmoothingEnabled=t=>{e.imageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.oImageSmoothingEnabled=t,e.webkitImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t},e.getImageSmoothingEnabled=()=>{const t=e.imageSmoothingEnabled;return null==t||t}}(e),function(e){e.ellipse||(e.ellipse=function(t,i,n,s,o,a,r,h=!1){const l=.551784;e.translate(t,i),e.rotate(o);let c=n,g=s;h&&(c=-n,g=-s),e.moveTo(-c,0),e.bezierCurveTo(-c,g*l,-c*l,g,0,g),e.bezierCurveTo(c*l,g,c,g*l,c,0),e.bezierCurveTo(c,-g*l,c*l,-g,0,-g),e.bezierCurveTo(-c*l,-g,-c,-g*l,-c,0),e.rotate(-o),e.translate(-t,-i)})}(e)}const l={position:"absolute",top:"0",left:"0",width:"100%",height:"100%"};class c{constructor(e,t){switch(this.backend=e,this.hidpi=t,this.pixel_ratio=1,this.bbox=new a.BBox,e){case"webgl":case"canvas":{this._el=this._canvas=r.canvas({style:l});const e=this.canvas.getContext("2d");if(null==e)throw new Error("unable to obtain 2D rendering context");this._ctx=e,t&&(this.pixel_ratio=devicePixelRatio);break}case"svg":{const e=new o.SVGRenderingContext2D;this._ctx=e,this._canvas=e.get_svg(),this._el=r.div({style:l},this._canvas);break}}h(this._ctx)}get canvas(){return this._canvas}get ctx(){return this._ctx}get el(){return this._el}resize(e,t){this.bbox=new a.BBox({left:0,top:0,width:e,height:t});const i=this._ctx instanceof o.SVGRenderingContext2D?this._ctx:this.canvas;i.width=e*this.pixel_ratio,i.height=t*this.pixel_ratio}prepare(){const{ctx:e,hidpi:t,pixel_ratio:i}=this;e.save(),t&&(e.scale(i,i),e.translate(.5,.5)),this.clear()}clear(){const{x:e,y:t,width:i,height:n}=this.bbox;this.ctx.clearRect(e,t,i,n)}finish(){this.ctx.restore()}to_blob(){const{_canvas:e}=this;if(e instanceof HTMLCanvasElement)return null!=e.msToBlob?Promise.resolve(e.msToBlob()):new Promise(((t,i)=>{e.toBlob((e=>null!=e?t(e):i()),"image/png")}));{const e=this._ctx.get_serialized_svg(!0),t=new Blob([e],{type:"image/svg+xml"});return Promise.resolve(t)}}}i.CanvasLayer=c,c.__name__="CanvasLayer"}, +function _(t,e,i,s,n){s();const r=t(168),a=t(8),o=t(43);function l(t){if(!t)throw new Error("cannot create a random attribute name for an undefined object");const e="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";let i="";do{i="";for(let t=0;t<12;t++)i+=e[Math.floor(Math.random()*e.length)]}while(t[i]);return i}function h(t){var e;const i={left:"start",right:"end",center:"middle",start:"start",end:"end"};return null!==(e=i[t])&&void 0!==e?e:i.start}function c(t){var e;const i={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return null!==(e=i[t])&&void 0!==e?e:i.alphabetic}const _=function(t,e){const i=new Map,s=t.split(",");e=null!=e?e:10;for(let t=0;t=0?Math.acos(e):-Math.acos(e)}const w=v(f),b=v(g);this.lineTo(d+f[0]*n,m+f[1]*n),this.arc(d,m,n,w,b)}stroke(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","fill"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke"),null!=this._clip_path&&this.__currentElement.setAttribute("clip-path",this._clip_path)}fill(t){if("path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","stroke"),"none"!=this.__currentElement.getAttribute("fill")){const t=this.__currentElement.cloneNode(!0);this.__root.appendChild(t),this.__currentElement=t}this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill"),null!=t&&this.__currentElement.setAttribute("fill-rule",t),null!=this._clip_path&&this.__currentElement.setAttribute("clip-path",this._clip_path)}rect(t,e,i,s){isFinite(t+e+i+s)&&("path"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+s),this.lineTo(t,e+s),this.lineTo(t,e))}fillRect(t,e,i,s){isFinite(t+e+i+s)&&(this.beginPath(),this.rect(t,e,i,s),this.fill())}strokeRect(t,e,i,s){isFinite(t+e+i+s)&&(this.beginPath(),this.rect(t,e,i,s),this.stroke())}__clearCanvas(){o.empty(this.__defs),o.empty(this.__root),this.__root.appendChild(this.__defs),this.__currentElement=this.__root}clearRect(t,e,i,s){if(!isFinite(t+e+i+s))return;if(0===t&&0===e&&i===this.width&&s===this.height)return void this.__clearCanvas();const n=this.__createElement("rect",{x:t,y:e,width:i,height:s,fill:"#FFFFFF"},!0);this._apply_transform(n),this.__root.appendChild(n)}createLinearGradient(t,e,i,s){if(!isFinite(t+e+i+s))throw new Error("The provided double value is non-finite");const[n,r]=this._transform.apply(t,e),[a,o]=this._transform.apply(i,s),h=this.__createElement("linearGradient",{id:l(this.__ids),x1:`${n}px`,x2:`${a}px`,y1:`${r}px`,y2:`${o}px`,gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(h),new p(h,this)}createRadialGradient(t,e,i,s,n,r){if(!isFinite(t+e+i+s+n+r))throw new Error("The provided double value is non-finite");const[a,o]=this._transform.apply(t,e),[h,c]=this._transform.apply(s,n),_=this.__createElement("radialGradient",{id:l(this.__ids),cx:`${h}px`,cy:`${c}px`,r:`${r}px`,fx:`${a}px`,fy:`${o}px`,gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(_),new p(_,this)}__parseFont(){var t,e,i,s,n;const r=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),a={style:null!==(t=r[1])&&void 0!==t?t:"normal",size:null!==(e=r[4])&&void 0!==e?e:"10px",family:null!==(i=r[6])&&void 0!==i?i:"sans-serif",weight:null!==(s=r[3])&&void 0!==s?s:"normal",decoration:null!==(n=r[2])&&void 0!==n?n:"normal"};return"underline"===this.__fontUnderline&&(a.decoration="underline"),null!=this.__fontHref&&(a.href=this.__fontHref),a}__wrapTextLink(t,e){if(t.href){const i=this.__createElement("a");return i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),i.appendChild(e),i}return e}__applyText(t,e,i,s){const n=this.__parseFont(),r=this.__createElement("text",{"font-family":n.family,"font-size":n.size,"font-style":n.style,"font-weight":n.weight,"text-decoration":n.decoration,x:e,y:i,"text-anchor":h(this.textAlign),"dominant-baseline":c(this.textBaseline)},!0);r.appendChild(this.__document.createTextNode(t)),this._apply_transform(r),this.__currentElement=r,this.__applyStyleToCurrentElement(s),this.__root.appendChild(this.__wrapTextLink(n,r))}fillText(t,e,i){null!=t&&isFinite(e+i)&&this.__applyText(t,e,i,"fill")}strokeText(t,e,i){null!=t&&isFinite(e+i)&&this.__applyText(t,e,i,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,i,s,n,r=!1){if(!isFinite(t+e+i+s+n))return;if(s===n)return;(s%=2*Math.PI)===(n%=2*Math.PI)&&(n=(n+2*Math.PI-.001*(r?-1:1))%(2*Math.PI));const a=t+i*Math.cos(n),o=e+i*Math.sin(n),l=t+i*Math.cos(s),h=e+i*Math.sin(s),c=r?0:1;let _=0,u=n-s;u<0&&(u+=2*Math.PI),_=r?u>Math.PI?0:1:u>Math.PI?1:0,this.lineTo(l,h);const p=i,d=i,[m,f]=this._transform.apply(a,o);this.__addPathCommand(m,f,`A ${p} ${d} 0 ${_} ${c} ${m} ${f}`)}clip(){const t=this.__createElement("clipPath"),e=l(this.__ids);this.__applyCurrentDefaultPath(),t.setAttribute("id",e),t.appendChild(this.__currentElement),this.__defs.appendChild(t),this._clip_path=`url(#${e})`}drawImage(t,...e){let i,s,n,r,a,o,l,h;if(2==e.length){if([i,s]=e,!isFinite(i+s))return;a=0,o=0,l=t.width,h=t.height,n=l,r=h}else if(4==e.length){if([i,s,n,r]=e,!isFinite(i+s+n+r))return;a=0,o=0,l=t.width,h=t.height}else{if(8!==e.length)throw new Error(`Inavlid number of arguments passed to drawImage: ${arguments.length}`);if([a,o,l,h,i,s,n,r]=e,!isFinite(a+o+l+h+i+s+n+r))return}const c=this.__root,_=this._transform.clone().translate(i,s);if(t instanceof m||t instanceof SVGSVGElement){const e=(t instanceof SVGSVGElement?t:t.get_svg()).cloneNode(!0);let i;_.is_identity?i=c:(i=this.__createElement("g"),this._apply_transform(i,_),c.appendChild(i));for(const t of[...e.childNodes])if(t instanceof SVGDefsElement){for(const e of[...t.childNodes])if(e instanceof Element){const t=e.getAttribute("id");this.__ids[t]=t,this.__defs.appendChild(e)}}else i.appendChild(t)}else if(t instanceof HTMLImageElement||t instanceof SVGImageElement){const e=this.__createElement("image");if(e.setAttribute("width",`${n}`),e.setAttribute("height",`${r}`),e.setAttribute("preserveAspectRatio","none"),a||o||l!==t.width||h!==t.height){const e=this.__document.createElement("canvas");e.width=n,e.height=r;e.getContext("2d").drawImage(t,a,o,l,h,0,0,n,r),t=e}this._apply_transform(e,_);const i=t instanceof HTMLCanvasElement?t.toDataURL():t.getAttribute("src");e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i),c.appendChild(e)}else if(t instanceof HTMLCanvasElement){const e=this.__createElement("image");e.setAttribute("width",`${n}`),e.setAttribute("height",`${r}`),e.setAttribute("preserveAspectRatio","none");const i=this.__document.createElement("canvas");i.width=n,i.height=r;const s=i.getContext("2d");s.imageSmoothingEnabled=!1,s.drawImage(t,a,o,l,h,0,0,n,r),t=i,this._apply_transform(e,_),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.toDataURL()),c.appendChild(e)}}createPattern(t,e){const i=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),s=l(this.__ids);if(i.setAttribute("id",s),i.setAttribute("width",`${this._to_number(t.width)}`),i.setAttribute("height",`${this._to_number(t.height)}`),i.setAttribute("patternUnits","userSpaceOnUse"),t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof SVGImageElement){const e=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),s=t instanceof HTMLCanvasElement?t.toDataURL():t.getAttribute("src");e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),i.appendChild(e),this.__defs.appendChild(i)}else if(t instanceof m){for(const e of[...t.__root.childNodes])e instanceof SVGDefsElement||i.appendChild(e);this.__defs.appendChild(i)}else{if(!(t instanceof SVGSVGElement))throw new Error("unsupported");for(const e of[...t.childNodes])e instanceof SVGDefsElement||i.appendChild(e);this.__defs.appendChild(i)}return new d(i,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}_to_number(t){return a.isNumber(t)?t:t.baseVal.value}}i.SVGRenderingContext2D=m,m.__name__="SVGRenderingContext2D"}, +function _(o,t,n,i,e){i();const s=o(238),c=o(15);class l extends s.ButtonToolButtonView{_clicked(){this.model.do.emit(void 0)}}n.ActionToolButtonView=l,l.__name__="ActionToolButtonView";class _ extends s.ButtonToolView{connect_signals(){super.connect_signals(),this.connect(this.model.do,(o=>this.doit(o)))}}n.ActionToolView=_,_.__name__="ActionToolView";class d extends s.ButtonTool{constructor(o){super(o),this.button_view=l,this.do=new c.Signal(this,"do")}}n.ActionTool=d,d.__name__="ActionTool"}, +function _(o,e,t,i,l){i();const s=o(251),n=o(242);class r extends s.ActionToolView{doit(){window.open(this.model.redirect)}}t.HelpToolView=r,r.__name__="HelpToolView";class c extends s.ActionTool{constructor(o){super(o),this.tool_name="Help",this.icon=n.tool_icon_help}static init_HelpTool(){this.prototype.default_view=r,this.define((({String:o})=>({redirect:[o,"https://docs.bokeh.org/en/latest/docs/user_guide/tools.html"]}))),this.override({description:"Click the question mark to learn more about Bokeh plot tools."}),this.register_alias("help",(()=>new c))}}t.HelpTool=c,c.__name__="HelpTool",c.init_HelpTool()}, +function _(o,l,g,A,r){A(),g.root="bk-root",g.logo="bk-logo",g.grey="bk-grey",g.logo_small="bk-logo-small",g.logo_notebook="bk-logo-notebook",g.default=".bk-root .bk-logo{margin:5px;position:relative;display:block;background-repeat:no-repeat;}.bk-root .bk-logo.bk-grey{filter:url(\"data:image/svg+xml;utf8,#grayscale\");filter:gray;-webkit-filter:grayscale(100%);}.bk-root .bk-logo-small{width:20px;height:20px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAOkSURBVDiNjZRtaJVlGMd/1/08zzln5zjP1LWcU9N0NkN8m2CYjpgQYQXqSs0I84OLIC0hkEKoPtiH3gmKoiJDU7QpLgoLjLIQCpEsNJ1vqUOdO7ppbuec5+V+rj4ctwzd8IIbbi6u+8f1539dt3A78eXC7QizUF7gyV1fD1Yqg4JWz84yffhm0qkFqBogB9rM8tZdtwVsPUhWhGcFJngGeWrPzHm5oaMmkfEg1usvLFyc8jLRqDOMru7AyC8saQr7GG7f5fvDeH7Ej8CM66nIF+8yngt6HWaKh7k49Soy9nXurCi1o3qUbS3zWfrYeQDTB/Qj6kX6Ybhw4B+bOYoLKCC9H3Nu/leUTZ1JdRWkkn2ldcCamzrcf47KKXdAJllSlxAOkRgyHsGC/zRday5Qld9DyoM4/q/rUoy/CXh3jzOu3bHUVZeU+DEn8FInkPBFlu3+nW3Nw0mk6vCDiWg8CeJaxEwuHS3+z5RgY+YBR6V1Z1nxSOfoaPa4LASWxxdNp+VWTk7+4vzaou8v8PN+xo+KY2xsw6une2frhw05CTYOmQvsEhjhWjn0bmXPjpE1+kplmmkP3suftwTubK9Vq22qKmrBhpY4jvd5afdRA3wGjFAgcnTK2s4hY0/GPNIb0nErGMCRxWOOX64Z8RAC4oCXdklmEvcL8o0BfkNK4lUg9HTl+oPlQxdNo3Mg4Nv175e/1LDGzZen30MEjRUtmXSfiTVu1kK8W4txyV6BMKlbgk3lMwYCiusNy9fVfvvwMxv8Ynl6vxoByANLTWplvuj/nF9m2+PDtt1eiHPBr1oIfhCChQMBw6Aw0UulqTKZdfVvfG7VcfIqLG9bcldL/+pdWTLxLUy8Qq38heUIjh4XlzZxzQm19lLFlr8vdQ97rjZVOLf8nclzckbcD4wxXMidpX30sFd37Fv/GtwwhzhxGVAprjbg0gCAEeIgwCZyTV2Z1REEW8O4py0wsjeloKoMr6iCY6dP92H6Vw/oTyICIthibxjm/DfN9lVz8IqtqKYLUXfoKVMVQVVJOElGjrnnUt9T9wbgp8AyYKaGlqingHZU/uG2NTZSVqwHQTWkx9hxjkpWDaCg6Ckj5qebgBVbT3V3NNXMSiWSDdGV3hrtzla7J+duwPOToIg42ChPQOQjspnSlp1V+Gjdged7+8UN5CRAV7a5EdFNwCjEaBR27b3W890TE7g24NAP/mMDXRWrGoFPQI9ls/MWO2dWFAar/xcOIImbbpA3zgAAAABJRU5ErkJggg==);}.bk-root .bk-logo-notebook{display:inline-block;vertical-align:middle;margin-right:5px;}"}, +function _(t,e,i,s,l){s();const o=t(1),n=t(40),h=t(20),a=t(43),r=o.__importStar(t(255)),c=r;class d extends n.AnnotationView{initialize(){super.initialize(),this.el=a.div({class:c.tooltip}),a.undisplay(this.el),this.plot_view.canvas_view.add_overlay(this.el)}remove(){a.remove(this.el),super.remove()}connect_signals(){super.connect_signals(),this.connect(this.model.properties.content.change,(()=>this.render())),this.connect(this.model.properties.position.change,(()=>this._reposition()))}styles(){return[...super.styles(),r.default]}render(){this.model.visible||a.undisplay(this.el),super.render()}_render(){const{content:t}=this.model;null!=t?(a.empty(this.el),a.classes(this.el).toggle("bk-tooltip-custom",this.model.custom),this.el.appendChild(t),this.model.show_arrow&&this.el.classList.add(c.tooltip_arrow)):a.undisplay(this.el)}_reposition(){const{position:t}=this.model;if(null==t)return void a.undisplay(this.el);const[e,i]=t,s=(()=>{const t=this.parent.layout.bbox.relative(),{attachment:s}=this.model;switch(s){case"horizontal":return e({attachment:[h.TooltipAttachment,"horizontal"],inner_only:[t,!0],show_arrow:[t,!0]}))),this.internal((({Boolean:t,Number:e,Tuple:i,Ref:s,Nullable:l})=>({position:[l(i(e,e)),null],content:[s(HTMLElement),()=>a.div()],custom:[t]}))),this.override({level:"overlay"})}clear(){this.position=null}}i.Tooltip=p,p.__name__="Tooltip",p.init_Tooltip()}, +function _(o,t,r,e,l){e(),r.root="bk-root",r.tooltip="bk-tooltip",r.left="bk-left",r.tooltip_arrow="bk-tooltip-arrow",r.right="bk-right",r.above="bk-above",r.below="bk-below",r.tooltip_row_label="bk-tooltip-row-label",r.tooltip_row_value="bk-tooltip-row-value",r.tooltip_color_block="bk-tooltip-color-block",r.default='.bk-root{}.bk-root .bk-tooltip{font-weight:300;font-size:12px;position:absolute;padding:5px;border:1px solid #e5e5e5;color:#2f2f2f;background-color:white;pointer-events:none;opacity:0.95;z-index:100;}.bk-root .bk-tooltip > div:not(:first-child){margin-top:5px;border-top:#e5e5e5 1px dashed;}.bk-root .bk-tooltip.bk-left.bk-tooltip-arrow::before{position:absolute;margin:-7px 0 0 0;top:50%;width:0;height:0;border-style:solid;border-width:7px 0 7px 0;border-color:transparent;content:" ";display:block;left:-10px;border-right-width:10px;border-right-color:#909599;}.bk-root .bk-tooltip.bk-left::before{left:-10px;border-right-width:10px;border-right-color:#909599;}.bk-root .bk-tooltip.bk-right.bk-tooltip-arrow::after{position:absolute;margin:-7px 0 0 0;top:50%;width:0;height:0;border-style:solid;border-width:7px 0 7px 0;border-color:transparent;content:" ";display:block;right:-10px;border-left-width:10px;border-left-color:#909599;}.bk-root .bk-tooltip.bk-right::after{right:-10px;border-left-width:10px;border-left-color:#909599;}.bk-root .bk-tooltip.bk-above::before{position:absolute;margin:0 0 0 -7px;left:50%;width:0;height:0;border-style:solid;border-width:0 7px 0 7px;border-color:transparent;content:" ";display:block;top:-10px;border-bottom-width:10px;border-bottom-color:#909599;}.bk-root .bk-tooltip.bk-below::after{position:absolute;margin:0 0 0 -7px;left:50%;width:0;height:0;border-style:solid;border-width:0 7px 0 7px;border-color:transparent;content:" ";display:block;bottom:-10px;border-top-width:10px;border-top-color:#909599;}.bk-root .bk-tooltip-row-label{text-align:right;color:#26aae1;}.bk-root .bk-tooltip-row-value{color:default;}.bk-root .bk-tooltip-color-block{width:12px;height:12px;margin-left:5px;margin-right:5px;outline:#dddddd solid 1px;display:inline-block;}'}, +function _(e,t,i,s,r){s();const a=e(135),h=e(133),_=e(122),l=e(48);class o extends a.UpperLowerView{async lazy_initialize(){await super.lazy_initialize();const{lower_head:e,upper_head:t}=this.model;null!=e&&(this.lower_head=await _.build_view(e,{parent:this})),null!=t&&(this.upper_head=await _.build_view(t,{parent:this}))}set_data(e){var t,i;super.set_data(e),null===(t=this.lower_head)||void 0===t||t.set_data(e),null===(i=this.upper_head)||void 0===i||i.set_data(e)}paint(e){if(this.visuals.line.doit)for(let t=0,i=this._lower_sx.length;t({lower_head:[t(e(h.ArrowHead)),()=>new h.TeeHead({size:10})],upper_head:[t(e(h.ArrowHead)),()=>new h.TeeHead({size:10})]}))),this.override({level:"underlay"})}}i.Whisker=n,n.__name__="Whisker",n.init_Whisker()}, +function _(n,o,t,u,e){u(),e("CustomJS",n(258).CustomJS),e("OpenURL",n(260).OpenURL)}, +function _(t,s,e,n,c){n();const u=t(259),i=t(13),a=t(34);class r extends u.Callback{constructor(t){super(t)}static init_CustomJS(){this.define((({Unknown:t,String:s,Dict:e})=>({args:[e(t),{}],code:[s,""]})))}get names(){return i.keys(this.args)}get values(){return i.values(this.args)}get func(){const t=a.use_strict(this.code);return new Function(...this.names,"cb_obj","cb_data",t)}execute(t,s={}){return this.func.apply(t,this.values.concat(t,s))}}e.CustomJS=r,r.__name__="CustomJS",r.init_CustomJS()}, +function _(c,a,l,n,s){n();const e=c(53);class o extends e.Model{constructor(c){super(c)}}l.Callback=o,o.__name__="Callback"}, +function _(e,n,t,o,i){o();const s=e(259),c=e(182),r=e(8);class a extends s.Callback{constructor(e){super(e)}static init_OpenURL(){this.define((({Boolean:e,String:n})=>({url:[n,"http://"],same_tab:[e,!1]})))}execute(e,{source:n}){const t=e=>{const t=c.replace_placeholders(this.url,n,e,void 0,void 0,encodeURIComponent);if(!r.isString(t))throw new Error("HTML output is not supported in this context");this.same_tab?window.location.href=t:window.open(t)},{selected:o}=n;for(const e of o.indices)t(e);for(const e of o.line_indices)t(e)}}t.OpenURL=a,a.__name__="OpenURL",a.init_OpenURL()}, +function _(a,n,e,r,s){r(),s("Canvas",a(262).Canvas),s("CartesianFrame",a(144).CartesianFrame)}, +function _(e,t,s,i,a){i();const l=e(14),n=e(240),r=e(19),o=e(43),h=e(20),_=e(13),c=e(263),d=e(99),p=e(249),v=(()=>{const e=document.createElement("canvas"),t=e.getContext("webgl",{premultipliedAlpha:!0});return null!=t?{canvas:e,gl:t}:void r.logger.trace("WebGL is not supported")})(),u={position:"absolute",top:"0",left:"0",width:"100%",height:"100%"};class b extends n.DOMView{constructor(){super(...arguments),this.bbox=new d.BBox}initialize(){super.initialize(),"webgl"==this.model.output_backend&&(this.webgl=v),this.underlays_el=o.div({style:u}),this.primary=this.create_layer(),this.overlays=this.create_layer(),this.overlays_el=o.div({style:u}),this.events_el=o.div({class:"bk-canvas-events",style:u});const e=[this.underlays_el,this.primary.el,this.overlays.el,this.overlays_el,this.events_el];_.extend(this.el.style,u),o.append(this.el,...e),this.ui_event_bus=new c.UIEventBus(this)}remove(){this.ui_event_bus.destroy(),super.remove()}add_underlay(e){this.underlays_el.appendChild(e)}add_overlay(e){this.overlays_el.appendChild(e)}add_event(e){this.events_el.appendChild(e)}get pixel_ratio(){return this.primary.pixel_ratio}resize(e,t){this.bbox=new d.BBox({left:0,top:0,width:e,height:t}),this.primary.resize(e,t),this.overlays.resize(e,t)}prepare_webgl(e){const{webgl:t}=this;if(null!=t){const{width:s,height:i}=this.bbox;t.canvas.width=this.pixel_ratio*s,t.canvas.height=this.pixel_ratio*i;const{gl:a}=t;a.enable(a.SCISSOR_TEST);const[l,n,r,o]=e,{xview:h,yview:_}=this.bbox,c=h.compute(l),d=_.compute(n+o),p=this.pixel_ratio;a.scissor(p*c,p*d,p*r,p*o),a.enable(a.BLEND),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ONE),this._clear_webgl()}}blit_webgl(e){const{webgl:t}=this;if(null!=t){if(r.logger.debug("Blitting WebGL canvas"),e.restore(),e.drawImage(t.canvas,0,0),e.save(),this.model.hidpi){const t=this.pixel_ratio;e.scale(t,t),e.translate(.5,.5)}this._clear_webgl()}}_clear_webgl(){const{webgl:e}=this;if(null!=e){const{gl:t,canvas:s}=e;t.viewport(0,0,s.width,s.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}}compose(){const e=this.create_layer(),{width:t,height:s}=this.bbox;return e.resize(t,s),e.ctx.drawImage(this.primary.canvas,0,0),e.ctx.drawImage(this.overlays.canvas,0,0),e}create_layer(){const{output_backend:e,hidpi:t}=this.model;return new p.CanvasLayer(e,t)}to_blob(){return this.compose().to_blob()}}s.CanvasView=b,b.__name__="CanvasView";class g extends l.HasProps{constructor(e){super(e)}static init_Canvas(){this.prototype.default_view=b,this.internal((({Boolean:e})=>({hidpi:[e,!0],output_backend:[h.OutputBackend,"canvas"]})))}}s.Canvas=g,g.__name__="Canvas",g.init_Canvas()}, +function _(t,e,s,n,i){n();const r=t(1),a=r.__importDefault(t(239)),_=t(15),h=t(19),o=t(43),l=r.__importStar(t(264)),c=t(265),p=t(9),u=t(8),v=t(27),d=t(244);class g{constructor(t){this.canvas_view=t,this.pan_start=new _.Signal(this,"pan:start"),this.pan=new _.Signal(this,"pan"),this.pan_end=new _.Signal(this,"pan:end"),this.pinch_start=new _.Signal(this,"pinch:start"),this.pinch=new _.Signal(this,"pinch"),this.pinch_end=new _.Signal(this,"pinch:end"),this.rotate_start=new _.Signal(this,"rotate:start"),this.rotate=new _.Signal(this,"rotate"),this.rotate_end=new _.Signal(this,"rotate:end"),this.tap=new _.Signal(this,"tap"),this.doubletap=new _.Signal(this,"doubletap"),this.press=new _.Signal(this,"press"),this.pressup=new _.Signal(this,"pressup"),this.move_enter=new _.Signal(this,"move:enter"),this.move=new _.Signal(this,"move"),this.move_exit=new _.Signal(this,"move:exit"),this.scroll=new _.Signal(this,"scroll"),this.keydown=new _.Signal(this,"keydown"),this.keyup=new _.Signal(this,"keyup"),this.hammer=new a.default(this.hit_area,{touchAction:"auto",inputClass:a.default.TouchMouseInput}),this._prev_move=null,this._curr_pan=null,this._curr_pinch=null,this._curr_rotate=null,this._configure_hammerjs(),this.hit_area.addEventListener("mousemove",(t=>this._mouse_move(t))),this.hit_area.addEventListener("mouseenter",(t=>this._mouse_enter(t))),this.hit_area.addEventListener("mouseleave",(t=>this._mouse_exit(t))),this.hit_area.addEventListener("contextmenu",(t=>this._context_menu(t))),this.hit_area.addEventListener("wheel",(t=>this._mouse_wheel(t))),document.addEventListener("keydown",this),document.addEventListener("keyup",this),this.menu=new d.ContextMenu([],{prevent_hide:t=>2==t.button&&t.target==this.hit_area}),this.hit_area.appendChild(this.menu.el)}get hit_area(){return this.canvas_view.events_el}destroy(){this.menu.remove(),this.hammer.destroy(),document.removeEventListener("keydown",this),document.removeEventListener("keyup",this)}handleEvent(t){"keydown"==t.type?this._key_down(t):"keyup"==t.type&&this._key_up(t)}_configure_hammerjs(){this.hammer.get("doubletap").recognizeWith("tap"),this.hammer.get("tap").requireFailure("doubletap"),this.hammer.get("doubletap").dropRequireFailure("tap"),this.hammer.on("doubletap",(t=>this._doubletap(t))),this.hammer.on("tap",(t=>this._tap(t))),this.hammer.on("press",(t=>this._press(t))),this.hammer.on("pressup",(t=>this._pressup(t))),this.hammer.get("pan").set({direction:a.default.DIRECTION_ALL}),this.hammer.on("panstart",(t=>this._pan_start(t))),this.hammer.on("pan",(t=>this._pan(t))),this.hammer.on("panend",(t=>this._pan_end(t))),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("pinchstart",(t=>this._pinch_start(t))),this.hammer.on("pinch",(t=>this._pinch(t))),this.hammer.on("pinchend",(t=>this._pinch_end(t))),this.hammer.get("rotate").set({enable:!0}),this.hammer.on("rotatestart",(t=>this._rotate_start(t))),this.hammer.on("rotate",(t=>this._rotate(t))),this.hammer.on("rotateend",(t=>this._rotate_end(t)))}register_tool(t){const e=t.model.event_type;null!=e&&(u.isString(e)?this._register_tool(t,e):e.forEach(((e,s)=>this._register_tool(t,e,s<1))))}_register_tool(t,e,s=!0){const n=t,{id:i}=n.model,r=t=>e=>{e.id==i&&t(e.e)},a=t=>e=>{t(e.e)};switch(e){case"pan":null!=n._pan_start&&n.connect(this.pan_start,r(n._pan_start.bind(n))),null!=n._pan&&n.connect(this.pan,r(n._pan.bind(n))),null!=n._pan_end&&n.connect(this.pan_end,r(n._pan_end.bind(n)));break;case"pinch":null!=n._pinch_start&&n.connect(this.pinch_start,r(n._pinch_start.bind(n))),null!=n._pinch&&n.connect(this.pinch,r(n._pinch.bind(n))),null!=n._pinch_end&&n.connect(this.pinch_end,r(n._pinch_end.bind(n)));break;case"rotate":null!=n._rotate_start&&n.connect(this.rotate_start,r(n._rotate_start.bind(n))),null!=n._rotate&&n.connect(this.rotate,r(n._rotate.bind(n))),null!=n._rotate_end&&n.connect(this.rotate_end,r(n._rotate_end.bind(n)));break;case"move":null!=n._move_enter&&n.connect(this.move_enter,r(n._move_enter.bind(n))),null!=n._move&&n.connect(this.move,r(n._move.bind(n))),null!=n._move_exit&&n.connect(this.move_exit,r(n._move_exit.bind(n)));break;case"tap":null!=n._tap&&n.connect(this.tap,r(n._tap.bind(n))),null!=n._doubletap&&n.connect(this.doubletap,r(n._doubletap.bind(n)));break;case"press":null!=n._press&&n.connect(this.press,r(n._press.bind(n))),null!=n._pressup&&n.connect(this.pressup,r(n._pressup.bind(n)));break;case"scroll":null!=n._scroll&&n.connect(this.scroll,r(n._scroll.bind(n)));break;default:throw new Error(`unsupported event_type: ${e}`)}s&&(null!=n._keydown&&n.connect(this.keydown,a(n._keydown.bind(n))),null!=n._keyup&&n.connect(this.keyup,a(n._keyup.bind(n))),v.is_mobile&&null!=n._scroll&&"pinch"==e&&(h.logger.debug("Registering scroll on touch screen"),n.connect(this.scroll,r(n._scroll.bind(n)))))}_hit_test_renderers(t,e,s){var n;const i=t.get_renderer_views();for(const t of p.reversed(i))if(null===(n=t.interactive_hit)||void 0===n?void 0:n.call(t,e,s))return t;return null}set_cursor(t="default"){this.hit_area.style.cursor=t}_hit_test_frame(t,e,s){return t.frame.bbox.contains(e,s)}_hit_test_canvas(t,e,s){return t.layout.bbox.contains(e,s)}_hit_test_plot(t,e){for(const s of this.canvas_view.plot_views)if(s.layout.bbox.relative().contains(t,e))return s;return null}_trigger(t,e,s){var n;const{sx:i,sy:r}=e,a=this._hit_test_plot(i,r),_=t=>{const[s,n]=[i,r];return Object.assign(Object.assign({},e),{sx:s,sy:n})};if("panstart"==e.type||"pan"==e.type||"panend"==e.type){let n;if("panstart"==e.type&&null!=a?(this._curr_pan={plot_view:a},n=a):"pan"==e.type&&null!=this._curr_pan?n=this._curr_pan.plot_view:"panend"==e.type&&null!=this._curr_pan?(n=this._curr_pan.plot_view,this._curr_pan=null):n=null,null!=n){const e=_();this.__trigger(n,t,e,s)}}else if("pinchstart"==e.type||"pinch"==e.type||"pinchend"==e.type){let n;if("pinchstart"==e.type&&null!=a?(this._curr_pinch={plot_view:a},n=a):"pinch"==e.type&&null!=this._curr_pinch?n=this._curr_pinch.plot_view:"pinchend"==e.type&&null!=this._curr_pinch?(n=this._curr_pinch.plot_view,this._curr_pinch=null):n=null,null!=n){const e=_();this.__trigger(n,t,e,s)}}else if("rotatestart"==e.type||"rotate"==e.type||"rotateend"==e.type){let n;if("rotatestart"==e.type&&null!=a?(this._curr_rotate={plot_view:a},n=a):"rotate"==e.type&&null!=this._curr_rotate?n=this._curr_rotate.plot_view:"rotateend"==e.type&&null!=this._curr_rotate?(n=this._curr_rotate.plot_view,this._curr_rotate=null):n=null,null!=n){const e=_();this.__trigger(n,t,e,s)}}else if("mouseenter"==e.type||"mousemove"==e.type||"mouseleave"==e.type){const h=null===(n=this._prev_move)||void 0===n?void 0:n.plot_view;if(null!=h&&("mouseleave"==e.type||h!=a)){const{sx:t,sy:e}=_();this.__trigger(h,this.move_exit,{type:"mouseleave",sx:t,sy:e,shiftKey:!1,ctrlKey:!1},s)}if(null!=a&&("mouseenter"==e.type||h!=a)){const{sx:t,sy:e}=_();this.__trigger(a,this.move_enter,{type:"mouseenter",sx:t,sy:e,shiftKey:!1,ctrlKey:!1},s)}if(null!=a&&"mousemove"==e.type){const e=_();this.__trigger(a,t,e,s)}this._prev_move={sx:i,sy:r,plot_view:a}}else if(null!=a){const e=_();this.__trigger(a,t,e,s)}}__trigger(t,e,s,n){var i,r;const a=t.model.toolbar.gestures,_=e.name.split(":")[0],h=this._hit_test_renderers(t,s.sx,s.sy),o=this._hit_test_canvas(t,s.sx,s.sy);switch(_){case"move":{const n=a[_].active;null!=n&&this.trigger(e,s,n.id);const r=t.model.toolbar.inspectors.filter((t=>t.active));let l="default";null!=h?(l=null!==(i=h.cursor(s.sx,s.sy))&&void 0!==i?i:l,p.is_empty(r)||(e=this.move_exit)):this._hit_test_frame(t,s.sx,s.sy)&&(p.is_empty(r)||(l="crosshair")),this.set_cursor(l),t.set_toolbar_visibility(o),r.map((t=>this.trigger(e,s,t.id)));break}case"tap":{const{target:t}=n;if(null!=t&&t!=this.hit_area)return;null!=h&&null!=h.on_hit&&h.on_hit(s.sx,s.sy);const i=a[_].active;null!=i&&this.trigger(e,s,i.id);break}case"doubletap":{const t=null!==(r=a.doubletap.active)&&void 0!==r?r:a.tap.active;null!=t&&this.trigger(e,s,t.id);break}case"scroll":{const t=a[v.is_mobile?"pinch":"scroll"].active;null!=t&&(n.preventDefault(),n.stopPropagation(),this.trigger(e,s,t.id));break}case"pan":{const t=a[_].active;null!=t&&(n.preventDefault(),this.trigger(e,s,t.id));break}default:{const t=a[_].active;null!=t&&this.trigger(e,s,t.id)}}this._trigger_bokeh_event(t,s)}trigger(t,e,s=null){t.emit({id:s,e})}_trigger_bokeh_event(t,e){const s=(()=>{const{sx:s,sy:n}=e,i=t.frame.x_scale.invert(s),r=t.frame.y_scale.invert(n);switch(e.type){case"wheel":return new l.MouseWheel(s,n,i,r,e.delta);case"mousemove":return new l.MouseMove(s,n,i,r);case"mouseenter":return new l.MouseEnter(s,n,i,r);case"mouseleave":return new l.MouseLeave(s,n,i,r);case"tap":return new l.Tap(s,n,i,r);case"doubletap":return new l.DoubleTap(s,n,i,r);case"press":return new l.Press(s,n,i,r);case"pressup":return new l.PressUp(s,n,i,r);case"pan":return new l.Pan(s,n,i,r,e.deltaX,e.deltaY);case"panstart":return new l.PanStart(s,n,i,r);case"panend":return new l.PanEnd(s,n,i,r);case"pinch":return new l.Pinch(s,n,i,r,e.scale);case"pinchstart":return new l.PinchStart(s,n,i,r);case"pinchend":return new l.PinchEnd(s,n,i,r);case"rotate":return new l.Rotate(s,n,i,r,e.rotation);case"rotatestart":return new l.RotateStart(s,n,i,r);case"rotateend":return new l.RotateEnd(s,n,i,r);default:return}})();null!=s&&t.model.trigger_event(s)}_get_sxy(t){const{pageX:e,pageY:s}=function(t){return"undefined"!=typeof TouchEvent&&t instanceof TouchEvent}(t)?(0!=t.touches.length?t.touches:t.changedTouches)[0]:t,{left:n,top:i}=o.offset(this.hit_area);return{sx:e-n,sy:s-i}}_pan_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t.srcEvent)),{deltaX:t.deltaX,deltaY:t.deltaY,shiftKey:t.srcEvent.shiftKey,ctrlKey:t.srcEvent.ctrlKey})}_pinch_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t.srcEvent)),{scale:t.scale,shiftKey:t.srcEvent.shiftKey,ctrlKey:t.srcEvent.ctrlKey})}_rotate_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t.srcEvent)),{rotation:t.rotation,shiftKey:t.srcEvent.shiftKey,ctrlKey:t.srcEvent.ctrlKey})}_tap_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t.srcEvent)),{shiftKey:t.srcEvent.shiftKey,ctrlKey:t.srcEvent.ctrlKey})}_move_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t)),{shiftKey:t.shiftKey,ctrlKey:t.ctrlKey})}_scroll_event(t){return Object.assign(Object.assign({type:t.type},this._get_sxy(t)),{delta:c.getDeltaY(t),shiftKey:t.shiftKey,ctrlKey:t.ctrlKey})}_key_event(t){return{type:t.type,keyCode:t.keyCode}}_pan_start(t){const e=this._pan_event(t);e.sx-=t.deltaX,e.sy-=t.deltaY,this._trigger(this.pan_start,e,t.srcEvent)}_pan(t){this._trigger(this.pan,this._pan_event(t),t.srcEvent)}_pan_end(t){this._trigger(this.pan_end,this._pan_event(t),t.srcEvent)}_pinch_start(t){this._trigger(this.pinch_start,this._pinch_event(t),t.srcEvent)}_pinch(t){this._trigger(this.pinch,this._pinch_event(t),t.srcEvent)}_pinch_end(t){this._trigger(this.pinch_end,this._pinch_event(t),t.srcEvent)}_rotate_start(t){this._trigger(this.rotate_start,this._rotate_event(t),t.srcEvent)}_rotate(t){this._trigger(this.rotate,this._rotate_event(t),t.srcEvent)}_rotate_end(t){this._trigger(this.rotate_end,this._rotate_event(t),t.srcEvent)}_tap(t){this._trigger(this.tap,this._tap_event(t),t.srcEvent)}_doubletap(t){this._trigger(this.doubletap,this._tap_event(t),t.srcEvent)}_press(t){this._trigger(this.press,this._tap_event(t),t.srcEvent)}_pressup(t){this._trigger(this.pressup,this._tap_event(t),t.srcEvent)}_mouse_enter(t){this._trigger(this.move_enter,this._move_event(t),t)}_mouse_move(t){this._trigger(this.move,this._move_event(t),t)}_mouse_exit(t){this._trigger(this.move_exit,this._move_event(t),t)}_mouse_wheel(t){this._trigger(this.scroll,this._scroll_event(t),t)}_context_menu(t){!this.menu.is_open&&this.menu.can_open&&t.preventDefault();const{sx:e,sy:s}=this._get_sxy(t);this.menu.toggle({left:e,top:s})}_key_down(t){this.trigger(this.keydown,this._key_event(t))}_key_up(t){this.trigger(this.keyup,this._key_event(t))}}s.UIEventBus=g,g.__name__="UIEventBus"}, +function _(e,t,s,n,_){n();var a=this&&this.__decorate||function(e,t,s,n){var _,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,n);else for(var c=e.length-1;c>=0;c--)(_=e[c])&&(o=(a<3?_(o):a>3?_(t,s,o):_(t,s))||o);return a>3&&o&&Object.defineProperty(t,s,o),o};function o(e){return function(t){t.prototype.event_name=e}}class c{to_json(){const{event_name:e}=this;return{event_name:e,event_values:this._to_json()}}}s.BokehEvent=c,c.__name__="BokehEvent";class r extends c{constructor(){super(...arguments),this.origin=null}_to_json(){return{model:this.origin}}}s.ModelEvent=r,r.__name__="ModelEvent";let l=class extends c{_to_json(){return{}}};s.DocumentReady=l,l.__name__="DocumentReady",s.DocumentReady=l=a([o("document_ready")],l);let i=class extends r{};s.ButtonClick=i,i.__name__="ButtonClick",s.ButtonClick=i=a([o("button_click")],i);let u=class extends r{constructor(e){super(),this.item=e}_to_json(){const{item:e}=this;return Object.assign(Object.assign({},super._to_json()),{item:e})}};s.MenuItemClick=u,u.__name__="MenuItemClick",s.MenuItemClick=u=a([o("menu_item_click")],u);class d extends r{}s.UIEvent=d,d.__name__="UIEvent";let h=class extends d{};s.LODStart=h,h.__name__="LODStart",s.LODStart=h=a([o("lodstart")],h);let m=class extends d{};s.LODEnd=m,m.__name__="LODEnd",s.LODEnd=m=a([o("lodend")],m);let x=class extends d{constructor(e,t){super(),this.geometry=e,this.final=t}_to_json(){const{geometry:e,final:t}=this;return Object.assign(Object.assign({},super._to_json()),{geometry:e,final:t})}};s.SelectionGeometry=x,x.__name__="SelectionGeometry",s.SelectionGeometry=x=a([o("selectiongeometry")],x);let p=class extends d{};s.Reset=p,p.__name__="Reset",s.Reset=p=a([o("reset")],p);class j extends d{constructor(e,t,s,n){super(),this.sx=e,this.sy=t,this.x=s,this.y=n}_to_json(){const{sx:e,sy:t,x:s,y:n}=this;return Object.assign(Object.assign({},super._to_json()),{sx:e,sy:t,x:s,y:n})}}s.PointEvent=j,j.__name__="PointEvent";let y=class extends j{constructor(e,t,s,n,_,a){super(e,t,s,n),this.sx=e,this.sy=t,this.x=s,this.y=n,this.delta_x=_,this.delta_y=a}_to_json(){const{delta_x:e,delta_y:t}=this;return Object.assign(Object.assign({},super._to_json()),{delta_x:e,delta_y:t})}};s.Pan=y,y.__name__="Pan",s.Pan=y=a([o("pan")],y);let P=class extends j{constructor(e,t,s,n,_){super(e,t,s,n),this.sx=e,this.sy=t,this.x=s,this.y=n,this.scale=_}_to_json(){const{scale:e}=this;return Object.assign(Object.assign({},super._to_json()),{scale:e})}};s.Pinch=P,P.__name__="Pinch",s.Pinch=P=a([o("pinch")],P);let v=class extends j{constructor(e,t,s,n,_){super(e,t,s,n),this.sx=e,this.sy=t,this.x=s,this.y=n,this.rotation=_}_to_json(){const{rotation:e}=this;return Object.assign(Object.assign({},super._to_json()),{rotation:e})}};s.Rotate=v,v.__name__="Rotate",s.Rotate=v=a([o("rotate")],v);let g=class extends j{constructor(e,t,s,n,_){super(e,t,s,n),this.sx=e,this.sy=t,this.x=s,this.y=n,this.delta=_}_to_json(){const{delta:e}=this;return Object.assign(Object.assign({},super._to_json()),{delta:e})}};s.MouseWheel=g,g.__name__="MouseWheel",s.MouseWheel=g=a([o("wheel")],g);let E=class extends j{};s.MouseMove=E,E.__name__="MouseMove",s.MouseMove=E=a([o("mousemove")],E);let O=class extends j{};s.MouseEnter=O,O.__name__="MouseEnter",s.MouseEnter=O=a([o("mouseenter")],O);let b=class extends j{};s.MouseLeave=b,b.__name__="MouseLeave",s.MouseLeave=b=a([o("mouseleave")],b);let M=class extends j{};s.Tap=M,M.__name__="Tap",s.Tap=M=a([o("tap")],M);let R=class extends j{};s.DoubleTap=R,R.__name__="DoubleTap",s.DoubleTap=R=a([o("doubletap")],R);let f=class extends j{};s.Press=f,f.__name__="Press",s.Press=f=a([o("press")],f);let S=class extends j{};s.PressUp=S,S.__name__="PressUp",s.PressUp=S=a([o("pressup")],S);let D=class extends j{};s.PanStart=D,D.__name__="PanStart",s.PanStart=D=a([o("panstart")],D);let k=class extends j{};s.PanEnd=k,k.__name__="PanEnd",s.PanEnd=k=a([o("panend")],k);let L=class extends j{};s.PinchStart=L,L.__name__="PinchStart",s.PinchStart=L=a([o("pinchstart")],L);let C=class extends j{};s.PinchEnd=C,C.__name__="PinchEnd",s.PinchEnd=C=a([o("pinchend")],C);let T=class extends j{};s.RotateStart=T,T.__name__="RotateStart",s.RotateStart=T=a([o("rotatestart")],T);let B=class extends j{};s.RotateEnd=B,B.__name__="RotateEnd",s.RotateEnd=B=a([o("rotateend")],B)}, +function _(t,e,n,l,o){ +/*! + * jQuery Mousewheel 3.1.13 + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + */ +function u(t){const e=getComputedStyle(t).fontSize;return null!=e?parseInt(e,10):null}l(),n.getDeltaY=function(t){let e=-t.deltaY;if(t.target instanceof HTMLElement)switch(t.deltaMode){case t.DOM_DELTA_LINE:e*=(n=t.target,null!==(a=null!==(o=u(null!==(l=n.offsetParent)&&void 0!==l?l:document.body))&&void 0!==o?o:u(n))&&void 0!==a?a:16);break;case t.DOM_DELTA_PAGE:e*=function(t){return t.clientHeight}(t.target)}var n,l,o,a;return e}}, +function _(m,i,u,s,a){s(),a("Expression",m(124).Expression),a("CustomJSExpr",m(267).CustomJSExpr),a("Stack",m(268).Stack),a("CumSum",m(269).CumSum),a("ScalarExpression",m(124).ScalarExpression),a("Minimum",m(270).Minimum),a("Maximum",m(271).Maximum)}, +function _(t,e,s,n,r){n();const i=t(14),o=t(124),a=t(24),c=t(9),u=t(13),l=t(34),h=t(8);class p extends o.Expression{constructor(t){super(t)}static init_CustomJSExpr(){this.define((({Unknown:t,String:e,Dict:s})=>({args:[s(t),{}],code:[e,""]})))}connect_signals(){super.connect_signals();for(const t of u.values(this.args))t instanceof i.HasProps&&t.change.connect((()=>{this._result.clear(),this.change.emit()}))}get names(){return u.keys(this.args)}get values(){return u.values(this.args)}get func(){const t=l.use_strict(this.code);return new a.GeneratorFunction(...this.names,t)}_v_compute(t){const e=this.func.apply(t,this.values);let s=e.next();if(s.done&&void 0!==s.value){const{value:e}=s;return h.isArray(e)||h.isTypedArray(e)?e:h.isIterable(e)?[...e]:c.repeat(e,t.length)}{const t=[];do{t.push(s.value),s=e.next()}while(!s.done);return t}}}s.CustomJSExpr=p,p.__name__="CustomJSExpr",p.init_CustomJSExpr()}, +function _(t,n,e,i,s){i();const a=t(124);class c extends a.Expression{constructor(t){super(t)}static init_Stack(){this.define((({String:t,Array:n})=>({fields:[n(t),[]]})))}_v_compute(t){var n;const e=null!==(n=t.get_length())&&void 0!==n?n:0,i=new Float64Array(e);for(const n of this.fields){const s=t.data[n];if(null!=s)for(let t=0,n=Math.min(e,s.length);t({field:[t],include_zero:[e,!1]})))}_v_compute(e){var t;const n=new Float64Array(null!==(t=e.get_length())&&void 0!==t?t:0),i=e.data[this.field],u=this.include_zero?1:0;n[0]=this.include_zero?0:i[0];for(let e=1;e({field:[n],initial:[t(i),null]})))}_compute(i){var n,t;const l=null!==(n=i.data[this.field])&&void 0!==n?n:[];return Math.min(null!==(t=this.initial)&&void 0!==t?t:1/0,m.min(l))}}t.Minimum=s,s.__name__="Minimum",s.init_Minimum()}, +function _(i,t,a,n,l){n();const u=i(124),e=i(9);class m extends u.ScalarExpression{constructor(i){super(i)}static init_Maximum(){this.define((({Number:i,String:t,Nullable:a})=>({field:[t],initial:[a(i),null]})))}_compute(i){var t,a;const n=null!==(t=i.data[this.field])&&void 0!==t?t:[];return Math.max(null!==(a=this.initial)&&void 0!==a?a:-1/0,e.max(n))}}a.Maximum=m,m.__name__="Maximum",m.init_Maximum()}, +function _(e,t,l,r,i){r(),i("BooleanFilter",e(273).BooleanFilter),i("CustomJSFilter",e(274).CustomJSFilter),i("Filter",e(121).Filter),i("GroupFilter",e(275).GroupFilter),i("IndexFilter",e(276).IndexFilter)}, +function _(e,n,l,o,t){o();const i=e(121),s=e(24);class a extends i.Filter{constructor(e){super(e)}static init_BooleanFilter(){this.define((({Boolean:e,Array:n,Nullable:l})=>({booleans:[l(n(e)),null]})))}compute_indices(e){const n=e.length,{booleans:l}=this;return null==l?s.Indices.all_set(n):s.Indices.from_booleans(n,l)}}l.BooleanFilter=a,a.__name__="BooleanFilter",a.init_BooleanFilter()}, +function _(e,t,s,n,r){n();const i=e(121),o=e(24),u=e(13),c=e(8),a=e(34);class l extends i.Filter{constructor(e){super(e)}static init_CustomJSFilter(){this.define((({Unknown:e,String:t,Dict:s})=>({args:[s(e),{}],code:[t,""]})))}get names(){return u.keys(this.args)}get values(){return u.values(this.args)}get func(){const e=a.use_strict(this.code);return new Function(...this.names,"source",e)}compute_indices(e){const t=e.length,s=this.func(...this.values,e);if(null==s)return o.Indices.all_set(t);if(c.isArrayOf(s,c.isInteger))return o.Indices.from_indices(t,s);if(c.isArrayOf(s,c.isBoolean))return o.Indices.from_booleans(t,s);throw new Error(`expect an array of integers or booleans, or null, got ${s}`)}}s.CustomJSFilter=l,l.__name__="CustomJSFilter",l.init_CustomJSFilter()}, +function _(n,t,e,i,o){i();const r=n(121),u=n(24),s=n(19);class c extends r.Filter{constructor(n){super(n)}static init_GroupFilter(){this.define((({String:n})=>({column_name:[n],group:[n]})))}compute_indices(n){const t=n.get_column(this.column_name);if(null==t)return s.logger.warn(`${this}: groupby column '${this.column_name}' not found in the data source`),new u.Indices(n.length,1);{const e=new u.Indices(n.length);for(let n=0;n({indices:[i(n(e)),null]})))}compute_indices(e){const n=e.length,{indices:i}=this;return null==i?c.Indices.all_set(n):c.Indices.from_indices(n,i)}}i.IndexFilter=r,r.__name__="IndexFilter",r.init_IndexFilter()}, +function _(e,a,l,i,t){i(),t("AnnularWedge",e(278).AnnularWedge),t("Annulus",e(279).Annulus),t("Arc",e(280).Arc),t("Bezier",e(281).Bezier),t("Circle",e(282).Circle),t("Ellipse",e(286).Ellipse),t("EllipseOval",e(287).EllipseOval),t("Glyph",e(98).Glyph),t("HArea",e(117).HArea),t("HBar",e(289).HBar),t("HexTile",e(291).HexTile),t("Image",e(292).Image),t("ImageRGBA",e(294).ImageRGBA),t("ImageURL",e(295).ImageURL),t("Line",e(63).Line),t("MultiLine",e(127).MultiLine),t("MultiPolygons",e(297).MultiPolygons),t("Oval",e(298).Oval),t("Patch",e(116).Patch),t("Patches",e(128).Patches),t("Quad",e(299).Quad),t("Quadratic",e(300).Quadratic),t("Ray",e(301).Ray),t("Rect",e(302).Rect),t("Scatter",e(303).Scatter),t("Segment",e(306).Segment),t("Spline",e(307).Spline),t("Step",e(309).Step),t("Text",e(310).Text),t("VArea",e(119).VArea),t("VBar",e(311).VBar),t("Wedge",e(312).Wedge)}, +function _(e,t,s,i,r){i();const n=e(1),a=e(64),o=e(106),_=e(48),d=e(24),u=e(20),h=n.__importStar(e(18)),l=e(10),c=e(59);class g extends a.XYGlyphView{_map_data(){"data"==this.model.properties.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xscale,this._x,this.inner_radius):this.sinner_radius=d.to_screen(this.inner_radius),"data"==this.model.properties.outer_radius.units?this.souter_radius=this.sdist(this.renderer.xscale,this._x,this.outer_radius):this.souter_radius=d.to_screen(this.outer_radius)}_render(e,t,s){const{sx:i,sy:r,start_angle:n,end_angle:a,sinner_radius:o,souter_radius:_}=null!=s?s:this,d="anticlock"==this.model.direction;for(const s of t){const t=i[s],u=r[s],h=o[s],l=_[s],c=n.get(s),g=a.get(s);if(isNaN(t+u+h+l+c+g))continue;const x=g-c;e.translate(t,u),e.rotate(c),e.beginPath(),e.moveTo(l,0),e.arc(0,0,l,0,x,d),e.rotate(x),e.lineTo(h,0),e.arc(0,0,h,0,-x,!d),e.closePath(),e.rotate(-x-c),e.translate(-t,-u),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(e,s),e.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_vectorize(e,s),e.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(e,s),e.stroke())}}_hit_point(e){const{sx:t,sy:s}=e,i=this.renderer.xscale.invert(t),r=this.renderer.yscale.invert(s);let n,a,o,_;if("data"==this.model.properties.outer_radius.units)n=i-this.max_outer_radius,o=i+this.max_outer_radius,a=r-this.max_outer_radius,_=r+this.max_outer_radius;else{const e=t-this.max_outer_radius,i=t+this.max_outer_radius;[n,o]=this.renderer.xscale.r_invert(e,i);const r=s-this.max_outer_radius,d=s+this.max_outer_radius;[a,_]=this.renderer.yscale.r_invert(r,d)}const d=[];for(const e of this.index.indices({x0:n,x1:o,y0:a,y1:_})){const t=this.souter_radius[e]**2,s=this.sinner_radius[e]**2,[n,a]=this.renderer.xscale.r_compute(i,this._x[e]),[o,_]=this.renderer.yscale.r_compute(r,this._y[e]),u=(n-a)**2+(o-_)**2;u<=t&&u>=s&&d.push(e)}const u="anticlock"==this.model.direction,h=[];for(const e of d){const i=Math.atan2(s-this.sy[e],t-this.sx[e]);l.angle_between(-i,-this.start_angle.get(e),-this.end_angle.get(e),u)&&h.push(e)}return new c.Selection({indices:h})}draw_legend_for_index(e,t,s){o.generic_area_vector_legend(this.visuals,e,t,s)}scenterxy(e){const t=(this.sinner_radius[e]+this.souter_radius[e])/2,s=(this.start_angle.get(e)+this.end_angle.get(e))/2;return[this.sx[e]+t*Math.cos(s),this.sy[e]+t*Math.sin(s)]}}s.AnnularWedgeView=g,g.__name__="AnnularWedgeView";class x extends a.XYGlyph{constructor(e){super(e)}static init_AnnularWedge(){this.prototype.default_view=g,this.mixins([_.LineVector,_.FillVector,_.HatchVector]),this.define((({})=>({direction:[u.Direction,"anticlock"],inner_radius:[h.DistanceSpec,{field:"inner_radius"}],outer_radius:[h.DistanceSpec,{field:"outer_radius"}],start_angle:[h.AngleSpec,{field:"start_angle"}],end_angle:[h.AngleSpec,{field:"end_angle"}]})))}}s.AnnularWedge=x,x.__name__="AnnularWedge",x.init_AnnularWedge()}, +function _(s,i,t,e,r){e();const n=s(1),a=s(64),u=s(24),_=s(48),o=n.__importStar(s(18)),h=s(27),d=s(59);class c extends a.XYGlyphView{_map_data(){"data"==this.model.properties.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xscale,this._x,this.inner_radius):this.sinner_radius=u.to_screen(this.inner_radius),"data"==this.model.properties.outer_radius.units?this.souter_radius=this.sdist(this.renderer.xscale,this._x,this.outer_radius):this.souter_radius=u.to_screen(this.outer_radius)}_render(s,i,t){const{sx:e,sy:r,sinner_radius:n,souter_radius:a}=null!=t?t:this;for(const t of i){const i=e[t],_=r[t],o=n[t],d=a[t];function u(){if(s.beginPath(),h.is_ie)for(const t of[!1,!0])s.arc(i,_,o,0,Math.PI,t),s.arc(i,_,d,Math.PI,0,!t);else s.arc(i,_,o,0,2*Math.PI,!0),s.arc(i,_,d,2*Math.PI,0,!1)}isNaN(i+_+o+d)||(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(s,t),u(),s.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_vectorize(s,t),u(),s.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(s,t),s.beginPath(),s.arc(i,_,o,0,2*Math.PI),s.moveTo(i+d,_),s.arc(i,_,d,0,2*Math.PI),s.stroke()))}}_hit_point(s){const{sx:i,sy:t}=s,e=this.renderer.xscale.invert(i),r=this.renderer.yscale.invert(t);let n,a,u,_;if("data"==this.model.properties.outer_radius.units)n=e-this.max_outer_radius,u=e+this.max_outer_radius,a=r-this.max_outer_radius,_=r+this.max_outer_radius;else{const s=i-this.max_outer_radius,e=i+this.max_outer_radius;[n,u]=this.renderer.xscale.r_invert(s,e);const r=t-this.max_outer_radius,o=t+this.max_outer_radius;[a,_]=this.renderer.yscale.r_invert(r,o)}const o=[];for(const s of this.index.indices({x0:n,x1:u,y0:a,y1:_})){const i=this.souter_radius[s]**2,t=this.sinner_radius[s]**2,[n,a]=this.renderer.xscale.r_compute(e,this._x[s]),[u,_]=this.renderer.yscale.r_compute(r,this._y[s]),h=(n-a)**2+(u-_)**2;h<=i&&h>=t&&o.push(s)}return new d.Selection({indices:o})}draw_legend_for_index(s,{x0:i,y0:t,x1:e,y1:r},n){const a=n+1,u=new Array(a);u[n]=(i+e)/2;const _=new Array(a);_[n]=(t+r)/2;const o=.5*Math.min(Math.abs(e-i),Math.abs(r-t)),h=new Array(a);h[n]=.4*o;const d=new Array(a);d[n]=.8*o,this._render(s,[n],{sx:u,sy:_,sinner_radius:h,souter_radius:d})}}t.AnnulusView=c,c.__name__="AnnulusView";class l extends a.XYGlyph{constructor(s){super(s)}static init_Annulus(){this.prototype.default_view=c,this.mixins([_.LineVector,_.FillVector,_.HatchVector]),this.define((({})=>({inner_radius:[o.DistanceSpec,{field:"inner_radius"}],outer_radius:[o.DistanceSpec,{field:"outer_radius"}]})))}}t.Annulus=l,l.__name__="Annulus",l.init_Annulus()}, +function _(e,i,s,t,n){t();const r=e(1),a=e(64),c=e(106),d=e(48),_=e(24),l=e(20),o=r.__importStar(e(18));class h extends a.XYGlyphView{_map_data(){"data"==this.model.properties.radius.units?this.sradius=this.sdist(this.renderer.xscale,this._x,this.radius):this.sradius=_.to_screen(this.radius)}_render(e,i,s){if(this.visuals.line.doit){const{sx:t,sy:n,sradius:r,start_angle:a,end_angle:c}=null!=s?s:this,d="anticlock"==this.model.direction;for(const s of i){const i=t[s],_=n[s],l=r[s],o=a.get(s),h=c.get(s);isNaN(i+_+l+o+h)||(e.beginPath(),e.arc(i,_,l,o,h,d),this.visuals.line.set_vectorize(e,s),e.stroke())}}}draw_legend_for_index(e,i,s){c.generic_line_vector_legend(this.visuals,e,i,s)}}s.ArcView=h,h.__name__="ArcView";class u extends a.XYGlyph{constructor(e){super(e)}static init_Arc(){this.prototype.default_view=h,this.mixins(d.LineVector),this.define((({})=>({direction:[l.Direction,"anticlock"],radius:[o.DistanceSpec,{field:"radius"}],start_angle:[o.AngleSpec,{field:"start_angle"}],end_angle:[o.AngleSpec,{field:"end_angle"}]})))}}s.Arc=u,u.__name__="Arc",u.init_Arc()}, +function _(e,t,i,s,n){s();const o=e(1),c=e(48),r=e(98),a=e(106),_=e(65),d=o.__importStar(e(18));function l(e,t,i,s,n,o,c,r){const a=[],_=[[],[]];for(let _=0;_<=2;_++){let d,l,x;if(0===_?(l=6*e-12*i+6*n,d=-3*e+9*i-9*n+3*c,x=3*i-3*e):(l=6*t-12*s+6*o,d=-3*t+9*s-9*o+3*r,x=3*s-3*t),Math.abs(d)<1e-12){if(Math.abs(l)<1e-12)continue;const e=-x/l;0({x0:[d.XCoordinateSpec,{field:"x0"}],y0:[d.YCoordinateSpec,{field:"y0"}],x1:[d.XCoordinateSpec,{field:"x1"}],y1:[d.YCoordinateSpec,{field:"y1"}],cx0:[d.XCoordinateSpec,{field:"cx0"}],cy0:[d.YCoordinateSpec,{field:"cy0"}],cx1:[d.XCoordinateSpec,{field:"cx1"}],cy1:[d.YCoordinateSpec,{field:"cy1"}]}))),this.mixins(c.LineVector)}}i.Bezier=h,h.__name__="Bezier",h.init_Bezier()}, +function _(s,i,e,t,r){t();const a=s(1),n=s(64),h=s(283),d=s(48),l=s(24),c=s(20),_=a.__importStar(s(107)),u=a.__importStar(s(18)),o=s(9),x=s(12),m=s(59);class y extends n.XYGlyphView{initialize(){super.initialize();const{webgl:s}=this.renderer.plot_view.canvas_view;null!=s&&(this.glglyph=new h.MarkerGL(s.gl,this,"circle"))}get use_radius(){return!(this.radius.is_Scalar()&&isNaN(this.radius.value))}_map_data(){if(this.use_radius)if("data"==this.model.properties.radius.units)switch(this.model.radius_dimension){case"x":this.sradius=this.sdist(this.renderer.xscale,this._x,this.radius);break;case"y":this.sradius=this.sdist(this.renderer.yscale,this._y,this.radius);break;case"max":{const s=this.sdist(this.renderer.xscale,this._x,this.radius),i=this.sdist(this.renderer.yscale,this._y,this.radius);this.sradius=x.map(s,((s,e)=>Math.max(s,i[e])));break}case"min":{const s=this.sdist(this.renderer.xscale,this._x,this.radius),i=this.sdist(this.renderer.yscale,this._y,this.radius);this.sradius=x.map(s,((s,e)=>Math.min(s,i[e])));break}}else this.sradius=l.to_screen(this.radius),this._configure("max_size",{value:2*this.max_radius});else{const s=new l.ScreenArray(this.size);this.sradius=x.map(s,(s=>s/2))}}_mask_data(){const{frame:s}=this.renderer.plot_view,i=s.x_target,e=s.y_target;let t,r;return this.use_radius&&"data"==this.model.properties.radius.units?(t=i.map((s=>this.renderer.xscale.invert(s))).widen(this.max_radius),r=e.map((s=>this.renderer.yscale.invert(s))).widen(this.max_radius)):(t=i.widen(this.max_size).map((s=>this.renderer.xscale.invert(s))),r=e.widen(this.max_size).map((s=>this.renderer.yscale.invert(s)))),this.index.indices({x0:t.start,x1:t.end,y0:r.start,y1:r.end})}_render(s,i,e){const{sx:t,sy:r,sradius:a}=null!=e?e:this;for(const e of i){const i=t[e],n=r[e],h=a[e];isNaN(i+n+h)||(s.beginPath(),s.arc(i,n,h,0,2*Math.PI,!1),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(s,e),s.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_vectorize(s,e),s.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(s,e),s.stroke()))}}_hit_point(s){const{sx:i,sy:e}=s,t=this.renderer.xscale.invert(i),r=this.renderer.yscale.invert(e),{hit_dilation:a}=this.model;let n,h,d,l;if(this.use_radius&&"data"==this.model.properties.radius.units)n=t-this.max_radius*a,h=t+this.max_radius*a,d=r-this.max_radius*a,l=r+this.max_radius*a;else{const s=i-this.max_size*a,t=i+this.max_size*a;[n,h]=this.renderer.xscale.r_invert(s,t);const r=e-this.max_size*a,c=e+this.max_size*a;[d,l]=this.renderer.yscale.r_invert(r,c)}const c=this.index.indices({x0:n,x1:h,y0:d,y1:l}),_=[];if(this.use_radius&&"data"==this.model.properties.radius.units)for(const s of c){const i=(this.sradius[s]*a)**2,[e,n]=this.renderer.xscale.r_compute(t,this._x[s]),[h,d]=this.renderer.yscale.r_compute(r,this._y[s]);(e-n)**2+(h-d)**2<=i&&_.push(s)}else for(const s of c){const t=(this.sradius[s]*a)**2;(this.sx[s]-i)**2+(this.sy[s]-e)**2<=t&&_.push(s)}return new m.Selection({indices:_})}_hit_span(s){const{sx:i,sy:e}=s,t=this.bounds();let r,a,n,h;if("h"==s.direction){let s,e;if(n=t.y0,h=t.y1,this.use_radius&&"data"==this.model.properties.radius.units)s=i-this.max_radius,e=i+this.max_radius,[r,a]=this.renderer.xscale.r_invert(s,e);else{const t=this.max_size/2;s=i-t,e=i+t,[r,a]=this.renderer.xscale.r_invert(s,e)}}else{let s,i;if(r=t.x0,a=t.x1,this.use_radius&&"data"==this.model.properties.radius.units)s=e-this.max_radius,i=e+this.max_radius,[n,h]=this.renderer.yscale.r_invert(s,i);else{const t=this.max_size/2;s=e-t,i=e+t,[n,h]=this.renderer.yscale.r_invert(s,i)}}const d=[...this.index.indices({x0:r,x1:a,y0:n,y1:h})];return new m.Selection({indices:d})}_hit_rect(s){const{sx0:i,sx1:e,sy0:t,sy1:r}=s,[a,n]=this.renderer.xscale.r_invert(i,e),[h,d]=this.renderer.yscale.r_invert(t,r),l=[...this.index.indices({x0:a,x1:n,y0:h,y1:d})];return new m.Selection({indices:l})}_hit_poly(s){const{sx:i,sy:e}=s,t=o.range(0,this.sx.length),r=[];for(let s=0,a=t.length;s({angle:[u.AngleSpec,0],size:[u.ScreenDistanceSpec,{value:4}],radius:[u.NullDistanceSpec,null],radius_dimension:[c.RadiusDimension,"x"],hit_dilation:[s,1]})))}}e.Circle=p,p.__name__="Circle",p.init_Circle()}, +function _(t,e,s,i,a){i();const r=t(1),o=t(109),_=t(113),l=r.__importDefault(t(284)),h=r.__importDefault(t(285)),n=t(282),f=t(12),u=t(19),c=t(24),g=t(22),b=t(11);function d(t,e,s,i,a,r,o){if(a.doit)if(r.is_Scalar()&&o.is_Scalar()){e.used=!1;const[i,a,_,l]=g.color2rgba(r.value,o.value);t.set_attribute(s,"vec4",[i/255,a/255,_/255,l/255])}else{let a;if(e.used=!0,r.is_Vector()){const t=new c.ColorArray(r.array);if(a=new c.RGBAArray(t.buffer),!o.is_Scalar()||1!=o.value)for(let t=0;t2*t))),i.data_changed=!1),this.visuals_changed&&(this._set_visuals(a),this.visuals_changed=!1),this.prog.set_uniform("u_pixel_ratio","float",[s.pixel_ratio]),this.prog.set_uniform("u_canvas_size","vec2",[s.width,s.height]),this.prog.set_attribute("a_sx","float",i.vbo_sx),this.prog.set_attribute("a_sy","float",i.vbo_sy),this.prog.set_attribute("a_size","float",i.vbo_s),this.prog.set_attribute("a_angle","float",i.vbo_a),0!=t.length)if(t.length===a)this.prog.draw(this.gl.POINTS,[0,a]);else if(a<65535){const e=window.navigator.userAgent;e.indexOf("MSIE ")+e.indexOf("Trident/")+e.indexOf("Edge/")>0&&u.logger.warn("WebGL warning: IE is known to produce 1px sprites whith selections."),this.index_buffer.set_size(2*t.length),this.index_buffer.set_data(0,new Uint16Array(t)),this.prog.draw(this.gl.POINTS,this.index_buffer)}else{const e=64e3,s=[];for(let t=0,i=Math.ceil(a/e);t2*t))):this.vbo_s.set_data(0,new Float32Array(this.glyph.size))}_set_visuals(t){const{line:e,fill:s}=this.glyph.visuals;!function(t,e,s,i,a,r){if(a.doit){if(r.is_Scalar())e.used=!1,t.set_attribute(s,"float",[r.value]);else if(r.is_Vector()){e.used=!0;const a=new Float32Array(r.array);e.set_size(4*i),e.set_data(0,a),t.set_attribute(s,"float",e)}}else e.used=!1,t.set_attribute(s,"float",[0])}(this.prog,this.vbo_linewidth,"a_linewidth",t,e,e.line_width),d(this.prog,this.vbo_fg_color,"a_fg_color",t,e,e.line_color,e.line_alpha),d(this.prog,this.vbo_bg_color,"a_bg_color",t,s,s.fill_color,s.fill_alpha),this.prog.set_uniform("u_antialias","float",[.8])}}s.MarkerGL=p,p.__name__="MarkerGL"}, +function _(n,i,a,o,_){o();a.default="\nprecision mediump float;\nconst float SQRT_2 = 1.4142135623730951;\n//\nuniform float u_pixel_ratio;\nuniform vec2 u_canvas_size;\nuniform vec2 u_offset;\nuniform vec2 u_scale;\nuniform float u_antialias;\n//\nattribute float a_sx;\nattribute float a_sy;\nattribute float a_size;\nattribute float a_angle; // in radians\nattribute float a_linewidth;\nattribute vec4 a_fg_color;\nattribute vec4 a_bg_color;\n//\nvarying float v_linewidth;\nvarying float v_size;\nvarying vec4 v_fg_color;\nvarying vec4 v_bg_color;\nvarying vec2 v_rotation;\n\nvoid main (void)\n{\n v_size = a_size * u_pixel_ratio;\n v_linewidth = a_linewidth * u_pixel_ratio;\n v_fg_color = a_fg_color;\n v_bg_color = a_bg_color;\n v_rotation = vec2(cos(-a_angle), sin(-a_angle));\n vec2 pos = vec2(a_sx, a_sy); // in pixels\n pos += 0.5; // make up for Bokeh's offset\n pos /= u_canvas_size / u_pixel_ratio; // in 0..1\n gl_Position = vec4(pos*2.0-1.0, 0.0, 1.0);\n gl_Position.y *= -1.0;\n gl_PointSize = SQRT_2 * v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\n}\n"}, +function _(n,a,s,e,t){e();s.default='\nprecision mediump float;\n\nconst float SQRT_2 = 1.4142135623730951;\nconst float PI = 3.14159265358979323846264;\n\nconst float IN_ANGLE = 0.6283185307179586; // PI/5. = 36 degrees (star of 5 pikes)\n//const float OUT_ANGLE = PI/2. - IN_ANGLE; // External angle for regular stars\nconst float COS_A = 0.8090169943749475; // cos(IN_ANGLE)\nconst float SIN_A = 0.5877852522924731; // sin(IN_ANGLE)\nconst float COS_B = 0.5877852522924731; // cos(OUT_ANGLE)\nconst float SIN_B = 0.8090169943749475; // sin(OUT_ANGLE)\n\n//\nuniform float u_antialias;\n//\nvarying vec4 v_fg_color;\nvarying vec4 v_bg_color;\nvarying float v_linewidth;\nvarying float v_size;\nvarying vec2 v_rotation;\n\n#ifdef USE_ASTERISK\n// asterisk\nfloat marker(vec2 P, float size)\n{\n // Masks\n float diamond = max(abs(SQRT_2 / 2.0 * (P.x - P.y)), abs(SQRT_2 / 2.0 * (P.x + P.y))) - size / (2.0 * SQRT_2);\n float square = max(abs(P.x), abs(P.y)) - size / (2.0 * SQRT_2);\n // Shapes\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of "width" for aa\n // Result is union of masked shapes\n return min(max(X, diamond), max(cross, square));\n}\n#endif\n\n#ifdef USE_CIRCLE\n// circle\nfloat marker(vec2 P, float size)\n{\n return length(P) - size/2.0;\n}\n#endif\n\n#ifdef USE_SQUARE\n// square\nfloat marker(vec2 P, float size)\n{\n return max(abs(P.x), abs(P.y)) - size/2.0;\n}\n#endif\n\n#ifdef USE_DIAMOND\n// diamond\nfloat marker(vec2 P, float size)\n{\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\n float r1 = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\n return r1 / SQRT_2;\n}\n#endif\n\n#ifdef USE_HEX\n// hex\nfloat marker(vec2 P, float size)\n{\n vec2 q = abs(P);\n return max(q.y * 0.57735 + q.x - 1.0 * size/2.0, q.y - 0.866 * size/2.0);\n}\n#endif\n\n#ifdef USE_STAR\n// star\n// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\nfloat marker(vec2 P, float size)\n{\n float bn = mod(atan(P.x, -P.y), 2.0*IN_ANGLE) - IN_ANGLE;\n P = length(P)*vec2(cos(bn), abs(sin(bn)));\n P -= size*vec2(COS_A, SIN_A)/2.;\n P += vec2(COS_B, SIN_B)*clamp(-(P.x*COS_B + P.y*SIN_B), 0.0, size*SIN_A/SIN_B/2.);\n\n return length(P)*sign(P.x);\n}\n#endif\n\n#ifdef USE_TRIANGLE\n// triangle\nfloat marker(vec2 P, float size)\n{\n P.y -= size * 0.3;\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\n float r1 = max(abs(x), abs(y)) - size / 1.6;\n float r2 = P.y;\n return max(r1 / SQRT_2, r2); // Intersect diamond with rectangle\n}\n#endif\n\n#ifdef USE_INVERTED_TRIANGLE\n// inverted_triangle\nfloat marker(vec2 P, float size)\n{\n P.y += size * 0.3;\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\n float r1 = max(abs(x), abs(y)) - size / 1.6;\n float r2 = - P.y;\n return max(r1 / SQRT_2, r2); // Intersect diamond with rectangle\n}\n#endif\n\n#ifdef USE_CROSS\n// cross\nfloat marker(vec2 P, float size)\n{\n float square = max(abs(P.x), abs(P.y)) - size / 2.5; // 2.5 is a tweak\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of "width" for aa\n return max(square, cross);\n}\n#endif\n\n#ifdef USE_CIRCLE_CROSS\n// circle_cross\nfloat marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float circle = length(P) - size/2.0;\n float c1 = max(circle, s1);\n float c2 = max(circle, s2);\n float c3 = max(circle, s3);\n float c4 = max(circle, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}\n#endif\n\n#ifdef USE_SQUARE_CROSS\n// square_cross\nfloat marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\n float c1 = max(square, s1);\n float c2 = max(square, s2);\n float c3 = max(square, s3);\n float c4 = max(square, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}\n#endif\n\n#ifdef USE_DIAMOND_CROSS\n// diamond_cross\nfloat marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\n float diamond = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\n diamond /= SQRT_2;\n float c1 = max(diamond, s1);\n float c2 = max(diamond, s2);\n float c3 = max(diamond, s3);\n float c4 = max(diamond, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}\n#endif\n\n#ifdef USE_X\n// x\nfloat marker(vec2 P, float size)\n{\n float circle = length(P) - size / 1.6;\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n return max(circle, X);\n}\n#endif\n\n#ifdef USE_CIRCLE_X\n// circle_x\nfloat marker(vec2 P, float size)\n{\n float x = P.x - P.y;\n float y = P.x + P.y;\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float circle = length(P) - size/2.0;\n float c1 = max(circle, s1);\n float c2 = max(circle, s2);\n float c3 = max(circle, s3);\n float c4 = max(circle, s4);\n // Union\n float almost = min(min(min(c1, c2), c3), c4);\n // In this case, the X is also outside of the main shape\n float Xmask = length(P) - size / 1.6; // a circle\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n return min(max(X, Xmask), almost);\n}\n#endif\n\n#ifdef USE_SQUARE_X\n// square_x\nfloat marker(vec2 P, float size)\n{\n float x = P.x - P.y;\n float y = P.x + P.y;\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\n float c1 = max(square, s1);\n float c2 = max(square, s2);\n float c3 = max(square, s3);\n float c4 = max(square, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}\n#endif\n\nvec4 outline(float distance, float linewidth, float antialias, vec4 fg_color, vec4 bg_color)\n{\n vec4 frag_color;\n float t = linewidth/2.0 - antialias;\n float signed_distance = distance;\n float border_distance = abs(signed_distance) - t;\n float alpha = border_distance/antialias;\n alpha = exp(-alpha*alpha);\n\n // If fg alpha is zero, it probably means no outline. To avoid a dark outline\n // shining through due to aa, we set the fg color to the bg color. Avoid if (i.e. branching).\n float select = float(bool(fg_color.a));\n fg_color.rgb = select * fg_color.rgb + (1.0 - select) * bg_color.rgb;\n // Similarly, if we want a transparent bg\n select = float(bool(bg_color.a));\n bg_color.rgb = select * bg_color.rgb + (1.0 - select) * fg_color.rgb;\n\n if( border_distance < 0.0)\n frag_color = fg_color;\n else if( signed_distance < 0.0 ) {\n frag_color = mix(bg_color, fg_color, sqrt(alpha));\n } else {\n if( abs(signed_distance) < (linewidth/2.0 + antialias) ) {\n frag_color = vec4(fg_color.rgb, fg_color.a * alpha);\n } else {\n discard;\n }\n }\n return frag_color;\n}\n\nvoid main()\n{\n vec2 P = gl_PointCoord.xy - vec2(0.5, 0.5);\n P = vec2(v_rotation.x*P.x - v_rotation.y*P.y,\n v_rotation.y*P.x + v_rotation.x*P.y);\n float point_size = SQRT_2*v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\n float distance = marker(P*point_size, v_size);\n gl_FragColor = outline(distance, v_linewidth, u_antialias, v_fg_color, v_bg_color);\n}\n'}, +function _(e,l,i,s,t){s();const _=e(287);class p extends _.EllipseOvalView{}i.EllipseView=p,p.__name__="EllipseView";class n extends _.EllipseOval{constructor(e){super(e)}static init_Ellipse(){this.prototype.default_view=p}}i.Ellipse=n,n.__name__="Ellipse",n.init_Ellipse()}, +function _(t,s,i,e,h){e();const r=t(1),a=t(288),n=r.__importStar(t(107)),l=t(24),o=t(59);class _ extends a.CenterRotatableView{_map_data(){"data"==this.model.properties.width.units?this.sw=this.sdist(this.renderer.xscale,this._x,this.width,"center"):this.sw=l.to_screen(this.width),"data"==this.model.properties.height.units?this.sh=this.sdist(this.renderer.yscale,this._y,this.height,"center"):this.sh=l.to_screen(this.height)}_render(t,s,i){const{sx:e,sy:h,sw:r,sh:a,angle:n}=null!=i?i:this;for(const i of s){const s=e[i],l=h[i],o=r[i],_=a[i],d=n.get(i);isNaN(s+l+o+_+d)||(t.beginPath(),t.ellipse(s,l,o/2,_/2,d,0,2*Math.PI),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,i),t.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_vectorize(t,i),t.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(t,i),t.stroke()))}}_hit_point(t){let s,i,e,h,r,a,l,_,d;const{sx:c,sy:x}=t,w=this.renderer.xscale.invert(c),p=this.renderer.yscale.invert(x);"data"==this.model.properties.width.units?(s=w-this.max_width,i=w+this.max_width):(a=c-this.max_width,l=c+this.max_width,[s,i]=this.renderer.xscale.r_invert(a,l)),"data"==this.model.properties.height.units?(e=p-this.max_height,h=p+this.max_height):(_=x-this.max_height,d=x+this.max_height,[e,h]=this.renderer.yscale.r_invert(_,d));const m=this.index.indices({x0:s,x1:i,y0:e,y1:h}),v=[];for(const t of m)r=n.point_in_ellipse(c,x,this.angle.get(t),this.sh[t]/2,this.sw[t]/2,this.sx[t],this.sy[t]),r&&v.push(t);return new o.Selection({indices:v})}draw_legend_for_index(t,{x0:s,y0:i,x1:e,y1:h},r){const a=r+1,n=new Array(a);n[r]=(s+e)/2;const l=new Array(a);l[r]=(i+h)/2;const o=this.sw[r]/this.sh[r],_=.8*Math.min(Math.abs(e-s),Math.abs(h-i)),d=new Array(a),c=new Array(a);o>1?(d[r]=_,c[r]=_/o):(d[r]=_*o,c[r]=_),this._render(t,[r],{sx:n,sy:l,sw:d,sh:c,_angle:[0]})}}i.EllipseOvalView=_,_.__name__="EllipseOvalView";class d extends a.CenterRotatable{constructor(t){super(t)}}i.EllipseOval=d,d.__name__="EllipseOval"}, +function _(t,e,i,a,n){a();const s=t(1),h=t(64),r=t(48),o=s.__importStar(t(18));class _ extends h.XYGlyphView{get max_w2(){return"data"==this.model.properties.width.units?this.max_width/2:0}get max_h2(){return"data"==this.model.properties.height.units?this.max_height/2:0}_bounds({x0:t,x1:e,y0:i,y1:a}){const{max_w2:n,max_h2:s}=this;return{x0:t-n,x1:e+n,y0:i-s,y1:a+s}}}i.CenterRotatableView=_,_.__name__="CenterRotatableView";class l extends h.XYGlyph{constructor(t){super(t)}static init_CenterRotatable(){this.mixins([r.LineVector,r.FillVector,r.HatchVector]),this.define((({})=>({angle:[o.AngleSpec,0],width:[o.DistanceSpec,{field:"width"}],height:[o.DistanceSpec,{field:"height"}]})))}}i.CenterRotatable=l,l.__name__="CenterRotatable",l.init_CenterRotatable()}, +function _(t,e,s,i,h){i();const r=t(1),a=t(290),n=t(24),_=r.__importStar(t(18));class o extends a.BoxView{scenterxy(t){return[(this.sleft[t]+this.sright[t])/2,this.sy[t]]}_lrtb(t){const e=this._left[t],s=this._right[t],i=this._y[t],h=this.height.get(t)/2;return[Math.min(e,s),Math.max(e,s),i+h,i-h]}_map_data(){this.sy=this.renderer.yscale.v_compute(this._y),this.sh=this.sdist(this.renderer.yscale,this._y,this.height,"center"),this.sleft=this.renderer.xscale.v_compute(this._left),this.sright=this.renderer.xscale.v_compute(this._right);const t=this.sy.length;this.stop=new n.ScreenArray(t),this.sbottom=new n.ScreenArray(t);for(let e=0;e({left:[_.XCoordinateSpec,{value:0}],y:[_.YCoordinateSpec,{field:"y"}],height:[_.NumberSpec,{value:1}],right:[_.XCoordinateSpec,{field:"right"}]})))}}s.HBar=c,c.__name__="HBar",c.init_HBar()}, +function _(t,e,s,i,r){i();const n=t(48),o=t(98),a=t(106),h=t(59);class c extends o.GlyphView{get_anchor_point(t,e,s){const i=Math.min(this.sleft[e],this.sright[e]),r=Math.max(this.sright[e],this.sleft[e]),n=Math.min(this.stop[e],this.sbottom[e]),o=Math.max(this.sbottom[e],this.stop[e]);switch(t){case"top_left":return{x:i,y:n};case"top":case"top_center":return{x:(i+r)/2,y:n};case"top_right":return{x:r,y:n};case"bottom_left":return{x:i,y:o};case"bottom":case"bottom_center":return{x:(i+r)/2,y:o};case"bottom_right":return{x:r,y:o};case"left":case"center_left":return{x:i,y:(n+o)/2};case"center":case"center_center":return{x:(i+r)/2,y:(n+o)/2};case"right":case"center_right":return{x:r,y:(n+o)/2}}}_index_data(t){const{min:e,max:s}=Math,{data_size:i}=this;for(let r=0;r({r:[c.NumberSpec,{field:"r"}],q:[c.NumberSpec,{field:"q"}],scale:[c.NumberSpec,1],size:[e,1],aspect_scale:[e,1],orientation:[h.HexTileOrientation,"pointytop"]}))),this.override({line_color:null})}}s.HexTile=y,y.__name__="HexTile",y.init_HexTile()}, +function _(e,a,t,_,s){_();const i=e(293),n=e(203),r=e(214);class o extends i.ImageBaseView{connect_signals(){super.connect_signals(),this.connect(this.model.color_mapper.change,(()=>this._update_image()))}_update_image(){null!=this.image_data&&(this._set_data(null),this.renderer.request_render())}_flat_img_to_buf8(e){return this.model.color_mapper.rgba_mapper.v_compute(e)}}t.ImageView=o,o.__name__="ImageView";class m extends i.ImageBase{constructor(e){super(e)}static init_Image(){this.prototype.default_view=o,this.define((({Ref:e})=>({color_mapper:[e(n.ColorMapper),()=>new r.LinearColorMapper({palette:["#000000","#252525","#525252","#737373","#969696","#bdbdbd","#d9d9d9","#f0f0f0","#ffffff"]})]})))}}t.Image=m,m.__name__="Image",m.init_Image()}, +function _(e,t,i,s,a){s();const h=e(1),n=e(64),r=e(24),_=h.__importStar(e(18)),d=e(59),l=e(9),g=e(29),o=e(11);class c extends n.XYGlyphView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.global_alpha.change,(()=>this.renderer.request_render()))}_render(e,t,i){const{image_data:s,sx:a,sy:h,sw:n,sh:r}=null!=i?i:this,_=e.getImageSmoothingEnabled();e.setImageSmoothingEnabled(!1),e.globalAlpha=this.model.global_alpha;for(const i of t){const t=s[i],_=a[i],d=h[i],l=n[i],g=r[i];if(null==t||isNaN(_+d+l+g))continue;const o=d;e.translate(0,o),e.scale(1,-1),e.translate(0,-o),e.drawImage(t,0|_,0|d,l,g),e.translate(0,o),e.scale(1,-1),e.translate(0,-o)}e.setImageSmoothingEnabled(_)}_set_data(e){this._set_width_heigh_data();for(let t=0,i=this.image.length;t({image:[_.NDArraySpec,{field:"image"}],dw:[_.DistanceSpec,{field:"dw"}],dh:[_.DistanceSpec,{field:"dh"}],dilate:[e,!1],global_alpha:[t,1]})))}}i.ImageBase=m,m.__name__="ImageBase",m.init_ImageBase()}, +function _(e,a,t,_,i){_();const n=e(293),s=e(8);class r extends n.ImageBaseView{_flat_img_to_buf8(e){let a;return a=s.isArray(e)?new Uint32Array(e):e,new Uint8ClampedArray(a.buffer)}}t.ImageRGBAView=r,r.__name__="ImageRGBAView";class m extends n.ImageBase{constructor(e){super(e)}static init_ImageRGBA(){this.prototype.default_view=r}}t.ImageRGBA=m,m.__name__="ImageRGBA",m.init_ImageRGBA()}, +function _(e,t,s,r,a){r();const i=e(1),n=e(64),o=e(24),c=e(20),_=i.__importStar(e(18)),h=e(12),l=e(296);class d extends n.XYGlyphView{constructor(){super(...arguments),this._images_rendered=!1,this._set_data_iteration=0}connect_signals(){super.connect_signals(),this.connect(this.model.properties.global_alpha.change,(()=>this.renderer.request_render()))}_index_data(e){const{data_size:t}=this;for(let s=0;s{this._set_data_iteration==r&&(this.image[a]=e,this.renderer.request_render())},attempts:t+1,timeout:s})}const a="data"==this.model.properties.w.units,i="data"==this.model.properties.h.units,n=this._x.length,c=new o.ScreenArray(a?2*n:n),_=new o.ScreenArray(i?2*n:n),{anchor:d}=this.model;function m(e,t){switch(d){case"top_left":case"bottom_left":case"left":case"center_left":return[e,e+t];case"top":case"top_center":case"bottom":case"bottom_center":case"center":case"center_center":return[e-t/2,e+t/2];case"top_right":case"bottom_right":case"right":case"center_right":return[e-t,e]}}function g(e,t){switch(d){case"top_left":case"top":case"top_center":case"top_right":return[e,e-t];case"bottom_left":case"bottom":case"bottom_center":case"bottom_right":return[e+t,e];case"left":case"center_left":case"center":case"center_center":case"right":case"center_right":return[e+t/2,e-t/2]}}if(a)for(let e=0;e({url:[_.StringSpec,{field:"url"}],anchor:[c.Anchor,"top_left"],global_alpha:[s,1],angle:[_.AngleSpec,0],w:[_.NullDistanceSpec,null],h:[_.NullDistanceSpec,null],dilate:[e,!1],retry_attempts:[t,0],retry_timeout:[t,0]})))}}s.ImageURL=m,m.__name__="ImageURL",m.init_ImageURL()}, +function _(i,e,t,s,o){s();const a=i(19);class n{constructor(i,e={}){this._image=new Image,this._finished=!1;const{attempts:t=1,timeout:s=1}=e;this.promise=new Promise(((o,n)=>{this._image.crossOrigin="anonymous";let r=0;this._image.onerror=()=>{if(++r==t){const s=`unable to load ${i} image after ${t} attempts`;if(a.logger.warn(s),null==this._image.crossOrigin)return void(null!=e.failed&&e.failed());a.logger.warn(`attempting to load ${i} without a cross origin policy`),this._image.crossOrigin=null,r=0}setTimeout((()=>this._image.src=i),s)},this._image.onload=()=>{this._finished=!0,null!=e.loaded&&e.loaded(this._image),o(this._image)},this._image.src=i}))}get finished(){return this._finished}get image(){if(this._finished)return this._image;throw new Error("not loaded yet")}}t.ImageLoader=n,n.__name__="ImageLoader"}, +function _(t,s,e,i,n){i();const o=t(1),l=t(101),r=t(98),h=t(106),_=t(12),a=t(12),c=t(48),d=o.__importStar(t(107)),x=o.__importStar(t(18)),y=t(59),f=t(11);class g extends r.GlyphView{_project_data(){}_index_data(t){const{min:s,max:e}=Math,{data_size:i}=this;for(let n=0;n1&&c.length>1)for(let e=1,i=n.length;e1){let l=!1;for(let t=1;t({xs:[x.XCoordinateSeqSeqSeqSpec,{field:"xs"}],ys:[x.YCoordinateSeqSeqSeqSpec,{field:"ys"}]}))),this.mixins([c.LineVector,c.FillVector,c.HatchVector])}}e.MultiPolygons=p,p.__name__="MultiPolygons",p.init_MultiPolygons()}, +function _(a,t,e,l,s){l();const _=a(287),i=a(12);class n extends _.EllipseOvalView{_map_data(){super._map_data(),i.mul(this.sw,.75)}}e.OvalView=n,n.__name__="OvalView";class v extends _.EllipseOval{constructor(a){super(a)}static init_Oval(){this.prototype.default_view=n}}e.Oval=v,v.__name__="Oval",v.init_Oval()}, +function _(t,e,i,o,s){o();const r=t(1),_=t(290),d=r.__importStar(t(18));class n extends _.BoxView{scenterxy(t){return[this.sleft[t]/2+this.sright[t]/2,this.stop[t]/2+this.sbottom[t]/2]}_lrtb(t){return[this._left[t],this._right[t],this._top[t],this._bottom[t]]}}i.QuadView=n,n.__name__="QuadView";class a extends _.Box{constructor(t){super(t)}static init_Quad(){this.prototype.default_view=n,this.define((({})=>({right:[d.XCoordinateSpec,{field:"right"}],bottom:[d.YCoordinateSpec,{field:"bottom"}],left:[d.XCoordinateSpec,{field:"left"}],top:[d.YCoordinateSpec,{field:"top"}]})))}}i.Quad=a,a.__name__="Quad",a.init_Quad()}, +function _(e,t,i,s,n){s();const a=e(1),c=e(48),o=e(65),r=e(98),_=e(106),d=a.__importStar(e(18));function l(e,t,i){if(t==(e+i)/2)return[e,i];{const s=(e-t)/(e-2*t+i),n=e*(1-s)**2+2*t*(1-s)*s+i*s**2;return[Math.min(e,i,n),Math.max(e,i,n)]}}class x extends r.GlyphView{_project_data(){o.inplace.project_xy(this._x0,this._y0),o.inplace.project_xy(this._x1,this._y1)}_index_data(e){const{_x0:t,_x1:i,_y0:s,_y1:n,_cx:a,_cy:c,data_size:o}=this;for(let r=0;r({x0:[d.XCoordinateSpec,{field:"x0"}],y0:[d.YCoordinateSpec,{field:"y0"}],x1:[d.XCoordinateSpec,{field:"x1"}],y1:[d.YCoordinateSpec,{field:"y1"}],cx:[d.XCoordinateSpec,{field:"cx"}],cy:[d.YCoordinateSpec,{field:"cy"}]}))),this.mixins(c.LineVector)}}i.Quadratic=y,y.__name__="Quadratic",y.init_Quadratic()}, +function _(e,t,s,i,n){i();const a=e(1),l=e(64),h=e(106),r=e(48),o=e(24),_=a.__importStar(e(18));class c extends l.XYGlyphView{_map_data(){"data"==this.model.properties.length.units?this.slength=this.sdist(this.renderer.xscale,this._x,this.length):this.slength=o.to_screen(this.length);const{width:e,height:t}=this.renderer.plot_view.frame.bbox,s=2*(e+t),{slength:i}=this;for(let e=0,t=i.length;e({length:[_.DistanceSpec,0],angle:[_.AngleSpec,0]})))}}s.Ray=g,g.__name__="Ray",g.init_Ray()}, +function _(t,s,e,i,h){i();const r=t(288),n=t(106),a=t(24),o=t(12),l=t(59);class _ extends r.CenterRotatableView{_map_data(){if("data"==this.model.properties.width.units)[this.sw,this.sx0]=this._map_dist_corner_for_data_side_length(this._x,this.width,this.renderer.xscale);else{this.sw=a.to_screen(this.width);const t=this.sx.length;this.sx0=new a.ScreenArray(t);for(let s=0;s({dilate:[t,!1]})))}}e.Rect=c,c.__name__="Rect",c.init_Rect()}, +function _(e,t,r,s,i){s();const a=e(1),n=e(304),_=e(305),l=e(283),c=a.__importStar(e(18));class o extends n.MarkerView{_init_webgl(){const{webgl:e}=this.renderer.plot_view.canvas_view;if(null!=e){const t=new Set(this.marker);if(1==t.size){const[r]=[...t];if(l.MarkerGL.is_supported(r)){const{glglyph:t}=this;if(null==t||t.marker_type!=r)return void(this.glglyph=new l.MarkerGL(e.gl,this,r))}}}delete this.glglyph}_set_data(e){super._set_data(e),this._init_webgl()}_render(e,t,r){const{sx:s,sy:i,size:a,angle:n,marker:l}=null!=r?r:this;for(const r of t){const t=s[r],c=i[r],o=a.get(r),g=n.get(r),h=l.get(r);if(isNaN(t+c+o+g)||null==h)continue;const d=o/2;e.beginPath(),e.translate(t,c),g&&e.rotate(g),_.marker_funcs[h](e,r,d,this.visuals),g&&e.rotate(-g),e.translate(-t,-c)}}draw_legend_for_index(e,{x0:t,x1:r,y0:s,y1:i},a){const n=a+1,_=this.marker.get(a),l=Object.assign(Object.assign({},this._get_legend_args({x0:t,x1:r,y0:s,y1:i},a)),{marker:new c.UniformScalar(_,n)});this._render(e,[a],l)}}r.ScatterView=o,o.__name__="ScatterView";class g extends n.Marker{constructor(e){super(e)}static init_Scatter(){this.prototype.default_view=o,this.define((()=>({marker:[c.MarkerSpec,{value:"circle"}]})))}}r.Scatter=g,g.__name__="Scatter",g.init_Scatter()}, +function _(e,t,s,i,n){i();const r=e(1),a=e(64),c=e(48),_=r.__importStar(e(107)),o=r.__importStar(e(18)),h=e(9),l=e(59);class x extends a.XYGlyphView{_render(e,t,s){const{sx:i,sy:n,size:r,angle:a}=null!=s?s:this;for(const s of t){const t=i[s],c=n[s],_=r.get(s),o=a.get(s);if(isNaN(t+c+_+o))continue;const h=_/2;e.beginPath(),e.translate(t,c),o&&e.rotate(o),this._render_one(e,s,h,this.visuals),o&&e.rotate(-o),e.translate(-t,-c)}}_mask_data(){const{x_target:e,y_target:t}=this.renderer.plot_view.frame,s=e.widen(this.max_size).map((e=>this.renderer.xscale.invert(e))),i=t.widen(this.max_size).map((e=>this.renderer.yscale.invert(e)));return this.index.indices({x0:s.start,x1:s.end,y0:i.start,y1:i.end})}_hit_point(e){const{sx:t,sy:s}=e,{max_size:i}=this,{hit_dilation:n}=this.model,r=t-i*n,a=t+i*n,[c,_]=this.renderer.xscale.r_invert(r,a),o=s-i*n,h=s+i*n,[x,d]=this.renderer.yscale.r_invert(o,h),y=this.index.indices({x0:c,x1:_,y0:x,y1:d}),g=[];for(const e of y){const i=this.size.get(e)/2*n;Math.abs(this.sx[e]-t)<=i&&Math.abs(this.sy[e]-s)<=i&&g.push(e)}return new l.Selection({indices:g})}_hit_span(e){const{sx:t,sy:s}=e,i=this.bounds(),n=this.max_size/2;let r,a,c,_;if("h"==e.direction){c=i.y0,_=i.y1;const e=t-n,s=t+n;[r,a]=this.renderer.xscale.r_invert(e,s)}else{r=i.x0,a=i.x1;const e=s-n,t=s+n;[c,_]=this.renderer.yscale.r_invert(e,t)}const o=[...this.index.indices({x0:r,x1:a,y0:c,y1:_})];return new l.Selection({indices:o})}_hit_rect(e){const{sx0:t,sx1:s,sy0:i,sy1:n}=e,[r,a]=this.renderer.xscale.r_invert(t,s),[c,_]=this.renderer.yscale.r_invert(i,n),o=[...this.index.indices({x0:r,x1:a,y0:c,y1:_})];return new l.Selection({indices:o})}_hit_poly(e){const{sx:t,sy:s}=e,i=h.range(0,this.sx.length),n=[];for(let e=0,r=i.length;e({size:[o.ScreenDistanceSpec,{value:4}],angle:[o.AngleSpec,0],hit_dilation:[e,1]})))}}s.Marker=d,d.__name__="Marker",d.init_Marker()}, +function _(t,e,i,o,l){o();const n=Math.sqrt(3),c=Math.sqrt(5),r=(c+1)/4,s=Math.sqrt((5-c)/8),f=(c-1)/4,a=Math.sqrt((5+c)/8);function h(t,e){t.rotate(Math.PI/4),d(t,e),t.rotate(-Math.PI/4)}function v(t,e){const i=e*n,o=i/3;t.moveTo(-i/2,-o),t.lineTo(0,0),t.lineTo(i/2,-o),t.lineTo(0,0),t.lineTo(0,e)}function d(t,e){t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-e,0),t.lineTo(e,0)}function _(t,e){t.moveTo(0,e),t.lineTo(e/1.5,0),t.lineTo(0,-e),t.lineTo(-e/1.5,0),t.closePath()}function u(t,e){const i=e*n,o=i/3;t.moveTo(-e,o),t.lineTo(e,o),t.lineTo(0,o-i),t.closePath()}function z(t,e,i,o){t.arc(0,0,i,0,2*Math.PI,!1),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}function T(t,e,i,o){_(t,i),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}function k(t,e,i,o){!function(t,e){t.beginPath(),t.arc(0,0,e/4,0,2*Math.PI,!1),t.closePath()}(t,i),o.line.set_vectorize(t,e),t.fillStyle=t.strokeStyle,t.fill()}function P(t,e,i,o){!function(t,e){const i=e/2,o=n*i;t.moveTo(e,0),t.lineTo(i,-o),t.lineTo(-i,-o),t.lineTo(-e,0),t.lineTo(-i,o),t.lineTo(i,o),t.closePath()}(t,i),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}function m(t,e,i,o){const l=2*i;t.rect(-i,-i,l,l),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}function q(t,e,i,o){!function(t,e){const i=Math.sqrt(5-2*c)*e;t.moveTo(0,-e),t.lineTo(i*f,i*a-e),t.lineTo(i*(1+f),i*a-e),t.lineTo(i*(1+f-r),i*(a+s)-e),t.lineTo(i*(1+2*f-r),i*(2*a+s)-e),t.lineTo(0,2*i*a-e),t.lineTo(-i*(1+2*f-r),i*(2*a+s)-e),t.lineTo(-i*(1+f-r),i*(a+s)-e),t.lineTo(-i*(1+f),i*a-e),t.lineTo(-i*f,i*a-e),t.closePath()}(t,i),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}function M(t,e,i,o){u(t,i),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}i.marker_funcs={asterisk:function(t,e,i,o){d(t,i),h(t,i),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},circle:z,circle_cross:function(t,e,i,o){t.arc(0,0,i,0,2*Math.PI,!1),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),d(t,i),t.stroke())},circle_dot:function(t,e,i,o){z(t,e,i,o),k(t,e,i,o)},circle_y:function(t,e,i,o){t.arc(0,0,i,0,2*Math.PI,!1),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),v(t,i),t.stroke())},circle_x:function(t,e,i,o){t.arc(0,0,i,0,2*Math.PI,!1),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),h(t,i),t.stroke())},cross:function(t,e,i,o){d(t,i),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},diamond:T,diamond_dot:function(t,e,i,o){T(t,e,i,o),k(t,e,i,o)},diamond_cross:function(t,e,i,o){_(t,i),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.moveTo(0,i),t.lineTo(0,-i),t.moveTo(-i/1.5,0),t.lineTo(i/1.5,0),t.stroke())},dot:k,hex:P,hex_dot:function(t,e,i,o){P(t,e,i,o),k(t,e,i,o)},inverted_triangle:function(t,e,i,o){t.rotate(Math.PI),u(t,i),t.rotate(-Math.PI),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},plus:function(t,e,i,o){const l=3*i/8,n=[l,l,i,i,l,l,-l,-l,-i,-i,-l,-l],c=[i,l,l,-l,-l,-i,-i,-l,-l,l,l,i];t.beginPath();for(let e=0;e<12;e++)t.lineTo(n[e],c[e]);t.closePath(),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},square:m,square_cross:function(t,e,i,o){const l=2*i;t.rect(-i,-i,l,l),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),d(t,i),t.stroke())},square_dot:function(t,e,i,o){m(t,e,i,o),k(t,e,i,o)},square_pin:function(t,e,i,o){const l=3*i/8;t.moveTo(-i,-i),t.quadraticCurveTo(0,-l,i,-i),t.quadraticCurveTo(l,0,i,i),t.quadraticCurveTo(0,l,-i,i),t.quadraticCurveTo(-l,0,-i,-i),t.closePath(),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},square_x:function(t,e,i,o){const l=2*i;t.rect(-i,-i,l,l),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.moveTo(-i,i),t.lineTo(i,-i),t.moveTo(-i,-i),t.lineTo(i,i),t.stroke())},star:q,star_dot:function(t,e,i,o){q(t,e,i,o),k(t,e,i,o)},triangle:M,triangle_dot:function(t,e,i,o){M(t,e,i,o),k(t,e,i,o)},triangle_pin:function(t,e,i,o){const l=i*n,c=l/3,r=3*c/8;t.moveTo(-i,c),t.quadraticCurveTo(0,r,i,c),t.quadraticCurveTo(n*r/2,r/2,0,c-l),t.quadraticCurveTo(-n*r/2,r/2,-i,c),t.closePath(),o.fill.doit&&(o.fill.set_vectorize(t,e),t.fill()),o.hatch.doit&&(o.hatch.set_vectorize(t,e),t.fill()),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},dash:function(t,e,i,o){!function(t,e){t.moveTo(-e,0),t.lineTo(e,0)}(t,i),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},x:function(t,e,i,o){h(t,i),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())},y:function(t,e,i,o){v(t,i),o.line.doit&&(o.line.set_vectorize(t,e),t.stroke())}}}, +function _(e,t,s,i,n){i();const r=e(1),_=r.__importStar(e(107)),o=r.__importStar(e(18)),h=e(48),a=e(65),c=e(98),d=e(106),x=e(59);class y extends c.GlyphView{_project_data(){a.inplace.project_xy(this._x0,this._y0),a.inplace.project_xy(this._x1,this._y1)}_index_data(e){const{min:t,max:s}=Math,{_x0:i,_x1:n,_y0:r,_y1:_,data_size:o}=this;for(let h=0;h({x0:[o.XCoordinateSpec,{field:"x0"}],y0:[o.YCoordinateSpec,{field:"y0"}],x1:[o.XCoordinateSpec,{field:"x1"}],y1:[o.YCoordinateSpec,{field:"y1"}]}))),this.mixins(h.LineVector)}}s.Segment=l,l.__name__="Segment",l.init_Segment()}, +function _(t,e,s,i,n){i();const _=t(1),l=t(64),o=_.__importStar(t(48)),a=t(308);class c extends l.XYGlyphView{_set_data(){const{tension:t,closed:e}=this.model;[this._xt,this._yt]=a.catmullrom_spline(this._x,this._y,20,t,e)}_map_data(){const{x_scale:t,y_scale:e}=this.renderer.coordinates;this.sxt=t.v_compute(this._xt),this.syt=e.v_compute(this._yt)}_render(t,e,s){const{sxt:i,syt:n}=null!=s?s:this;this.visuals.line.set_value(t);const _=i.length;for(let e=0;e<_;e++)0!=e?isNaN(i[e])||isNaN(n[e])?(t.stroke(),t.beginPath()):t.lineTo(i[e],n[e]):(t.beginPath(),t.moveTo(i[e],n[e]));t.stroke()}}s.SplineView=c,c.__name__="SplineView";class h extends l.XYGlyph{constructor(t){super(t)}static init_Spline(){this.prototype.default_view=c,this.mixins(o.LineScalar),this.define((({Boolean:t,Number:e})=>({tension:[e,.5],closed:[t,!1]})))}}s.Spline=h,h.__name__="Spline",h.init_Spline()}, +function _(n,t,e,o,s){o();const c=n(24),l=n(11);e.catmullrom_spline=function(n,t,e=10,o=.5,s=!1){l.assert(n.length==t.length);const r=n.length,f=s?r+1:r,w=c.infer_type(n,t),i=new w(f+2),u=new w(f+2);i.set(n,1),u.set(t,1),s?(i[0]=n[r-1],u[0]=t[r-1],i[f]=n[0],u[f]=t[0],i[f+1]=n[1],u[f+1]=t[1]):(i[0]=n[0],u[0]=t[0],i[f+1]=n[r-1],u[f+1]=t[r-1]);const g=new w(4*(e+1));for(let n=0,t=0;n<=e;n++){const o=n/e,s=o**2,c=o*s;g[t++]=2*c-3*s+1,g[t++]=-2*c+3*s,g[t++]=c-2*s+o,g[t++]=c-s}const h=new w((f-1)*(e+1)),_=new w((f-1)*(e+1));for(let n=1,t=0;n1&&(e.stroke(),o=!1)}o?(e.lineTo(t,a),e.lineTo(r,_)):(e.beginPath(),e.moveTo(n[i],s[i]),o=!0),l=i}e.lineTo(n[r-1],s[r-1]),e.stroke()}}draw_legend_for_index(e,t,i){r.generic_line_scalar_legend(this.visuals,e,t)}}i.StepView=c,c.__name__="StepView";class d extends l.XYGlyph{constructor(e){super(e)}static init_Step(){this.prototype.default_view=c,this.mixins(a.LineScalar),this.define((()=>({mode:[_.StepMode,"before"]})))}}i.Step=d,d.__name__="Step",d.init_Step()}, +function _(t,e,s,i,n){i();const o=t(1),_=t(64),h=t(48),l=o.__importStar(t(107)),r=o.__importStar(t(18)),a=t(143),c=t(11),x=t(59);class u extends _.XYGlyphView{_rotate_point(t,e,s,i,n){return[(t-s)*Math.cos(n)-(e-i)*Math.sin(n)+s,(t-s)*Math.sin(n)+(e-i)*Math.cos(n)+i]}_text_bounds(t,e,s,i){return[[t,t+s,t+s,t,t],[e,e,e-i,e-i,e]]}_render(t,e,s){const{sx:i,sy:n,x_offset:o,y_offset:_,angle:h,text:l}=null!=s?s:this;this._sys=[],this._sxs=[];for(const s of e){const e=this._sxs[s]=[],r=this._sys[s]=[],c=i[s],x=n[s],u=o.get(s),f=_.get(s),p=h.get(s),g=l.get(s);if(!isNaN(c+x+u+f+p)&&null!=g&&this.visuals.text.doit){const i=`${g}`;t.save(),t.translate(c+u,x+f),t.rotate(p),this.visuals.text.set_vectorize(t,s);const n=this.visuals.text.font_value(s),{height:o}=a.font_metrics(n),_=this.text_line_height.get(s)*o;if(-1==i.indexOf("\n")){t.fillText(i,0,0);const s=c+u,n=x+f,o=t.measureText(i).width,[h,l]=this._text_bounds(s,n,o,_);e.push(h),r.push(l)}else{const n=i.split("\n"),o=_*n.length,h=this.text_baseline.get(s);let l;switch(h){case"top":l=0;break;case"middle":l=-o/2+_/2;break;case"bottom":l=-o+_;break;default:l=0,console.warn(`'${h}' baseline not supported with multi line text`)}for(const s of n){t.fillText(s,0,l);const i=c+u,n=l+x+f,o=t.measureText(s).width,[h,a]=this._text_bounds(i,n,o,_);e.push(h),r.push(a),l+=_}}t.restore()}}}_hit_point(t){const{sx:e,sy:s}=t,i=[];for(let t=0;t({text:[r.NullStringSpec,{field:"text"}],angle:[r.AngleSpec,0],x_offset:[r.NumberSpec,0],y_offset:[r.NumberSpec,0]})))}}s.Text=f,f.__name__="Text",f.init_Text()}, +function _(t,s,e,i,r){i();const h=t(1),o=t(290),a=t(24),n=h.__importStar(t(18));class _ extends o.BoxView{scenterxy(t){return[this.sx[t],(this.stop[t]+this.sbottom[t])/2]}_lrtb(t){const s=this.width.get(t)/2,e=this._x[t],i=this._top[t],r=this._bottom[t];return[e-s,e+s,Math.max(i,r),Math.min(i,r)]}_map_data(){this.sx=this.renderer.xscale.v_compute(this._x),this.sw=this.sdist(this.renderer.xscale,this._x,this.width,"center"),this.stop=this.renderer.yscale.v_compute(this._top),this.sbottom=this.renderer.yscale.v_compute(this._bottom);const t=this.sx.length;this.sleft=new a.ScreenArray(t),this.sright=new a.ScreenArray(t);for(let s=0;s({x:[n.XCoordinateSpec,{field:"x"}],bottom:[n.YCoordinateSpec,{value:0}],width:[n.NumberSpec,{value:1}],top:[n.YCoordinateSpec,{field:"top"}]})))}}e.VBar=c,c.__name__="VBar",c.init_VBar()}, +function _(e,t,s,i,n){i();const r=e(1),a=e(64),l=e(106),c=e(48),d=e(24),h=e(20),o=r.__importStar(e(18)),_=e(10),u=e(59);class g extends a.XYGlyphView{_map_data(){"data"==this.model.properties.radius.units?this.sradius=this.sdist(this.renderer.xscale,this._x,this.radius):this.sradius=d.to_screen(this.radius)}_render(e,t,s){const{sx:i,sy:n,sradius:r,start_angle:a,end_angle:l}=null!=s?s:this,c="anticlock"==this.model.direction;for(const s of t){const t=i[s],d=n[s],h=r[s],o=a.get(s),_=l.get(s);isNaN(t+d+h+o+_)||(e.beginPath(),e.arc(t,d,h,o,_,c),e.lineTo(t,d),e.closePath(),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(e,s),e.fill()),this.visuals.hatch.doit&&(this.visuals.hatch.set_vectorize(e,s),e.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(e,s),e.stroke()))}}_hit_point(e){let t,s,i,n,r,a,l,c,d;const{sx:h,sy:o}=e,g=this.renderer.xscale.invert(h),p=this.renderer.yscale.invert(o),x=2*this.max_radius;"data"===this.model.properties.radius.units?(a=g-x,l=g+x,c=p-x,d=p+x):(s=h-x,i=h+x,[a,l]=this.renderer.xscale.r_invert(s,i),n=o-x,r=o+x,[c,d]=this.renderer.yscale.r_invert(n,r));const f=[];for(const e of this.index.indices({x0:a,x1:l,y0:c,y1:d})){const a=this.sradius[e]**2;[s,i]=this.renderer.xscale.r_compute(g,this._x[e]),[n,r]=this.renderer.yscale.r_compute(p,this._y[e]),t=(s-i)**2+(n-r)**2,t<=a&&f.push(e)}const v="anticlock"==this.model.direction,y=[];for(const e of f){const t=Math.atan2(o-this.sy[e],h-this.sx[e]);_.angle_between(-t,-this.start_angle.get(e),-this.end_angle.get(e),v)&&y.push(e)}return new u.Selection({indices:y})}draw_legend_for_index(e,t,s){l.generic_area_vector_legend(this.visuals,e,t,s)}scenterxy(e){const t=this.sradius[e]/2,s=(this.start_angle.get(e)+this.end_angle.get(e))/2;return[this.sx[e]+t*Math.cos(s),this.sy[e]+t*Math.sin(s)]}}s.WedgeView=g,g.__name__="WedgeView";class p extends a.XYGlyph{constructor(e){super(e)}static init_Wedge(){this.prototype.default_view=g,this.mixins([c.LineVector,c.FillVector,c.HatchVector]),this.define((({})=>({direction:[h.Direction,"anticlock"],radius:[o.DistanceSpec,{field:"radius"}],start_angle:[o.AngleSpec,{field:"start_angle"}],end_angle:[o.AngleSpec,{field:"end_angle"}]})))}}s.Wedge=p,p.__name__="Wedge",p.init_Wedge()}, +function _(t,_,r,o,a){o();const e=t(1);e.__exportStar(t(126),r),e.__exportStar(t(125),r),e.__exportStar(t(314),r)}, +function _(t,a,o,r,e){r();const n=t(125);class l extends n.LayoutProvider{constructor(t){super(t)}static init_StaticLayoutProvider(){this.define((({Number:t,Tuple:a,Dict:o})=>({graph_layout:[o(a(t,t)),{}]})))}get_node_coordinates(t){var a;const o=null!==(a=t.data.index)&&void 0!==a?a:[],r=o.length,e=new Float64Array(r),n=new Float64Array(r);for(let t=0;tthis.request_render()))}_draw_regions(i){if(!this.visuals.band_fill.doit&&!this.visuals.band_hatch.doit)return;const[e,t]=this.grid_coords("major",!1);for(let s=0;st[1]&&(n=t[1]);else{[s,n]=t;for(const i of this.plot_view.axis_views)i.dimension==this.model.dimension&&i.model.x_range_name==this.model.x_range_name&&i.model.y_range_name==this.model.y_range_name&&([s,n]=i.computed_bounds)}return[s,n]}grid_coords(i,e=!0){const t=this.model.dimension,s=(t+1)%2,[n,r]=this.ranges();let[o,d]=this.computed_bounds();[o,d]=[Math.min(o,d),Math.max(o,d)];const l=[[],[]],_=this.model.get_ticker();if(null==_)return l;const a=_.get_ticks(o,d,n,r.min)[i],h=n.min,u=n.max,c=r.min,m=r.max;e||(a[0]!=h&&a.splice(0,0,h),a[a.length-1]!=u&&a.push(u));for(let i=0;i({bounds:[r(n(i,i),e),"auto"],dimension:[t(0,1),0],axis:[d(s(o.Axis)),null],ticker:[d(s(l.Ticker)),null]}))),this.override({level:"underlay",band_fill_color:null,band_fill_alpha:0,grid_line_color:"#e5e5e5",minor_grid_line_color:null})}get_ticker(){return null!=this.ticker?this.ticker:null!=this.axis?this.axis.ticker:null}}t.Grid=u,u.__name__="Grid",u.init_Grid()}, +function _(o,a,x,B,e){B(),e("Box",o(318).Box),e("Column",o(320).Column),e("GridBox",o(321).GridBox),e("HTMLBox",o(322).HTMLBox),e("LayoutDOM",o(319).LayoutDOM),e("Panel",o(323).Panel),e("Row",o(324).Row),e("Spacer",o(325).Spacer),e("Tabs",o(326).Tabs),e("WidgetBox",o(329).WidgetBox)}, +function _(e,n,i,t,s){t();const o=e(319);class c extends o.LayoutDOMView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.children.change,(()=>this.rebuild()))}get child_models(){return this.model.children}}i.BoxView=c,c.__name__="BoxView";class r extends o.LayoutDOM{constructor(e){super(e)}static init_Box(){this.define((({Number:e,Array:n,Ref:i})=>({children:[n(i(o.LayoutDOM)),[]],spacing:[e,0]})))}}i.Box=r,r.__name__="Box",r.init_Box()}, +function _(t,i,e,s,o){s();const l=t(53),n=t(20),h=t(43),a=t(19),r=t(8),_=t(22),d=t(122),c=t(240),u=t(221),m=t(44),p=t(249);class g extends c.DOMView{constructor(){super(...arguments),this._idle_notified=!1,this._offset_parent=null,this._viewport={}}initialize(){super.initialize(),this.el.style.position=this.is_root?"relative":"absolute",this._child_views=new Map}async lazy_initialize(){await super.lazy_initialize(),await this.build_child_views()}remove(){for(const t of this.child_views)t.remove();this._child_views.clear(),super.remove()}connect_signals(){super.connect_signals(),this.is_root&&(this._on_resize=()=>this.resize_layout(),window.addEventListener("resize",this._on_resize),this._parent_observer=setInterval((()=>{const t=this.el.offsetParent;this._offset_parent!=t&&(this._offset_parent=t,null!=t&&(this.compute_viewport(),this.invalidate_layout()))}),250));const t=this.model.properties;this.on_change([t.width,t.height,t.min_width,t.min_height,t.max_width,t.max_height,t.margin,t.width_policy,t.height_policy,t.sizing_mode,t.aspect_ratio,t.visible],(()=>this.invalidate_layout())),this.on_change([t.background,t.css_classes],(()=>this.invalidate_render()))}disconnect_signals(){null!=this._parent_observer&&clearTimeout(this._parent_observer),null!=this._on_resize&&window.removeEventListener("resize",this._on_resize),super.disconnect_signals()}css_classes(){return super.css_classes().concat(this.model.css_classes)}get child_views(){return this.child_models.map((t=>this._child_views.get(t)))}async build_child_views(){await d.build_views(this._child_views,this.child_models,{parent:this})}render(){super.render(),h.empty(this.el);const{background:t}=this.model;this.el.style.backgroundColor=null!=t?_.color2css(t):"",h.classes(this.el).clear().add(...this.css_classes());for(const t of this.child_views)this.el.appendChild(t.el),t.render()}update_layout(){for(const t of this.child_views)t.update_layout();this._update_layout()}update_position(){this.el.style.display=this.model.visible?"block":"none";const t=this.is_root?this.layout.sizing.margin:void 0;h.position(this.el,this.layout.bbox,t);for(const t of this.child_views)t.update_position()}after_layout(){for(const t of this.child_views)t.after_layout();this._has_finished=!0}compute_viewport(){this._viewport=this._viewport_size()}renderTo(t){t.appendChild(this.el),this._offset_parent=this.el.offsetParent,this.compute_viewport(),this.build()}build(){return this.assert_root(),this.render(),this.update_layout(),this.compute_layout(),this}async rebuild(){await this.build_child_views(),this.invalidate_render()}compute_layout(){const t=Date.now();this.layout.compute(this._viewport),this.update_position(),this.after_layout(),a.logger.debug(`layout computed in ${Date.now()-t} ms`),this.notify_finished()}resize_layout(){this.root.compute_viewport(),this.root.compute_layout()}invalidate_layout(){this.root.update_layout(),this.root.compute_layout()}invalidate_render(){this.render(),this.invalidate_layout()}has_finished(){if(!super.has_finished())return!1;for(const t of this.child_views)if(!t.has_finished())return!1;return!0}notify_finished(){this.is_root?!this._idle_notified&&this.has_finished()&&null!=this.model.document&&(this._idle_notified=!0,this.model.document.notify_idle(this.model)):this.root.notify_finished()}_width_policy(){return null!=this.model.width?"fixed":"fit"}_height_policy(){return null!=this.model.height?"fixed":"fit"}box_sizing(){let{width_policy:t,height_policy:i,aspect_ratio:e}=this.model;"auto"==t&&(t=this._width_policy()),"auto"==i&&(i=this._height_policy());const{sizing_mode:s}=this.model;if(null!=s)if("fixed"==s)t=i="fixed";else if("stretch_both"==s)t=i="max";else if("stretch_width"==s)t="max";else if("stretch_height"==s)i="max";else switch(null==e&&(e="auto"),s){case"scale_width":t="max",i="min";break;case"scale_height":t="min",i="max";break;case"scale_both":t="max",i="max"}const o={width_policy:t,height_policy:i},{min_width:l,min_height:n}=this.model;null!=l&&(o.min_width=l),null!=n&&(o.min_height=n);const{width:h,height:a}=this.model;null!=h&&(o.width=h),null!=a&&(o.height=a);const{max_width:_,max_height:d}=this.model;null!=_&&(o.max_width=_),null!=d&&(o.max_height=d),"auto"==e&&null!=h&&null!=a?o.aspect=h/a:r.isNumber(e)&&(o.aspect=e);const{margin:c}=this.model;if(null!=c)if(r.isNumber(c))o.margin={top:c,right:c,bottom:c,left:c};else if(2==c.length){const[t,i]=c;o.margin={top:t,right:i,bottom:t,left:i}}else{const[t,i,e,s]=c;o.margin={top:t,right:i,bottom:e,left:s}}o.visible=this.model.visible;const{align:u}=this.model;return r.isArray(u)?[o.halign,o.valign]=u:o.halign=o.valign=u,o}_viewport_size(){return h.undisplayed(this.el,(()=>{let t=this.el;for(;t=t.parentElement;){if(t.classList.contains(m.root))continue;if(t==document.body){const{margin:{left:t,right:i,top:e,bottom:s}}=h.extents(document.body);return{width:Math.ceil(document.documentElement.clientWidth-t-i),height:Math.ceil(document.documentElement.clientHeight-e-s)}}const{padding:{left:i,right:e,top:s,bottom:o}}=h.extents(t),{width:l,height:n}=t.getBoundingClientRect();let a=0;for(const i of t.children){const{height:t}=i.getBoundingClientRect(),{margin:{top:e,bottom:s}}=h.extents(i);a+=t+e+s}const r=Math.ceil(l-i-e),_=Math.ceil(n-s-o-a);if(r>0||_>0)return{width:r>0?r:void 0,height:_>0?_:void 0}}return{}}))}export(t,i=!0){const e="png"==t?"canvas":"svg",s=new p.CanvasLayer(e,i),{width:o,height:l}=this.layout.bbox;s.resize(o,l);for(const e of this.child_views){const o=e.export(t,i),{x:l,y:n}=e.layout.bbox;s.ctx.drawImage(o.canvas,l,n)}return s}serializable_state(){return Object.assign(Object.assign({},super.serializable_state()),{bbox:this.layout.bbox.box,children:this.child_views.map((t=>t.serializable_state()))})}}e.LayoutDOMView=g,g.__name__="LayoutDOMView";class f extends l.Model{constructor(t){super(t)}static init_LayoutDOM(){this.define((t=>{const{Boolean:i,Number:e,String:s,Auto:o,Color:l,Array:h,Tuple:a,Or:r,Null:_,Nullable:d}=t,c=a(e,e),m=a(e,e,e,e);return{width:[d(e),null],height:[d(e),null],min_width:[d(e),null],min_height:[d(e),null],max_width:[d(e),null],max_height:[d(e),null],margin:[d(r(e,c,m)),[0,0,0,0]],width_policy:[r(u.SizingPolicy,o),"auto"],height_policy:[r(u.SizingPolicy,o),"auto"],aspect_ratio:[r(e,o,_),null],sizing_mode:[d(n.SizingMode),null],visible:[i,!0],disabled:[i,!1],align:[r(n.Align,a(n.Align,n.Align)),"start"],background:[d(l),null],css_classes:[h(s),[]]}}))}}e.LayoutDOM=f,f.__name__="LayoutDOM",f.init_LayoutDOM()}, +function _(t,s,i,o,n){o();const e=t(318),l=t(223);class u extends e.BoxView{_update_layout(){const t=this.child_views.map((t=>t.layout));this.layout=new l.Column(t),this.layout.rows=this.model.rows,this.layout.spacing=[this.model.spacing,0],this.layout.set_sizing(this.box_sizing())}}i.ColumnView=u,u.__name__="ColumnView";class a extends e.Box{constructor(t){super(t)}static init_Column(){this.prototype.default_view=u,this.define((({Any:t})=>({rows:[t,"auto"]})))}}i.Column=a,a.__name__="Column",a.init_Column()}, +function _(t,s,i,o,e){o();const n=t(319),l=t(223);class a extends n.LayoutDOMView{connect_signals(){super.connect_signals();const{children:t,rows:s,cols:i,spacing:o}=this.model.properties;this.on_change([t,s,i,o],(()=>this.rebuild()))}get child_models(){return this.model.children.map((([t])=>t))}_update_layout(){this.layout=new l.Grid,this.layout.rows=this.model.rows,this.layout.cols=this.model.cols,this.layout.spacing=this.model.spacing;for(const[t,s,i,o,e]of this.model.children){const n=this._child_views.get(t);this.layout.items.push({layout:n.layout,row:s,col:i,row_span:o,col_span:e})}this.layout.set_sizing(this.box_sizing())}}i.GridBoxView=a,a.__name__="GridBoxView";class r extends n.LayoutDOM{constructor(t){super(t)}static init_GridBox(){this.prototype.default_view=a,this.define((({Any:t,Int:s,Number:i,Tuple:o,Array:e,Ref:l,Or:a,Opt:r})=>({children:[e(o(l(n.LayoutDOM),s,s,r(s),r(s))),[]],rows:[t,"auto"],cols:[t,"auto"],spacing:[a(i,o(i,i)),0]})))}}i.GridBox=r,r.__name__="GridBox",r.init_GridBox()}, +function _(t,e,o,s,n){s();const _=t(319),i=t(221);class a extends _.LayoutDOMView{get child_models(){return[]}_update_layout(){this.layout=new i.ContentBox(this.el),this.layout.set_sizing(this.box_sizing())}}o.HTMLBoxView=a,a.__name__="HTMLBoxView";class u extends _.LayoutDOM{constructor(t){super(t)}}o.HTMLBox=u,u.__name__="HTMLBox"}, +function _(e,n,t,i,l){i();const a=e(53),o=e(319);class s extends a.Model{constructor(e){super(e)}static init_Panel(){this.define((({Boolean:e,String:n,Ref:t})=>({title:[n,""],child:[t(o.LayoutDOM)],closable:[e,!1]})))}}t.Panel=s,s.__name__="Panel",s.init_Panel()}, +function _(t,s,i,o,e){o();const n=t(318),a=t(223);class _ extends n.BoxView{_update_layout(){const t=this.child_views.map((t=>t.layout));this.layout=new a.Row(t),this.layout.cols=this.model.cols,this.layout.spacing=[0,this.model.spacing],this.layout.set_sizing(this.box_sizing())}}i.RowView=_,_.__name__="RowView";class l extends n.Box{constructor(t){super(t)}static init_Row(){this.prototype.default_view=_,this.define((({Any:t})=>({cols:[t,"auto"]})))}}i.Row=l,l.__name__="Row",l.init_Row()}, +function _(t,e,a,i,s){i();const _=t(319),c=t(221);class n extends _.LayoutDOMView{get child_models(){return[]}_update_layout(){this.layout=new c.LayoutItem,this.layout.set_sizing(this.box_sizing())}}a.SpacerView=n,n.__name__="SpacerView";class o extends _.LayoutDOM{constructor(t){super(t)}static init_Spacer(){this.prototype.default_view=n}}a.Spacer=o,o.__name__="Spacer",o.init_Spacer()}, +function _(e,t,s,i,a){i();const l=e(1),h=e(221),o=e(43),c=e(9),d=e(20),r=e(319),n=e(323),_=l.__importStar(e(327)),p=_,b=l.__importStar(e(328)),u=b,m=l.__importStar(e(243)),v=m;class g extends r.LayoutDOMView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.tabs.change,(()=>this.rebuild())),this.connect(this.model.properties.active.change,(()=>this.on_active_change()))}styles(){return[...super.styles(),b.default,m.default,_.default]}get child_models(){return this.model.tabs.map((e=>e.child))}_update_layout(){const e=this.model.tabs_location,t="above"==e||"below"==e,{scroll_el:s,headers_el:i}=this;this.header=new class extends h.ContentBox{_measure(e){const a=o.size(s),l=o.children(i).slice(0,3).map((e=>o.size(e))),{width:h,height:d}=super._measure(e);if(t){const t=a.width+c.sum(l.map((e=>e.width)));return{width:e.width!=1/0?e.width:t,height:d}}{const t=a.height+c.sum(l.map((e=>e.height)));return{width:h,height:e.height!=1/0?e.height:t}}}}(this.header_el),t?this.header.set_sizing({width_policy:"fit",height_policy:"fixed"}):this.header.set_sizing({width_policy:"fixed",height_policy:"fit"});let a=1,l=1;switch(e){case"above":a-=1;break;case"below":a+=1;break;case"left":l-=1;break;case"right":l+=1}const d={layout:this.header,row:a,col:l},r=this.child_views.map((e=>({layout:e.layout,row:1,col:1})));this.layout=new h.Grid([d,...r]),this.layout.set_sizing(this.box_sizing())}update_position(){super.update_position(),this.header_el.style.position="absolute",o.position(this.header_el,this.header.bbox);const e=this.model.tabs_location,t="above"==e||"below"==e,s=o.size(this.scroll_el),i=o.scroll_size(this.headers_el);if(t){const{width:e}=this.header.bbox;i.width>e?(this.wrapper_el.style.maxWidth=e-s.width+"px",o.display(this.scroll_el)):(this.wrapper_el.style.maxWidth="",o.undisplay(this.scroll_el))}else{const{height:e}=this.header.bbox;i.height>e?(this.wrapper_el.style.maxHeight=e-s.height+"px",o.display(this.scroll_el)):(this.wrapper_el.style.maxHeight="",o.undisplay(this.scroll_el))}const{child_views:a}=this;for(const e of a)o.hide(e.el);const l=a[this.model.active];null!=l&&o.show(l.el)}render(){super.render();const{active:e}=this.model,t=this.model.tabs_location,s="above"==t||"below"==t,i=this.model.tabs.map(((t,s)=>{const i=o.div({class:[p.tab,s==e?p.active:null]},t.title);if(i.addEventListener("click",(e=>{e.target==e.currentTarget&&this.change_active(s)})),t.closable){const e=o.div({class:p.close});e.addEventListener("click",(e=>{if(e.target==e.currentTarget){this.model.tabs=c.remove_at(this.model.tabs,s);const e=this.model.tabs.length;this.model.active>e-1&&(this.model.active=e-1)}})),i.appendChild(e)}return i}));this.headers_el=o.div({class:[p.headers]},i),this.wrapper_el=o.div({class:p.headers_wrapper},this.headers_el);const a=o.div({class:[u.btn,u.btn_default],disabled:""},o.div({class:[v.caret,p.left]})),l=o.div({class:[u.btn,u.btn_default]},o.div({class:[v.caret,p.right]}));let h=0;const d=e=>()=>{const t=this.model.tabs.length;h="left"==e?Math.max(h-1,0):Math.min(h+1,t-1),0==h?a.setAttribute("disabled",""):a.removeAttribute("disabled"),h==t-1?l.setAttribute("disabled",""):l.removeAttribute("disabled");const i=o.children(this.headers_el).slice(0,h).map((e=>e.getBoundingClientRect()));if(s){const e=-c.sum(i.map((e=>e.width)));this.headers_el.style.left=`${e}px`}else{const e=-c.sum(i.map((e=>e.height)));this.headers_el.style.top=`${e}px`}};a.addEventListener("click",d("left")),l.addEventListener("click",d("right")),this.scroll_el=o.div({class:u.btn_group},a,l),this.header_el=o.div({class:[p.tabs_header,p[t]]},this.scroll_el,this.wrapper_el),this.el.appendChild(this.header_el)}change_active(e){e!=this.model.active&&(this.model.active=e)}on_active_change(){const e=this.model.active,t=o.children(this.headers_el);for(const e of t)e.classList.remove(p.active);t[e].classList.add(p.active);const{child_views:s}=this;for(const e of s)o.hide(e.el);o.show(s[e].el)}}s.TabsView=g,g.__name__="TabsView";class w extends r.LayoutDOM{constructor(e){super(e)}static init_Tabs(){this.prototype.default_view=g,this.define((({Int:e,Array:t,Ref:s})=>({tabs:[t(s(n.Panel)),[]],tabs_location:[d.Location,"above"],active:[e,0]})))}}s.Tabs=w,w.__name__="Tabs",w.init_Tabs()}, +function _(e,r,b,o,t){o(),b.root="bk-root",b.tabs_header="bk-tabs-header",b.btn_group="bk-btn-group",b.btn="bk-btn",b.headers_wrapper="bk-headers-wrapper",b.above="bk-above",b.right="bk-right",b.below="bk-below",b.left="bk-left",b.headers="bk-headers",b.tab="bk-tab",b.active="bk-active",b.close="bk-close",b.default='.bk-root .bk-tabs-header{display:flex;display:-webkit-flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;align-items:center;-webkit-align-items:center;overflow:hidden;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none;}.bk-root .bk-tabs-header .bk-btn-group{height:auto;margin-right:5px;}.bk-root .bk-tabs-header .bk-btn-group > .bk-btn{flex-grow:0;-webkit-flex-grow:0;height:auto;padding:4px 4px;}.bk-root .bk-tabs-header .bk-headers-wrapper{flex-grow:1;-webkit-flex-grow:1;overflow:hidden;color:#666666;}.bk-root .bk-tabs-header.bk-above .bk-headers-wrapper{border-bottom:1px solid #e6e6e6;}.bk-root .bk-tabs-header.bk-right .bk-headers-wrapper{border-left:1px solid #e6e6e6;}.bk-root .bk-tabs-header.bk-below .bk-headers-wrapper{border-top:1px solid #e6e6e6;}.bk-root .bk-tabs-header.bk-left .bk-headers-wrapper{border-right:1px solid #e6e6e6;}.bk-root .bk-tabs-header.bk-above,.bk-root .bk-tabs-header.bk-below{flex-direction:row;-webkit-flex-direction:row;}.bk-root .bk-tabs-header.bk-above .bk-headers,.bk-root .bk-tabs-header.bk-below .bk-headers{flex-direction:row;-webkit-flex-direction:row;}.bk-root .bk-tabs-header.bk-left,.bk-root .bk-tabs-header.bk-right{flex-direction:column;-webkit-flex-direction:column;}.bk-root .bk-tabs-header.bk-left .bk-headers,.bk-root .bk-tabs-header.bk-right .bk-headers{flex-direction:column;-webkit-flex-direction:column;}.bk-root .bk-tabs-header .bk-headers{position:relative;display:flex;display:-webkit-flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;align-items:center;-webkit-align-items:center;}.bk-root .bk-tabs-header .bk-tab{padding:4px 8px;border:solid transparent;white-space:nowrap;cursor:pointer;}.bk-root .bk-tabs-header .bk-tab:hover{background-color:#f2f2f2;}.bk-root .bk-tabs-header .bk-tab.bk-active{color:#4d4d4d;background-color:white;border-color:#e6e6e6;}.bk-root .bk-tabs-header .bk-tab .bk-close{margin-left:10px;}.bk-root .bk-tabs-header.bk-above .bk-tab{border-width:3px 1px 0px 1px;border-radius:4px 4px 0 0;}.bk-root .bk-tabs-header.bk-right .bk-tab{border-width:1px 3px 1px 0px;border-radius:0 4px 4px 0;}.bk-root .bk-tabs-header.bk-below .bk-tab{border-width:0px 1px 3px 1px;border-radius:0 0 4px 4px;}.bk-root .bk-tabs-header.bk-left .bk-tab{border-width:1px 0px 1px 3px;border-radius:4px 0 0 4px;}.bk-root .bk-close{display:inline-block;width:10px;height:10px;vertical-align:middle;background-image:url(\'data:image/svg+xml;utf8, \');}.bk-root .bk-close:hover{background-image:url(\'data:image/svg+xml;utf8, \');}'}, +function _(o,b,r,t,e){t(),r.root="bk-root",r.btn="bk-btn",r.active="bk-active",r.btn_default="bk-btn-default",r.btn_primary="bk-btn-primary",r.btn_success="bk-btn-success",r.btn_warning="bk-btn-warning",r.btn_danger="bk-btn-danger",r.btn_light="bk-btn-light",r.btn_group="bk-btn-group",r.dropdown_toggle="bk-dropdown-toggle",r.default=".bk-root .bk-btn{height:100%;display:inline-block;text-align:center;vertical-align:middle;white-space:nowrap;cursor:pointer;padding:6px 12px;font-size:12px;border:1px solid transparent;border-radius:4px;outline:0;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none;}.bk-root .bk-btn:hover,.bk-root .bk-btn:focus{text-decoration:none;}.bk-root .bk-btn:active,.bk-root .bk-btn.bk-active{background-image:none;box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);}.bk-root .bk-btn[disabled]{cursor:not-allowed;pointer-events:none;opacity:0.65;box-shadow:none;}.bk-root .bk-btn-default{color:#333;background-color:#fff;border-color:#ccc;}.bk-root .bk-btn-default:hover{background-color:#f5f5f5;border-color:#b8b8b8;}.bk-root .bk-btn-default.bk-active{background-color:#ebebeb;border-color:#adadad;}.bk-root .bk-btn-default[disabled],.bk-root .bk-btn-default[disabled]:hover,.bk-root .bk-btn-default[disabled]:focus,.bk-root .bk-btn-default[disabled]:active,.bk-root .bk-btn-default[disabled].bk-active{background-color:#e6e6e6;border-color:#ccc;}.bk-root .bk-btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd;}.bk-root .bk-btn-primary:hover{background-color:#3681c1;border-color:#2c699e;}.bk-root .bk-btn-primary.bk-active{background-color:#3276b1;border-color:#285e8e;}.bk-root .bk-btn-primary[disabled],.bk-root .bk-btn-primary[disabled]:hover,.bk-root .bk-btn-primary[disabled]:focus,.bk-root .bk-btn-primary[disabled]:active,.bk-root .bk-btn-primary[disabled].bk-active{background-color:#506f89;border-color:#357ebd;}.bk-root .bk-btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c;}.bk-root .bk-btn-success:hover{background-color:#4eb24e;border-color:#409240;}.bk-root .bk-btn-success.bk-active{background-color:#47a447;border-color:#398439;}.bk-root .bk-btn-success[disabled],.bk-root .bk-btn-success[disabled]:hover,.bk-root .bk-btn-success[disabled]:focus,.bk-root .bk-btn-success[disabled]:active,.bk-root .bk-btn-success[disabled].bk-active{background-color:#667b66;border-color:#4cae4c;}.bk-root .bk-btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236;}.bk-root .bk-btn-warning:hover{background-color:#eea43b;border-color:#e89014;}.bk-root .bk-btn-warning.bk-active{background-color:#ed9c28;border-color:#d58512;}.bk-root .bk-btn-warning[disabled],.bk-root .bk-btn-warning[disabled]:hover,.bk-root .bk-btn-warning[disabled]:focus,.bk-root .bk-btn-warning[disabled]:active,.bk-root .bk-btn-warning[disabled].bk-active{background-color:#c89143;border-color:#eea236;}.bk-root .bk-btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a;}.bk-root .bk-btn-danger:hover{background-color:#d5433e;border-color:#bd2d29;}.bk-root .bk-btn-danger.bk-active{background-color:#d2322d;border-color:#ac2925;}.bk-root .bk-btn-danger[disabled],.bk-root .bk-btn-danger[disabled]:hover,.bk-root .bk-btn-danger[disabled]:focus,.bk-root .bk-btn-danger[disabled]:active,.bk-root .bk-btn-danger[disabled].bk-active{background-color:#a55350;border-color:#d43f3a;}.bk-root .bk-btn-light{color:#333;background-color:#fff;border-color:#ccc;border-color:transparent;}.bk-root .bk-btn-light:hover{background-color:#f5f5f5;border-color:#b8b8b8;}.bk-root .bk-btn-light.bk-active{background-color:#ebebeb;border-color:#adadad;}.bk-root .bk-btn-light[disabled],.bk-root .bk-btn-light[disabled]:hover,.bk-root .bk-btn-light[disabled]:focus,.bk-root .bk-btn-light[disabled]:active,.bk-root .bk-btn-light[disabled].bk-active{background-color:#e6e6e6;border-color:#ccc;}.bk-root .bk-btn-group{height:100%;display:flex;display:-webkit-flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;align-items:center;-webkit-align-items:center;flex-direction:row;-webkit-flex-direction:row;}.bk-root .bk-btn-group > .bk-btn{flex-grow:1;-webkit-flex-grow:1;}.bk-root .bk-btn-group > .bk-btn + .bk-btn{margin-left:-1px;}.bk-root .bk-btn-group > .bk-btn:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0;}.bk-root .bk-btn-group > .bk-btn:not(:first-child):last-child{border-bottom-left-radius:0;border-top-left-radius:0;}.bk-root .bk-btn-group > .bk-btn:not(:first-child):not(:last-child){border-radius:0;}.bk-root .bk-btn-group .bk-dropdown-toggle{flex:0 0 0;-webkit-flex:0 0 0;padding:6px 6px;}"}, +function _(t,e,i,o,n){o();const _=t(320);class s extends _.ColumnView{}i.WidgetBoxView=s,s.__name__="WidgetBoxView";class d extends _.Column{constructor(t){super(t)}static init_WidgetBox(){this.prototype.default_view=s}}i.WidgetBox=d,d.__name__="WidgetBox",d.init_WidgetBox()}, +function _(p,o,t,a,n){a(),n("MapOptions",p(331).MapOptions),n("GMapOptions",p(331).GMapOptions),n("GMapPlot",p(331).GMapPlot),n("Plot",p(332).Plot)}, +function _(t,i,n,e,a){e();const s=t(332),o=t(53),p=t(156),_=t(337);a("GMapPlotView",_.GMapPlotView);class l extends o.Model{constructor(t){super(t)}static init_MapOptions(){this.define((({Int:t,Number:i})=>({lat:[i],lng:[i],zoom:[t,12]})))}}n.MapOptions=l,l.__name__="MapOptions",l.init_MapOptions();class r extends l{constructor(t){super(t)}static init_GMapOptions(){this.define((({Boolean:t,Int:i,String:n})=>({map_type:[n,"roadmap"],scale_control:[t,!1],styles:[n],tilt:[i,45]})))}}n.GMapOptions=r,r.__name__="GMapOptions",r.init_GMapOptions();class c extends s.Plot{constructor(t){super(t),this.use_map=!0}static init_GMapPlot(){this.prototype.default_view=_.GMapPlotView,this.define((({String:t,Ref:i})=>({map_options:[i(r)],api_key:[t],api_version:[t,"3.43"]}))),this.override({x_range:()=>new p.Range1d,y_range:()=>new p.Range1d})}}n.GMapPlot=c,c.__name__="GMapPlot",c.init_GMapPlot()}, +function _(e,t,i,n,r){n();const o=e(1),a=o.__importStar(e(48)),s=o.__importStar(e(18)),l=e(15),_=e(20),h=e(9),c=e(13),d=e(8),u=e(319),g=e(163),p=e(316),f=e(40),b=e(138),w=e(218),m=e(235),y=e(105),v=e(146),x=e(130),A=e(41),R=e(62),S=e(61),P=e(159),D=e(333);r("PlotView",D.PlotView);class L extends u.LayoutDOM{constructor(e){super(e),this.use_map=!1}static init_Plot(){this.prototype.default_view=D.PlotView,this.mixins([["outline_",a.Line],["background_",a.Fill],["border_",a.Fill]]),this.define((({Boolean:e,Number:t,String:i,Array:n,Dict:r,Or:o,Ref:a,Null:l,Nullable:h})=>({toolbar:[a(m.Toolbar),()=>new m.Toolbar],toolbar_location:[h(_.Location),"right"],toolbar_sticky:[e,!0],plot_width:[s.Alias("width")],plot_height:[s.Alias("height")],frame_width:[h(t),null],frame_height:[h(t),null],title:[o(a(b.Title),i,l),()=>new b.Title({text:""})],title_location:[h(_.Location),"above"],above:[n(o(a(f.Annotation),a(g.Axis))),[]],below:[n(o(a(f.Annotation),a(g.Axis))),[]],left:[n(o(a(f.Annotation),a(g.Axis))),[]],right:[n(o(a(f.Annotation),a(g.Axis))),[]],center:[n(o(a(f.Annotation),a(p.Grid))),[]],renderers:[n(a(A.Renderer)),[]],x_range:[a(y.Range),()=>new P.DataRange1d],extra_x_ranges:[r(a(y.Range)),{}],y_range:[a(y.Range),()=>new P.DataRange1d],extra_y_ranges:[r(a(y.Range)),{}],x_scale:[a(v.Scale),()=>new w.LinearScale],y_scale:[a(v.Scale),()=>new w.LinearScale],lod_factor:[t,10],lod_interval:[t,300],lod_threshold:[h(t),2e3],lod_timeout:[t,500],hidpi:[e,!0],output_backend:[_.OutputBackend,"canvas"],min_border:[h(t),5],min_border_top:[h(t),null],min_border_left:[h(t),null],min_border_bottom:[h(t),null],min_border_right:[h(t),null],inner_width:[t,0],inner_height:[t,0],outer_width:[t,0],outer_height:[t,0],match_aspect:[e,!1],aspect_scale:[t,1],reset_policy:[_.ResetPolicy,"standard"]}))),this.override({width:600,height:600,outline_line_color:"#e5e5e5",border_fill_color:"#ffffff",background_fill_color:"#ffffff"})}_doc_attached(){super._doc_attached(),this._push_changes([[this.properties.inner_height,null,this.inner_height],[this.properties.inner_width,null,this.inner_width]])}initialize(){super.initialize(),this.reset=new l.Signal0(this,"reset");for(const e of c.values(this.extra_x_ranges).concat(this.x_range)){let t=e.plots;d.isArray(t)&&(t=t.concat(this),e.setv({plots:t},{silent:!0}))}for(const e of c.values(this.extra_y_ranges).concat(this.y_range)){let t=e.plots;d.isArray(t)&&(t=t.concat(this),e.setv({plots:t},{silent:!0}))}}add_layout(e,t="center"){const i=this.properties[t].get_value();this.setv({[t]:[...i,e]})}remove_layout(e){const t=t=>{h.remove_by(t,(t=>t==e))};t(this.left),t(this.right),t(this.above),t(this.below),t(this.center)}get data_renderers(){return this.renderers.filter((e=>e instanceof R.DataRenderer))}add_renderers(...e){this.renderers=this.renderers.concat(e)}add_glyph(e,t=new x.ColumnDataSource,i={}){const n=new S.GlyphRenderer(Object.assign(Object.assign({},i),{data_source:t,glyph:e}));return this.add_renderers(n),n}add_tools(...e){this.toolbar.tools=this.toolbar.tools.concat(e)}get panels(){return[...this.side_panels,...this.center]}get side_panels(){const{above:e,below:t,left:i,right:n}=this;return h.concat([e,t,i,n])}}i.Plot=L,L.__name__="Plot",L.init_Plot()}, +function _(e,t,i,s,a){s();const n=e(1),o=e(144),l=e(262),r=e(319),_=e(40),h=e(138),d=e(163),u=e(234),c=e(264),p=e(122),v=e(45),b=e(19),g=e(334),m=e(8),w=e(9),y=e(249),f=e(222),x=e(225),z=e(223),k=e(140),q=e(99),M=e(335),V=e(336),P=e(28);class R extends r.LayoutDOMView{constructor(){super(...arguments),this._outer_bbox=new q.BBox,this._inner_bbox=new q.BBox,this._needs_paint=!0,this._needs_layout=!1,this._invalidated_painters=new Set,this._invalidate_all=!0}get canvas(){return this.canvas_view}get state(){return this._state_manager}set invalidate_dataranges(e){this._range_manager.invalidate_dataranges=e}renderer_view(e){const t=this.renderer_views.get(e);if(null==t)for(const[,t]of this.renderer_views){const i=t.renderer_view(e);if(null!=i)return i}return t}get is_paused(){return null!=this._is_paused&&0!==this._is_paused}get child_models(){return[]}pause(){null==this._is_paused?this._is_paused=1:this._is_paused+=1}unpause(e=!1){if(null==this._is_paused)throw new Error("wasn't paused");this._is_paused-=1,0!=this._is_paused||e||this.request_paint("everything")}request_render(){this.request_paint("everything")}request_paint(e){this.invalidate_painters(e),this.schedule_paint()}invalidate_painters(e){if("everything"==e)this._invalidate_all=!0;else if(m.isArray(e))for(const t of e)this._invalidated_painters.add(t);else this._invalidated_painters.add(e)}schedule_paint(){if(!this.is_paused){const e=this.throttled_paint();this._ready=this._ready.then((()=>e))}}request_layout(){this._needs_layout=!0,this.request_paint("everything")}reset(){"standard"==this.model.reset_policy&&(this.state.clear(),this.reset_range(),this.reset_selection()),this.model.trigger_event(new c.Reset)}remove(){p.remove_views(this.renderer_views),p.remove_views(this.tool_views),this.canvas_view.remove(),super.remove()}render(){super.render(),this.el.appendChild(this.canvas_view.el),this.canvas_view.render()}initialize(){this.pause(),super.initialize(),this.lod_started=!1,this.visuals=new v.Visuals(this),this._initial_state={selection:new Map,dimensions:{width:0,height:0}},this.visibility_callbacks=[],this.renderer_views=new Map,this.tool_views=new Map,this.frame=new o.CartesianFrame(this.model.x_scale,this.model.y_scale,this.model.x_range,this.model.y_range,this.model.extra_x_ranges,this.model.extra_y_ranges),this._range_manager=new M.RangeManager(this),this._state_manager=new V.StateManager(this,this._initial_state),this.throttled_paint=g.throttle((()=>this.repaint()),1e3/60);const{title_location:e,title:t}=this.model;null!=e&&null!=t&&(this._title=t instanceof h.Title?t:new h.Title({text:t}));const{toolbar_location:i,toolbar:s}=this.model;null!=i&&null!=s&&(this._toolbar=new u.ToolbarPanel({toolbar:s}),s.toolbar_location=i)}async lazy_initialize(){await super.lazy_initialize();const{hidpi:e,output_backend:t}=this.model,i=new l.Canvas({hidpi:e,output_backend:t});this.canvas_view=await p.build_view(i,{parent:this}),this.canvas_view.plot_views=[this],await this.build_renderer_views(),await this.build_tool_views(),this._range_manager.update_dataranges(),this.unpause(!0),b.logger.debug("PlotView initialized")}_width_policy(){return null==this.model.frame_width?super._width_policy():"min"}_height_policy(){return null==this.model.frame_height?super._height_policy():"min"}_update_layout(){var e,t,i,s,a;this.layout=new x.BorderLayout,this.layout.set_sizing(this.box_sizing());const n=w.copy(this.model.above),o=w.copy(this.model.below),l=w.copy(this.model.left),r=w.copy(this.model.right),d=e=>{switch(e){case"above":return n;case"below":return o;case"left":return l;case"right":return r}},{title_location:c,title:p}=this.model;null!=c&&null!=p&&d(c).push(this._title);const{toolbar_location:v,toolbar:b}=this.model;if(null!=v&&null!=b){const e=d(v);let t=!0;if(this.model.toolbar_sticky)for(let i=0;i{var i;const s=this.renderer_view(t);return s.panel=new k.Panel(e),null===(i=s.update_layout)||void 0===i||i.call(s),s.layout},y=(e,t)=>{const i="above"==e||"below"==e,s=[];for(const a of t)if(m.isArray(a)){const t=a.map((t=>{const s=g(e,t);if(t instanceof u.ToolbarPanel){const e=i?"width_policy":"height_policy";s.set_sizing(Object.assign(Object.assign({},s.sizing),{[e]:"min"}))}return s}));let n;i?(n=new z.Row(t),n.set_sizing({width_policy:"max",height_policy:"min"})):(n=new z.Column(t),n.set_sizing({width_policy:"min",height_policy:"max"})),n.absolute=!0,s.push(n)}else s.push(g(e,a));return s},q=null!==(e=this.model.min_border)&&void 0!==e?e:0;this.layout.min_border={left:null!==(t=this.model.min_border_left)&&void 0!==t?t:q,top:null!==(i=this.model.min_border_top)&&void 0!==i?i:q,right:null!==(s=this.model.min_border_right)&&void 0!==s?s:q,bottom:null!==(a=this.model.min_border_bottom)&&void 0!==a?a:q};const M=new f.NodeLayout,V=new f.VStack,P=new f.VStack,R=new f.HStack,O=new f.HStack;M.absolute=!0,V.absolute=!0,P.absolute=!0,R.absolute=!0,O.absolute=!0,M.children=this.model.center.filter((e=>e instanceof _.Annotation)).map((e=>{var t;const i=this.renderer_view(e);return null===(t=i.update_layout)||void 0===t||t.call(i),i.layout})).filter((e=>null!=e));const{frame_width:S,frame_height:j}=this.model;M.set_sizing(Object.assign(Object.assign({},null!=S?{width_policy:"fixed",width:S}:{width_policy:"fit"}),null!=j?{height_policy:"fixed",height:j}:{height_policy:"fit"})),M.on_resize((e=>this.frame.set_geometry(e))),V.children=w.reversed(y("above",n)),P.children=y("below",o),R.children=w.reversed(y("left",l)),O.children=y("right",r),V.set_sizing({width_policy:"fit",height_policy:"min"}),P.set_sizing({width_policy:"fit",height_policy:"min"}),R.set_sizing({width_policy:"min",height_policy:"fit"}),O.set_sizing({width_policy:"min",height_policy:"fit"}),this.layout.center_panel=M,this.layout.top_panel=V,this.layout.bottom_panel=P,this.layout.left_panel=R,this.layout.right_panel=O}get axis_views(){const e=[];for(const[,t]of this.renderer_views)t instanceof d.AxisView&&e.push(t);return e}set_toolbar_visibility(e){for(const t of this.visibility_callbacks)t(e)}update_range(e,t){this.pause(),this._range_manager.update(e,t),this.unpause()}reset_range(){this.update_range(null)}get_selection(){const e=new Map;for(const t of this.model.data_renderers){const{selected:i}=t.selection_manager.source;e.set(t,i)}return e}update_selection(e){for(const t of this.model.data_renderers){const i=t.selection_manager.source;if(null!=e){const s=e.get(t);null!=s&&i.selected.update(s,!0)}else i.selection_manager.clear()}}reset_selection(){this.update_selection(null)}_invalidate_layout(){(()=>{var e;for(const t of this.model.side_panels){const i=this.renderer_views.get(t);if(null===(e=i.layout)||void 0===e?void 0:e.has_size_changed())return this.invalidate_painters(i),!0}return!1})()&&this.root.compute_layout()}get_renderer_views(){return this.computed_renderers.map((e=>this.renderer_views.get(e)))}*_compute_renderers(){const{above:e,below:t,left:i,right:s,center:a,renderers:n}=this.model;yield*n,yield*e,yield*t,yield*i,yield*s,yield*a,null!=this._title&&(yield this._title),null!=this._toolbar&&(yield this._toolbar);for(const e of this.model.toolbar.tools)null!=e.overlay&&(yield e.overlay),yield*e.synthetic_renderers}async build_renderer_views(){this.computed_renderers=[...this._compute_renderers()],await p.build_views(this.renderer_views,this.computed_renderers,{parent:this})}async build_tool_views(){const e=this.model.toolbar.tools;(await p.build_views(this.tool_views,e,{parent:this})).map((e=>this.canvas_view.ui_event_bus.register_tool(e)))}connect_signals(){super.connect_signals();const{x_ranges:e,y_ranges:t}=this.frame;for(const[,t]of e)this.connect(t.change,(()=>{this._needs_layout=!0,this.request_paint("everything")}));for(const[,e]of t)this.connect(e.change,(()=>{this._needs_layout=!0,this.request_paint("everything")}));const{above:i,below:s,left:a,right:n,center:o,renderers:l}=this.model.properties;this.on_change([i,s,a,n,o,l],(async()=>await this.build_renderer_views())),this.connect(this.model.toolbar.properties.tools.change,(async()=>{await this.build_renderer_views(),await this.build_tool_views()})),this.connect(this.model.change,(()=>this.request_paint("everything"))),this.connect(this.model.reset,(()=>this.reset()))}has_finished(){if(!super.has_finished())return!1;if(this.model.visible)for(const[,e]of this.renderer_views)if(!e.has_finished())return!1;return!0}after_layout(){var e;super.after_layout();for(const[,t]of this.renderer_views)t instanceof _.AnnotationView&&(null===(e=t.after_layout)||void 0===e||e.call(t));if(this._needs_layout=!1,this.model.setv({inner_width:Math.round(this.frame.bbox.width),inner_height:Math.round(this.frame.bbox.height),outer_width:Math.round(this.layout.bbox.width),outer_height:Math.round(this.layout.bbox.height)},{no_change:!0}),!1!==this.model.match_aspect&&(this.pause(),this._range_manager.update_dataranges(),this.unpause(!0)),!this._outer_bbox.equals(this.layout.bbox)){const{width:e,height:t}=this.layout.bbox;this.canvas_view.resize(e,t),this._outer_bbox=this.layout.bbox,this._invalidate_all=!0,this._needs_paint=!0}const{inner_bbox:t}=this.layout;this._inner_bbox.equals(t)||(this._inner_bbox=t,this._needs_paint=!0),this._needs_paint&&this.paint()}repaint(){this._needs_layout&&this._invalidate_layout(),this.paint()}paint(){var e;if(this.is_paused||!this.model.visible)return;b.logger.trace(`PlotView.paint() for ${this.model.id}`);const{document:t}=this.model;if(null!=t){const e=t.interactive_duration();e>=0&&e{t.interactive_duration()>this.model.lod_timeout&&t.interactive_stop(),this.request_paint("everything")}),this.model.lod_timeout):t.interactive_stop()}this._range_manager.invalidate_dataranges&&(this._range_manager.update_dataranges(),this._invalidate_layout());let i=!1,s=!1;if(this._invalidate_all)i=!0,s=!0;else for(const e of this._invalidated_painters){const{level:t}=e.model;if("overlay"!=t?i=!0:s=!0,i&&s)break}this._invalidated_painters.clear(),this._invalidate_all=!1;const a=[this.frame.bbox.left,this.frame.bbox.top,this.frame.bbox.width,this.frame.bbox.height],{primary:n,overlays:o}=this.canvas_view;i&&(n.prepare(),this.canvas_view.prepare_webgl(a),this._map_hook(n.ctx,a),this._paint_empty(n.ctx,a),this._paint_outline(n.ctx,a),this._paint_levels(n.ctx,"image",a,!0),this._paint_levels(n.ctx,"underlay",a,!0),this._paint_levels(n.ctx,"glyph",a,!0),this._paint_levels(n.ctx,"guide",a,!1),this._paint_levels(n.ctx,"annotation",a,!1),n.finish()),(s||P.settings.wireframe)&&(o.prepare(),this._paint_levels(o.ctx,"overlay",a,!1),P.settings.wireframe&&this._paint_layout(o.ctx,this.layout),o.finish()),null==this._initial_state.range&&(this._initial_state.range=null!==(e=this._range_manager.compute_initial())&&void 0!==e?e:void 0),this._needs_paint=!1}_paint_levels(e,t,i,s){for(const a of this.computed_renderers){if(a.level!=t)continue;const n=this.renderer_views.get(a);e.save(),(s||n.needs_clip)&&(e.beginPath(),e.rect(...i),e.clip()),n.render(),e.restore(),n.has_webgl&&n.needs_webgl_blit&&this.canvas_view.blit_webgl(e)}}_paint_layout(e,t){const{x:i,y:s,width:a,height:n}=t.bbox;e.strokeStyle="blue",e.strokeRect(i,s,a,n);for(const a of t)e.save(),t.absolute||e.translate(i,s),this._paint_layout(e,a),e.restore()}_map_hook(e,t){}_paint_empty(e,t){const[i,s,a,n]=[0,0,this.layout.bbox.width,this.layout.bbox.height],[o,l,r,_]=t;this.visuals.border_fill.doit&&(this.visuals.border_fill.set_value(e),e.fillRect(i,s,a,n),e.clearRect(o,l,r,_)),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(e),e.fillRect(o,l,r,_))}_paint_outline(e,t){if(this.visuals.outline_line.doit){e.save(),this.visuals.outline_line.set_value(e);let[i,s,a,n]=t;i+a==this.layout.bbox.width&&(a-=1),s+n==this.layout.bbox.height&&(n-=1),e.strokeRect(i,s,a,n),e.restore()}}to_blob(){return this.canvas_view.to_blob()}export(e,t=!0){const i="png"==e?"canvas":"svg",s=new y.CanvasLayer(i,t),{width:a,height:n}=this.layout.bbox;s.resize(a,n);const{canvas:o}=this.canvas_view.compose();return s.ctx.drawImage(o,0,0),s}serializable_state(){const e=super.serializable_state(),{children:t}=e,i=n.__rest(e,["children"]),s=this.get_renderer_views().map((e=>e.serializable_state())).filter((e=>null!=e.bbox));return Object.assign(Object.assign({},i),{children:[...null!=t?t:[],...s]})}}i.PlotView=R,R.__name__="PlotView"}, +function _(t,n,e,o,u){o(),e.throttle=function(t,n){let e=null,o=0,u=!1;return function(){return new Promise(((r,i)=>{const l=function(){o=Date.now(),e=null,u=!1;try{t(),r()}catch(t){i(t)}},a=Date.now(),c=n-(a-o);c<=0&&!u?(null!=e&&clearTimeout(e),u=!0,requestAnimationFrame(l)):e||u?r():e=setTimeout((()=>requestAnimationFrame(l)),c)}))}}}, +function _(t,n,e,s,a){s();const o=t(159),r=t(19);class l{constructor(t){this.parent=t,this.invalidate_dataranges=!0}get frame(){return this.parent.frame}update(t,n){const{x_ranges:e,y_ranges:s}=this.frame;if(null==t){for(const[,t]of e)t.reset();for(const[,t]of s)t.reset();this.update_dataranges()}else{const a=[];for(const[n,s]of e)a.push([s,t.xrs.get(n)]);for(const[n,e]of s)a.push([e,t.yrs.get(n)]);(null==n?void 0:n.scrolling)&&this._update_ranges_together(a),this._update_ranges_individually(a,n)}}reset(){this.update(null)}update_dataranges(){const t=new Map,n=new Map;let e=!1;for(const[,t]of this.frame.x_ranges)t instanceof o.DataRange1d&&"log"==t.scale_hint&&(e=!0);for(const[,t]of this.frame.y_ranges)t instanceof o.DataRange1d&&"log"==t.scale_hint&&(e=!0);for(const s of this.parent.model.data_renderers){const a=this.parent.renderer_view(s);if(null==a)continue;const o=a.glyph_view.bounds();if(null!=o&&t.set(s,o),e){const t=a.glyph_view.log_bounds();null!=t&&n.set(s,t)}}let s=!1,a=!1;const{width:l,height:i}=this.frame.bbox;let d;!1!==this.parent.model.match_aspect&&0!=l&&0!=i&&(d=1/this.parent.model.aspect_scale*(l/i));for(const[,e]of this.frame.x_ranges){if(e instanceof o.DataRange1d){const a="log"==e.scale_hint?n:t;e.update(a,0,this.parent.model,d),e.follow&&(s=!0)}null!=e.bounds&&(a=!0)}for(const[,e]of this.frame.y_ranges){if(e instanceof o.DataRange1d){const a="log"==e.scale_hint?n:t;e.update(a,1,this.parent.model,d),e.follow&&(s=!0)}null!=e.bounds&&(a=!0)}if(s&&a){r.logger.warn("Follow enabled so bounds are unset.");for(const[,t]of this.frame.x_ranges)t.bounds=null;for(const[,t]of this.frame.y_ranges)t.bounds=null}this.invalidate_dataranges=!1}compute_initial(){let t=!0;const{x_ranges:n,y_ranges:e}=this.frame,s=new Map,a=new Map;for(const[e,a]of n){const{start:n,end:o}=a;if(null==n||null==o||isNaN(n+o)){t=!1;break}s.set(e,{start:n,end:o})}if(t)for(const[n,s]of e){const{start:e,end:o}=s;if(null==e||null==o||isNaN(e+o)){t=!1;break}a.set(n,{start:e,end:o})}return t?{xrs:s,yrs:a}:(r.logger.warn("could not set initial ranges"),null)}_update_ranges_together(t){let n=1;for(const[e,s]of t)n=Math.min(n,this._get_weight_to_constrain_interval(e,s));if(n<1)for(const[e,s]of t)s.start=n*s.start+(1-n)*e.start,s.end=n*s.end+(1-n)*e.end}_update_ranges_individually(t,n){const e=!!(null==n?void 0:n.panning),s=!!(null==n?void 0:n.scrolling);let a=!1;for(const[n,o]of t){if(!s){const t=this._get_weight_to_constrain_interval(n,o);t<1&&(o.start=t*o.start+(1-t)*n.start,o.end=t*o.end+(1-t)*n.end)}if(null!=n.bounds&&"auto"!=n.bounds){const[t,r]=n.bounds,l=Math.abs(o.end-o.start);n.is_reversed?(null!=t&&t>=o.end&&(a=!0,o.end=t,(e||s)&&(o.start=t+l)),null!=r&&r<=o.start&&(a=!0,o.start=r,(e||s)&&(o.end=r-l))):(null!=t&&t>=o.start&&(a=!0,o.start=t,(e||s)&&(o.end=t+l)),null!=r&&r<=o.end&&(a=!0,o.end=r,(e||s)&&(o.start=r-l)))}}if(!(s&&a&&(null==n?void 0:n.maintain_focus)))for(const[n,e]of t)n.have_updated_interactively=!0,n.start==e.start&&n.end==e.end||n.setv(e)}_get_weight_to_constrain_interval(t,n){const{min_interval:e}=t;let{max_interval:s}=t;if(null!=t.bounds&&"auto"!=t.bounds){const[n,e]=t.bounds;if(null!=n&&null!=e){const t=Math.abs(e-n);s=null!=s?Math.min(s,t):t}}let a=1;if(null!=e||null!=s){const o=Math.abs(t.end-t.start),r=Math.abs(n.end-n.start);null!=e&&e>0&&r0&&r>s&&(a=(s-o)/(r-o)),a=Math.max(0,Math.min(1,a))}return a}}e.RangeManager=l,l.__name__="RangeManager"}, +function _(t,i,s,e,n){e();const h=t(15);class a{constructor(t,i){this.parent=t,this.initial_state=i,this.changed=new h.Signal0(this.parent,"state_changed"),this.history=[],this.index=-1}_do_state_change(t){const i=null!=this.history[t]?this.history[t].state:this.initial_state;null!=i.range&&this.parent.update_range(i.range),null!=i.selection&&this.parent.update_selection(i.selection)}push(t,i){const{history:s,index:e}=this,n=null!=s[e]?s[e].state:{},h=Object.assign(Object.assign(Object.assign({},this.initial_state),n),i);this.history=this.history.slice(0,this.index+1),this.history.push({type:t,state:h}),this.index=this.history.length-1,this.changed.emit()}clear(){this.history=[],this.index=-1,this.changed.emit()}undo(){this.can_undo&&(this.index-=1,this._do_state_change(this.index),this.changed.emit())}redo(){this.can_redo&&(this.index+=1,this._do_state_change(this.index),this.changed.emit())}get can_undo(){return this.index>=0}get can_redo(){return this.indexm.emit();const s=encodeURIComponent,o=document.createElement("script");o.type="text/javascript",o.src=`https://maps.googleapis.com/maps/api/js?v=${s(e)}&key=${s(t)}&callback=_bokeh_gmaps_callback`,document.body.appendChild(o)}(t,e)}m.connect((()=>this.request_paint("everything")))}this.unpause()}remove(){p.remove(this.map_el),super.remove()}update_range(t,e){var s,o;if(null==t)this.map.setCenter({lat:this.initial_lat,lng:this.initial_lng}),this.map.setOptions({zoom:this.initial_zoom}),super.update_range(null,e);else if(null!=t.sdx||null!=t.sdy)this.map.panBy(null!==(s=t.sdx)&&void 0!==s?s:0,null!==(o=t.sdy)&&void 0!==o?o:0),super.update_range(t,e);else if(null!=t.factor){if(10!==this.zoom_count)return void(this.zoom_count+=1);this.zoom_count=0,this.pause(),super.update_range(t,e);const s=t.factor<0?-1:1,o=this.map.getZoom(),i=o+s;if(i>=2){this.map.setZoom(i);const[t,e,,]=this._get_projected_bounds();e-t<0&&this.map.setZoom(o)}this.unpause()}this._set_bokeh_ranges()}_build_map(){const{maps:t}=google;this.map_types={satellite:t.MapTypeId.SATELLITE,terrain:t.MapTypeId.TERRAIN,roadmap:t.MapTypeId.ROADMAP,hybrid:t.MapTypeId.HYBRID};const e=this.model.map_options,s={center:new t.LatLng(e.lat,e.lng),zoom:e.zoom,disableDefaultUI:!0,mapTypeId:this.map_types[e.map_type],scaleControl:e.scale_control,tilt:e.tilt};null!=e.styles&&(s.styles=JSON.parse(e.styles)),this.map_el=p.div({style:{position:"absolute"}}),this.canvas_view.add_underlay(this.map_el),this.map=new t.Map(this.map_el,s),t.event.addListener(this.map,"idle",(()=>this._set_bokeh_ranges())),t.event.addListener(this.map,"bounds_changed",(()=>this._set_bokeh_ranges())),t.event.addListenerOnce(this.map,"tilesloaded",(()=>this._render_finished())),this.connect(this.model.properties.map_options.change,(()=>this._update_options())),this.connect(this.model.map_options.properties.styles.change,(()=>this._update_styles())),this.connect(this.model.map_options.properties.lat.change,(()=>this._update_center("lat"))),this.connect(this.model.map_options.properties.lng.change,(()=>this._update_center("lng"))),this.connect(this.model.map_options.properties.zoom.change,(()=>this._update_zoom())),this.connect(this.model.map_options.properties.map_type.change,(()=>this._update_map_type())),this.connect(this.model.map_options.properties.scale_control.change,(()=>this._update_scale_control())),this.connect(this.model.map_options.properties.tilt.change,(()=>this._update_tilt()))}_render_finished(){this._tiles_loaded=!0,this.notify_finished()}has_finished(){return super.has_finished()&&!0===this._tiles_loaded}_get_latlon_bounds(){const t=this.map.getBounds(),e=t.getNorthEast(),s=t.getSouthWest();return[s.lng(),e.lng(),s.lat(),e.lat()]}_get_projected_bounds(){const[t,e,s,o]=this._get_latlon_bounds(),[i,a]=l.wgs84_mercator.compute(t,s),[n,p]=l.wgs84_mercator.compute(e,o);return[i,n,a,p]}_set_bokeh_ranges(){const[t,e,s,o]=this._get_projected_bounds();this.frame.x_range.setv({start:t,end:e}),this.frame.y_range.setv({start:s,end:o})}_update_center(t){const e=this.map.getCenter().toJSON();e[t]=this.model.map_options[t],this.map.setCenter(e),this._set_bokeh_ranges()}_update_map_type(){this.map.setOptions({mapTypeId:this.map_types[this.model.map_options.map_type]})}_update_scale_control(){this.map.setOptions({scaleControl:this.model.map_options.scale_control})}_update_tilt(){this.map.setOptions({tilt:this.model.map_options.tilt})}_update_options(){this._update_styles(),this._update_center("lat"),this._update_center("lng"),this._update_zoom(),this._update_map_type()}_update_styles(){this.map.setOptions({styles:JSON.parse(this.model.map_options.styles)})}_update_zoom(){this.map.setOptions({zoom:this.model.map_options.zoom}),this._set_bokeh_ranges()}_map_hook(t,e){if(null==this.map&&"undefined"!=typeof google&&null!=google.maps&&this._build_map(),null!=this.map_el){const[t,s,o,i]=e;this.map_el.style.top=`${s}px`,this.map_el.style.left=`${t}px`,this.map_el.style.width=`${o}px`,this.map_el.style.height=`${i}px`}}_paint_empty(t,e){const s=this.layout.bbox.width,o=this.layout.bbox.height,[i,a,n,p]=e;t.clearRect(0,0,s,o),t.beginPath(),t.moveTo(0,0),t.lineTo(0,o),t.lineTo(s,o),t.lineTo(s,0),t.lineTo(0,0),t.moveTo(i,a),t.lineTo(i+n,a),t.lineTo(i+n,a+p),t.lineTo(i,a+p),t.lineTo(i,a),t.closePath(),null!=this.model.border_fill_color&&(t.fillStyle=_.color2css(this.model.border_fill_color),t.fill())}}s.GMapPlotView=d,d.__name__="GMapPlotView"}, +function _(t,_,n,o,r){o();t(1).__exportStar(t(169),n)}, +function _(e,r,d,n,R){n(),R("GlyphRenderer",e(61).GlyphRenderer),R("GraphRenderer",e(123).GraphRenderer),R("GuideRenderer",e(164).GuideRenderer),R("Renderer",e(41).Renderer)}, +function _(e,t,n,o,c){o();e(1).__exportStar(e(129),n),c("Selection",e(59).Selection)}, +function _(a,e,S,o,r){o(),r("ServerSentDataSource",a(342).ServerSentDataSource),r("AjaxDataSource",a(344).AjaxDataSource),r("ColumnDataSource",a(130).ColumnDataSource),r("ColumnarDataSource",a(57).ColumnarDataSource),r("CDSView",a(120).CDSView),r("DataSource",a(58).DataSource),r("GeoJSONDataSource",a(345).GeoJSONDataSource),r("WebDataSource",a(343).WebDataSource)}, +function _(e,t,i,a,s){a();const n=e(343);class r extends n.WebDataSource{constructor(e){super(e),this.initialized=!1}setup(){if(!this.initialized){this.initialized=!0;new EventSource(this.data_url).onmessage=e=>{var t;this.load_data(JSON.parse(e.data),this.mode,null!==(t=this.max_size)&&void 0!==t?t:void 0)}}}}i.ServerSentDataSource=r,r.__name__="ServerSentDataSource"}, +function _(t,e,a,n,s){n();const r=t(130),i=t(20);class l extends r.ColumnDataSource{constructor(t){super(t)}get_column(t){const e=this.data[t];return null!=e?e:[]}get_length(){var t;return null!==(t=super.get_length())&&void 0!==t?t:0}initialize(){super.initialize(),this.setup()}load_data(t,e,a){const{adapter:n}=this;let s;switch(s=null!=n?n.execute(this,{response:t}):t,e){case"replace":this.data=s;break;case"append":{const t=this.data;for(const e of this.columns()){const n=Array.from(t[e]),r=Array.from(s[e]),i=n.concat(r);s[e]=null!=a?i.slice(-a):i}this.data=s;break}}}static init_WebDataSource(){this.define((({Any:t,Int:e,String:a,Nullable:n})=>({max_size:[n(e),null],mode:[i.UpdateMode,"replace"],adapter:[n(t),null],data_url:[a]})))}}a.WebDataSource=l,l.__name__="WebDataSource",l.init_WebDataSource()}, +function _(t,e,i,s,a){s();const n=t(343),r=t(20),o=t(19),l=t(13);class d extends n.WebDataSource{constructor(t){super(t),this.interval=null,this.initialized=!1}static init_AjaxDataSource(){this.define((({Boolean:t,Int:e,String:i,Dict:s,Nullable:a})=>({polling_interval:[a(e),null],content_type:[i,"application/json"],http_headers:[s(i),{}],method:[r.HTTPMethod,"POST"],if_modified:[t,!1]})))}destroy(){null!=this.interval&&clearInterval(this.interval),super.destroy()}setup(){if(!this.initialized&&(this.initialized=!0,this.get_data(this.mode),null!=this.polling_interval)){const t=()=>this.get_data(this.mode,this.max_size,this.if_modified);this.interval=setInterval(t,this.polling_interval)}}get_data(t,e=null,i=!1){const s=this.prepare_request();s.addEventListener("load",(()=>this.do_load(s,t,null!=e?e:void 0))),s.addEventListener("error",(()=>this.do_error(s))),s.send()}prepare_request(){const t=new XMLHttpRequest;t.open(this.method,this.data_url,!0),t.withCredentials=!1,t.setRequestHeader("Content-Type",this.content_type);const e=this.http_headers;for(const[i,s]of l.entries(e))t.setRequestHeader(i,s);return t}do_load(t,e,i){if(200===t.status){const s=JSON.parse(t.responseText);this.load_data(s,e,i)}}do_error(t){o.logger.error(`Failed to fetch JSON from ${this.data_url} with code ${t.status}`)}}i.AjaxDataSource=d,d.__name__="AjaxDataSource",d.init_AjaxDataSource()}, +function _(e,t,o,r,n){r();const s=e(57),a=e(19),i=e(9),l=e(13);function c(e){return null!=e?e:NaN}const{hasOwnProperty:_}=Object.prototype;class g extends s.ColumnarDataSource{constructor(e){super(e)}static init_GeoJSONDataSource(){this.define((({String:e})=>({geojson:[e]}))),this.internal((({Dict:e,Arrayable:t})=>({data:[e(t),{}]})))}initialize(){super.initialize(),this._update_data()}connect_signals(){super.connect_signals(),this.connect(this.properties.geojson.change,(()=>this._update_data()))}_update_data(){this.data=this.geojson_to_column_data()}_get_new_list_array(e){return i.range(0,e).map((e=>[]))}_get_new_nan_array(e){return i.range(0,e).map((e=>NaN))}_add_properties(e,t,o,r){var n;const s=null!==(n=e.properties)&&void 0!==n?n:{};for(const[e,n]of l.entries(s))_.call(t,e)||(t[e]=this._get_new_nan_array(r)),t[e][o]=c(n)}_add_geometry(e,t,o){function r(e,t){return e.concat([[NaN,NaN,NaN]]).concat(t)}switch(e.type){case"Point":{const[r,n,s]=e.coordinates;t.x[o]=r,t.y[o]=n,t.z[o]=c(s);break}case"LineString":{const{coordinates:r}=e;for(let e=0;e1&&a.logger.warn("Bokeh does not support Polygons with holes in, only exterior ring used.");const r=e.coordinates[0];for(let e=0;e1&&a.logger.warn("Bokeh does not support Polygons with holes in, only exterior ring used."),n.push(t[0]);const s=n.reduce(r);for(let e=0;e({use_latlon:[e,!1]})))}get_image_url(e,t,r){const i=this.string_lookup_replace(this.url,this.extra_url_vars);let o,l,n,s;return this.use_latlon?[l,s,o,n]=this.get_tile_geographic_bounds(e,t,r):[l,s,o,n]=this.get_tile_meter_bounds(e,t,r),i.replace("{XMIN}",l.toString()).replace("{YMIN}",s.toString()).replace("{XMAX}",o.toString()).replace("{YMAX}",n.toString())}}r.BBoxTileSource=n,n.__name__="BBoxTileSource",n.init_BBoxTileSource()}, +function _(t,e,i,_,s){_();const r=t(349),o=t(9),n=t(350);class l extends r.TileSource{constructor(t){super(t)}static init_MercatorTileSource(){this.define((({Boolean:t})=>({snap_to_zoom:[t,!1],wrap_around:[t,!0]}))),this.override({x_origin_offset:20037508.34,y_origin_offset:20037508.34,initial_resolution:156543.03392804097})}initialize(){super.initialize(),this._resolutions=o.range(this.min_zoom,this.max_zoom+1).map((t=>this.get_resolution(t)))}_computed_initial_resolution(){return null!=this.initial_resolution?this.initial_resolution:2*Math.PI*6378137/this.tile_size}is_valid_tile(t,e,i){return!(!this.wrap_around&&(t<0||t>=2**i))&&!(e<0||e>=2**i)}parent_by_tile_xyz(t,e,i){const _=this.tile_xyz_to_quadkey(t,e,i),s=_.substring(0,_.length-1);return this.quadkey_to_tile_xyz(s)}get_resolution(t){return this._computed_initial_resolution()/2**t}get_resolution_by_extent(t,e,i){return[(t[2]-t[0])/i,(t[3]-t[1])/e]}get_level_by_extent(t,e,i){const _=(t[2]-t[0])/i,s=(t[3]-t[1])/e,r=Math.max(_,s);let o=0;for(const t of this._resolutions){if(r>t){if(0==o)return 0;if(o>0)return o-1}o+=1}return o-1}get_closest_level_by_extent(t,e,i){const _=(t[2]-t[0])/i,s=(t[3]-t[1])/e,r=Math.max(_,s),o=this._resolutions.reduce((function(t,e){return Math.abs(e-r)e?(u=o-s,a*=t):(u*=e,a=n-r)}const h=(u-(o-s))/2,c=(a-(n-r))/2;return[s-h,r-c,o+h,n+c]}tms_to_wmts(t,e,i){return[t,2**i-1-e,i]}wmts_to_tms(t,e,i){return[t,2**i-1-e,i]}pixels_to_meters(t,e,i){const _=this.get_resolution(i);return[t*_-this.x_origin_offset,e*_-this.y_origin_offset]}meters_to_pixels(t,e,i){const _=this.get_resolution(i);return[(t+this.x_origin_offset)/_,(e+this.y_origin_offset)/_]}pixels_to_tile(t,e){let i=Math.ceil(t/this.tile_size);i=0===i?i:i-1;return[i,Math.max(Math.ceil(e/this.tile_size)-1,0)]}pixels_to_raster(t,e,i){return[t,(this.tile_size<=l;t--)for(let i=n;i<=u;i++)this.is_valid_tile(i,t,e)&&h.push([i,t,e,this.get_tile_meter_bounds(i,t,e)]);return this.sort_tiles_from_center(h,[n,l,u,a]),h}quadkey_to_tile_xyz(t){let e=0,i=0;const _=t.length;for(let s=_;s>0;s--){const r=1<0;s--){const i=1<0;)if(s=s.substring(0,s.length-1),[t,e,i]=this.quadkey_to_tile_xyz(s),[t,e,i]=this.denormalize_xyz(t,e,i,_),this.tiles.has(this.tile_xyz_to_key(t,e,i)))return[t,e,i];return[0,0,0]}normalize_xyz(t,e,i){if(this.wrap_around){const _=2**i;return[(t%_+_)%_,e,i]}return[t,e,i]}denormalize_xyz(t,e,i,_){return[t+_*2**i,e,i]}denormalize_meters(t,e,i,_){return[t+2*_*Math.PI*6378137,e]}calculate_world_x_by_tile_xyz(t,e,i){return Math.floor(t/2**i)}}i.MercatorTileSource=l,l.__name__="MercatorTileSource",l.init_MercatorTileSource()}, +function _(e,t,r,i,n){i();const l=e(53),s=e(13);class a extends l.Model{constructor(e){super(e)}static init_TileSource(){this.define((({Number:e,String:t,Dict:r,Nullable:i})=>({url:[t,""],tile_size:[e,256],max_zoom:[e,30],min_zoom:[e,0],extra_url_vars:[r(t),{}],attribution:[t,""],x_origin_offset:[e],y_origin_offset:[e],initial_resolution:[i(e),null]})))}initialize(){super.initialize(),this.tiles=new Map,this._normalize_case()}connect_signals(){super.connect_signals(),this.connect(this.change,(()=>this._clear_cache()))}string_lookup_replace(e,t){let r=e;for(const[e,i]of s.entries(t))r=r.replace(`{${e}}`,i);return r}_normalize_case(){const e=this.url.replace("{x}","{X}").replace("{y}","{Y}").replace("{z}","{Z}").replace("{q}","{Q}").replace("{xmin}","{XMIN}").replace("{ymin}","{YMIN}").replace("{xmax}","{XMAX}").replace("{ymax}","{YMAX}");this.url=e}_clear_cache(){this.tiles=new Map}tile_xyz_to_key(e,t,r){return`${e}:${t}:${r}`}key_to_tile_xyz(e){const[t,r,i]=e.split(":").map((e=>parseInt(e)));return[t,r,i]}sort_tiles_from_center(e,t){const[r,i,n,l]=t,s=(n-r)/2+r,a=(l-i)/2+i;e.sort((function(e,t){return Math.sqrt((s-e[0])**2+(a-e[1])**2)-Math.sqrt((s-t[0])**2+(a-t[1])**2)}))}get_image_url(e,t,r){return this.string_lookup_replace(this.url,this.extra_url_vars).replace("{X}",e.toString()).replace("{Y}",t.toString()).replace("{Z}",r.toString())}}r.TileSource=a,a.__name__="TileSource",a.init_TileSource()}, +function _(t,e,r,n,o){n();const c=t(65);function _(t,e){return c.wgs84_mercator.compute(t,e)}function g(t,e){return c.wgs84_mercator.invert(t,e)}r.geographic_to_meters=_,r.meters_to_geographic=g,r.geographic_extent_to_meters=function(t){const[e,r,n,o]=t,[c,g]=_(e,r),[i,u]=_(n,o);return[c,g,i,u]},r.meters_extent_to_geographic=function(t){const[e,r,n,o]=t,[c,_]=g(e,r),[i,u]=g(n,o);return[c,_,i,u]}}, +function _(e,t,r,s,_){s();const o=e(348);class c extends o.MercatorTileSource{constructor(e){super(e)}get_image_url(e,t,r){const s=this.string_lookup_replace(this.url,this.extra_url_vars),[_,o,c]=this.tms_to_wmts(e,t,r),i=this.tile_xyz_to_quadkey(_,o,c);return s.replace("{Q}",i)}}r.QUADKEYTileSource=c,c.__name__="QUADKEYTileSource"}, +function _(t,e,i,s,_){s();const n=t(1),a=t(349),h=t(353),r=t(41),o=t(156),l=t(43),d=t(296),m=t(9),c=t(8),p=n.__importStar(t(354));class g extends r.RendererView{initialize(){this._tiles=[],super.initialize()}connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render())),this.connect(this.model.tile_source.change,(()=>this.request_render()))}styles(){return[...super.styles(),p.default]}get_extent(){return[this.x_range.start,this.y_range.start,this.x_range.end,this.y_range.end]}get map_plot(){return this.plot_model}get map_canvas(){return this.layer.ctx}get map_frame(){return this.plot_view.frame}get x_range(){return this.map_plot.x_range}get y_range(){return this.map_plot.y_range}_set_data(){this.extent=this.get_extent(),this._last_height=void 0,this._last_width=void 0}_update_attribution(){null!=this.attribution_el&&l.removeElement(this.attribution_el);const{attribution:t}=this.model.tile_source;if(c.isString(t)&&t.length>0){const{layout:e,frame:i}=this.plot_view,s=e.bbox.width-i.bbox.right,_=e.bbox.height-i.bbox.bottom,n=i.bbox.width;this.attribution_el=l.div({class:p.tile_attribution,style:{position:"absolute",right:`${s}px`,bottom:`${_}px`,"max-width":n-4+"px",padding:"2px","background-color":"rgba(255,255,255,0.5)","font-size":"9px","line-height":"1.05","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"}}),this.plot_view.canvas_view.add_event(this.attribution_el),this.attribution_el.innerHTML=t,this.attribution_el.title=this.attribution_el.textContent.replace(/\s*\n\s*/g," ")}}_map_data(){this.initial_extent=this.get_extent();const t=this.model.tile_source.get_level_by_extent(this.initial_extent,this.map_frame.bbox.height,this.map_frame.bbox.width),e=this.model.tile_source.snap_to_zoom_level(this.initial_extent,this.map_frame.bbox.height,this.map_frame.bbox.width,t);this.x_range.start=e[0],this.y_range.start=e[1],this.x_range.end=e[2],this.y_range.end=e[3],this.x_range instanceof o.Range1d&&(this.x_range.reset_start=e[0],this.x_range.reset_end=e[2]),this.y_range instanceof o.Range1d&&(this.y_range.reset_start=e[1],this.y_range.reset_end=e[3]),this._update_attribution()}_create_tile(t,e,i,s,_=!1){const[n,a,h]=this.model.tile_source.normalize_xyz(t,e,i),r={img:void 0,tile_coords:[t,e,i],normalized_coords:[n,a,h],quadkey:this.model.tile_source.tile_xyz_to_quadkey(t,e,i),cache_key:this.model.tile_source.tile_xyz_to_key(t,e,i),bounds:s,loaded:!1,finished:!1,x_coord:s[0],y_coord:s[3]},o=this.model.tile_source.get_image_url(n,a,h);new d.ImageLoader(o,{loaded:t=>{Object.assign(r,{img:t,loaded:!0}),_?(r.finished=!0,this.notify_finished()):this.request_render()},failed(){r.finished=!0}}),this.model.tile_source.tiles.set(r.cache_key,r),this._tiles.push(r)}_enforce_aspect_ratio(){if(this._last_height!==this.map_frame.bbox.height||this._last_width!==this.map_frame.bbox.width){const t=this.get_extent(),e=this.model.tile_source.get_level_by_extent(t,this.map_frame.bbox.height,this.map_frame.bbox.width),i=this.model.tile_source.snap_to_zoom_level(t,this.map_frame.bbox.height,this.map_frame.bbox.width,e);this.x_range.setv({start:i[0],end:i[2]}),this.y_range.setv({start:i[1],end:i[3]}),this.extent=i,this._last_height=this.map_frame.bbox.height,this._last_width=this.map_frame.bbox.width}}has_finished(){if(!super.has_finished())return!1;if(0===this._tiles.length)return!1;for(const t of this._tiles)if(!t.finished)return!1;return!0}_render(){null==this.map_initialized&&(this._set_data(),this._map_data(),this.map_initialized=!0),this._enforce_aspect_ratio(),this._update(),null!=this.prefetch_timer&&clearTimeout(this.prefetch_timer),this.prefetch_timer=setTimeout(this._prefetch_tiles.bind(this),500),this.has_finished()&&this.notify_finished()}_draw_tile(t){const e=this.model.tile_source.tiles.get(t);if(null!=e&&e.loaded){const[[t],[i]]=this.coordinates.map_to_screen([e.bounds[0]],[e.bounds[3]]),[[s],[_]]=this.coordinates.map_to_screen([e.bounds[2]],[e.bounds[1]]),n=s-t,a=_-i,h=t,r=i,o=this.map_canvas.getImageSmoothingEnabled();this.map_canvas.setImageSmoothingEnabled(this.model.smoothing),this.map_canvas.drawImage(e.img,h,r,n,a),this.map_canvas.setImageSmoothingEnabled(o),e.finished=!0}}_set_rect(){const t=this.plot_model.outline_line_width,e=this.map_frame.bbox.left+t/2,i=this.map_frame.bbox.top+t/2,s=this.map_frame.bbox.width-t,_=this.map_frame.bbox.height-t;this.map_canvas.rect(e,i,s,_),this.map_canvas.clip()}_render_tiles(t){this.map_canvas.save(),this._set_rect(),this.map_canvas.globalAlpha=this.model.alpha;for(const e of t)this._draw_tile(e);this.map_canvas.restore()}_prefetch_tiles(){const{tile_source:t}=this.model,e=this.get_extent(),i=this.map_frame.bbox.height,s=this.map_frame.bbox.width,_=this.model.tile_source.get_level_by_extent(e,i,s),n=this.model.tile_source.get_tiles_by_extent(e,_);for(let e=0,i=Math.min(10,n.length);ei&&(s=this.extent,h=i,r=!0),r&&(this.x_range.setv({start:s[0],end:s[2]}),this.y_range.setv({start:s[1],end:s[3]})),this.extent=s;const o=t.get_tiles_by_extent(s,h),l=[],d=[],c=[],p=[];for(const e of o){const[i,s,n]=e,a=t.tile_xyz_to_key(i,s,n),h=t.tiles.get(a);if(null!=h&&h.loaded)d.push(a);else if(this.model.render_parents){const[e,a,h]=t.get_closest_parent_by_tile_xyz(i,s,n),r=t.tile_xyz_to_key(e,a,h),o=t.tiles.get(r);if(null!=o&&o.loaded&&!m.includes(c,r)&&c.push(r),_){const e=t.children_by_tile_xyz(i,s,n);for(const[i,s,_]of e){const e=t.tile_xyz_to_key(i,s,_);t.tiles.has(e)&&p.push(e)}}}null==h&&l.push(e)}this._render_tiles(c),this._render_tiles(p),this._render_tiles(d),null!=this.render_timer&&clearTimeout(this.render_timer),this.render_timer=setTimeout((()=>this._fetch_tiles(l)),65)}}i.TileRendererView=g,g.__name__="TileRendererView";class u extends r.Renderer{constructor(t){super(t)}static init_TileRenderer(){this.prototype.default_view=g,this.define((({Boolean:t,Number:e,Ref:i})=>({alpha:[e,1],smoothing:[t,!0],tile_source:[i(a.TileSource),()=>new h.WMTSTileSource],render_parents:[t,!0]}))),this.override({level:"image"})}}i.TileRenderer=u,u.__name__="TileRenderer",u.init_TileRenderer()}, +function _(t,e,r,o,s){o();const c=t(348);class i extends c.MercatorTileSource{constructor(t){super(t)}get_image_url(t,e,r){const o=this.string_lookup_replace(this.url,this.extra_url_vars),[s,c,i]=this.tms_to_wmts(t,e,r);return o.replace("{X}",s.toString()).replace("{Y}",c.toString()).replace("{Z}",i.toString())}}r.WMTSTileSource=i,i.__name__="WMTSTileSource"}, +function _(t,o,i,b,r){b(),i.root="bk-root",i.tile_attribution="bk-tile-attribution",i.default=".bk-root .bk-tile-attribution a{color:black;}"}, +function _(e,r,t,c,o){c();const i=e(348);class l extends i.MercatorTileSource{constructor(e){super(e)}get_image_url(e,r,t){return this.string_lookup_replace(this.url,this.extra_url_vars).replace("{X}",e.toString()).replace("{Y}",r.toString()).replace("{Z}",t.toString())}}t.TMSTileSource=l,l.__name__="TMSTileSource"}, +function _(e,t,u,a,r){a(),r("CanvasTexture",e(357).CanvasTexture),r("ImageURLTexture",e(359).ImageURLTexture),r("Texture",e(358).Texture)}, +function _(t,e,n,c,s){c();const a=t(358),i=t(34);class r extends a.Texture{constructor(t){super(t)}static init_CanvasTexture(){this.define((({String:t})=>({code:[t]})))}get func(){const t=i.use_strict(this.code);return new Function("ctx","color","scale","weight",t)}get_pattern(t,e,n){const c=document.createElement("canvas");c.width=e,c.height=e;const s=c.getContext("2d");return this.func.call(this,s,t,e,n),c}}n.CanvasTexture=r,r.__name__="CanvasTexture",r.init_CanvasTexture()}, +function _(e,t,i,n,r){n();const s=e(53),u=e(20);class o extends s.Model{constructor(e){super(e)}static init_Texture(){this.define((()=>({repetition:[u.TextureRepetition,"repeat"]})))}}i.Texture=o,o.__name__="Texture",o.init_Texture()}, +function _(e,t,i,r,n){r();const a=e(358),s=e(296);class u extends a.Texture{constructor(e){super(e)}static init_ImageURLTexture(){this.define((({String:e})=>({url:[e]})))}initialize(){super.initialize(),this._loader=new s.ImageLoader(this.url)}get_pattern(e,t,i){const{_loader:r}=this;return this._loader.finished?r.image:r.promise}}i.ImageURLTexture=u,u.__name__="ImageURLTexture",u.init_ImageURLTexture()}, +function _(o,l,T,e,t){e(),t("ActionTool",o(251).ActionTool),t("CustomAction",o(361).CustomAction),t("HelpTool",o(252).HelpTool),t("RedoTool",o(362).RedoTool),t("ResetTool",o(363).ResetTool),t("SaveTool",o(364).SaveTool),t("UndoTool",o(365).UndoTool),t("ZoomInTool",o(366).ZoomInTool),t("ZoomOutTool",o(369).ZoomOutTool),t("ButtonTool",o(238).ButtonTool),t("EditTool",o(370).EditTool),t("BoxEditTool",o(371).BoxEditTool),t("FreehandDrawTool",o(372).FreehandDrawTool),t("PointDrawTool",o(373).PointDrawTool),t("PolyDrawTool",o(374).PolyDrawTool),t("PolyTool",o(375).PolyTool),t("PolyEditTool",o(376).PolyEditTool),t("BoxSelectTool",o(377).BoxSelectTool),t("BoxZoomTool",o(379).BoxZoomTool),t("GestureTool",o(237).GestureTool),t("LassoSelectTool",o(380).LassoSelectTool),t("LineEditTool",o(382).LineEditTool),t("PanTool",o(384).PanTool),t("PolySelectTool",o(381).PolySelectTool),t("RangeTool",o(385).RangeTool),t("SelectTool",o(378).SelectTool),t("TapTool",o(386).TapTool),t("WheelPanTool",o(387).WheelPanTool),t("WheelZoomTool",o(388).WheelZoomTool),t("CrosshairTool",o(389).CrosshairTool),t("CustomJSHover",o(390).CustomJSHover),t("HoverTool",o(391).HoverTool),t("InspectTool",o(247).InspectTool),t("Tool",o(236).Tool),t("ToolProxy",o(392).ToolProxy),t("Toolbar",o(235).Toolbar),t("ToolbarBase",o(248).ToolbarBase),t("ProxyToolbar",o(393).ProxyToolbar),t("ToolbarBox",o(393).ToolbarBox)}, +function _(t,o,i,s,n){s();const e=t(251);class c extends e.ActionToolButtonView{css_classes(){return super.css_classes().concat("bk-toolbar-button-custom-action")}}i.CustomActionButtonView=c,c.__name__="CustomActionButtonView";class u extends e.ActionToolView{doit(){var t;null===(t=this.model.callback)||void 0===t||t.execute(this.model)}}i.CustomActionView=u,u.__name__="CustomActionView";class l extends e.ActionTool{constructor(t){super(t),this.tool_name="Custom Action",this.button_view=c}static init_CustomAction(){this.prototype.default_view=u,this.define((({Any:t,String:o,Nullable:i})=>({callback:[i(t)],icon:[o]}))),this.override({description:"Perform a Custom Action"})}}i.CustomAction=l,l.__name__="CustomAction",l.init_CustomAction()}, +function _(o,e,t,i,s){i();const n=o(251),d=o(242);class l extends n.ActionToolView{connect_signals(){super.connect_signals(),this.connect(this.plot_view.state.changed,(()=>this.model.disabled=!this.plot_view.state.can_redo))}doit(){this.plot_view.state.redo()}}t.RedoToolView=l,l.__name__="RedoToolView";class _ extends n.ActionTool{constructor(o){super(o),this.tool_name="Redo",this.icon=d.tool_icon_redo}static init_RedoTool(){this.prototype.default_view=l,this.override({disabled:!0}),this.register_alias("redo",(()=>new _))}}t.RedoTool=_,_.__name__="RedoTool",_.init_RedoTool()}, +function _(e,t,o,s,i){s();const _=e(251),n=e(242);class l extends _.ActionToolView{doit(){this.plot_view.reset()}}o.ResetToolView=l,l.__name__="ResetToolView";class c extends _.ActionTool{constructor(e){super(e),this.tool_name="Reset",this.icon=n.tool_icon_reset}static init_ResetTool(){this.prototype.default_view=l,this.register_alias("reset",(()=>new c))}}o.ResetTool=c,c.__name__="ResetTool",c.init_ResetTool()}, +function _(o,e,t,a,i){a();const n=o(251),s=o(242);class c extends n.ActionToolView{async copy(){const o=await this.plot_view.to_blob(),e=new ClipboardItem({[o.type]:o});await navigator.clipboard.write([e])}async save(o){const e=await this.plot_view.to_blob(),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=o,t.target="_blank",t.dispatchEvent(new MouseEvent("click"))}doit(o="save"){switch(o){case"save":this.save("bokeh_plot");break;case"copy":this.copy()}}}t.SaveToolView=c,c.__name__="SaveToolView";class l extends n.ActionTool{constructor(o){super(o),this.tool_name="Save",this.icon=s.tool_icon_save}static init_SaveTool(){this.prototype.default_view=c,this.register_alias("save",(()=>new l))}get menu(){return[{icon:"bk-tool-icon-copy-to-clipboard",tooltip:"Copy image to clipboard",if:()=>"undefined"!=typeof ClipboardItem,handler:()=>{this.do.emit("copy")}}]}}t.SaveTool=l,l.__name__="SaveTool",l.init_SaveTool()}, +function _(o,t,n,i,e){i();const s=o(251),d=o(242);class l extends s.ActionToolView{connect_signals(){super.connect_signals(),this.connect(this.plot_view.state.changed,(()=>this.model.disabled=!this.plot_view.state.can_undo))}doit(){this.plot_view.state.undo()}}n.UndoToolView=l,l.__name__="UndoToolView";class _ extends s.ActionTool{constructor(o){super(o),this.tool_name="Undo",this.icon=d.tool_icon_undo}static init_UndoTool(){this.prototype.default_view=l,this.override({disabled:!0}),this.register_alias("undo",(()=>new _))}}n.UndoTool=_,_.__name__="UndoTool",_.init_UndoTool()}, +function _(o,i,n,s,e){s();const t=o(367),_=o(242);class m extends t.ZoomBaseToolView{}n.ZoomInToolView=m,m.__name__="ZoomInToolView";class l extends t.ZoomBaseTool{constructor(o){super(o),this.sign=1,this.tool_name="Zoom In",this.icon=_.tool_icon_zoom_in}static init_ZoomInTool(){this.prototype.default_view=m,this.register_alias("zoom_in",(()=>new l({dimensions:"both"}))),this.register_alias("xzoom_in",(()=>new l({dimensions:"width"}))),this.register_alias("yzoom_in",(()=>new l({dimensions:"height"})))}}n.ZoomInTool=l,l.__name__="ZoomInTool",l.init_ZoomInTool()}, +function _(o,t,e,i,s){i();const n=o(251),l=o(20),a=o(368);class _ extends n.ActionToolView{doit(){var o;const t=this.plot_view.frame,e=this.model.dimensions,i="width"==e||"both"==e,s="height"==e||"both"==e,n=a.scale_range(t,this.model.sign*this.model.factor,i,s);this.plot_view.state.push("zoom_out",{range:n}),this.plot_view.update_range(n,{scrolling:!0}),null===(o=this.model.document)||void 0===o||o.interactive_start(this.plot_model)}}e.ZoomBaseToolView=_,_.__name__="ZoomBaseToolView";class m extends n.ActionTool{constructor(o){super(o)}static init_ZoomBaseTool(){this.define((({Percent:o})=>({factor:[o,.1],dimensions:[l.Dimensions,"both"]})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}e.ZoomBaseTool=m,m.__name__="ZoomBaseTool",m.init_ZoomBaseTool()}, +function _(n,t,o,r,s){r();const c=n(10);function e(n,t,o){const[r,s]=[n.start,n.end],c=null!=o?o:(s+r)/2;return[r-(r-c)*t,s-(s-c)*t]}function a(n,[t,o]){const r=new Map;for(const[s,c]of n){const[n,e]=c.r_invert(t,o);r.set(s,{start:n,end:e})}return r}o.scale_highlow=e,o.get_info=a,o.scale_range=function(n,t,o=!0,r=!0,s){t=c.clamp(t,-.9,.9);const l=o?t:0,[u,i]=e(n.bbox.h_range,l,null!=s?s.x:void 0),_=a(n.x_scales,[u,i]),f=r?t:0,[g,x]=e(n.bbox.v_range,f,null!=s?s.y:void 0);return{xrs:_,yrs:a(n.y_scales,[g,x]),factor:t}}}, +function _(o,t,i,s,e){s();const n=o(367),_=o(242);class m extends n.ZoomBaseToolView{}i.ZoomOutToolView=m,m.__name__="ZoomOutToolView";class l extends n.ZoomBaseTool{constructor(o){super(o),this.sign=-1,this.tool_name="Zoom Out",this.icon=_.tool_icon_zoom_out}static init_ZoomOutTool(){this.prototype.default_view=m,this.register_alias("zoom_out",(()=>new l({dimensions:"both"}))),this.register_alias("xzoom_out",(()=>new l({dimensions:"width"}))),this.register_alias("yzoom_out",(()=>new l({dimensions:"height"})))}}i.ZoomOutTool=l,l.__name__="ZoomOutTool",l.init_ZoomOutTool()}, +function _(e,t,s,o,n){o();const i=e(9),r=e(8),c=e(11),a=e(61),_=e(237);class l extends _.GestureToolView{constructor(){super(...arguments),this._mouse_in_frame=!0}_select_mode(e){const{shiftKey:t,ctrlKey:s}=e;return t||s?t&&!s?"append":!t&&s?"intersect":t&&s?"subtract":void c.unreachable():"replace"}_move_enter(e){this._mouse_in_frame=!0}_move_exit(e){this._mouse_in_frame=!1}_map_drag(e,t,s){if(!this.plot_view.frame.bbox.contains(e,t))return null;const o=this.plot_view.renderer_view(s);if(null==o)return null;return[o.coordinates.x_scale.invert(e),o.coordinates.y_scale.invert(t)]}_delete_selected(e){const t=e.data_source,s=t.selected.indices;s.sort();for(const e of t.columns()){const o=t.get_array(e);for(let e=0;e({custom_icon:[n(t),null],empty_value:[e],renderers:[s(o(a.GlyphRenderer)),[]]})))}get computed_icon(){var e;return null!==(e=this.custom_icon)&&void 0!==e?e:this.icon}}s.EditTool=d,d.__name__="EditTool",d.init_EditTool()}, +function _(e,t,s,i,_){i();const o=e(43),n=e(20),a=e(370),d=e(242);class l extends a.EditToolView{_tap(e){null==this._draw_basepoint&&null==this._basepoint&&this._select_event(e,this._select_mode(e),this.model.renderers)}_keyup(e){if(this.model.active&&this._mouse_in_frame)for(const t of this.model.renderers)if(e.keyCode===o.Keys.Backspace)this._delete_selected(t);else if(e.keyCode==o.Keys.Esc){t.data_source.selection_manager.clear()}}_set_extent([e,t],[s,i],_,o=!1){const n=this.model.renderers[0],a=this.plot_view.renderer_view(n);if(null==a)return;const d=n.glyph,l=n.data_source,[r,h]=a.coordinates.x_scale.r_invert(e,t),[p,u]=a.coordinates.y_scale.r_invert(s,i),[c,m]=[(r+h)/2,(p+u)/2],[f,b]=[h-r,u-p],[x,y]=[d.x.field,d.y.field],[w,v]=[d.width.field,d.height.field];if(_)this._pop_glyphs(l,this.model.num_objects),x&&l.get_array(x).push(c),y&&l.get_array(y).push(m),w&&l.get_array(w).push(f),v&&l.get_array(v).push(b),this._pad_empty_columns(l,[x,y,w,v]);else{const e=l.data[x].length-1;x&&(l.data[x][e]=c),y&&(l.data[y][e]=m),w&&(l.data[w][e]=f),v&&(l.data[v][e]=b)}this._emit_cds_changes(l,!0,!1,o)}_update_box(e,t=!1,s=!1){if(null==this._draw_basepoint)return;const i=[e.sx,e.sy],_=this.plot_view.frame,o=this.model.dimensions,n=this.model._get_dim_limits(this._draw_basepoint,i,_,o);if(null!=n){const[e,i]=n;this._set_extent(e,i,t,s)}}_doubletap(e){this.model.active&&(null!=this._draw_basepoint?(this._update_box(e,!1,!0),this._draw_basepoint=null):(this._draw_basepoint=[e.sx,e.sy],this._select_event(e,"append",this.model.renderers),this._update_box(e,!0,!1)))}_move(e){this._update_box(e,!1,!1)}_pan_start(e){if(e.shiftKey){if(null!=this._draw_basepoint)return;this._draw_basepoint=[e.sx,e.sy],this._update_box(e,!0,!1)}else{if(null!=this._basepoint)return;this._select_event(e,"append",this.model.renderers),this._basepoint=[e.sx,e.sy]}}_pan(e,t=!1,s=!1){if(e.shiftKey){if(null==this._draw_basepoint)return;this._update_box(e,t,s)}else{if(null==this._basepoint)return;this._drag_points(e,this.model.renderers)}}_pan_end(e){if(this._pan(e,!1,!0),e.shiftKey)this._draw_basepoint=null;else{this._basepoint=null;for(const e of this.model.renderers)this._emit_cds_changes(e.data_source,!1,!0,!0)}}}s.BoxEditToolView=l,l.__name__="BoxEditToolView";class r extends a.EditTool{constructor(e){super(e),this.tool_name="Box Edit Tool",this.icon=d.tool_icon_box_edit,this.event_type=["tap","pan","move"],this.default_order=1}static init_BoxEditTool(){this.prototype.default_view=l,this.define((({Int:e})=>({dimensions:[n.Dimensions,"both"],num_objects:[e,0]})))}}s.BoxEditTool=r,r.__name__="BoxEditTool",r.init_BoxEditTool()}, +function _(e,t,a,s,r){s();const _=e(43),i=e(8),o=e(370),d=e(242);class n extends o.EditToolView{_draw(e,t,a=!1){if(!this.model.active)return;const s=this.model.renderers[0],r=this._map_drag(e.sx,e.sy,s);if(null==r)return;const[_,o]=r,d=s.data_source,n=s.glyph,[h,l]=[n.xs.field,n.ys.field];if("new"==t)this._pop_glyphs(d,this.model.num_objects),h&&d.get_array(h).push([_]),l&&d.get_array(l).push([o]),this._pad_empty_columns(d,[h,l]);else if("add"==t){if(h){const e=d.data[h].length-1;let t=d.get_array(h)[e];i.isArray(t)||(t=Array.from(t),d.data[h][e]=t),t.push(_)}if(l){const e=d.data[l].length-1;let t=d.get_array(l)[e];i.isArray(t)||(t=Array.from(t),d.data[l][e]=t),t.push(o)}}this._emit_cds_changes(d,!0,!0,a)}_pan_start(e){this._draw(e,"new")}_pan(e){this._draw(e,"add")}_pan_end(e){this._draw(e,"add",!0)}_tap(e){this._select_event(e,this._select_mode(e),this.model.renderers)}_keyup(e){if(this.model.active&&this._mouse_in_frame)for(const t of this.model.renderers)e.keyCode===_.Keys.Esc?t.data_source.selection_manager.clear():e.keyCode===_.Keys.Backspace&&this._delete_selected(t)}}a.FreehandDrawToolView=n,n.__name__="FreehandDrawToolView";class h extends o.EditTool{constructor(e){super(e),this.tool_name="Freehand Draw Tool",this.icon=d.tool_icon_freehand_draw,this.event_type=["pan","tap"],this.default_order=3}static init_FreehandDrawTool(){this.prototype.default_view=n,this.define((({Int:e})=>({num_objects:[e,0]}))),this.register_alias("freehand_draw",(()=>new h))}}a.FreehandDrawTool=h,h.__name__="FreehandDrawTool",h.init_FreehandDrawTool()}, +function _(e,t,s,o,i){o();const a=e(43),n=e(370),_=e(242);class r extends n.EditToolView{_tap(e){if(this._select_event(e,this._select_mode(e),this.model.renderers).length||!this.model.add)return;const t=this.model.renderers[0],s=this._map_drag(e.sx,e.sy,t);if(null==s)return;const o=t.glyph,i=t.data_source,[a,n]=[o.x.field,o.y.field],[_,r]=s;this._pop_glyphs(i,this.model.num_objects),a&&i.get_array(a).push(_),n&&i.get_array(n).push(r),this._pad_empty_columns(i,[a,n]),i.change.emit(),i.data=i.data,i.properties.data.change.emit()}_keyup(e){if(this.model.active&&this._mouse_in_frame)for(const t of this.model.renderers)e.keyCode===a.Keys.Backspace?this._delete_selected(t):e.keyCode==a.Keys.Esc&&t.data_source.selection_manager.clear()}_pan_start(e){this.model.drag&&(this._select_event(e,"append",this.model.renderers),this._basepoint=[e.sx,e.sy])}_pan(e){this.model.drag&&null!=this._basepoint&&this._drag_points(e,this.model.renderers)}_pan_end(e){if(this.model.drag){this._pan(e);for(const e of this.model.renderers)this._emit_cds_changes(e.data_source,!1,!0,!0);this._basepoint=null}}}s.PointDrawToolView=r,r.__name__="PointDrawToolView";class d extends n.EditTool{constructor(e){super(e),this.tool_name="Point Draw Tool",this.icon=_.tool_icon_point_draw,this.event_type=["tap","pan","move"],this.default_order=2}static init_PointDrawTool(){this.prototype.default_view=r,this.define((({Boolean:e,Int:t})=>({add:[e,!0],drag:[e,!0],num_objects:[t,0]})))}}s.PointDrawTool=d,d.__name__="PointDrawTool",d.init_PointDrawTool()}, +function _(e,t,s,i,a){i();const o=e(43),r=e(8),n=e(375),_=e(242);class d extends n.PolyToolView{constructor(){super(...arguments),this._drawing=!1,this._initialized=!1}_tap(e){this._drawing?this._draw(e,"add",!0):this._select_event(e,this._select_mode(e),this.model.renderers)}_draw(e,t,s=!1){const i=this.model.renderers[0],a=this._map_drag(e.sx,e.sy,i);if(this._initialized||this.activate(),null==a)return;const[o,n]=this._snap_to_vertex(e,...a),_=i.data_source,d=i.glyph,[l,h]=[d.xs.field,d.ys.field];if("new"==t)this._pop_glyphs(_,this.model.num_objects),l&&_.get_array(l).push([o,o]),h&&_.get_array(h).push([n,n]),this._pad_empty_columns(_,[l,h]);else if("edit"==t){if(l){const e=_.data[l][_.data[l].length-1];e[e.length-1]=o}if(h){const e=_.data[h][_.data[h].length-1];e[e.length-1]=n}}else if("add"==t){if(l){const e=_.data[l].length-1;let t=_.get_array(l)[e];const s=t[t.length-1];t[t.length-1]=o,r.isArray(t)||(t=Array.from(t),_.data[l][e]=t),t.push(s)}if(h){const e=_.data[h].length-1;let t=_.get_array(h)[e];const s=t[t.length-1];t[t.length-1]=n,r.isArray(t)||(t=Array.from(t),_.data[h][e]=t),t.push(s)}}this._emit_cds_changes(_,!0,!1,s)}_show_vertices(){if(!this.model.active)return;const e=[],t=[];for(let s=0;sthis._show_vertices()))}this._initialized=!0}}deactivate(){this._drawing&&(this._remove(),this._drawing=!1),this.model.vertex_renderer&&this._hide_vertices()}}s.PolyDrawToolView=d,d.__name__="PolyDrawToolView";class l extends n.PolyTool{constructor(e){super(e),this.tool_name="Polygon Draw Tool",this.icon=_.tool_icon_poly_draw,this.event_type=["pan","tap","move"],this.default_order=3}static init_PolyDrawTool(){this.prototype.default_view=d,this.define((({Boolean:e,Int:t})=>({drag:[e,!0],num_objects:[t,0]})))}}s.PolyDrawTool=l,l.__name__="PolyDrawTool",l.init_PolyDrawTool()}, +function _(e,t,r,o,s){o();const i=e(8),l=e(370);class _ extends l.EditToolView{_set_vertices(e,t){const r=this.model.vertex_renderer.glyph,o=this.model.vertex_renderer.data_source,[s,l]=[r.x.field,r.y.field];s&&(i.isArray(e)?o.data[s]=e:r.x={value:e}),l&&(i.isArray(t)?o.data[l]=t:r.y={value:t}),this._emit_cds_changes(o,!0,!0,!1)}_hide_vertices(){this._set_vertices([],[])}_snap_to_vertex(e,t,r){if(this.model.vertex_renderer){const o=this._select_event(e,"replace",[this.model.vertex_renderer]),s=this.model.vertex_renderer.data_source,i=this.model.vertex_renderer.glyph,[l,_]=[i.x.field,i.y.field];if(o.length){const e=s.selected.indices[0];l&&(t=s.data[l][e]),_&&(r=s.data[_][e]),s.selection_manager.clear()}}return[t,r]}}r.PolyToolView=_,_.__name__="PolyToolView";class d extends l.EditTool{constructor(e){super(e)}static init_PolyTool(){this.define((({AnyRef:e})=>({vertex_renderer:[e()]})))}}r.PolyTool=d,d.__name__="PolyTool",d.init_PolyTool()}, +function _(e,t,s,r,i){r();const _=e(43),d=e(8),n=e(375),l=e(242);class a extends n.PolyToolView{constructor(){super(...arguments),this._drawing=!1,this._cur_index=null}_doubletap(e){if(!this.model.active)return;const t=this._map_drag(e.sx,e.sy,this.model.vertex_renderer);if(null==t)return;const[s,r]=t,i=this._select_event(e,"replace",[this.model.vertex_renderer]),_=this.model.vertex_renderer.data_source,d=this.model.vertex_renderer.glyph,[n,l]=[d.x.field,d.y.field];if(i.length&&null!=this._selected_renderer){const e=_.selected.indices[0];this._drawing?(this._drawing=!1,_.selection_manager.clear()):(_.selected.indices=[e+1],n&&_.get_array(n).splice(e+1,0,s),l&&_.get_array(l).splice(e+1,0,r),this._drawing=!0),_.change.emit(),this._emit_cds_changes(this._selected_renderer.data_source)}else this._show_vertices(e)}_show_vertices(e){if(!this.model.active)return;const t=this.model.renderers[0],s=()=>this._update_vertices(t),r=null==t?void 0:t.data_source,i=this._select_event(e,"replace",this.model.renderers);if(!i.length)return this._set_vertices([],[]),this._selected_renderer=null,this._drawing=!1,this._cur_index=null,void(null!=r&&r.disconnect(r.properties.data.change,s));null!=r&&r.connect(r.properties.data.change,s),this._cur_index=i[0].data_source.selected.indices[0],this._update_vertices(i[0])}_update_vertices(e){const t=e.glyph,s=e.data_source,r=this._cur_index,[i,_]=[t.xs.field,t.ys.field];if(this._drawing)return;if(null==r&&(i||_))return;let n,l;i&&null!=r?(n=s.data[i][r],d.isArray(n)||(s.data[i][r]=n=Array.from(n))):n=t.xs.value,_&&null!=r?(l=s.data[_][r],d.isArray(l)||(s.data[_][r]=l=Array.from(l))):l=t.ys.value,this._selected_renderer=e,this._set_vertices(n,l)}_move(e){if(this._drawing&&null!=this._selected_renderer){const t=this.model.vertex_renderer,s=t.data_source,r=t.glyph,i=this._map_drag(e.sx,e.sy,t);if(null==i)return;let[_,d]=i;const n=s.selected.indices;[_,d]=this._snap_to_vertex(e,_,d),s.selected.indices=n;const[l,a]=[r.x.field,r.y.field],c=n[0];l&&(s.data[l][c]=_),a&&(s.data[a][c]=d),s.change.emit(),this._selected_renderer.data_source.change.emit()}}_tap(e){const t=this.model.vertex_renderer,s=this._map_drag(e.sx,e.sy,t);if(null==s)return;if(this._drawing&&this._selected_renderer){let[r,i]=s;const _=t.data_source,d=t.glyph,[n,l]=[d.x.field,d.y.field],a=_.selected.indices;[r,i]=this._snap_to_vertex(e,r,i);const c=a[0];if(_.selected.indices=[c+1],n){const e=_.get_array(n),t=e[c];e[c]=r,e.splice(c+1,0,t)}if(l){const e=_.get_array(l),t=e[c];e[c]=i,e.splice(c+1,0,t)}return _.change.emit(),void this._emit_cds_changes(this._selected_renderer.data_source,!0,!1,!0)}const r=this._select_mode(e);this._select_event(e,r,[t]),this._select_event(e,r,this.model.renderers)}_remove_vertex(){if(!this._drawing||!this._selected_renderer)return;const e=this.model.vertex_renderer,t=e.data_source,s=e.glyph,r=t.selected.indices[0],[i,_]=[s.x.field,s.y.field];i&&t.get_array(i).splice(r,1),_&&t.get_array(_).splice(r,1),t.change.emit(),this._emit_cds_changes(this._selected_renderer.data_source)}_pan_start(e){this._select_event(e,"append",[this.model.vertex_renderer]),this._basepoint=[e.sx,e.sy]}_pan(e){null!=this._basepoint&&(this._drag_points(e,[this.model.vertex_renderer]),this._selected_renderer&&this._selected_renderer.data_source.change.emit())}_pan_end(e){null!=this._basepoint&&(this._drag_points(e,[this.model.vertex_renderer]),this._emit_cds_changes(this.model.vertex_renderer.data_source,!1,!0,!0),this._selected_renderer&&this._emit_cds_changes(this._selected_renderer.data_source),this._basepoint=null)}_keyup(e){if(!this.model.active||!this._mouse_in_frame)return;let t;t=this._selected_renderer?[this.model.vertex_renderer]:this.model.renderers;for(const s of t)e.keyCode===_.Keys.Backspace?(this._delete_selected(s),this._selected_renderer&&this._emit_cds_changes(this._selected_renderer.data_source)):e.keyCode==_.Keys.Esc&&(this._drawing?(this._remove_vertex(),this._drawing=!1):this._selected_renderer&&this._hide_vertices(),s.data_source.selection_manager.clear())}deactivate(){this._selected_renderer&&(this._drawing&&(this._remove_vertex(),this._drawing=!1),this._hide_vertices())}}s.PolyEditToolView=a,a.__name__="PolyEditToolView";class c extends n.PolyTool{constructor(e){super(e),this.tool_name="Poly Edit Tool",this.icon=l.tool_icon_poly_edit,this.event_type=["tap","pan","move"],this.default_order=4}static init_PolyEditTool(){this.prototype.default_view=a}}s.PolyEditTool=c,c.__name__="PolyEditTool",c.init_PolyEditTool()}, +function _(e,t,o,s,i){s();const l=e(378),n=e(136),_=e(20),c=e(242);class h extends l.SelectToolView{_compute_limits(e){const t=this.plot_view.frame,o=this.model.dimensions;let s=this._base_point;if("center"==this.model.origin){const[t,o]=s,[i,l]=e;s=[t-(i-t),o-(l-o)]}return this.model._get_dim_limits(s,e,t,o)}_pan_start(e){const{sx:t,sy:o}=e;this._base_point=[t,o]}_pan(e){const{sx:t,sy:o}=e,s=[t,o],[i,l]=this._compute_limits(s);this.model.overlay.update({left:i[0],right:i[1],top:l[0],bottom:l[1]}),this.model.select_every_mousemove&&this._do_select(i,l,!1,this._select_mode(e))}_pan_end(e){const{sx:t,sy:o}=e,s=[t,o],[i,l]=this._compute_limits(s);this._do_select(i,l,!0,this._select_mode(e)),this.model.overlay.update({left:null,right:null,top:null,bottom:null}),this._base_point=null,this.plot_view.state.push("box_select",{selection:this.plot_view.get_selection()})}_do_select([e,t],[o,s],i,l="replace"){const n={type:"rect",sx0:e,sx1:t,sy0:o,sy1:s};this._select(n,i,l)}}o.BoxSelectToolView=h,h.__name__="BoxSelectToolView";const r=()=>new n.BoxAnnotation({level:"overlay",top_units:"screen",left_units:"screen",bottom_units:"screen",right_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]});class a extends l.SelectTool{constructor(e){super(e),this.tool_name="Box Select",this.icon=c.tool_icon_box_select,this.event_type="pan",this.default_order=30}static init_BoxSelectTool(){this.prototype.default_view=h,this.define((({Boolean:e,Ref:t})=>({dimensions:[_.Dimensions,"both"],select_every_mousemove:[e,!1],overlay:[t(n.BoxAnnotation),r],origin:[_.BoxOrigin,"corner"]}))),this.register_alias("box_select",(()=>new a)),this.register_alias("xbox_select",(()=>new a({dimensions:"width"}))),this.register_alias("ybox_select",(()=>new a({dimensions:"height"})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}o.BoxSelectTool=a,a.__name__="BoxSelectTool",a.init_BoxSelectTool()}, +function _(e,t,s,n,o){n();const r=e(237),c=e(61),i=e(123),l=e(62),a=e(161),_=e(20),d=e(43),h=e(264),p=e(15),u=e(11);class m extends r.GestureToolView{connect_signals(){super.connect_signals(),this.model.clear.connect((()=>this._clear()))}get computed_renderers(){const{renderers:e,names:t}=this.model,s=this.plot_model.data_renderers;return a.compute_renderers(e,s,t)}_computed_renderers_by_data_source(){var e;const t=new Map;for(const s of this.computed_renderers){let n;if(s instanceof c.GlyphRenderer)n=s.data_source;else{if(!(s instanceof i.GraphRenderer))continue;n=s.node_renderer.data_source}const o=null!==(e=t.get(n))&&void 0!==e?e:[];t.set(n,[...o,s])}return t}_select_mode(e){const{shiftKey:t,ctrlKey:s}=e;return t||s?t&&!s?"append":!t&&s?"intersect":t&&s?"subtract":void u.unreachable():this.model.mode}_keyup(e){e.keyCode==d.Keys.Esc&&this._clear()}_clear(){for(const e of this.computed_renderers)e.get_selection_manager().clear();const e=this.computed_renderers.map((e=>this.plot_view.renderer_view(e)));this.plot_view.request_paint(e)}_select(e,t,s){const n=this._computed_renderers_by_data_source();for(const[,o]of n){const n=o[0].get_selection_manager(),r=[];for(const e of o){const t=this.plot_view.renderer_view(e);null!=t&&r.push(t)}n.select(r,e,t,s)}null!=this.model.callback&&this._emit_callback(e),this._emit_selection_event(e,t)}_emit_selection_event(e,t=!0){const{x_scale:s,y_scale:n}=this.plot_view.frame;let o;switch(e.type){case"point":{const{sx:t,sy:r}=e,c=s.invert(t),i=n.invert(r);o=Object.assign(Object.assign({},e),{x:c,y:i});break}case"span":{const{sx:t,sy:r}=e,c=s.invert(t),i=n.invert(r);o=Object.assign(Object.assign({},e),{x:c,y:i});break}case"rect":{const{sx0:t,sx1:r,sy0:c,sy1:i}=e,[l,a]=s.r_invert(t,r),[_,d]=n.r_invert(c,i);o=Object.assign(Object.assign({},e),{x0:l,y0:_,x1:a,y1:d});break}case"poly":{const{sx:t,sy:r}=e,c=s.v_invert(t),i=n.v_invert(r);o=Object.assign(Object.assign({},e),{x:c,y:i});break}}this.plot_model.trigger_event(new h.SelectionGeometry(o,t))}}s.SelectToolView=m,m.__name__="SelectToolView";class v extends r.GestureTool{constructor(e){super(e)}initialize(){super.initialize(),this.clear=new p.Signal0(this,"clear")}static init_SelectTool(){this.define((({String:e,Array:t,Ref:s,Or:n,Auto:o})=>({renderers:[n(t(s(l.DataRenderer)),o),"auto"],names:[t(e),[]],mode:[_.SelectionMode,"replace"]})))}get menu(){return[{icon:"bk-tool-icon-replace-mode",tooltip:"Replace the current selection",active:()=>"replace"==this.mode,handler:()=>{this.mode="replace",this.active=!0}},{icon:"bk-tool-icon-append-mode",tooltip:"Append to the current selection (Shift)",active:()=>"append"==this.mode,handler:()=>{this.mode="append",this.active=!0}},{icon:"bk-tool-icon-intersect-mode",tooltip:"Intersect with the current selection (Ctrl)",active:()=>"intersect"==this.mode,handler:()=>{this.mode="intersect",this.active=!0}},{icon:"bk-tool-icon-subtract-mode",tooltip:"Subtract from the current selection (Shift+Ctrl)",active:()=>"subtract"==this.mode,handler:()=>{this.mode="subtract",this.active=!0}},null,{icon:"bk-tool-icon-clear-selection",tooltip:"Clear the current selection (Esc)",handler:()=>{this.clear.emit()}}]}}s.SelectTool=v,v.__name__="SelectTool",v.init_SelectTool()}, +function _(t,o,e,s,i){s();const n=t(237),_=t(136),a=t(20),l=t(242);class r extends n.GestureToolView{_match_aspect(t,o,e){const s=e.bbox.aspect,i=e.bbox.h_range.end,n=e.bbox.h_range.start,_=e.bbox.v_range.end,a=e.bbox.v_range.start;let l=Math.abs(t[0]-o[0]),r=Math.abs(t[1]-o[1]);const h=0==r?0:l/r,[c]=h>=s?[1,h/s]:[s/h,1];let m,p,d,b;return t[0]<=o[0]?(m=t[0],p=t[0]+l*c,p>i&&(p=i)):(p=t[0],m=t[0]-l*c,m_&&(d=_)):(d=t[1],b=t[1]-l/s,bnew _.BoxAnnotation({level:"overlay",top_units:"screen",left_units:"screen",bottom_units:"screen",right_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]});class c extends n.GestureTool{constructor(t){super(t),this.tool_name="Box Zoom",this.icon=l.tool_icon_box_zoom,this.event_type="pan",this.default_order=20}static init_BoxZoomTool(){this.prototype.default_view=r,this.define((({Boolean:t,Ref:o})=>({dimensions:[a.Dimensions,"both"],overlay:[o(_.BoxAnnotation),h],match_aspect:[t,!1],origin:[a.BoxOrigin,"corner"]}))),this.register_alias("box_zoom",(()=>new c({dimensions:"both"}))),this.register_alias("xbox_zoom",(()=>new c({dimensions:"width"}))),this.register_alias("ybox_zoom",(()=>new c({dimensions:"height"})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}e.BoxZoomTool=c,c.__name__="BoxZoomTool",c.init_BoxZoomTool()}, +function _(s,e,t,o,i){o();const l=s(378),_=s(231),a=s(381),c=s(43),n=s(242);class h extends l.SelectToolView{constructor(){super(...arguments),this.sxs=[],this.sys=[]}connect_signals(){super.connect_signals(),this.connect(this.model.properties.active.change,(()=>this._active_change()))}_active_change(){this.model.active||this._clear_overlay()}_keyup(s){s.keyCode==c.Keys.Enter&&this._clear_overlay()}_pan_start(s){this.sxs=[],this.sys=[];const{sx:e,sy:t}=s;this._append_overlay(e,t)}_pan(s){const[e,t]=this.plot_view.frame.bbox.clip(s.sx,s.sy);this._append_overlay(e,t),this.model.select_every_mousemove&&this._do_select(this.sxs,this.sys,!1,this._select_mode(s))}_pan_end(s){const{sxs:e,sys:t}=this;this._clear_overlay(),this._do_select(e,t,!0,this._select_mode(s)),this.plot_view.state.push("lasso_select",{selection:this.plot_view.get_selection()})}_append_overlay(s,e){const{sxs:t,sys:o}=this;t.push(s),o.push(e),this.model.overlay.update({xs:t,ys:o})}_clear_overlay(){this.sxs=[],this.sys=[],this.model.overlay.update({xs:this.sxs,ys:this.sys})}_do_select(s,e,t,o){const i={type:"poly",sx:s,sy:e};this._select(i,t,o)}}t.LassoSelectToolView=h,h.__name__="LassoSelectToolView";class r extends l.SelectTool{constructor(s){super(s),this.tool_name="Lasso Select",this.icon=n.tool_icon_lasso_select,this.event_type="pan",this.default_order=12}static init_LassoSelectTool(){this.prototype.default_view=h,this.define((({Boolean:s,Ref:e})=>({select_every_mousemove:[s,!0],overlay:[e(_.PolyAnnotation),a.DEFAULT_POLY_OVERLAY]}))),this.register_alias("lasso_select",(()=>new r))}}t.LassoSelectTool=r,r.__name__="LassoSelectTool",r.init_LassoSelectTool()}, +function _(e,t,s,l,o){l();const i=e(378),a=e(231),_=e(43),c=e(9),n=e(242);class h extends i.SelectToolView{initialize(){super.initialize(),this.data={sx:[],sy:[]}}connect_signals(){super.connect_signals(),this.connect(this.model.properties.active.change,(()=>this._active_change()))}_active_change(){this.model.active||this._clear_data()}_keyup(e){e.keyCode==_.Keys.Enter&&this._clear_data()}_doubletap(e){this._do_select(this.data.sx,this.data.sy,!0,this._select_mode(e)),this.plot_view.state.push("poly_select",{selection:this.plot_view.get_selection()}),this._clear_data()}_clear_data(){this.data={sx:[],sy:[]},this.model.overlay.update({xs:[],ys:[]})}_tap(e){const{sx:t,sy:s}=e;this.plot_view.frame.bbox.contains(t,s)&&(this.data.sx.push(t),this.data.sy.push(s),this.model.overlay.update({xs:c.copy(this.data.sx),ys:c.copy(this.data.sy)}))}_do_select(e,t,s,l){const o={type:"poly",sx:e,sy:t};this._select(o,s,l)}}s.PolySelectToolView=h,h.__name__="PolySelectToolView";s.DEFAULT_POLY_OVERLAY=()=>new a.PolyAnnotation({level:"overlay",xs_units:"screen",ys_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]});class y extends i.SelectTool{constructor(e){super(e),this.tool_name="Poly Select",this.icon=n.tool_icon_polygon_select,this.event_type="tap",this.default_order=11}static init_PolySelectTool(){this.prototype.default_view=h,this.define((({Ref:e})=>({overlay:[e(a.PolyAnnotation),s.DEFAULT_POLY_OVERLAY]}))),this.register_alias("poly_select",(()=>new y))}}s.PolySelectTool=y,y.__name__="PolySelectTool",y.init_PolySelectTool()}, +function _(e,t,i,s,n){s();const r=e(20),_=e(383),d=e(242);class o extends _.LineToolView{constructor(){super(...arguments),this._drawing=!1}_doubletap(e){if(!this.model.active)return;const t=this.model.renderers;for(const i of t){1==this._select_event(e,"replace",[i]).length&&(this._selected_renderer=i)}this._show_intersections(),this._update_line_cds()}_show_intersections(){if(!this.model.active)return;if(null==this._selected_renderer)return;if(!this.model.renderers.length)return this._set_intersection([],[]),this._selected_renderer=null,void(this._drawing=!1);const e=this._selected_renderer.data_source,t=this._selected_renderer.glyph,[i,s]=[t.x.field,t.y.field],n=e.get_array(i),r=e.get_array(s);this._set_intersection(n,r)}_tap(e){const t=this.model.intersection_renderer;if(null==this._map_drag(e.sx,e.sy,t))return;if(this._drawing&&this._selected_renderer){const i=this._select_mode(e);if(0==this._select_event(e,i,[t]).length)return}const i=this._select_mode(e);this._select_event(e,i,[t]),this._select_event(e,i,this.model.renderers)}_update_line_cds(){if(null==this._selected_renderer)return;const e=this.model.intersection_renderer.glyph,t=this.model.intersection_renderer.data_source,[i,s]=[e.x.field,e.y.field];if(i&&s){const e=t.data[i],n=t.data[s];this._selected_renderer.data_source.data[i]=e,this._selected_renderer.data_source.data[s]=n}this._emit_cds_changes(this._selected_renderer.data_source,!0,!0,!1)}_pan_start(e){this._select_event(e,"append",[this.model.intersection_renderer]),this._basepoint=[e.sx,e.sy]}_pan(e){null!=this._basepoint&&(this._drag_points(e,[this.model.intersection_renderer],this.model.dimensions),this._selected_renderer&&this._selected_renderer.data_source.change.emit())}_pan_end(e){null!=this._basepoint&&(this._drag_points(e,[this.model.intersection_renderer]),this._emit_cds_changes(this.model.intersection_renderer.data_source,!1,!0,!0),this._selected_renderer&&this._emit_cds_changes(this._selected_renderer.data_source),this._basepoint=null)}activate(){this._drawing=!0}deactivate(){this._selected_renderer&&(this._drawing&&(this._drawing=!1),this._hide_intersections())}}i.LineEditToolView=o,o.__name__="LineEditToolView";class l extends _.LineTool{constructor(e){super(e),this.tool_name="Line Edit Tool",this.icon=d.tool_icon_line_edit,this.event_type=["tap","pan","move"],this.default_order=4}static init_LineEditTool(){this.prototype.default_view=o,this.define((()=>({dimensions:[r.Dimensions,"both"]})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}i.LineEditTool=l,l.__name__="LineEditTool",l.init_LineEditTool()}, +function _(e,i,t,n,o){n();const s=e(8),_=e(370);class r extends _.EditToolView{_set_intersection(e,i){const t=this.model.intersection_renderer.glyph,n=this.model.intersection_renderer.data_source,[o,_]=[t.x.field,t.y.field];o&&(s.isArray(e)?n.data[o]=e:t.x={value:e}),_&&(s.isArray(i)?n.data[_]=i:t.y={value:i}),this._emit_cds_changes(n,!0,!0,!1)}_hide_intersections(){this._set_intersection([],[])}}t.LineToolView=r,r.__name__="LineToolView";class c extends _.EditTool{constructor(e){super(e)}static init_LineTool(){this.define((({AnyRef:e})=>({intersection_renderer:[e()]})))}}t.LineTool=c,c.__name__="LineTool",c.init_LineTool()}, +function _(t,s,i,n,e){n();const o=t(1),a=t(237),_=t(20),h=o.__importStar(t(242));function l(t,s,i){const n=new Map;for(const[e,o]of t){const[t,a]=o.r_invert(s,i);n.set(e,{start:t,end:a})}return n}i.update_ranges=l;class r extends a.GestureToolView{_pan_start(t){var s;this.last_dx=0,this.last_dy=0;const{sx:i,sy:n}=t,e=this.plot_view.frame.bbox;if(!e.contains(i,n)){const t=e.h_range,s=e.v_range;(it.end)&&(this.v_axis_only=!0),(ns.end)&&(this.h_axis_only=!0)}null===(s=this.model.document)||void 0===s||s.interactive_start(this.plot_model)}_pan(t){var s;this._update(t.deltaX,t.deltaY),null===(s=this.model.document)||void 0===s||s.interactive_start(this.plot_model)}_pan_end(t){this.h_axis_only=!1,this.v_axis_only=!1,null!=this.pan_info&&this.plot_view.state.push("pan",{range:this.pan_info})}_update(t,s){const i=this.plot_view.frame,n=t-this.last_dx,e=s-this.last_dy,o=i.bbox.h_range,a=o.start-n,_=o.end-n,h=i.bbox.v_range,r=h.start-e,d=h.end-e,p=this.model.dimensions;let c,m,u,x,v,y;"width"!=p&&"both"!=p||this.v_axis_only?(c=o.start,m=o.end,u=0):(c=a,m=_,u=-n),"height"!=p&&"both"!=p||this.h_axis_only?(x=h.start,v=h.end,y=0):(x=r,v=d,y=-e),this.last_dx=t,this.last_dy=s;const{x_scales:g,y_scales:w}=i,f=l(g,c,m),b=l(w,x,v);this.pan_info={xrs:f,yrs:b,sdx:u,sdy:y},this.plot_view.update_range(this.pan_info,{panning:!0})}}i.PanToolView=r,r.__name__="PanToolView";class d extends a.GestureTool{constructor(t){super(t),this.tool_name="Pan",this.event_type="pan",this.default_order=10}static init_PanTool(){this.prototype.default_view=r,this.define((()=>({dimensions:[_.Dimensions,"both",{on_update(t,s){switch(t){case"both":s.icon=h.tool_icon_pan;break;case"width":s.icon=h.tool_icon_xpan;break;case"height":s.icon=h.tool_icon_ypan}}}]}))),this.register_alias("pan",(()=>new d({dimensions:"both"}))),this.register_alias("xpan",(()=>new d({dimensions:"width"}))),this.register_alias("ypan",(()=>new d({dimensions:"height"})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}i.PanTool=d,d.__name__="PanTool",d.init_PanTool()}, +function _(t,e,i,s,n){s();const l=t(136),a=t(156),r=t(19),o=t(237),_=t(242);function h(t){switch(t){case 1:return 2;case 2:return 1;case 4:return 5;case 5:return 4;default:return t}}function d(t,e,i,s){if(null==e)return!1;const n=i.compute(e);return Math.abs(t-n)n.right)&&(l=!1)}if(null!=n.bottom&&null!=n.top){const t=s.invert(e);(tn.top)&&(l=!1)}return l}function c(t,e,i){let s=0;return t>=i.start&&t<=i.end&&(s+=1),e>=i.start&&e<=i.end&&(s+=1),s}function g(t,e,i,s){const n=e.compute(t),l=e.invert(n+i);return l>=s.start&&l<=s.end?l:t}function y(t,e,i){return t>e.start?(e.end=t,i):(e.end=e.start,e.start=t,h(i))}function f(t,e,i){return t=o&&(t.start=a,t.end=r)}i.flip_side=h,i.is_near=d,i.is_inside=u,i.sides_inside=c,i.compute_value=g,i.update_range_end_side=y,i.update_range_start_side=f,i.update_range=m;class v extends o.GestureToolView{initialize(){super.initialize(),this.side=0,this.model.update_overlay_from_ranges()}connect_signals(){super.connect_signals(),null!=this.model.x_range&&this.connect(this.model.x_range.change,(()=>this.model.update_overlay_from_ranges())),null!=this.model.y_range&&this.connect(this.model.y_range.change,(()=>this.model.update_overlay_from_ranges()))}_pan_start(t){this.last_dx=0,this.last_dy=0;const e=this.model.x_range,i=this.model.y_range,{frame:s}=this.plot_view,n=s.x_scale,a=s.y_scale,r=this.model.overlay,{left:o,right:_,top:h,bottom:c}=r,g=this.model.overlay.line_width+l.EDGE_TOLERANCE;null!=e&&this.model.x_interaction&&(d(t.sx,o,n,g)?this.side=1:d(t.sx,_,n,g)?this.side=2:u(t.sx,t.sy,n,a,r)&&(this.side=3)),null!=i&&this.model.y_interaction&&(0==this.side&&d(t.sy,c,a,g)&&(this.side=4),0==this.side&&d(t.sy,h,a,g)?this.side=5:u(t.sx,t.sy,n,a,this.model.overlay)&&(3==this.side?this.side=7:this.side=6))}_pan(t){const e=this.plot_view.frame,i=t.deltaX-this.last_dx,s=t.deltaY-this.last_dy,n=this.model.x_range,l=this.model.y_range,a=e.x_scale,r=e.y_scale;if(null!=n)if(3==this.side||7==this.side)m(n,a,i,e.x_range);else if(1==this.side){const t=g(n.start,a,i,e.x_range);this.side=f(t,n,this.side)}else if(2==this.side){const t=g(n.end,a,i,e.x_range);this.side=y(t,n,this.side)}if(null!=l)if(6==this.side||7==this.side)m(l,r,s,e.y_range);else if(4==this.side){const t=g(l.start,r,s,e.y_range);this.side=f(t,l,this.side)}else if(5==this.side){const t=g(l.end,r,s,e.y_range);this.side=y(t,l,this.side)}this.last_dx=t.deltaX,this.last_dy=t.deltaY}_pan_end(t){this.side=0}}i.RangeToolView=v,v.__name__="RangeToolView";const p=()=>new l.BoxAnnotation({level:"overlay",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:.5,line_dash:[2,2]});class x extends o.GestureTool{constructor(t){super(t),this.tool_name="Range Tool",this.icon=_.tool_icon_range,this.event_type="pan",this.default_order=1}static init_RangeTool(){this.prototype.default_view=v,this.define((({Boolean:t,Ref:e,Nullable:i})=>({x_range:[i(e(a.Range1d)),null],x_interaction:[t,!0],y_range:[i(e(a.Range1d)),null],y_interaction:[t,!0],overlay:[e(l.BoxAnnotation),p]})))}initialize(){super.initialize(),this.overlay.in_cursor="grab",this.overlay.ew_cursor=null!=this.x_range&&this.x_interaction?"ew-resize":null,this.overlay.ns_cursor=null!=this.y_range&&this.y_interaction?"ns-resize":null}update_overlay_from_ranges(){null==this.x_range&&null==this.y_range&&(this.overlay.left=null,this.overlay.right=null,this.overlay.bottom=null,this.overlay.top=null,r.logger.warn("RangeTool not configured with any Ranges.")),null==this.x_range?(this.overlay.left=null,this.overlay.right=null):(this.overlay.left=this.x_range.start,this.overlay.right=this.x_range.end),null==this.y_range?(this.overlay.bottom=null,this.overlay.top=null):(this.overlay.bottom=this.y_range.start,this.overlay.top=this.y_range.end)}}i.RangeTool=x,x.__name__="RangeTool",x.init_RangeTool()}, +function _(e,t,s,o,i){o();const l=e(378),a=e(20),n=e(242);class c extends l.SelectToolView{_tap(e){"tap"==this.model.gesture&&this._handle_tap(e)}_doubletap(e){"doubletap"==this.model.gesture&&this._handle_tap(e)}_handle_tap(e){const{sx:t,sy:s}=e,o={type:"point",sx:t,sy:s};this._select(o,!0,this._select_mode(e))}_select(e,t,s){const{callback:o}=this.model;if("select"==this.model.behavior){const i=this._computed_renderers_by_data_source();for(const[,l]of i){const i=l[0].get_selection_manager(),a=l.map((e=>this.plot_view.renderer_view(e))).filter((e=>null!=e));if(i.select(a,e,t,s)&&null!=o){const t=a[0].coordinates.x_scale.invert(e.sx),s=a[0].coordinates.y_scale.invert(e.sy),l={geometries:Object.assign(Object.assign({},e),{x:t,y:s}),source:i.source};o.execute(this.model,l)}}this._emit_selection_event(e),this.plot_view.state.push("tap",{selection:this.plot_view.get_selection()})}else for(const t of this.computed_renderers){const s=this.plot_view.renderer_view(t);if(null==s)continue;const i=t.get_selection_manager();if(i.inspect(s,e)&&null!=o){const t=s.coordinates.x_scale.invert(e.sx),l=s.coordinates.y_scale.invert(e.sy),a={geometries:Object.assign(Object.assign({},e),{x:t,y:l}),source:i.source};o.execute(this.model,a)}}}}s.TapToolView=c,c.__name__="TapToolView";class _ extends l.SelectTool{constructor(e){super(e),this.tool_name="Tap",this.icon=n.tool_icon_tap_select,this.event_type="tap",this.default_order=10}static init_TapTool(){this.prototype.default_view=c,this.define((({Any:e,Enum:t,Nullable:s})=>({behavior:[a.TapBehavior,"select"],gesture:[t("tap","doubletap"),"tap"],callback:[s(e)]}))),this.register_alias("click",(()=>new _({behavior:"inspect"}))),this.register_alias("tap",(()=>new _)),this.register_alias("doubletap",(()=>new _({gesture:"doubletap"})))}}s.TapTool=_,_.__name__="TapTool",_.init_TapTool()}, +function _(e,t,s,i,n){i();const o=e(237),a=e(20),l=e(242),_=e(384);class h extends o.GestureToolView{_scroll(e){let t=this.model.speed*e.delta;t>.9?t=.9:t<-.9&&(t=-.9),this._update_ranges(t)}_update_ranges(e){var t;const{frame:s}=this.plot_view,i=s.bbox.h_range,n=s.bbox.v_range,[o,a]=[i.start,i.end],[l,h]=[n.start,n.end];let r,d,c,p;switch(this.model.dimension){case"height":{const t=Math.abs(h-l);r=o,d=a,c=l-t*e,p=h-t*e;break}case"width":{const t=Math.abs(a-o);r=o-t*e,d=a-t*e,c=l,p=h;break}}const{x_scales:m,y_scales:u}=s,w={xrs:_.update_ranges(m,r,d),yrs:_.update_ranges(u,c,p),factor:e};this.plot_view.state.push("wheel_pan",{range:w}),this.plot_view.update_range(w,{scrolling:!0}),null===(t=this.model.document)||void 0===t||t.interactive_start(this.plot_model)}}s.WheelPanToolView=h,h.__name__="WheelPanToolView";class r extends o.GestureTool{constructor(e){super(e),this.tool_name="Wheel Pan",this.icon=l.tool_icon_wheel_pan,this.event_type="scroll",this.default_order=12}static init_WheelPanTool(){this.prototype.default_view=h,this.define((()=>({dimension:[a.Dimension,"width"]}))),this.internal((({Number:e})=>({speed:[e,.001]}))),this.register_alias("xwheel_pan",(()=>new r({dimension:"width"}))),this.register_alias("ywheel_pan",(()=>new r({dimension:"height"})))}get tooltip(){return this._get_dim_tooltip(this.dimension)}}s.WheelPanTool=r,r.__name__="WheelPanTool",r.init_WheelPanTool()}, +function _(e,o,t,s,i){s();const l=e(237),n=e(368),h=e(20),_=e(27),a=e(242);class m extends l.GestureToolView{_pinch(e){const{sx:o,sy:t,scale:s,ctrlKey:i,shiftKey:l}=e;let n;n=s>=1?20*(s-1):-20/s,this._scroll({type:"wheel",sx:o,sy:t,delta:n,ctrlKey:i,shiftKey:l})}_scroll(e){var o;const{frame:t}=this.plot_view,s=t.bbox.h_range,i=t.bbox.v_range,{sx:l,sy:h}=e,_=this.model.dimensions,a=("width"==_||"both"==_)&&s.start({dimensions:[h.Dimensions,"both"],maintain_focus:[e,!0],zoom_on_axis:[e,!0],speed:[o,1/600]}))),this.register_alias("wheel_zoom",(()=>new r({dimensions:"both"}))),this.register_alias("xwheel_zoom",(()=>new r({dimensions:"width"}))),this.register_alias("ywheel_zoom",(()=>new r({dimensions:"height"})))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}}t.WheelZoomTool=r,r.__name__="WheelZoomTool",r.init_WheelZoomTool()}, +function _(i,s,t,o,e){o();const n=i(247),l=i(233),h=i(20),a=i(13),r=i(242);class _ extends n.InspectToolView{_move(i){if(!this.model.active)return;const{sx:s,sy:t}=i;this.plot_view.frame.bbox.contains(s,t)?this._update_spans(s,t):this._update_spans(null,null)}_move_exit(i){this._update_spans(null,null)}_update_spans(i,s){const t=this.model.dimensions;"width"!=t&&"both"!=t||(this.model.spans.width.location=s),"height"!=t&&"both"!=t||(this.model.spans.height.location=i)}}t.CrosshairToolView=_,_.__name__="CrosshairToolView";class c extends n.InspectTool{constructor(i){super(i),this.tool_name="Crosshair",this.icon=r.tool_icon_crosshair}static init_CrosshairTool(){function i(i,s){return new l.Span({for_hover:!0,dimension:s,location_units:"screen",level:"overlay",line_color:i.line_color,line_width:i.line_width,line_alpha:i.line_alpha})}this.prototype.default_view=_,this.define((({Alpha:i,Number:s,Color:t})=>({dimensions:[h.Dimensions,"both"],line_color:[t,"black"],line_width:[s,1],line_alpha:[i,1]}))),this.internal((({Struct:s,Ref:t})=>({spans:[s({width:t(l.Span),height:t(l.Span)}),s=>({width:i(s,"width"),height:i(s,"height")})]}))),this.register_alias("crosshair",(()=>new c))}get tooltip(){return this._get_dim_tooltip(this.dimensions)}get synthetic_renderers(){return a.values(this.spans)}}t.CrosshairTool=c,c.__name__="CrosshairTool",c.init_CrosshairTool()}, +function _(t,e,s,o,r){o();const n=t(53),i=t(13),a=t(34);class u extends n.Model{constructor(t){super(t)}static init_CustomJSHover(){this.define((({Unknown:t,String:e,Dict:s})=>({args:[s(t),{}],code:[e,""]})))}get values(){return i.values(this.args)}_make_code(t,e,s,o){return new Function(...i.keys(this.args),t,e,s,a.use_strict(o))}format(t,e,s){return this._make_code("value","format","special_vars",this.code)(...this.values,t,e,s)}}s.CustomJSHover=u,u.__name__="CustomJSHover",u.init_CustomJSHover()}, +function _(e,t,n,s,o){s();const i=e(1),r=e(247),l=e(390),a=e(254),c=e(61),_=e(123),d=e(62),p=e(63),h=e(127),u=i.__importStar(e(107)),m=e(182),y=e(43),f=e(22),x=e(13),v=e(245),w=e(8),g=e(122),b=e(20),k=e(242),C=e(15),S=e(161),T=i.__importStar(e(255));function $(e,t,n,s,o,i){const r={x:o[e],y:i[e]},l={x:o[e+1],y:i[e+1]};let a,c;if("span"==t.type)"h"==t.direction?(a=Math.abs(r.x-n),c=Math.abs(l.x-n)):(a=Math.abs(r.y-s),c=Math.abs(l.y-s));else{const e={x:n,y:s};a=u.dist_2_pts(r,e),c=u.dist_2_pts(l,e)}return adelete this._template_el)),this.on_change([e,t,n],(async()=>await this._update_ttmodels()))}async _update_ttmodels(){const{_ttmodels:e,computed_renderers:t}=this;e.clear();const{tooltips:n}=this.model;if(null!=n)for(const t of this.computed_renderers){const s=new a.Tooltip({custom:w.isString(n)||w.isFunction(n),attachment:this.model.attachment,show_arrow:this.model.show_arrow});t instanceof c.GlyphRenderer?e.set(t,s):t instanceof _.GraphRenderer&&(e.set(t.node_renderer,s),e.set(t.edge_renderer,s))}const s=await g.build_views(this._ttviews,[...e.values()],{parent:this.plot_view});for(const e of s)e.render();const o=[...function*(){for(const e of t)e instanceof c.GlyphRenderer?yield e:e instanceof _.GraphRenderer&&(yield e.node_renderer,yield e.edge_renderer)}()],i=this._slots.get(this._update);if(null!=i){const e=new Set(o.map((e=>e.data_source)));C.Signal.disconnect_receiver(this,i,e)}for(const e of o)this.connect(e.data_source.inspect,this._update)}get computed_renderers(){const{renderers:e,names:t}=this.model,n=this.plot_model.data_renderers;return S.compute_renderers(e,n,t)}get ttmodels(){return this._ttmodels}_clear(){this._inspect(1/0,1/0);for(const[,e]of this.ttmodels)e.clear()}_move(e){if(!this.model.active)return;const{sx:t,sy:n}=e;this.plot_view.frame.bbox.contains(t,n)?this._inspect(t,n):this._clear()}_move_exit(){this._clear()}_inspect(e,t){let n;if("mouse"==this.model.mode)n={type:"point",sx:e,sy:t};else{n={type:"span",direction:"vline"==this.model.mode?"h":"v",sx:e,sy:t}}for(const e of this.computed_renderers){const t=e.get_selection_manager(),s=this.plot_view.renderer_view(e);null!=s&&t.inspect(s,n)}this._emit_callback(n)}_update([e,{geometry:t}]){var n,s;if(!this.model.active)return;if("point"!=t.type&&"span"!=t.type)return;if(!(e instanceof c.GlyphRenderer))return;if("ignore"==this.model.muted_policy&&e.muted)return;const o=this.ttmodels.get(e);if(null==o)return;const i=e.get_selection_manager();let r=i.inspectors.get(e);if(r=e.view.convert_selection_to_subset(r),r.is_empty())return void o.clear();const l=i.source,a=this.plot_view.renderer_view(e);if(null==a)return;const{sx:_,sy:d}=t,u=a.coordinates.x_scale,m=a.coordinates.y_scale,f=u.invert(_),v=m.invert(d),{glyph:w}=a,g=[];if(w instanceof p.LineView)for(const n of r.line_indices){let s,o,i=w._x[n+1],a=w._y[n+1],c=n;switch(this.model.line_policy){case"interp":[i,a]=w.get_interpolation_hit(n,t),s=u.compute(i),o=m.compute(a);break;case"prev":[[s,o],c]=R(w.sx,w.sy,n);break;case"next":[[s,o],c]=R(w.sx,w.sy,n+1);break;case"nearest":[[s,o],c]=$(n,t,_,d,w.sx,w.sy),i=w._x[c],a=w._y[c];break;default:[s,o]=[_,d]}const p={index:c,x:f,y:v,sx:_,sy:d,data_x:i,data_y:a,rx:s,ry:o,indices:r.line_indices,name:e.name};g.push([s,o,this._render_tooltips(l,c,p)])}for(const t of r.image_indices){const n={index:t.index,x:f,y:v,sx:_,sy:d,name:e.name},s=this._render_tooltips(l,t,n);g.push([_,d,s])}for(const o of r.indices)if(w instanceof h.MultiLineView&&!x.isEmpty(r.multiline_indices))for(const n of r.multiline_indices[o.toString()]){let s,i,a,p=w._xs.get(o)[n],h=w._ys.get(o)[n],y=n;switch(this.model.line_policy){case"interp":[p,h]=w.get_interpolation_hit(o,n,t),s=u.compute(p),i=m.compute(h);break;case"prev":[[s,i],y]=R(w.sxs.get(o),w.sys.get(o),n);break;case"next":[[s,i],y]=R(w.sxs.get(o),w.sys.get(o),n+1);break;case"nearest":[[s,i],y]=$(n,t,_,d,w.sxs.get(o),w.sys.get(o)),p=w._xs.get(o)[y],h=w._ys.get(o)[y];break;default:throw new Error("shouldn't have happened")}a=e instanceof c.GlyphRenderer?e.view.convert_indices_from_subset([o])[0]:o;const x={index:a,x:f,y:v,sx:_,sy:d,data_x:p,data_y:h,segment_index:y,indices:r.multiline_indices,name:e.name};g.push([s,i,this._render_tooltips(l,a,x)])}else{const t=null===(n=w._x)||void 0===n?void 0:n[o],i=null===(s=w._y)||void 0===s?void 0:s[o];let a,p,h;if("snap_to_data"==this.model.point_policy){let e=w.get_anchor_point(this.model.anchor,o,[_,d]);if(null==e&&(e=w.get_anchor_point("center",o,[_,d]),null==e))continue;a=e.x,p=e.y}else[a,p]=[_,d];h=e instanceof c.GlyphRenderer?e.view.convert_indices_from_subset([o])[0]:o;const u={index:h,x:f,y:v,sx:_,sy:d,data_x:t,data_y:i,indices:r.indices,name:e.name};g.push([a,p,this._render_tooltips(l,h,u)])}if(0==g.length)o.clear();else{const{content:e}=o;y.empty(o.content);for(const[,,t]of g)null!=t&&e.appendChild(t);const[t,n]=g[g.length-1];o.setv({position:[t,n]},{check_eq:!1})}}_emit_callback(e){const{callback:t}=this.model;if(null!=t)for(const n of this.computed_renderers){if(!(n instanceof c.GlyphRenderer))continue;const s=this.plot_view.renderer_view(n);if(null==s)continue;const{x_scale:o,y_scale:i}=s.coordinates,r=o.invert(e.sx),l=i.invert(e.sy),a=n.data_source.inspected;t.execute(this.model,{geometry:Object.assign({x:r,y:l},e),renderer:n,index:a})}}_create_template(e){const t=y.div({style:{display:"table",borderSpacing:"2px"}});for(const[n]of e){const e=y.div({style:{display:"table-row"}});t.appendChild(e);const s=y.div({style:{display:"table-cell"},class:T.tooltip_row_label},0!=n.length?`${n}: `:"");e.appendChild(s);const o=y.span();o.dataset.value="";const i=y.span({class:T.tooltip_color_block}," ");i.dataset.swatch="",y.undisplay(i);const r=y.div({style:{display:"table-cell"},class:T.tooltip_row_value},o,i);e.appendChild(r)}return t}_render_template(e,t,n,s,o){const i=e.cloneNode(!0),r=i.querySelectorAll("[data-value]"),l=i.querySelectorAll("[data-swatch]"),a=/\$color(\[.*\])?:(\w*)/,c=/\$swatch:(\w*)/;for(const[[,e],i]of v.enumerate(t)){const t=e.match(c),_=e.match(a);if(null!=t||null!=_){if(null!=t){const[,e]=t,o=n.get_column(e);if(null==o)r[i].textContent=`${e} unknown`;else{const e=w.isNumber(s)?o[s]:null;null!=e&&(l[i].style.backgroundColor=f.color2css(e),y.display(l[i]))}}if(null!=_){const[,e="",t]=_,o=n.get_column(t);if(null==o){r[i].textContent=`${t} unknown`;continue}const a=e.indexOf("hex")>=0,c=e.indexOf("swatch")>=0,d=w.isNumber(s)?o[s]:null;if(null==d){r[i].textContent="(null)";continue}r[i].textContent=a?f.color2hex(d):f.color2css(d),c&&(l[i].style.backgroundColor=f.color2css(d),y.display(l[i]))}}else{const t=m.replace_placeholders(e.replace("$~","$data_"),n,s,this.model.formatters,o);if(w.isString(t))r[i].textContent=t;else for(const e of t)r[i].appendChild(e)}}return i}_render_tooltips(e,t,n){var s;const{tooltips:o}=this.model;if(w.isString(o)){const s=m.replace_placeholders({html:o},e,t,this.model.formatters,n);return y.div({},s)}if(w.isFunction(o))return o(e,n);if(null!=o){const i=null!==(s=this._template_el)&&void 0!==s?s:this._template_el=this._create_template(o);return this._render_template(i,o,e,t,n)}return null}}n.HoverToolView=H,H.__name__="HoverToolView";class M extends r.InspectTool{constructor(e){super(e),this.tool_name="Hover",this.icon=k.tool_icon_hover}static init_HoverTool(){this.prototype.default_view=H,this.define((({Any:e,Boolean:t,String:n,Array:s,Tuple:o,Dict:i,Or:r,Ref:a,Function:c,Auto:_,Nullable:p})=>({tooltips:[p(r(n,s(o(n,n)),c())),[["index","$index"],["data (x, y)","($x, $y)"],["screen (x, y)","($sx, $sy)"]]],formatters:[i(r(a(l.CustomJSHover),m.FormatterType)),{}],renderers:[r(s(a(d.DataRenderer)),_),"auto"],names:[s(n),[]],mode:[b.HoverMode,"mouse"],muted_policy:[b.MutedPolicy,"show"],point_policy:[b.PointPolicy,"snap_to_data"],line_policy:[b.LinePolicy,"nearest"],show_arrow:[t,!0],anchor:[b.Anchor,"center"],attachment:[b.TooltipAttachment,"horizontal"],callback:[p(e)]}))),this.register_alias("hover",(()=>new M))}}n.HoverTool=M,M.__name__="HoverTool",M.init_HoverTool()}, +function _(t,o,e,n,i){n();const s=t(15),l=t(53),c=t(238),r=t(247),a=t(245);class u extends l.Model{constructor(t){super(t)}static init_ToolProxy(){this.define((({Boolean:t,Array:o,Ref:e})=>({tools:[o(e(c.ButtonTool)),[]],active:[t,!1],disabled:[t,!1]})))}get button_view(){return this.tools[0].button_view}get event_type(){return this.tools[0].event_type}get tooltip(){return this.tools[0].tooltip}get tool_name(){return this.tools[0].tool_name}get icon(){return this.tools[0].computed_icon}get computed_icon(){return this.icon}get toggleable(){const t=this.tools[0];return t instanceof r.InspectTool&&t.toggleable}initialize(){super.initialize(),this.do=new s.Signal0(this,"do")}connect_signals(){super.connect_signals(),this.connect(this.do,(()=>this.doit())),this.connect(this.properties.active.change,(()=>this.set_active()));for(const t of this.tools)this.connect(t.properties.active.change,(()=>{this.active=t.active}))}doit(){for(const t of this.tools)t.do.emit()}set_active(){for(const t of this.tools)t.active=this.active}get menu(){const{menu:t}=this.tools[0];if(null==t)return null;const o=[];for(const[e,n]of a.enumerate(t))if(null==e)o.push(null);else{const t=()=>{var t,o;for(const e of this.tools)null===(o=null===(t=e.menu)||void 0===t?void 0:t[n])||void 0===o||o.handler()};o.push(Object.assign(Object.assign({},e),{handler:t}))}return o}}e.ToolProxy=u,u.__name__="ToolProxy",u.init_ToolProxy()}, +function _(o,t,s,i,e){i();const n=o(20),r=o(9),l=o(13),c=o(248),h=o(235),a=o(392),_=o(319),p=o(221);class f extends c.ToolbarBase{constructor(o){super(o)}static init_ProxyToolbar(){this.define((({Array:o,Ref:t})=>({toolbars:[o(t(h.Toolbar)),[]]})))}initialize(){super.initialize(),this._merge_tools()}_merge_tools(){this._proxied_tools=[];const o={},t={},s={},i=[],e=[];for(const o of this.help)r.includes(e,o.redirect)||(i.push(o),e.push(o.redirect));this._proxied_tools.push(...i),this.help=i;for(const[o,t]of l.entries(this.gestures)){o in s||(s[o]={});for(const i of t.tools)i.type in s[o]||(s[o][i.type]=[]),s[o][i.type].push(i)}for(const t of this.inspectors)t.type in o||(o[t.type]=[]),o[t.type].push(t);for(const o of this.actions)o.type in t||(t[o.type]=[]),t[o.type].push(o);const n=(o,t=!1)=>{const s=new a.ToolProxy({tools:o,active:t});return this._proxied_tools.push(s),s};for(const o of l.keys(s)){const t=this.gestures[o];t.tools=[];for(const i of l.keys(s[o])){const e=s[o][i];if(e.length>0)if("multi"==o)for(const o of e){const s=n([o]);t.tools.push(s),this.connect(s.properties.active.change,(()=>this._active_change(s)))}else{const o=n(e);t.tools.push(o),this.connect(o.properties.active.change,(()=>this._active_change(o)))}}}this.actions=[];for(const[o,s]of l.entries(t))if("CustomAction"==o)for(const o of s)this.actions.push(n([o]));else s.length>0&&this.actions.push(n(s));this.inspectors=[];for(const t of l.values(o))t.length>0&&this.inspectors.push(n(t,!0));for(const[o,t]of l.entries(this.gestures))0!=t.tools.length&&(t.tools=r.sort_by(t.tools,(o=>o.default_order)),"pinch"!=o&&"scroll"!=o&&"multi"!=o&&(t.tools[0].active=!0))}}s.ProxyToolbar=f,f.__name__="ProxyToolbar",f.init_ProxyToolbar();class u extends _.LayoutDOMView{initialize(){this.model.toolbar.toolbar_location=this.model.toolbar_location,super.initialize()}get child_models(){return[this.model.toolbar]}_update_layout(){this.layout=new p.ContentBox(this.child_views[0].el);const{toolbar:o}=this.model;o.horizontal?this.layout.set_sizing({width_policy:"fit",min_width:100,height_policy:"fixed"}):this.layout.set_sizing({width_policy:"fixed",height_policy:"fit",min_height:100})}}s.ToolbarBoxView=u,u.__name__="ToolbarBoxView";class y extends _.LayoutDOM{constructor(o){super(o)}static init_ToolbarBox(){this.prototype.default_view=u,this.define((({Ref:o})=>({toolbar:[o(c.ToolbarBase)],toolbar_location:[n.Location,"right"]})))}}s.ToolbarBox=y,y.__name__="ToolbarBox",y.init_ToolbarBox()}, +function _(e,n,r,t,o){t();const s=e(1),u=e(53),c=s.__importStar(e(21)),a=e(8),l=e(13);r.resolve_defs=function(e,n){var r,t,o,s;function i(e){return null!=e.module?`${e.module}.${e.name}`:e.name}function f(e){if(a.isString(e))switch(e){case"Any":return c.Any;case"Unknown":return c.Unknown;case"Boolean":return c.Boolean;case"Number":return c.Number;case"Int":return c.Int;case"String":return c.String;case"Null":return c.Null}else switch(e[0]){case"Nullable":{const[,n]=e;return c.Nullable(f(n))}case"Or":{const[,...n]=e;return c.Or(...n.map(f))}case"Tuple":{const[,n,...r]=e;return c.Tuple(f(n),...r.map(f))}case"Array":{const[,n]=e;return c.Array(f(n))}case"Struct":{const[,...n]=e,r=n.map((([e,n])=>[e,f(n)]));return c.Struct(l.to_object(r))}case"Dict":{const[,n]=e;return c.Dict(f(n))}case"Map":{const[,n,r]=e;return c.Map(f(n),f(r))}case"Enum":{const[,...n]=e;return c.Enum(...n)}case"Ref":{const[,r]=e,t=n.get(i(r));if(null!=t)return c.Ref(t);throw new Error(`${i(r)} wasn't defined before referencing it`)}case"AnyRef":return c.AnyRef()}}for(const c of e){const e=(()=>{if(null==c.extends)return u.Model;{const e=n.get(i(c.extends));if(null!=e)return e;throw new Error(`base model ${i(c.extends)} of ${i(c)} is not defined`)}})(),a=((s=class extends e{}).__name__=c.name,s.__module__=c.module,s);for(const e of null!==(r=c.properties)&&void 0!==r?r:[]){const n=f(null!==(t=e.kind)&&void 0!==t?t:"Unknown");a.define({[e.name]:[n,e.default]})}for(const e of null!==(o=c.overrides)&&void 0!==o?o:[])a.override({[e.name]:e.default});n.register(a)}}}, +function _(n,e,t,o,i){o();const d=n(5),c=n(240),s=n(122),a=n(43),l=n(396);t.index={},t.add_document_standalone=async function(n,e,o=[],i=!1){const u=new Map;async function f(i){let d;const f=n.roots().indexOf(i),r=o[f];null!=r?d=r:e.classList.contains(l.BOKEH_ROOT)?d=e:(d=a.div({class:l.BOKEH_ROOT}),e.appendChild(d));const w=await s.build_view(i,{parent:null});return w instanceof c.DOMView&&w.renderTo(d),u.set(i,w),t.index[i.id]=w,w}for(const e of n.roots())await f(e);return i&&(window.document.title=n.title()),n.on_change((n=>{n instanceof d.RootAddedEvent?f(n.model):n instanceof d.RootRemovedEvent?function(n){const e=u.get(n);null!=e&&(e.remove(),u.delete(n),delete t.index[n.id])}(n.model):i&&n instanceof d.TitleChangedEvent&&(window.document.title=n.title)})),[...u.values()]}}, +function _(o,e,n,t,r){t();const l=o(43),d=o(44);function u(o){let e=document.getElementById(o);if(null==e)throw new Error(`Error rendering Bokeh model: could not find #${o} HTML tag`);if(!document.body.contains(e))throw new Error(`Error rendering Bokeh model: element #${o} must be under `);if("SCRIPT"==e.tagName){const o=l.div({class:n.BOKEH_ROOT});l.replaceWith(e,o),e=o}return e}n.BOKEH_ROOT=d.root,n._resolve_element=function(o){const{elementid:e}=o;return null!=e?u(e):document.body},n._resolve_root_elements=function(o){const e=[];if(null!=o.root_ids&&null!=o.roots)for(const n of o.root_ids)e.push(u(o.roots[n]));return e}}, +function _(n,o,t,s,e){s();const c=n(398),r=n(19),a=n(395);t._get_ws_url=function(n,o){let t,s="ws:";return"https:"==window.location.protocol&&(s="wss:"),null!=o?(t=document.createElement("a"),t.href=o):t=window.location,null!=n?"/"==n&&(n=""):n=t.pathname.replace(/\/+$/,""),s+"//"+t.host+n+"/ws"};const i={};t.add_document_from_session=async function(n,o,t,s=[],e=!1){const l=window.location.search.substr(1);let d;try{d=await function(n,o,t){const s=c.parse_token(o).session_id;n in i||(i[n]={});const e=i[n];return s in e||(e[s]=c.pull_session(n,o,t)),e[s]}(n,o,l)}catch(n){const t=c.parse_token(o).session_id;throw r.logger.error(`Failed to load Bokeh session ${t}: ${n}`),n}return a.add_document_standalone(d.document,t,s,e)}}, +function _(e,s,n,t,o){t();const r=e(19),i=e(5),c=e(399),l=e(400),_=e(401);n.DEFAULT_SERVER_WEBSOCKET_URL="ws://localhost:5006/ws",n.DEFAULT_TOKEN="eyJzZXNzaW9uX2lkIjogImRlZmF1bHQifQ";let h=0;function a(e){let s=e.split(".")[0];const n=s.length%4;return 0!=n&&(s+="=".repeat(4-n)),JSON.parse(atob(s.replace(/_/g,"/").replace(/-/g,"+")))}n.parse_token=a;class d{constructor(e=n.DEFAULT_SERVER_WEBSOCKET_URL,s=n.DEFAULT_TOKEN,t=null){this.url=e,this.token=s,this.args_string=t,this._number=h++,this.socket=null,this.session=null,this.closed_permanently=!1,this._current_handler=null,this._pending_replies=new Map,this._pending_messages=[],this._receiver=new l.Receiver,this.id=a(s).session_id.split(".")[0],r.logger.debug(`Creating websocket ${this._number} to '${this.url}' session '${this.id}'`)}async connect(){if(this.closed_permanently)throw new Error("Cannot connect() a closed ClientConnection");if(null!=this.socket)throw new Error("Already connected");this._current_handler=null,this._pending_replies.clear(),this._pending_messages=[];try{let e=`${this.url}`;return null!=this.args_string&&this.args_string.length>0&&(e+=`?${this.args_string}`),this.socket=new WebSocket(e,["bokeh",this.token]),new Promise(((e,s)=>{this.socket.binaryType="arraybuffer",this.socket.onopen=()=>this._on_open(e,s),this.socket.onmessage=e=>this._on_message(e),this.socket.onclose=e=>this._on_close(e,s),this.socket.onerror=()=>this._on_error(s)}))}catch(e){throw r.logger.error(`websocket creation failed to url: ${this.url}`),r.logger.error(` - ${e}`),e}}close(){this.closed_permanently||(r.logger.debug(`Permanently closing websocket connection ${this._number}`),this.closed_permanently=!0,null!=this.socket&&this.socket.close(1e3,`close method called on ClientConnection ${this._number}`),this.session._connection_closed())}_schedule_reconnect(e){setTimeout((()=>{this.closed_permanently||r.logger.info(`Websocket connection ${this._number} disconnected, will not attempt to reconnect`)}),e)}send(e){if(null==this.socket)throw new Error(`not connected so cannot send ${e}`);e.send(this.socket)}async send_with_reply(e){const s=await new Promise(((s,n)=>{this._pending_replies.set(e.msgid(),{resolve:s,reject:n}),this.send(e)}));if("ERROR"===s.msgtype())throw new Error(`Error reply ${s.content.text}`);return s}async _pull_doc_json(){const e=c.Message.create("PULL-DOC-REQ",{}),s=await this.send_with_reply(e);if(!("doc"in s.content))throw new Error("No 'doc' field in PULL-DOC-REPLY");return s.content.doc}async _repull_session_doc(e,s){var n;r.logger.debug(this.session?"Repulling session":"Pulling session for first time");try{const n=await this._pull_doc_json();if(null==this.session)if(this.closed_permanently)r.logger.debug("Got new document after connection was already closed"),s(new Error("The connection has been closed"));else{const s=i.Document.from_json(n),t=i.Document._compute_patch_since_json(n,s);if(t.events.length>0){r.logger.debug(`Sending ${t.events.length} changes from model construction back to server`);const e=c.Message.create("PATCH-DOC",{},t);this.send(e)}this.session=new _.ClientSession(this,s,this.id);for(const e of this._pending_messages)this.session.handle(e);this._pending_messages=[],r.logger.debug("Created a new session from new pulled doc"),e(this.session)}else this.session.document.replace_with_json(n),r.logger.debug("Updated existing session with new pulled doc")}catch(e){null===(n=console.trace)||void 0===n||n.call(console,e),r.logger.error(`Failed to repull session ${e}`),s(e instanceof Error?e:`${e}`)}}_on_open(e,s){r.logger.info(`Websocket connection ${this._number} is now open`),this._current_handler=n=>{this._awaiting_ack_handler(n,e,s)}}_on_message(e){null==this._current_handler&&r.logger.error("Got a message with no current handler set");try{this._receiver.consume(e.data)}catch(e){this._close_bad_protocol(`${e}`)}const s=this._receiver.message;if(null!=s){const e=s.problem();null!=e&&this._close_bad_protocol(e),this._current_handler(s)}}_on_close(e,s){r.logger.info(`Lost websocket ${this._number} connection, ${e.code} (${e.reason})`),this.socket=null,this._pending_replies.forEach((e=>e.reject("Disconnected"))),this._pending_replies.clear(),this.closed_permanently||this._schedule_reconnect(2e3),s(new Error(`Lost websocket connection, ${e.code} (${e.reason})`))}_on_error(e){r.logger.debug(`Websocket error on socket ${this._number}`);const s="Could not open websocket";r.logger.error(`Failed to connect to Bokeh server: ${s}`),e(new Error(s))}_close_bad_protocol(e){r.logger.error(`Closing connection: ${e}`),null!=this.socket&&this.socket.close(1002,e)}_awaiting_ack_handler(e,s,n){"ACK"===e.msgtype()?(this._current_handler=e=>this._steady_state_handler(e),this._repull_session_doc(s,n)):this._close_bad_protocol("First message was not an ACK")}_steady_state_handler(e){const s=e.reqid(),n=this._pending_replies.get(s);n?(this._pending_replies.delete(s),n.resolve(e)):this.session?this.session.handle(e):"PATCH-DOC"!=e.msgtype()&&this._pending_messages.push(e)}}n.ClientConnection=d,d.__name__="ClientConnection",n.pull_session=function(e,s,n){return new d(e,s,n).connect()}}, +function _(e,s,t,r,n){r();const i=e(34);class a{constructor(e,s,t){this.header=e,this.metadata=s,this.content=t,this.buffers=new Map}static assemble(e,s,t){const r=JSON.parse(e),n=JSON.parse(s),i=JSON.parse(t);return new a(r,n,i)}assemble_buffer(e,s){const t=null!=this.header.num_buffers?this.header.num_buffers:0;if(t<=this.buffers.size)throw new Error(`too many buffers received, expecting ${t}`);const{id:r}=JSON.parse(e);this.buffers.set(r,s)}static create(e,s,t={}){const r=a.create_header(e);return new a(r,s,t)}static create_header(e){return{msgid:i.uniqueId(),msgtype:e}}complete(){return null!=this.header&&null!=this.metadata&&null!=this.content&&(null==this.header.num_buffers||this.buffers.size==this.header.num_buffers)}send(e){if((null!=this.header.num_buffers?this.header.num_buffers:0)>0)throw new Error("BokehJS only supports receiving buffers, not sending");const s=JSON.stringify(this.header),t=JSON.stringify(this.metadata),r=JSON.stringify(this.content);e.send(s),e.send(t),e.send(r)}msgid(){return this.header.msgid}msgtype(){return this.header.msgtype}reqid(){return this.header.reqid}problem(){return"msgid"in this.header?"msgtype"in this.header?null:"No msgtype in header":"No msgid in header"}}t.Message=a,a.__name__="Message"}, +function _(e,t,s,_,r){_();const i=e(399),h=e(8);class a{constructor(){this.message=null,this._partial=null,this._fragments=[],this._buf_header=null,this._current_consumer=this._HEADER}consume(e){this._current_consumer(e)}_HEADER(e){this._assume_text(e),this.message=null,this._partial=null,this._fragments=[e],this._buf_header=null,this._current_consumer=this._METADATA}_METADATA(e){this._assume_text(e),this._fragments.push(e),this._current_consumer=this._CONTENT}_CONTENT(e){this._assume_text(e),this._fragments.push(e);const[t,s,_]=this._fragments.slice(0,3);this._partial=i.Message.assemble(t,s,_),this._check_complete()}_BUFFER_HEADER(e){this._assume_text(e),this._buf_header=e,this._current_consumer=this._BUFFER_PAYLOAD}_BUFFER_PAYLOAD(e){this._assume_binary(e),this._partial.assemble_buffer(this._buf_header,e),this._check_complete()}_assume_text(e){if(!h.isString(e))throw new Error("Expected text fragment but received binary fragment")}_assume_binary(e){if(!(e instanceof ArrayBuffer))throw new Error("Expected binary fragment but received text fragment")}_check_complete(){this._partial.complete()?(this.message=this._partial,this._current_consumer=this._HEADER):this._current_consumer=this._BUFFER_HEADER}}s.Receiver=a,a.__name__="Receiver"}, +function _(e,t,n,s,o){s();const c=e(5),i=e(399),_=e(19);class r{constructor(e,t,n){this._connection=e,this.document=t,this.id=n,this._document_listener=e=>{this._document_changed(e)},this.document.on_change(this._document_listener,!0)}handle(e){const t=e.msgtype();"PATCH-DOC"===t?this._handle_patch(e):"OK"===t?this._handle_ok(e):"ERROR"===t?this._handle_error(e):_.logger.debug(`Doing nothing with message ${e.msgtype()}`)}close(){this._connection.close()}_connection_closed(){this.document.remove_on_change(this._document_listener)}async request_server_info(){const e=i.Message.create("SERVER-INFO-REQ",{});return(await this._connection.send_with_reply(e)).content}async force_roundtrip(){await this.request_server_info()}_document_changed(e){if(e.setter_id===this.id)return;const t=e instanceof c.DocumentEventBatch?e.events:[e],n=this.document.create_json_patch(t),s=i.Message.create("PATCH-DOC",{},n);this._connection.send(s)}_handle_patch(e){this.document.apply_json_patch(e.content,e.buffers,this.id)}_handle_ok(e){_.logger.trace(`Unhandled OK reply to ${e.reqid()}`)}_handle_error(e){_.logger.error(`Unhandled ERROR reply to ${e.reqid()}: ${e.content.text}`)}}n.ClientSession=r,r.__name__="ClientSession"}, +function _(e,o,t,n,r){n();const s=e(1),l=e(5),i=e(400),a=e(19),c=e(43),g=e(13),f=e(395),u=e(396),m=s.__importDefault(e(44)),p=s.__importDefault(e(253)),d=s.__importDefault(e(403));function _(e,o){o.buffers.length>0?e.consume(o.buffers[0].buffer):e.consume(o.content.data);const t=e.message;null!=t&&this.apply_json_patch(t.content,t.buffers)}function b(e,o){if("undefined"!=typeof Jupyter&&null!=Jupyter.notebook.kernel){a.logger.info(`Registering Jupyter comms for target ${e}`);const t=Jupyter.notebook.kernel.comm_manager;try{t.register_target(e,(t=>{a.logger.info(`Registering Jupyter comms for target ${e}`);const n=new i.Receiver;t.on_msg(_.bind(o,n))}))}catch(e){a.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`)}}else if(o.roots()[0].id in t.kernels){a.logger.info(`Registering JupyterLab comms for target ${e}`);const n=t.kernels[o.roots()[0].id];try{n.registerCommTarget(e,(t=>{a.logger.info(`Registering JupyterLab comms for target ${e}`);const n=new i.Receiver;t.onMsg=_.bind(o,n)}))}catch(e){a.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`)}}else if("undefined"!=typeof google&&null!=google.colab.kernel){a.logger.info(`Registering Google Colab comms for target ${e}`);const t=google.colab.kernel.comms;try{t.registerTarget(e,(async t=>{var n,r,l;a.logger.info(`Registering Google Colab comms for target ${e}`);const c=new i.Receiver;try{for(var g,f=s.__asyncValues(t.messages);!(g=await f.next()).done;){const e=g.value,t={data:e.data},n=[];for(const o of null!==(l=e.buffers)&&void 0!==l?l:[])n.push(new DataView(o));const r={content:t,buffers:n};_.bind(o)(c,r)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=f.return)&&await r.call(f)}finally{if(n)throw n.error}}}))}catch(e){a.logger.warn(`Google Colab comms failed to register. push_notebook() will not function. (exception reported: ${e})`)}}else console.warn("Jupyter notebooks comms not available. push_notebook() will not function. If running JupyterLab ensure the latest @bokeh/jupyter_bokeh extension is installed. In an exported notebook this warning is expected.")}c.stylesheet.append(m.default),c.stylesheet.append(p.default),c.stylesheet.append(d.default),t.kernels={},t.embed_items_notebook=function(e,o){if(1!=g.size(e))throw new Error("embed_items_notebook expects exactly one document in docs_json");const t=l.Document.from_json(g.values(e)[0]);for(const e of o){null!=e.notebook_comms_target&&b(e.notebook_comms_target,t);const o=u._resolve_element(e),n=u._resolve_root_elements(e);f.add_document_standalone(t,o,n)}}}, +function _(t,o,r,e,d){e(),r.root="bk-root",r.tooltip="bk-tooltip",r.default=".rendered_html .bk-root .bk-tooltip table,.rendered_html .bk-root .bk-tooltip tr,.rendered_html .bk-root .bk-tooltip th,.rendered_html .bk-root .bk-tooltip td{border:none;padding:1px;}"}, +function _(t,_,o,r,n){r();const a=t(1);a.__exportStar(t(399),o),a.__exportStar(t(400),o)}, +function _(e,t,n,s,o){function l(){const e=document.getElementsByTagName("body")[0],t=document.getElementsByClassName("bokeh-test-div");1==t.length&&(e.removeChild(t[0]),delete t[0]);const n=document.createElement("div");n.classList.add("bokeh-test-div"),n.style.display="none",e.insertBefore(n,e.firstChild)}s(),n.results={},n.init=function(){l()},n.record0=function(e,t){n.results[e]=t},n.record=function(e,t){n.results[e]=t,l()},n.count=function(e){null==n.results[e]&&(n.results[e]=0),n.results[e]+=1,l()}}, +function _(e,t,o,n,l){n(),o.safely=function(e,t=!1){try{return e()}catch(e){if(function(e){const t=document.createElement("div");t.style.backgroundColor="#f2dede",t.style.border="1px solid #a94442",t.style.borderRadius="4px",t.style.display="inline-block",t.style.fontFamily="sans-serif",t.style.marginTop="5px",t.style.minWidth="200px",t.style.padding="5px 5px 5px 10px",t.classList.add("bokeh-error-box-into-flames");const o=document.createElement("span");o.style.backgroundColor="#a94442",o.style.borderRadius="0px 4px 0px 0px",o.style.color="white",o.style.cursor="pointer",o.style.cssFloat="right",o.style.fontSize="0.8em",o.style.margin="-6px -6px 0px 0px",o.style.padding="2px 5px 4px 5px",o.title="close",o.setAttribute("aria-label","close"),o.appendChild(document.createTextNode("x")),o.addEventListener("click",(()=>s.removeChild(t)));const n=document.createElement("h3");n.style.color="#a94442",n.style.margin="8px 0px 0px 0px",n.style.padding="0px",n.appendChild(document.createTextNode("Bokeh Error"));const l=document.createElement("pre");l.style.whiteSpace="unset",l.style.overflowX="auto",l.appendChild(document.createTextNode(e)),t.appendChild(o),t.appendChild(n),t.appendChild(l);const s=document.getElementsByTagName("body")[0];s.insertBefore(t,s.firstChild)}(e instanceof Error&&e.stack?e.stack:`${e}`),t)return;throw e}}}, +], 0, {"main":0,"tslib":1,"index":2,"version":3,"embed/index":4,"document/index":5,"document/document":6,"base":7,"core/util/types":8,"core/util/array":9,"core/util/math":10,"core/util/assert":11,"core/util/arrayable":12,"core/util/object":13,"core/has_props":14,"core/signaling":15,"core/util/defer":16,"core/util/refs":17,"core/properties":18,"core/logging":19,"core/enums":20,"core/kinds":21,"core/util/color":22,"core/util/svg_colors":23,"core/types":24,"core/util/bitset":25,"core/util/eq":26,"core/util/platform":27,"core/settings":28,"core/util/ndarray":29,"core/serializer":30,"core/util/serialization":31,"core/util/buffer":32,"core/uniforms":33,"core/util/string":34,"document/events":35,"core/util/pretty":36,"core/util/cloneable":37,"models/index":38,"models/annotations/index":39,"models/annotations/annotation":40,"models/renderers/renderer":41,"core/view":42,"core/dom":43,"styles/root.css":44,"core/visuals/index":45,"core/visuals/line":46,"core/visuals/visual":47,"core/property_mixins":48,"core/visuals/fill":49,"core/visuals/text":50,"core/visuals/hatch":51,"core/visuals/patterns":52,"model":53,"models/canvas/coordinates":54,"models/annotations/arrow":55,"models/annotations/data_annotation":56,"models/sources/columnar_data_source":57,"models/sources/data_source":58,"models/selections/selection":59,"core/selection_manager":60,"models/renderers/glyph_renderer":61,"models/renderers/data_renderer":62,"models/glyphs/line":63,"models/glyphs/xy_glyph":64,"core/util/projections":65,"models/glyphs/glyph":98,"core/util/bbox":99,"core/util/ragged_array":100,"core/util/spatial":101,"models/ranges/factor_range":104,"models/ranges/range":105,"models/glyphs/utils":106,"core/hittest":107,"models/glyphs/webgl/line":108,"models/glyphs/webgl/utils/index":109,"models/glyphs/webgl/utils/program":110,"models/glyphs/webgl/utils/buffer":111,"models/glyphs/webgl/utils/texture":112,"models/glyphs/webgl/base":113,"models/glyphs/webgl/line.vert":114,"models/glyphs/webgl/line.frag":115,"models/glyphs/patch":116,"models/glyphs/harea":117,"models/glyphs/area":118,"models/glyphs/varea":119,"models/sources/cds_view":120,"models/filters/filter":121,"core/build_views":122,"models/renderers/graph_renderer":123,"models/expressions/expression":124,"models/graphs/layout_provider":125,"models/graphs/graph_hit_test_policy":126,"models/glyphs/multi_line":127,"models/glyphs/patches":128,"models/selections/interaction_policy":129,"models/sources/column_data_source":130,"core/util/typed_array":131,"core/util/set":132,"models/annotations/arrow_head":133,"models/annotations/band":134,"models/annotations/upper_lower":135,"models/annotations/box_annotation":136,"models/annotations/color_bar":137,"models/annotations/title":138,"models/annotations/text_annotation":139,"core/layout/side_panel":140,"core/layout/types":141,"core/layout/layoutable":142,"core/util/text":143,"models/canvas/cartesian_frame":144,"models/scales/categorical_scale":145,"models/scales/scale":146,"models/transforms/index":147,"models/transforms/customjs_transform":148,"models/transforms/transform":149,"models/transforms/dodge":150,"models/transforms/range_transform":151,"models/transforms/interpolator":152,"models/transforms/jitter":153,"models/transforms/linear_interpolator":154,"models/transforms/step_interpolator":155,"models/ranges/range1d":156,"models/scales/log_scale":157,"models/scales/continuous_scale":158,"models/ranges/data_range1d":159,"models/ranges/data_range":160,"models/util":161,"models/axes/index":162,"models/axes/axis":163,"models/renderers/guide_renderer":164,"models/tickers/ticker":165,"models/formatters/tick_formatter":166,"core/graphics":167,"core/util/affine":168,"models/policies/labeling":169,"models/axes/categorical_axis":170,"models/tickers/categorical_ticker":171,"models/formatters/categorical_tick_formatter":172,"models/axes/continuous_axis":173,"models/axes/datetime_axis":174,"models/axes/linear_axis":175,"models/formatters/basic_tick_formatter":176,"models/tickers/basic_ticker":177,"models/tickers/adaptive_ticker":178,"models/tickers/continuous_ticker":179,"models/formatters/datetime_tick_formatter":180,"core/util/templating":182,"models/tickers/datetime_ticker":185,"models/tickers/composite_ticker":186,"models/tickers/days_ticker":187,"models/tickers/single_interval_ticker":188,"models/tickers/util":189,"models/tickers/months_ticker":190,"models/tickers/years_ticker":191,"models/axes/log_axis":192,"models/formatters/log_tick_formatter":193,"models/tickers/log_ticker":194,"models/axes/mercator_axis":195,"models/formatters/mercator_tick_formatter":196,"models/tickers/mercator_ticker":197,"models/tickers/index":198,"models/tickers/fixed_ticker":199,"models/tickers/binned_ticker":200,"models/mappers/scanning_color_mapper":201,"models/mappers/continuous_color_mapper":202,"models/mappers/color_mapper":203,"models/mappers/mapper":204,"models/formatters/index":205,"models/formatters/func_tick_formatter":206,"models/formatters/numeral_tick_formatter":207,"models/formatters/printf_tick_formatter":208,"models/mappers/index":209,"models/mappers/categorical_color_mapper":210,"models/mappers/categorical_mapper":211,"models/mappers/categorical_marker_mapper":212,"models/mappers/categorical_pattern_mapper":213,"models/mappers/linear_color_mapper":214,"models/mappers/log_color_mapper":215,"models/mappers/eqhist_color_mapper":216,"models/scales/index":217,"models/scales/linear_scale":218,"models/scales/linear_interpolation_scale":219,"models/ranges/index":220,"core/layout/index":221,"core/layout/alignments":222,"core/layout/grid":223,"core/layout/html":224,"core/layout/border":225,"models/annotations/label":226,"models/annotations/label_set":227,"models/annotations/legend":228,"models/annotations/legend_item":229,"core/vectorization":230,"models/annotations/poly_annotation":231,"models/annotations/slope":232,"models/annotations/span":233,"models/annotations/toolbar_panel":234,"models/tools/toolbar":235,"models/tools/tool":236,"models/tools/gestures/gesture_tool":237,"models/tools/button_tool":238,"core/dom_view":240,"styles/toolbar.css":241,"styles/icons.css":242,"styles/menus.css":243,"core/util/menus":244,"core/util/iterator":245,"models/tools/on_off_button":246,"models/tools/inspectors/inspect_tool":247,"models/tools/toolbar_base":248,"core/util/canvas":249,"core/util/svg":250,"models/tools/actions/action_tool":251,"models/tools/actions/help_tool":252,"styles/logo.css":253,"models/annotations/tooltip":254,"styles/tooltips.css":255,"models/annotations/whisker":256,"models/callbacks/index":257,"models/callbacks/customjs":258,"models/callbacks/callback":259,"models/callbacks/open_url":260,"models/canvas/index":261,"models/canvas/canvas":262,"core/ui_events":263,"core/bokeh_events":264,"core/util/wheel":265,"models/expressions/index":266,"models/expressions/customjs_expr":267,"models/expressions/stack":268,"models/expressions/cumsum":269,"models/expressions/minimum":270,"models/expressions/maximum":271,"models/filters/index":272,"models/filters/boolean_filter":273,"models/filters/customjs_filter":274,"models/filters/group_filter":275,"models/filters/index_filter":276,"models/glyphs/index":277,"models/glyphs/annular_wedge":278,"models/glyphs/annulus":279,"models/glyphs/arc":280,"models/glyphs/bezier":281,"models/glyphs/circle":282,"models/glyphs/webgl/markers":283,"models/glyphs/webgl/markers.vert":284,"models/glyphs/webgl/markers.frag":285,"models/glyphs/ellipse":286,"models/glyphs/ellipse_oval":287,"models/glyphs/center_rotatable":288,"models/glyphs/hbar":289,"models/glyphs/box":290,"models/glyphs/hex_tile":291,"models/glyphs/image":292,"models/glyphs/image_base":293,"models/glyphs/image_rgba":294,"models/glyphs/image_url":295,"core/util/image":296,"models/glyphs/multi_polygons":297,"models/glyphs/oval":298,"models/glyphs/quad":299,"models/glyphs/quadratic":300,"models/glyphs/ray":301,"models/glyphs/rect":302,"models/glyphs/scatter":303,"models/glyphs/marker":304,"models/glyphs/defs":305,"models/glyphs/segment":306,"models/glyphs/spline":307,"core/util/interpolation":308,"models/glyphs/step":309,"models/glyphs/text":310,"models/glyphs/vbar":311,"models/glyphs/wedge":312,"models/graphs/index":313,"models/graphs/static_layout_provider":314,"models/grids/index":315,"models/grids/grid":316,"models/layouts/index":317,"models/layouts/box":318,"models/layouts/layout_dom":319,"models/layouts/column":320,"models/layouts/grid_box":321,"models/layouts/html_box":322,"models/layouts/panel":323,"models/layouts/row":324,"models/layouts/spacer":325,"models/layouts/tabs":326,"styles/tabs.css":327,"styles/buttons.css":328,"models/layouts/widget_box":329,"models/plots/index":330,"models/plots/gmap_plot":331,"models/plots/plot":332,"models/plots/plot_canvas":333,"core/util/throttle":334,"models/plots/range_manager":335,"models/plots/state_manager":336,"models/plots/gmap_plot_canvas":337,"models/policies/index":338,"models/renderers/index":339,"models/selections/index":340,"models/sources/index":341,"models/sources/server_sent_data_source":342,"models/sources/web_data_source":343,"models/sources/ajax_data_source":344,"models/sources/geojson_data_source":345,"models/tiles/index":346,"models/tiles/bbox_tile_source":347,"models/tiles/mercator_tile_source":348,"models/tiles/tile_source":349,"models/tiles/tile_utils":350,"models/tiles/quadkey_tile_source":351,"models/tiles/tile_renderer":352,"models/tiles/wmts_tile_source":353,"styles/tiles.css":354,"models/tiles/tms_tile_source":355,"models/textures/index":356,"models/textures/canvas_texture":357,"models/textures/texture":358,"models/textures/image_url_texture":359,"models/tools/index":360,"models/tools/actions/custom_action":361,"models/tools/actions/redo_tool":362,"models/tools/actions/reset_tool":363,"models/tools/actions/save_tool":364,"models/tools/actions/undo_tool":365,"models/tools/actions/zoom_in_tool":366,"models/tools/actions/zoom_base_tool":367,"core/util/zoom":368,"models/tools/actions/zoom_out_tool":369,"models/tools/edit/edit_tool":370,"models/tools/edit/box_edit_tool":371,"models/tools/edit/freehand_draw_tool":372,"models/tools/edit/point_draw_tool":373,"models/tools/edit/poly_draw_tool":374,"models/tools/edit/poly_tool":375,"models/tools/edit/poly_edit_tool":376,"models/tools/gestures/box_select_tool":377,"models/tools/gestures/select_tool":378,"models/tools/gestures/box_zoom_tool":379,"models/tools/gestures/lasso_select_tool":380,"models/tools/gestures/poly_select_tool":381,"models/tools/edit/line_edit_tool":382,"models/tools/edit/line_tool":383,"models/tools/gestures/pan_tool":384,"models/tools/gestures/range_tool":385,"models/tools/gestures/tap_tool":386,"models/tools/gestures/wheel_pan_tool":387,"models/tools/gestures/wheel_zoom_tool":388,"models/tools/inspectors/crosshair_tool":389,"models/tools/inspectors/customjs_hover":390,"models/tools/inspectors/hover_tool":391,"models/tools/tool_proxy":392,"models/tools/toolbar_box":393,"document/defs":394,"embed/standalone":395,"embed/dom":396,"embed/server":397,"client/connection":398,"protocol/message":399,"protocol/receiver":400,"client/session":401,"embed/notebook":402,"styles/notebook.css":403,"protocol/index":404,"testing":405,"safely":406}, {});}); diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-1.1.0.js b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-1.1.0.js deleted file mode 100644 index 1c42f36a8..000000000 --- a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-1.1.0.js +++ /dev/null @@ -1,1784 +0,0 @@ -/*! - * Copyright (c) 2012 - 2018, Anaconda, Inc., and Bokeh Contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of Anaconda nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ -(function(root, factory) { -// if(typeof exports === 'object' && typeof module === 'object') -// factory(require("Bokeh")); -// else if(typeof define === 'function' && define.amd) -// define(["Bokeh"], factory); -// else if(typeof exports === 'object') -// factory(require("Bokeh")); -// else - factory(root["Bokeh"]); -})(this, function(Bokeh) { - var define; - return (function(modules, aliases, entry) { - if (Bokeh != null) { - return Bokeh.register_plugin(modules, aliases, entry); - } else { - throw new Error("Cannot find Bokeh. You have to load it prior to loading plugins."); - } - }) -({ -401: /* api/charts */ function _(require, module, exports) { - var palettes = require(407) /* ./palettes */; - var array_1 = require(24) /* ../core/util/array */; - var types_1 = require(46) /* ../core/util/types */; - var templating_1 = require(42) /* ../core/util/templating */; - var models_1 = require(406) /* ./models */; - function num2hexcolor(num) { - return templating_1.sprintf("#%06x", num); - } - function hexcolor2rgb(color) { - var r = parseInt(color.substr(1, 2), 16); - var g = parseInt(color.substr(3, 2), 16); - var b = parseInt(color.substr(5, 2), 16); - return [r, g, b]; - } - function is_dark(_a) { - var r = _a[0], g = _a[1], b = _a[2]; - var l = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255; - return l >= 0.6; - } - function norm_palette(palette) { - if (palette === void 0) { - palette = "Spectral11"; - } - if (types_1.isArray(palette)) - return palette; - else { - return palettes[palette].map(num2hexcolor); - } - } - function pie(data, opts) { - if (opts === void 0) { - opts = {}; - } - var labels = []; - var values = []; - for (var i = 0; i < Math.min(data.labels.length, data.values.length); i++) { - if (data.values[i] > 0) { - labels.push(data.labels[i]); - values.push(data.values[i]); - } - } - var start_angle = opts.start_angle != null ? opts.start_angle : 0; - var end_angle = opts.end_angle != null ? opts.end_angle : (start_angle + 2 * Math.PI); - var angle_span = Math.abs(end_angle - start_angle); - var to_radians = function (x) { return angle_span * x; }; - var total_value = array_1.sum(values); - var normalized_values = values.map(function (v) { return v / total_value; }); - var cumulative_values = array_1.cumsum(normalized_values); - var end_angles = cumulative_values.map(function (v) { return start_angle + to_radians(v); }); - var start_angles = [start_angle].concat(end_angles.slice(0, -1)); - var half_angles = array_1.zip(start_angles, end_angles).map(function (_a) { - var start = _a[0], end = _a[1]; - return (start + end) / 2; - }); - var cx; - var cy; - if (opts.center == null) { - cx = 0; - cy = 0; - } - else if (types_1.isArray(opts.center)) { - cx = opts.center[0]; - cy = opts.center[1]; - } - else { - cx = opts.center.x; - cy = opts.center.y; - } - var inner_radius = opts.inner_radius != null ? opts.inner_radius : 0; - var outer_radius = opts.outer_radius != null ? opts.outer_radius : 1; - var palette = norm_palette(opts.palette); - var colors = []; - for (var i = 0; i < normalized_values.length; i++) - colors.push(palette[i % palette.length]); - var text_colors = colors.map(function (c) { return is_dark(hexcolor2rgb(c)) ? "white" : "black"; }); - function to_cartesian(r, alpha) { - return [r * Math.cos(alpha), r * Math.sin(alpha)]; - } - var half_radius = (inner_radius + outer_radius) / 2; - var _a = array_1.unzip(half_angles.map(function (half_angle) { return to_cartesian(half_radius, half_angle); })), text_cx = _a[0], text_cy = _a[1]; - text_cx = text_cx.map(function (x) { return x + cx; }); - text_cy = text_cy.map(function (y) { return y + cy; }); - var text_angles = half_angles.map(function (a) { - if (a >= Math.PI / 2 && a <= 3 * Math.PI / 2) - return a + Math.PI; - else - return a; - }); - var source = new models_1.ColumnDataSource({ - data: { - labels: labels, - values: values, - percentages: normalized_values.map(function (v) { return templating_1.sprintf("%.2f%%", v * 100); }), - start_angles: start_angles, - end_angles: end_angles, - text_angles: text_angles, - colors: colors, - text_colors: text_colors, - text_cx: text_cx, - text_cy: text_cy, - }, - }); - var g1 = new models_1.AnnularWedge({ - x: cx, y: cy, - inner_radius: inner_radius, outer_radius: outer_radius, - start_angle: { field: "start_angles" }, end_angle: { field: "end_angles" }, - line_color: null, line_width: 1, fill_color: { field: "colors" }, - }); - var h1 = new models_1.AnnularWedge({ - x: cx, y: cy, - inner_radius: inner_radius, outer_radius: outer_radius, - start_angle: { field: "start_angles" }, end_angle: { field: "end_angles" }, - line_color: null, line_width: 1, fill_color: { field: "colors" }, fill_alpha: 0.8, - }); - var r1 = new models_1.GlyphRenderer({ - data_source: source, - glyph: g1, - hover_glyph: h1, - }); - var g2 = new models_1.Text({ - x: { field: "text_cx" }, y: { field: "text_cy" }, - text: { field: opts.slice_labels || "labels" }, - angle: { field: "text_angles" }, - text_align: "center", text_baseline: "middle", - text_color: { field: "text_colors" }, text_font_size: "9pt", - }); - var r2 = new models_1.GlyphRenderer({ - data_source: source, - glyph: g2, - }); - var xdr = new models_1.DataRange1d({ renderers: [r1], range_padding: 0.2 }); - var ydr = new models_1.DataRange1d({ renderers: [r1], range_padding: 0.2 }); - var plot = new models_1.Plot({ x_range: xdr, y_range: ydr }); - if (opts.width != null) - plot.plot_width = opts.width; - if (opts.height != null) - plot.plot_height = opts.height; - plot.add_renderers(r1, r2); - var tooltip = "
@labels
@values (@percentages)
"; - var hover = new models_1.HoverTool({ renderers: [r1], tooltips: tooltip }); - plot.add_tools(hover); - return plot; - } - exports.pie = pie; - function bar(data, opts) { - var _a, _b, _c, _d, _e; - if (opts === void 0) { - opts = {}; - } - var column_names = data[0]; - var row_data = data.slice(1); - var col_data = array_1.transpose(row_data); - var labels = col_data[0].map(function (v) { return v.toString(); }); - var columns = col_data.slice(1); - var yaxis = new models_1.CategoricalAxis(); - var ydr = new models_1.FactorRange({ factors: labels }); - var yscale = new models_1.CategoricalScale(); - var xformatter; - if (opts.axis_number_format != null) - xformatter = new models_1.NumeralTickFormatter({ format: opts.axis_number_format }); - else - xformatter = new models_1.BasicTickFormatter(); - var xaxis = new models_1.LinearAxis({ formatter: xformatter }); - var xdr = new models_1.DataRange1d({ start: 0 }); - var xscale = new models_1.LinearScale(); - var palette = norm_palette(opts.palette); - var stacked = opts.stacked != null ? opts.stacked : false; - var orientation = opts.orientation != null ? opts.orientation : "horizontal"; - var renderers = []; - if (stacked) { - var left = []; - var right = []; - var _loop_1 = function (i) { - var bottom = []; - var top_1 = []; - for (var j = 0; j < labels.length; j++) { - var label = labels[j]; - if (i == 0) { - left.push(0); - right.push(columns[i][j]); - } - else { - left[j] += columns[i - 1][j]; - right[j] += columns[i][j]; - } - bottom.push([label, -0.5]); - top_1.push([label, 0.5]); - } - var source = new models_1.ColumnDataSource({ - data: { - left: array_1.copy(left), - right: array_1.copy(right), - top: top_1, - bottom: bottom, - labels: labels, - values: columns[i], - columns: columns[i].map(function (_) { return column_names[i + 1]; }), - }, - }); - var g1 = new models_1.Quad({ - left: { field: "left" }, bottom: { field: "bottom" }, - right: { field: "right" }, top: { field: "top" }, - line_color: null, fill_color: palette[i % palette.length], - }); - var r1 = new models_1.GlyphRenderer({ data_source: source, glyph: g1 }); - renderers.push(r1); - }; - for (var i = 0; i < columns.length; i++) { - _loop_1(i); - } - } - else { - var dy = 1 / columns.length; - var _loop_2 = function (i) { - var left = []; - var right = []; - var bottom = []; - var top_2 = []; - for (var j = 0; j < labels.length; j++) { - var label = labels[j]; - left.push(0); - right.push(columns[i][j]); - bottom.push([label, i * dy - 0.5]); - top_2.push([label, (i + 1) * dy - 0.5]); - } - var source = new models_1.ColumnDataSource({ - data: { - left: left, - right: right, - top: top_2, - bottom: bottom, - labels: labels, - values: columns[i], - columns: columns[i].map(function (_) { return column_names[i + 1]; }), - }, - }); - var g1 = new models_1.Quad({ - left: { field: "left" }, bottom: { field: "bottom" }, - right: { field: "right" }, top: { field: "top" }, - line_color: null, fill_color: palette[i % palette.length], - }); - var r1 = new models_1.GlyphRenderer({ data_source: source, glyph: g1 }); - renderers.push(r1); - }; - for (var i = 0; i < columns.length; i++) { - _loop_2(i); - } - } - if (orientation == "vertical") { - _a = [ydr, xdr], xdr = _a[0], ydr = _a[1]; - _b = [yaxis, xaxis], xaxis = _b[0], yaxis = _b[1]; - _c = [yscale, xscale], xscale = _c[0], yscale = _c[1]; - for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) { - var r = renderers_1[_i]; - var data_1 = r.data_source.data; - _d = [data_1.bottom, data_1.left], data_1.left = _d[0], data_1.bottom = _d[1]; - _e = [data_1.top, data_1.right], data_1.right = _e[0], data_1.top = _e[1]; - } - } - var plot = new models_1.Plot({ x_range: xdr, y_range: ydr, x_scale: xscale, y_scale: yscale }); - if (opts.width != null) - plot.plot_width = opts.width; - if (opts.height != null) - plot.plot_height = opts.height; - plot.add_renderers.apply(plot, renderers); - plot.add_layout(yaxis, "left"); - plot.add_layout(xaxis, "below"); - var tooltip = "
@labels
@columns: @values
"; - var anchor; - var attachment; - if (orientation == "horizontal") { - anchor = "center_right"; - attachment = "horizontal"; - } - else { - anchor = "top_center"; - attachment = "vertical"; - } - var hover = new models_1.HoverTool({ - renderers: renderers, - tooltips: tooltip, - point_policy: "snap_to_data", - anchor: anchor, - attachment: attachment, - }); - plot.add_tools(hover); - return plot; - } - exports.bar = bar; -} -, -402: /* api/gridplot */ function _(require, module, exports) { - var models_1 = require(406) /* ./models */; - function or_else(value, default_value) { - if (value === undefined) - return default_value; - else - return value; - } - function gridplot(children, opts) { - if (opts === void 0) { - opts = {}; - } - var toolbar_location = or_else(opts.toolbar_location, "above"); - var merge_tools = or_else(opts.merge_tools, true); - var sizing_mode = or_else(opts.sizing_mode, null); - var tools = []; - var items = []; - for (var y = 0; y < children.length; y++) { - var row = children[y]; - for (var x = 0; x < row.length; x++) { - var item = row[x]; - if (item == null) - continue; - else { - if (item instanceof models_1.Plot) { // XXX: semantics differ - if (merge_tools) { - tools.push.apply(tools, item.toolbar.tools); - item.toolbar_location = null; - } - if (opts.plot_width != null) - item.plot_width = opts.plot_width; - if (opts.plot_height != null) - item.plot_height = opts.plot_height; - } - items.push([item, y, x]); - } - } - } - if (!merge_tools || toolbar_location == null) - return new models_1.GridBox({ children: items, sizing_mode: sizing_mode }); - var grid = new models_1.GridBox({ children: items, sizing_mode: sizing_mode }); - var toolbar = new models_1.ToolbarBox({ - toolbar: new models_1.ProxyToolbar({ tools: tools }), - toolbar_location: toolbar_location, - }); - switch (toolbar_location) { - case "above": - return new models_1.Column({ children: [toolbar, grid], sizing_mode: sizing_mode }); - case "below": - return new models_1.Column({ children: [grid, toolbar], sizing_mode: sizing_mode }); - case "left": - return new models_1.Row({ children: [toolbar, grid], sizing_mode: sizing_mode }); - case "right": - return new models_1.Row({ children: [grid, toolbar], sizing_mode: sizing_mode }); - default: - throw new Error("unexpected"); - } - } - exports.gridplot = gridplot; -} -, -403: /* api/index */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var LinAlg = require(404) /* ./linalg */; - exports.LinAlg = LinAlg; - var Charts = require(401) /* ./charts */; - exports.Charts = Charts; - var Plotting = require(408) /* ./plotting */; - exports.Plotting = Plotting; - var document_1 = require(54) /* ../document */; - exports.Document = document_1.Document; - var templating_1 = require(42) /* ../core/util/templating */; - exports.sprintf = templating_1.sprintf; - tslib_1.__exportStar(require(406) /* ./models */, exports); -} -, -404: /* api/linalg */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(35) /* ../core/util/object */, exports); - tslib_1.__exportStar(require(24) /* ../core/util/array */, exports); - tslib_1.__exportStar(require(40) /* ../core/util/string */, exports); - tslib_1.__exportStar(require(409) /* ../core/util/random */, exports); - tslib_1.__exportStar(require(46) /* ../core/util/types */, exports); - tslib_1.__exportStar(require(33) /* ../core/util/eq */, exports); -} -, -405: /* api/main */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(403) /* ./index */, exports); -} -, -406: /* api/models */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - tslib_1.__exportStar(require(157) /* ../models/index */, exports); -} -, -407: /* api/palettes */ function _(require, module, exports) { - exports.YlGn3 = [0x31a354, 0xaddd8e, 0xf7fcb9]; - exports.YlGn4 = [0x238443, 0x78c679, 0xc2e699, 0xffffcc]; - exports.YlGn5 = [0x006837, 0x31a354, 0x78c679, 0xc2e699, 0xffffcc]; - exports.YlGn6 = [0x006837, 0x31a354, 0x78c679, 0xaddd8e, 0xd9f0a3, 0xffffcc]; - exports.YlGn7 = [0x005a32, 0x238443, 0x41ab5d, 0x78c679, 0xaddd8e, 0xd9f0a3, 0xffffcc]; - exports.YlGn8 = [0x005a32, 0x238443, 0x41ab5d, 0x78c679, 0xaddd8e, 0xd9f0a3, 0xf7fcb9, 0xffffe5]; - exports.YlGn9 = [0x004529, 0x006837, 0x238443, 0x41ab5d, 0x78c679, 0xaddd8e, 0xd9f0a3, 0xf7fcb9, 0xffffe5]; - exports.YlGnBu3 = [0x2c7fb8, 0x7fcdbb, 0xedf8b1]; - exports.YlGnBu4 = [0x225ea8, 0x41b6c4, 0xa1dab4, 0xffffcc]; - exports.YlGnBu5 = [0x253494, 0x2c7fb8, 0x41b6c4, 0xa1dab4, 0xffffcc]; - exports.YlGnBu6 = [0x253494, 0x2c7fb8, 0x41b6c4, 0x7fcdbb, 0xc7e9b4, 0xffffcc]; - exports.YlGnBu7 = [0x0c2c84, 0x225ea8, 0x1d91c0, 0x41b6c4, 0x7fcdbb, 0xc7e9b4, 0xffffcc]; - exports.YlGnBu8 = [0x0c2c84, 0x225ea8, 0x1d91c0, 0x41b6c4, 0x7fcdbb, 0xc7e9b4, 0xedf8b1, 0xffffd9]; - exports.YlGnBu9 = [0x081d58, 0x253494, 0x225ea8, 0x1d91c0, 0x41b6c4, 0x7fcdbb, 0xc7e9b4, 0xedf8b1, 0xffffd9]; - exports.GnBu3 = [0x43a2ca, 0xa8ddb5, 0xe0f3db]; - exports.GnBu4 = [0x2b8cbe, 0x7bccc4, 0xbae4bc, 0xf0f9e8]; - exports.GnBu5 = [0x0868ac, 0x43a2ca, 0x7bccc4, 0xbae4bc, 0xf0f9e8]; - exports.GnBu6 = [0x0868ac, 0x43a2ca, 0x7bccc4, 0xa8ddb5, 0xccebc5, 0xf0f9e8]; - exports.GnBu7 = [0x08589e, 0x2b8cbe, 0x4eb3d3, 0x7bccc4, 0xa8ddb5, 0xccebc5, 0xf0f9e8]; - exports.GnBu8 = [0x08589e, 0x2b8cbe, 0x4eb3d3, 0x7bccc4, 0xa8ddb5, 0xccebc5, 0xe0f3db, 0xf7fcf0]; - exports.GnBu9 = [0x084081, 0x0868ac, 0x2b8cbe, 0x4eb3d3, 0x7bccc4, 0xa8ddb5, 0xccebc5, 0xe0f3db, 0xf7fcf0]; - exports.BuGn3 = [0x2ca25f, 0x99d8c9, 0xe5f5f9]; - exports.BuGn4 = [0x238b45, 0x66c2a4, 0xb2e2e2, 0xedf8fb]; - exports.BuGn5 = [0x006d2c, 0x2ca25f, 0x66c2a4, 0xb2e2e2, 0xedf8fb]; - exports.BuGn6 = [0x006d2c, 0x2ca25f, 0x66c2a4, 0x99d8c9, 0xccece6, 0xedf8fb]; - exports.BuGn7 = [0x005824, 0x238b45, 0x41ae76, 0x66c2a4, 0x99d8c9, 0xccece6, 0xedf8fb]; - exports.BuGn8 = [0x005824, 0x238b45, 0x41ae76, 0x66c2a4, 0x99d8c9, 0xccece6, 0xe5f5f9, 0xf7fcfd]; - exports.BuGn9 = [0x00441b, 0x006d2c, 0x238b45, 0x41ae76, 0x66c2a4, 0x99d8c9, 0xccece6, 0xe5f5f9, 0xf7fcfd]; - exports.PuBuGn3 = [0x1c9099, 0xa6bddb, 0xece2f0]; - exports.PuBuGn4 = [0x02818a, 0x67a9cf, 0xbdc9e1, 0xf6eff7]; - exports.PuBuGn5 = [0x016c59, 0x1c9099, 0x67a9cf, 0xbdc9e1, 0xf6eff7]; - exports.PuBuGn6 = [0x016c59, 0x1c9099, 0x67a9cf, 0xa6bddb, 0xd0d1e6, 0xf6eff7]; - exports.PuBuGn7 = [0x016450, 0x02818a, 0x3690c0, 0x67a9cf, 0xa6bddb, 0xd0d1e6, 0xf6eff7]; - exports.PuBuGn8 = [0x016450, 0x02818a, 0x3690c0, 0x67a9cf, 0xa6bddb, 0xd0d1e6, 0xece2f0, 0xfff7fb]; - exports.PuBuGn9 = [0x014636, 0x016c59, 0x02818a, 0x3690c0, 0x67a9cf, 0xa6bddb, 0xd0d1e6, 0xece2f0, 0xfff7fb]; - exports.PuBu3 = [0x2b8cbe, 0xa6bddb, 0xece7f2]; - exports.PuBu4 = [0x0570b0, 0x74a9cf, 0xbdc9e1, 0xf1eef6]; - exports.PuBu5 = [0x045a8d, 0x2b8cbe, 0x74a9cf, 0xbdc9e1, 0xf1eef6]; - exports.PuBu6 = [0x045a8d, 0x2b8cbe, 0x74a9cf, 0xa6bddb, 0xd0d1e6, 0xf1eef6]; - exports.PuBu7 = [0x034e7b, 0x0570b0, 0x3690c0, 0x74a9cf, 0xa6bddb, 0xd0d1e6, 0xf1eef6]; - exports.PuBu8 = [0x034e7b, 0x0570b0, 0x3690c0, 0x74a9cf, 0xa6bddb, 0xd0d1e6, 0xece7f2, 0xfff7fb]; - exports.PuBu9 = [0x023858, 0x045a8d, 0x0570b0, 0x3690c0, 0x74a9cf, 0xa6bddb, 0xd0d1e6, 0xece7f2, 0xfff7fb]; - exports.BuPu3 = [0x8856a7, 0x9ebcda, 0xe0ecf4]; - exports.BuPu4 = [0x88419d, 0x8c96c6, 0xb3cde3, 0xedf8fb]; - exports.BuPu5 = [0x810f7c, 0x8856a7, 0x8c96c6, 0xb3cde3, 0xedf8fb]; - exports.BuPu6 = [0x810f7c, 0x8856a7, 0x8c96c6, 0x9ebcda, 0xbfd3e6, 0xedf8fb]; - exports.BuPu7 = [0x6e016b, 0x88419d, 0x8c6bb1, 0x8c96c6, 0x9ebcda, 0xbfd3e6, 0xedf8fb]; - exports.BuPu8 = [0x6e016b, 0x88419d, 0x8c6bb1, 0x8c96c6, 0x9ebcda, 0xbfd3e6, 0xe0ecf4, 0xf7fcfd]; - exports.BuPu9 = [0x4d004b, 0x810f7c, 0x88419d, 0x8c6bb1, 0x8c96c6, 0x9ebcda, 0xbfd3e6, 0xe0ecf4, 0xf7fcfd]; - exports.RdPu3 = [0xc51b8a, 0xfa9fb5, 0xfde0dd]; - exports.RdPu4 = [0xae017e, 0xf768a1, 0xfbb4b9, 0xfeebe2]; - exports.RdPu5 = [0x7a0177, 0xc51b8a, 0xf768a1, 0xfbb4b9, 0xfeebe2]; - exports.RdPu6 = [0x7a0177, 0xc51b8a, 0xf768a1, 0xfa9fb5, 0xfcc5c0, 0xfeebe2]; - exports.RdPu7 = [0x7a0177, 0xae017e, 0xdd3497, 0xf768a1, 0xfa9fb5, 0xfcc5c0, 0xfeebe2]; - exports.RdPu8 = [0x7a0177, 0xae017e, 0xdd3497, 0xf768a1, 0xfa9fb5, 0xfcc5c0, 0xfde0dd, 0xfff7f3]; - exports.RdPu9 = [0x49006a, 0x7a0177, 0xae017e, 0xdd3497, 0xf768a1, 0xfa9fb5, 0xfcc5c0, 0xfde0dd, 0xfff7f3]; - exports.PuRd3 = [0xdd1c77, 0xc994c7, 0xe7e1ef]; - exports.PuRd4 = [0xce1256, 0xdf65b0, 0xd7b5d8, 0xf1eef6]; - exports.PuRd5 = [0x980043, 0xdd1c77, 0xdf65b0, 0xd7b5d8, 0xf1eef6]; - exports.PuRd6 = [0x980043, 0xdd1c77, 0xdf65b0, 0xc994c7, 0xd4b9da, 0xf1eef6]; - exports.PuRd7 = [0x91003f, 0xce1256, 0xe7298a, 0xdf65b0, 0xc994c7, 0xd4b9da, 0xf1eef6]; - exports.PuRd8 = [0x91003f, 0xce1256, 0xe7298a, 0xdf65b0, 0xc994c7, 0xd4b9da, 0xe7e1ef, 0xf7f4f9]; - exports.PuRd9 = [0x67001f, 0x980043, 0xce1256, 0xe7298a, 0xdf65b0, 0xc994c7, 0xd4b9da, 0xe7e1ef, 0xf7f4f9]; - exports.OrRd3 = [0xe34a33, 0xfdbb84, 0xfee8c8]; - exports.OrRd4 = [0xd7301f, 0xfc8d59, 0xfdcc8a, 0xfef0d9]; - exports.OrRd5 = [0xb30000, 0xe34a33, 0xfc8d59, 0xfdcc8a, 0xfef0d9]; - exports.OrRd6 = [0xb30000, 0xe34a33, 0xfc8d59, 0xfdbb84, 0xfdd49e, 0xfef0d9]; - exports.OrRd7 = [0x990000, 0xd7301f, 0xef6548, 0xfc8d59, 0xfdbb84, 0xfdd49e, 0xfef0d9]; - exports.OrRd8 = [0x990000, 0xd7301f, 0xef6548, 0xfc8d59, 0xfdbb84, 0xfdd49e, 0xfee8c8, 0xfff7ec]; - exports.OrRd9 = [0x7f0000, 0xb30000, 0xd7301f, 0xef6548, 0xfc8d59, 0xfdbb84, 0xfdd49e, 0xfee8c8, 0xfff7ec]; - exports.YlOrRd3 = [0xf03b20, 0xfeb24c, 0xffeda0]; - exports.YlOrRd4 = [0xe31a1c, 0xfd8d3c, 0xfecc5c, 0xffffb2]; - exports.YlOrRd5 = [0xbd0026, 0xf03b20, 0xfd8d3c, 0xfecc5c, 0xffffb2]; - exports.YlOrRd6 = [0xbd0026, 0xf03b20, 0xfd8d3c, 0xfeb24c, 0xfed976, 0xffffb2]; - exports.YlOrRd7 = [0xb10026, 0xe31a1c, 0xfc4e2a, 0xfd8d3c, 0xfeb24c, 0xfed976, 0xffffb2]; - exports.YlOrRd8 = [0xb10026, 0xe31a1c, 0xfc4e2a, 0xfd8d3c, 0xfeb24c, 0xfed976, 0xffeda0, 0xffffcc]; - exports.YlOrRd9 = [0x800026, 0xbd0026, 0xe31a1c, 0xfc4e2a, 0xfd8d3c, 0xfeb24c, 0xfed976, 0xffeda0, 0xffffcc]; - exports.YlOrBr3 = [0xd95f0e, 0xfec44f, 0xfff7bc]; - exports.YlOrBr4 = [0xcc4c02, 0xfe9929, 0xfed98e, 0xffffd4]; - exports.YlOrBr5 = [0x993404, 0xd95f0e, 0xfe9929, 0xfed98e, 0xffffd4]; - exports.YlOrBr6 = [0x993404, 0xd95f0e, 0xfe9929, 0xfec44f, 0xfee391, 0xffffd4]; - exports.YlOrBr7 = [0x8c2d04, 0xcc4c02, 0xec7014, 0xfe9929, 0xfec44f, 0xfee391, 0xffffd4]; - exports.YlOrBr8 = [0x8c2d04, 0xcc4c02, 0xec7014, 0xfe9929, 0xfec44f, 0xfee391, 0xfff7bc, 0xffffe5]; - exports.YlOrBr9 = [0x662506, 0x993404, 0xcc4c02, 0xec7014, 0xfe9929, 0xfec44f, 0xfee391, 0xfff7bc, 0xffffe5]; - exports.Purples3 = [0x756bb1, 0xbcbddc, 0xefedf5]; - exports.Purples4 = [0x6a51a3, 0x9e9ac8, 0xcbc9e2, 0xf2f0f7]; - exports.Purples5 = [0x54278f, 0x756bb1, 0x9e9ac8, 0xcbc9e2, 0xf2f0f7]; - exports.Purples6 = [0x54278f, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0xf2f0f7]; - exports.Purples7 = [0x4a1486, 0x6a51a3, 0x807dba, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0xf2f0f7]; - exports.Purples8 = [0x4a1486, 0x6a51a3, 0x807dba, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0xefedf5, 0xfcfbfd]; - exports.Purples9 = [0x3f007d, 0x54278f, 0x6a51a3, 0x807dba, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0xefedf5, 0xfcfbfd]; - exports.Blues3 = [0x3182bd, 0x9ecae1, 0xdeebf7]; - exports.Blues4 = [0x2171b5, 0x6baed6, 0xbdd7e7, 0xeff3ff]; - exports.Blues5 = [0x08519c, 0x3182bd, 0x6baed6, 0xbdd7e7, 0xeff3ff]; - exports.Blues6 = [0x08519c, 0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xeff3ff]; - exports.Blues7 = [0x084594, 0x2171b5, 0x4292c6, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xeff3ff]; - exports.Blues8 = [0x084594, 0x2171b5, 0x4292c6, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xdeebf7, 0xf7fbff]; - exports.Blues9 = [0x08306b, 0x08519c, 0x2171b5, 0x4292c6, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xdeebf7, 0xf7fbff]; - exports.Greens3 = [0x31a354, 0xa1d99b, 0xe5f5e0]; - exports.Greens4 = [0x238b45, 0x74c476, 0xbae4b3, 0xedf8e9]; - exports.Greens5 = [0x006d2c, 0x31a354, 0x74c476, 0xbae4b3, 0xedf8e9]; - exports.Greens6 = [0x006d2c, 0x31a354, 0x74c476, 0xa1d99b, 0xc7e9c0, 0xedf8e9]; - exports.Greens7 = [0x005a32, 0x238b45, 0x41ab5d, 0x74c476, 0xa1d99b, 0xc7e9c0, 0xedf8e9]; - exports.Greens8 = [0x005a32, 0x238b45, 0x41ab5d, 0x74c476, 0xa1d99b, 0xc7e9c0, 0xe5f5e0, 0xf7fcf5]; - exports.Greens9 = [0x00441b, 0x006d2c, 0x238b45, 0x41ab5d, 0x74c476, 0xa1d99b, 0xc7e9c0, 0xe5f5e0, 0xf7fcf5]; - exports.Oranges3 = [0xe6550d, 0xfdae6b, 0xfee6ce]; - exports.Oranges4 = [0xd94701, 0xfd8d3c, 0xfdbe85, 0xfeedde]; - exports.Oranges5 = [0xa63603, 0xe6550d, 0xfd8d3c, 0xfdbe85, 0xfeedde]; - exports.Oranges6 = [0xa63603, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0xfeedde]; - exports.Oranges7 = [0x8c2d04, 0xd94801, 0xf16913, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0xfeedde]; - exports.Oranges8 = [0x8c2d04, 0xd94801, 0xf16913, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0xfee6ce, 0xfff5eb]; - exports.Oranges9 = [0x7f2704, 0xa63603, 0xd94801, 0xf16913, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0xfee6ce, 0xfff5eb]; - exports.Reds3 = [0xde2d26, 0xfc9272, 0xfee0d2]; - exports.Reds4 = [0xcb181d, 0xfb6a4a, 0xfcae91, 0xfee5d9]; - exports.Reds5 = [0xa50f15, 0xde2d26, 0xfb6a4a, 0xfcae91, 0xfee5d9]; - exports.Reds6 = [0xa50f15, 0xde2d26, 0xfb6a4a, 0xfc9272, 0xfcbba1, 0xfee5d9]; - exports.Reds7 = [0x99000d, 0xcb181d, 0xef3b2c, 0xfb6a4a, 0xfc9272, 0xfcbba1, 0xfee5d9]; - exports.Reds8 = [0x99000d, 0xcb181d, 0xef3b2c, 0xfb6a4a, 0xfc9272, 0xfcbba1, 0xfee0d2, 0xfff5f0]; - exports.Reds9 = [0x67000d, 0xa50f15, 0xcb181d, 0xef3b2c, 0xfb6a4a, 0xfc9272, 0xfcbba1, 0xfee0d2, 0xfff5f0]; - exports.Greys3 = [0x636363, 0xbdbdbd, 0xf0f0f0]; - exports.Greys4 = [0x525252, 0x969696, 0xcccccc, 0xf7f7f7]; - exports.Greys5 = [0x252525, 0x636363, 0x969696, 0xcccccc, 0xf7f7f7]; - exports.Greys6 = [0x252525, 0x636363, 0x969696, 0xbdbdbd, 0xd9d9d9, 0xf7f7f7]; - exports.Greys7 = [0x252525, 0x525252, 0x737373, 0x969696, 0xbdbdbd, 0xd9d9d9, 0xf7f7f7]; - exports.Greys8 = [0x252525, 0x525252, 0x737373, 0x969696, 0xbdbdbd, 0xd9d9d9, 0xf0f0f0, 0xffffff]; - exports.Greys9 = [0x000000, 0x252525, 0x525252, 0x737373, 0x969696, 0xbdbdbd, 0xd9d9d9, 0xf0f0f0, 0xffffff]; - exports.Greys10 = [0x000000, 0x1c1c1c, 0x383838, 0x555555, 0x717171, 0x8d8d8d, 0xaaaaaa, 0xc6c6c6, 0xe2e2e2, 0xffffff]; - exports.Greys11 = [0x000000, 0x191919, 0x333333, 0x4c4c4c, 0x666666, 0x7f7f7f, 0x999999, 0xb2b2b2, 0xcccccc, 0xe5e5e5, 0xffffff]; - exports.Greys256 = [0x000000, 0x010101, 0x020202, 0x030303, 0x040404, 0x050505, 0x060606, 0x070707, 0x080808, 0x090909, 0x0a0a0a, 0x0b0b0b, - 0x0c0c0c, 0x0d0d0d, 0x0e0e0e, 0x0f0f0f, 0x101010, 0x111111, 0x121212, 0x131313, 0x141414, 0x151515, 0x161616, 0x171717, - 0x181818, 0x191919, 0x1a1a1a, 0x1b1b1b, 0x1c1c1c, 0x1d1d1d, 0x1e1e1e, 0x1f1f1f, 0x202020, 0x212121, 0x222222, 0x232323, - 0x242424, 0x252525, 0x262626, 0x272727, 0x282828, 0x292929, 0x2a2a2a, 0x2b2b2b, 0x2c2c2c, 0x2d2d2d, 0x2e2e2e, 0x2f2f2f, - 0x303030, 0x313131, 0x323232, 0x333333, 0x343434, 0x353535, 0x363636, 0x373737, 0x383838, 0x393939, 0x3a3a3a, 0x3b3b3b, - 0x3c3c3c, 0x3d3d3d, 0x3e3e3e, 0x3f3f3f, 0x404040, 0x414141, 0x424242, 0x434343, 0x444444, 0x454545, 0x464646, 0x474747, - 0x484848, 0x494949, 0x4a4a4a, 0x4b4b4b, 0x4c4c4c, 0x4d4d4d, 0x4e4e4e, 0x4f4f4f, 0x505050, 0x515151, 0x525252, 0x535353, - 0x545454, 0x555555, 0x565656, 0x575757, 0x585858, 0x595959, 0x5a5a5a, 0x5b5b5b, 0x5c5c5c, 0x5d5d5d, 0x5e5e5e, 0x5f5f5f, - 0x606060, 0x616161, 0x626262, 0x636363, 0x646464, 0x656565, 0x666666, 0x676767, 0x686868, 0x696969, 0x6a6a6a, 0x6b6b6b, - 0x6c6c6c, 0x6d6d6d, 0x6e6e6e, 0x6f6f6f, 0x707070, 0x717171, 0x727272, 0x737373, 0x747474, 0x757575, 0x767676, 0x777777, - 0x787878, 0x797979, 0x7a7a7a, 0x7b7b7b, 0x7c7c7c, 0x7d7d7d, 0x7e7e7e, 0x7f7f7f, 0x808080, 0x818181, 0x828282, 0x838383, - 0x848484, 0x858585, 0x868686, 0x878787, 0x888888, 0x898989, 0x8a8a8a, 0x8b8b8b, 0x8c8c8c, 0x8d8d8d, 0x8e8e8e, 0x8f8f8f, - 0x909090, 0x919191, 0x929292, 0x939393, 0x949494, 0x959595, 0x969696, 0x979797, 0x989898, 0x999999, 0x9a9a9a, 0x9b9b9b, - 0x9c9c9c, 0x9d9d9d, 0x9e9e9e, 0x9f9f9f, 0xa0a0a0, 0xa1a1a1, 0xa2a2a2, 0xa3a3a3, 0xa4a4a4, 0xa5a5a5, 0xa6a6a6, 0xa7a7a7, - 0xa8a8a8, 0xa9a9a9, 0xaaaaaa, 0xababab, 0xacacac, 0xadadad, 0xaeaeae, 0xafafaf, 0xb0b0b0, 0xb1b1b1, 0xb2b2b2, 0xb3b3b3, - 0xb4b4b4, 0xb5b5b5, 0xb6b6b6, 0xb7b7b7, 0xb8b8b8, 0xb9b9b9, 0xbababa, 0xbbbbbb, 0xbcbcbc, 0xbdbdbd, 0xbebebe, 0xbfbfbf, - 0xc0c0c0, 0xc1c1c1, 0xc2c2c2, 0xc3c3c3, 0xc4c4c4, 0xc5c5c5, 0xc6c6c6, 0xc7c7c7, 0xc8c8c8, 0xc9c9c9, 0xcacaca, 0xcbcbcb, - 0xcccccc, 0xcdcdcd, 0xcecece, 0xcfcfcf, 0xd0d0d0, 0xd1d1d1, 0xd2d2d2, 0xd3d3d3, 0xd4d4d4, 0xd5d5d5, 0xd6d6d6, 0xd7d7d7, - 0xd8d8d8, 0xd9d9d9, 0xdadada, 0xdbdbdb, 0xdcdcdc, 0xdddddd, 0xdedede, 0xdfdfdf, 0xe0e0e0, 0xe1e1e1, 0xe2e2e2, 0xe3e3e3, - 0xe4e4e4, 0xe5e5e5, 0xe6e6e6, 0xe7e7e7, 0xe8e8e8, 0xe9e9e9, 0xeaeaea, 0xebebeb, 0xececec, 0xededed, 0xeeeeee, 0xefefef, - 0xf0f0f0, 0xf1f1f1, 0xf2f2f2, 0xf3f3f3, 0xf4f4f4, 0xf5f5f5, 0xf6f6f6, 0xf7f7f7, 0xf8f8f8, 0xf9f9f9, 0xfafafa, 0xfbfbfb, - 0xfcfcfc, 0xfdfdfd, 0xfefefe, 0xffffff]; - exports.PuOr3 = [0x998ec3, 0xf7f7f7, 0xf1a340]; - exports.PuOr4 = [0x5e3c99, 0xb2abd2, 0xfdb863, 0xe66101]; - exports.PuOr5 = [0x5e3c99, 0xb2abd2, 0xf7f7f7, 0xfdb863, 0xe66101]; - exports.PuOr6 = [0x542788, 0x998ec3, 0xd8daeb, 0xfee0b6, 0xf1a340, 0xb35806]; - exports.PuOr7 = [0x542788, 0x998ec3, 0xd8daeb, 0xf7f7f7, 0xfee0b6, 0xf1a340, 0xb35806]; - exports.PuOr8 = [0x542788, 0x8073ac, 0xb2abd2, 0xd8daeb, 0xfee0b6, 0xfdb863, 0xe08214, 0xb35806]; - exports.PuOr9 = [0x542788, 0x8073ac, 0xb2abd2, 0xd8daeb, 0xf7f7f7, 0xfee0b6, 0xfdb863, 0xe08214, 0xb35806]; - exports.PuOr10 = [0x2d004b, 0x542788, 0x8073ac, 0xb2abd2, 0xd8daeb, 0xfee0b6, 0xfdb863, 0xe08214, 0xb35806, 0x7f3b08]; - exports.PuOr11 = [0x2d004b, 0x542788, 0x8073ac, 0xb2abd2, 0xd8daeb, 0xf7f7f7, 0xfee0b6, 0xfdb863, 0xe08214, 0xb35806, 0x7f3b08]; - exports.BrBG3 = [0x5ab4ac, 0xf5f5f5, 0xd8b365]; - exports.BrBG4 = [0x018571, 0x80cdc1, 0xdfc27d, 0xa6611a]; - exports.BrBG5 = [0x018571, 0x80cdc1, 0xf5f5f5, 0xdfc27d, 0xa6611a]; - exports.BrBG6 = [0x01665e, 0x5ab4ac, 0xc7eae5, 0xf6e8c3, 0xd8b365, 0x8c510a]; - exports.BrBG7 = [0x01665e, 0x5ab4ac, 0xc7eae5, 0xf5f5f5, 0xf6e8c3, 0xd8b365, 0x8c510a]; - exports.BrBG8 = [0x01665e, 0x35978f, 0x80cdc1, 0xc7eae5, 0xf6e8c3, 0xdfc27d, 0xbf812d, 0x8c510a]; - exports.BrBG9 = [0x01665e, 0x35978f, 0x80cdc1, 0xc7eae5, 0xf5f5f5, 0xf6e8c3, 0xdfc27d, 0xbf812d, 0x8c510a]; - exports.BrBG10 = [0x003c30, 0x01665e, 0x35978f, 0x80cdc1, 0xc7eae5, 0xf6e8c3, 0xdfc27d, 0xbf812d, 0x8c510a, 0x543005]; - exports.BrBG11 = [0x003c30, 0x01665e, 0x35978f, 0x80cdc1, 0xc7eae5, 0xf5f5f5, 0xf6e8c3, 0xdfc27d, 0xbf812d, 0x8c510a, 0x543005]; - exports.PRGn3 = [0x7fbf7b, 0xf7f7f7, 0xaf8dc3]; - exports.PRGn4 = [0x008837, 0xa6dba0, 0xc2a5cf, 0x7b3294]; - exports.PRGn5 = [0x008837, 0xa6dba0, 0xf7f7f7, 0xc2a5cf, 0x7b3294]; - exports.PRGn6 = [0x1b7837, 0x7fbf7b, 0xd9f0d3, 0xe7d4e8, 0xaf8dc3, 0x762a83]; - exports.PRGn7 = [0x1b7837, 0x7fbf7b, 0xd9f0d3, 0xf7f7f7, 0xe7d4e8, 0xaf8dc3, 0x762a83]; - exports.PRGn8 = [0x1b7837, 0x5aae61, 0xa6dba0, 0xd9f0d3, 0xe7d4e8, 0xc2a5cf, 0x9970ab, 0x762a83]; - exports.PRGn9 = [0x1b7837, 0x5aae61, 0xa6dba0, 0xd9f0d3, 0xf7f7f7, 0xe7d4e8, 0xc2a5cf, 0x9970ab, 0x762a83]; - exports.PRGn10 = [0x00441b, 0x1b7837, 0x5aae61, 0xa6dba0, 0xd9f0d3, 0xe7d4e8, 0xc2a5cf, 0x9970ab, 0x762a83, 0x40004b]; - exports.PRGn11 = [0x00441b, 0x1b7837, 0x5aae61, 0xa6dba0, 0xd9f0d3, 0xf7f7f7, 0xe7d4e8, 0xc2a5cf, 0x9970ab, 0x762a83, 0x40004b]; - exports.PiYG3 = [0xa1d76a, 0xf7f7f7, 0xe9a3c9]; - exports.PiYG4 = [0x4dac26, 0xb8e186, 0xf1b6da, 0xd01c8b]; - exports.PiYG5 = [0x4dac26, 0xb8e186, 0xf7f7f7, 0xf1b6da, 0xd01c8b]; - exports.PiYG6 = [0x4d9221, 0xa1d76a, 0xe6f5d0, 0xfde0ef, 0xe9a3c9, 0xc51b7d]; - exports.PiYG7 = [0x4d9221, 0xa1d76a, 0xe6f5d0, 0xf7f7f7, 0xfde0ef, 0xe9a3c9, 0xc51b7d]; - exports.PiYG8 = [0x4d9221, 0x7fbc41, 0xb8e186, 0xe6f5d0, 0xfde0ef, 0xf1b6da, 0xde77ae, 0xc51b7d]; - exports.PiYG9 = [0x4d9221, 0x7fbc41, 0xb8e186, 0xe6f5d0, 0xf7f7f7, 0xfde0ef, 0xf1b6da, 0xde77ae, 0xc51b7d]; - exports.PiYG10 = [0x276419, 0x4d9221, 0x7fbc41, 0xb8e186, 0xe6f5d0, 0xfde0ef, 0xf1b6da, 0xde77ae, 0xc51b7d, 0x8e0152]; - exports.PiYG11 = [0x276419, 0x4d9221, 0x7fbc41, 0xb8e186, 0xe6f5d0, 0xf7f7f7, 0xfde0ef, 0xf1b6da, 0xde77ae, 0xc51b7d, 0x8e0152]; - exports.RdBu3 = [0x67a9cf, 0xf7f7f7, 0xef8a62]; - exports.RdBu4 = [0x0571b0, 0x92c5de, 0xf4a582, 0xca0020]; - exports.RdBu5 = [0x0571b0, 0x92c5de, 0xf7f7f7, 0xf4a582, 0xca0020]; - exports.RdBu6 = [0x2166ac, 0x67a9cf, 0xd1e5f0, 0xfddbc7, 0xef8a62, 0xb2182b]; - exports.RdBu7 = [0x2166ac, 0x67a9cf, 0xd1e5f0, 0xf7f7f7, 0xfddbc7, 0xef8a62, 0xb2182b]; - exports.RdBu8 = [0x2166ac, 0x4393c3, 0x92c5de, 0xd1e5f0, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b]; - exports.RdBu9 = [0x2166ac, 0x4393c3, 0x92c5de, 0xd1e5f0, 0xf7f7f7, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b]; - exports.RdBu10 = [0x053061, 0x2166ac, 0x4393c3, 0x92c5de, 0xd1e5f0, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b, 0x67001f]; - exports.RdBu11 = [0x053061, 0x2166ac, 0x4393c3, 0x92c5de, 0xd1e5f0, 0xf7f7f7, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b, 0x67001f]; - exports.RdGy3 = [0x999999, 0xffffff, 0xef8a62]; - exports.RdGy4 = [0x404040, 0xbababa, 0xf4a582, 0xca0020]; - exports.RdGy5 = [0x404040, 0xbababa, 0xffffff, 0xf4a582, 0xca0020]; - exports.RdGy6 = [0x4d4d4d, 0x999999, 0xe0e0e0, 0xfddbc7, 0xef8a62, 0xb2182b]; - exports.RdGy7 = [0x4d4d4d, 0x999999, 0xe0e0e0, 0xffffff, 0xfddbc7, 0xef8a62, 0xb2182b]; - exports.RdGy8 = [0x4d4d4d, 0x878787, 0xbababa, 0xe0e0e0, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b]; - exports.RdGy9 = [0x4d4d4d, 0x878787, 0xbababa, 0xe0e0e0, 0xffffff, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b]; - exports.RdGy10 = [0x1a1a1a, 0x4d4d4d, 0x878787, 0xbababa, 0xe0e0e0, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b, 0x67001f]; - exports.RdGy11 = [0x1a1a1a, 0x4d4d4d, 0x878787, 0xbababa, 0xe0e0e0, 0xffffff, 0xfddbc7, 0xf4a582, 0xd6604d, 0xb2182b, 0x67001f]; - exports.RdYlBu3 = [0x91bfdb, 0xffffbf, 0xfc8d59]; - exports.RdYlBu4 = [0x2c7bb6, 0xabd9e9, 0xfdae61, 0xd7191c]; - exports.RdYlBu5 = [0x2c7bb6, 0xabd9e9, 0xffffbf, 0xfdae61, 0xd7191c]; - exports.RdYlBu6 = [0x4575b4, 0x91bfdb, 0xe0f3f8, 0xfee090, 0xfc8d59, 0xd73027]; - exports.RdYlBu7 = [0x4575b4, 0x91bfdb, 0xe0f3f8, 0xffffbf, 0xfee090, 0xfc8d59, 0xd73027]; - exports.RdYlBu8 = [0x4575b4, 0x74add1, 0xabd9e9, 0xe0f3f8, 0xfee090, 0xfdae61, 0xf46d43, 0xd73027]; - exports.RdYlBu9 = [0x4575b4, 0x74add1, 0xabd9e9, 0xe0f3f8, 0xffffbf, 0xfee090, 0xfdae61, 0xf46d43, 0xd73027]; - exports.RdYlBu10 = [0x313695, 0x4575b4, 0x74add1, 0xabd9e9, 0xe0f3f8, 0xfee090, 0xfdae61, 0xf46d43, 0xd73027, 0xa50026]; - exports.RdYlBu11 = [0x313695, 0x4575b4, 0x74add1, 0xabd9e9, 0xe0f3f8, 0xffffbf, 0xfee090, 0xfdae61, 0xf46d43, 0xd73027, 0xa50026]; - exports.Spectral3 = [0x99d594, 0xffffbf, 0xfc8d59]; - exports.Spectral4 = [0x2b83ba, 0xabdda4, 0xfdae61, 0xd7191c]; - exports.Spectral5 = [0x2b83ba, 0xabdda4, 0xffffbf, 0xfdae61, 0xd7191c]; - exports.Spectral6 = [0x3288bd, 0x99d594, 0xe6f598, 0xfee08b, 0xfc8d59, 0xd53e4f]; - exports.Spectral7 = [0x3288bd, 0x99d594, 0xe6f598, 0xffffbf, 0xfee08b, 0xfc8d59, 0xd53e4f]; - exports.Spectral8 = [0x3288bd, 0x66c2a5, 0xabdda4, 0xe6f598, 0xfee08b, 0xfdae61, 0xf46d43, 0xd53e4f]; - exports.Spectral9 = [0x3288bd, 0x66c2a5, 0xabdda4, 0xe6f598, 0xffffbf, 0xfee08b, 0xfdae61, 0xf46d43, 0xd53e4f]; - exports.Spectral10 = [0x5e4fa2, 0x3288bd, 0x66c2a5, 0xabdda4, 0xe6f598, 0xfee08b, 0xfdae61, 0xf46d43, 0xd53e4f, 0x9e0142]; - exports.Spectral11 = [0x5e4fa2, 0x3288bd, 0x66c2a5, 0xabdda4, 0xe6f598, 0xffffbf, 0xfee08b, 0xfdae61, 0xf46d43, 0xd53e4f, 0x9e0142]; - exports.RdYlGn3 = [0x91cf60, 0xffffbf, 0xfc8d59]; - exports.RdYlGn4 = [0x1a9641, 0xa6d96a, 0xfdae61, 0xd7191c]; - exports.RdYlGn5 = [0x1a9641, 0xa6d96a, 0xffffbf, 0xfdae61, 0xd7191c]; - exports.RdYlGn6 = [0x1a9850, 0x91cf60, 0xd9ef8b, 0xfee08b, 0xfc8d59, 0xd73027]; - exports.RdYlGn7 = [0x1a9850, 0x91cf60, 0xd9ef8b, 0xffffbf, 0xfee08b, 0xfc8d59, 0xd73027]; - exports.RdYlGn8 = [0x1a9850, 0x66bd63, 0xa6d96a, 0xd9ef8b, 0xfee08b, 0xfdae61, 0xf46d43, 0xd73027]; - exports.RdYlGn9 = [0x1a9850, 0x66bd63, 0xa6d96a, 0xd9ef8b, 0xffffbf, 0xfee08b, 0xfdae61, 0xf46d43, 0xd73027]; - exports.RdYlGn10 = [0x006837, 0x1a9850, 0x66bd63, 0xa6d96a, 0xd9ef8b, 0xfee08b, 0xfdae61, 0xf46d43, 0xd73027, 0xa50026]; - exports.RdYlGn11 = [0x006837, 0x1a9850, 0x66bd63, 0xa6d96a, 0xd9ef8b, 0xffffbf, 0xfee08b, 0xfdae61, 0xf46d43, 0xd73027, 0xa50026]; - exports.Inferno3 = [0x440154, 0x208f8c, 0xfde724]; - exports.Inferno4 = [0x000003, 0x781c6d, 0xed6825, 0xfcfea4]; - exports.Inferno5 = [0x000003, 0x550f6d, 0xba3655, 0xf98c09, 0xfcfea4]; - exports.Inferno6 = [0x000003, 0x410967, 0x932567, 0xdc5039, 0xfba40a, 0xfcfea4]; - exports.Inferno7 = [0x000003, 0x32095d, 0x781c6d, 0xba3655, 0xed6825, 0xfbb318, 0xfcfea4]; - exports.Inferno8 = [0x000003, 0x270b52, 0x63146e, 0x9e2963, 0xd24742, 0xf57c15, 0xfabf25, 0xfcfea4]; - exports.Inferno9 = [0x000003, 0x1f0c47, 0x550f6d, 0x88216a, 0xba3655, 0xe35832, 0xf98c09, 0xf8c931, 0xfcfea4]; - exports.Inferno10 = [0x000003, 0x1a0b40, 0x4a0b6a, 0x781c6d, 0xa42c60, 0xcd4247, 0xed6825, 0xfb9906, 0xf7cf3a, 0xfcfea4]; - exports.Inferno11 = [0x000003, 0x160b39, 0x410967, 0x6a176e, 0x932567, 0xba3655, 0xdc5039, 0xf2751a, 0xfba40a, 0xf6d542, 0xfcfea4]; - exports.Inferno256 = [0x000003, 0x000004, 0x000006, 0x010007, 0x010109, 0x01010b, 0x02010e, 0x020210, 0x030212, 0x040314, 0x040316, 0x050418, - 0x06041b, 0x07051d, 0x08061f, 0x090621, 0x0a0723, 0x0b0726, 0x0d0828, 0x0e082a, 0x0f092d, 0x10092f, 0x120a32, 0x130a34, - 0x140b36, 0x160b39, 0x170b3b, 0x190b3e, 0x1a0b40, 0x1c0c43, 0x1d0c45, 0x1f0c47, 0x200c4a, 0x220b4c, 0x240b4e, 0x260b50, - 0x270b52, 0x290b54, 0x2b0a56, 0x2d0a58, 0x2e0a5a, 0x300a5c, 0x32095d, 0x34095f, 0x350960, 0x370961, 0x390962, 0x3b0964, - 0x3c0965, 0x3e0966, 0x400966, 0x410967, 0x430a68, 0x450a69, 0x460a69, 0x480b6a, 0x4a0b6a, 0x4b0c6b, 0x4d0c6b, 0x4f0d6c, - 0x500d6c, 0x520e6c, 0x530e6d, 0x550f6d, 0x570f6d, 0x58106d, 0x5a116d, 0x5b116e, 0x5d126e, 0x5f126e, 0x60136e, 0x62146e, - 0x63146e, 0x65156e, 0x66156e, 0x68166e, 0x6a176e, 0x6b176e, 0x6d186e, 0x6e186e, 0x70196e, 0x72196d, 0x731a6d, 0x751b6d, - 0x761b6d, 0x781c6d, 0x7a1c6d, 0x7b1d6c, 0x7d1d6c, 0x7e1e6c, 0x801f6b, 0x811f6b, 0x83206b, 0x85206a, 0x86216a, 0x88216a, - 0x892269, 0x8b2269, 0x8d2369, 0x8e2468, 0x902468, 0x912567, 0x932567, 0x952666, 0x962666, 0x982765, 0x992864, 0x9b2864, - 0x9c2963, 0x9e2963, 0xa02a62, 0xa12b61, 0xa32b61, 0xa42c60, 0xa62c5f, 0xa72d5f, 0xa92e5e, 0xab2e5d, 0xac2f5c, 0xae305b, - 0xaf315b, 0xb1315a, 0xb23259, 0xb43358, 0xb53357, 0xb73456, 0xb83556, 0xba3655, 0xbb3754, 0xbd3753, 0xbe3852, 0xbf3951, - 0xc13a50, 0xc23b4f, 0xc43c4e, 0xc53d4d, 0xc73e4c, 0xc83e4b, 0xc93f4a, 0xcb4049, 0xcc4148, 0xcd4247, 0xcf4446, 0xd04544, - 0xd14643, 0xd24742, 0xd44841, 0xd54940, 0xd64a3f, 0xd74b3e, 0xd94d3d, 0xda4e3b, 0xdb4f3a, 0xdc5039, 0xdd5238, 0xde5337, - 0xdf5436, 0xe05634, 0xe25733, 0xe35832, 0xe45a31, 0xe55b30, 0xe65c2e, 0xe65e2d, 0xe75f2c, 0xe8612b, 0xe9622a, 0xea6428, - 0xeb6527, 0xec6726, 0xed6825, 0xed6a23, 0xee6c22, 0xef6d21, 0xf06f1f, 0xf0701e, 0xf1721d, 0xf2741c, 0xf2751a, 0xf37719, - 0xf37918, 0xf47a16, 0xf57c15, 0xf57e14, 0xf68012, 0xf68111, 0xf78310, 0xf7850e, 0xf8870d, 0xf8880c, 0xf88a0b, 0xf98c09, - 0xf98e08, 0xf99008, 0xfa9107, 0xfa9306, 0xfa9506, 0xfa9706, 0xfb9906, 0xfb9b06, 0xfb9d06, 0xfb9e07, 0xfba007, 0xfba208, - 0xfba40a, 0xfba60b, 0xfba80d, 0xfbaa0e, 0xfbac10, 0xfbae12, 0xfbb014, 0xfbb116, 0xfbb318, 0xfbb51a, 0xfbb71c, 0xfbb91e, - 0xfabb21, 0xfabd23, 0xfabf25, 0xfac128, 0xf9c32a, 0xf9c52c, 0xf9c72f, 0xf8c931, 0xf8cb34, 0xf8cd37, 0xf7cf3a, 0xf7d13c, - 0xf6d33f, 0xf6d542, 0xf5d745, 0xf5d948, 0xf4db4b, 0xf4dc4f, 0xf3de52, 0xf3e056, 0xf3e259, 0xf2e45d, 0xf2e660, 0xf1e864, - 0xf1e968, 0xf1eb6c, 0xf1ed70, 0xf1ee74, 0xf1f079, 0xf1f27d, 0xf2f381, 0xf2f485, 0xf3f689, 0xf4f78d, 0xf5f891, 0xf6fa95, - 0xf7fb99, 0xf9fc9d, 0xfafda0, 0xfcfea4]; - exports.Magma3 = [0x000003, 0xb53679, 0xfbfcbf]; - exports.Magma4 = [0x000003, 0x711f81, 0xf0605d, 0xfbfcbf]; - exports.Magma5 = [0x000003, 0x4f117b, 0xb53679, 0xfb8660, 0xfbfcbf]; - exports.Magma6 = [0x000003, 0x3b0f6f, 0x8c2980, 0xdd4968, 0xfd9f6c, 0xfbfcbf]; - exports.Magma7 = [0x000003, 0x2b115e, 0x711f81, 0xb53679, 0xf0605d, 0xfeae76, 0xfbfcbf]; - exports.Magma8 = [0x000003, 0x221150, 0x5d177e, 0x972c7f, 0xd1426e, 0xf8755c, 0xfeb97f, 0xfbfcbf]; - exports.Magma9 = [0x000003, 0x1b1044, 0x4f117b, 0x812581, 0xb53679, 0xe55063, 0xfb8660, 0xfec286, 0xfbfcbf]; - exports.Magma10 = [0x000003, 0x170f3c, 0x430f75, 0x711f81, 0x9e2e7e, 0xcb3e71, 0xf0605d, 0xfc9366, 0xfec78b, 0xfbfcbf]; - exports.Magma11 = [0x000003, 0x140d35, 0x3b0f6f, 0x63197f, 0x8c2980, 0xb53679, 0xdd4968, 0xf66e5b, 0xfd9f6c, 0xfdcd90, 0xfbfcbf]; - exports.Magma256 = [0x000003, 0x000004, 0x000006, 0x010007, 0x010109, 0x01010b, 0x02020d, 0x02020f, 0x030311, 0x040313, 0x040415, 0x050417, - 0x060519, 0x07051b, 0x08061d, 0x09071f, 0x0a0722, 0x0b0824, 0x0c0926, 0x0d0a28, 0x0e0a2a, 0x0f0b2c, 0x100c2f, 0x110c31, - 0x120d33, 0x140d35, 0x150e38, 0x160e3a, 0x170f3c, 0x180f3f, 0x1a1041, 0x1b1044, 0x1c1046, 0x1e1049, 0x1f114b, 0x20114d, - 0x221150, 0x231152, 0x251155, 0x261157, 0x281159, 0x2a115c, 0x2b115e, 0x2d1060, 0x2f1062, 0x301065, 0x321067, 0x341068, - 0x350f6a, 0x370f6c, 0x390f6e, 0x3b0f6f, 0x3c0f71, 0x3e0f72, 0x400f73, 0x420f74, 0x430f75, 0x450f76, 0x470f77, 0x481078, - 0x4a1079, 0x4b1079, 0x4d117a, 0x4f117b, 0x50127b, 0x52127c, 0x53137c, 0x55137d, 0x57147d, 0x58157e, 0x5a157e, 0x5b167e, - 0x5d177e, 0x5e177f, 0x60187f, 0x61187f, 0x63197f, 0x651a80, 0x661a80, 0x681b80, 0x691c80, 0x6b1c80, 0x6c1d80, 0x6e1e81, - 0x6f1e81, 0x711f81, 0x731f81, 0x742081, 0x762181, 0x772181, 0x792281, 0x7a2281, 0x7c2381, 0x7e2481, 0x7f2481, 0x812581, - 0x822581, 0x842681, 0x852681, 0x872781, 0x892881, 0x8a2881, 0x8c2980, 0x8d2980, 0x8f2a80, 0x912a80, 0x922b80, 0x942b80, - 0x952c80, 0x972c7f, 0x992d7f, 0x9a2d7f, 0x9c2e7f, 0x9e2e7e, 0x9f2f7e, 0xa12f7e, 0xa3307e, 0xa4307d, 0xa6317d, 0xa7317d, - 0xa9327c, 0xab337c, 0xac337b, 0xae347b, 0xb0347b, 0xb1357a, 0xb3357a, 0xb53679, 0xb63679, 0xb83778, 0xb93778, 0xbb3877, - 0xbd3977, 0xbe3976, 0xc03a75, 0xc23a75, 0xc33b74, 0xc53c74, 0xc63c73, 0xc83d72, 0xca3e72, 0xcb3e71, 0xcd3f70, 0xce4070, - 0xd0416f, 0xd1426e, 0xd3426d, 0xd4436d, 0xd6446c, 0xd7456b, 0xd9466a, 0xda4769, 0xdc4869, 0xdd4968, 0xde4a67, 0xe04b66, - 0xe14c66, 0xe24d65, 0xe44e64, 0xe55063, 0xe65162, 0xe75262, 0xe85461, 0xea5560, 0xeb5660, 0xec585f, 0xed595f, 0xee5b5e, - 0xee5d5d, 0xef5e5d, 0xf0605d, 0xf1615c, 0xf2635c, 0xf3655c, 0xf3675b, 0xf4685b, 0xf56a5b, 0xf56c5b, 0xf66e5b, 0xf6705b, - 0xf7715b, 0xf7735c, 0xf8755c, 0xf8775c, 0xf9795c, 0xf97b5d, 0xf97d5d, 0xfa7f5e, 0xfa805e, 0xfa825f, 0xfb8460, 0xfb8660, - 0xfb8861, 0xfb8a62, 0xfc8c63, 0xfc8e63, 0xfc9064, 0xfc9265, 0xfc9366, 0xfd9567, 0xfd9768, 0xfd9969, 0xfd9b6a, 0xfd9d6b, - 0xfd9f6c, 0xfda16e, 0xfda26f, 0xfda470, 0xfea671, 0xfea873, 0xfeaa74, 0xfeac75, 0xfeae76, 0xfeaf78, 0xfeb179, 0xfeb37b, - 0xfeb57c, 0xfeb77d, 0xfeb97f, 0xfebb80, 0xfebc82, 0xfebe83, 0xfec085, 0xfec286, 0xfec488, 0xfec689, 0xfec78b, 0xfec98d, - 0xfecb8e, 0xfdcd90, 0xfdcf92, 0xfdd193, 0xfdd295, 0xfdd497, 0xfdd698, 0xfdd89a, 0xfdda9c, 0xfddc9d, 0xfddd9f, 0xfddfa1, - 0xfde1a3, 0xfce3a5, 0xfce5a6, 0xfce6a8, 0xfce8aa, 0xfceaac, 0xfcecae, 0xfceeb0, 0xfcf0b1, 0xfcf1b3, 0xfcf3b5, 0xfcf5b7, - 0xfbf7b9, 0xfbf9bb, 0xfbfabd, 0xfbfcbf]; - exports.Plasma3 = [0x0c0786, 0xca4678, 0xeff821]; - exports.Plasma4 = [0x0c0786, 0x9b179e, 0xec7853, 0xeff821]; - exports.Plasma5 = [0x0c0786, 0x7c02a7, 0xca4678, 0xf79341, 0xeff821]; - exports.Plasma6 = [0x0c0786, 0x6a00a7, 0xb02a8f, 0xe06461, 0xfca635, 0xeff821]; - exports.Plasma7 = [0x0c0786, 0x5c00a5, 0x9b179e, 0xca4678, 0xec7853, 0xfdb22f, 0xeff821]; - exports.Plasma8 = [0x0c0786, 0x5201a3, 0x8908a5, 0xb83289, 0xda5a68, 0xf38748, 0xfdbb2b, 0xeff821]; - exports.Plasma9 = [0x0c0786, 0x4a02a0, 0x7c02a7, 0xa82296, 0xca4678, 0xe56b5c, 0xf79341, 0xfdc328, 0xeff821]; - exports.Plasma10 = [0x0c0786, 0x45039e, 0x7200a8, 0x9b179e, 0xbc3685, 0xd7566c, 0xec7853, 0xfa9d3a, 0xfcc726, 0xeff821]; - exports.Plasma11 = [0x0c0786, 0x40039c, 0x6a00a7, 0x8f0da3, 0xb02a8f, 0xca4678, 0xe06461, 0xf1824c, 0xfca635, 0xfccc25, 0xeff821]; - exports.Plasma256 = [0x0c0786, 0x100787, 0x130689, 0x15068a, 0x18068b, 0x1b068c, 0x1d068d, 0x1f058e, 0x21058f, 0x230590, 0x250591, 0x270592, - 0x290593, 0x2b0594, 0x2d0494, 0x2f0495, 0x310496, 0x330497, 0x340498, 0x360498, 0x380499, 0x3a049a, 0x3b039a, 0x3d039b, - 0x3f039c, 0x40039c, 0x42039d, 0x44039e, 0x45039e, 0x47029f, 0x49029f, 0x4a02a0, 0x4c02a1, 0x4e02a1, 0x4f02a2, 0x5101a2, - 0x5201a3, 0x5401a3, 0x5601a3, 0x5701a4, 0x5901a4, 0x5a00a5, 0x5c00a5, 0x5e00a5, 0x5f00a6, 0x6100a6, 0x6200a6, 0x6400a7, - 0x6500a7, 0x6700a7, 0x6800a7, 0x6a00a7, 0x6c00a8, 0x6d00a8, 0x6f00a8, 0x7000a8, 0x7200a8, 0x7300a8, 0x7500a8, 0x7601a8, - 0x7801a8, 0x7901a8, 0x7b02a8, 0x7c02a7, 0x7e03a7, 0x7f03a7, 0x8104a7, 0x8204a7, 0x8405a6, 0x8506a6, 0x8607a6, 0x8807a5, - 0x8908a5, 0x8b09a4, 0x8c0aa4, 0x8e0ca4, 0x8f0da3, 0x900ea3, 0x920fa2, 0x9310a1, 0x9511a1, 0x9612a0, 0x9713a0, 0x99149f, - 0x9a159e, 0x9b179e, 0x9d189d, 0x9e199c, 0x9f1a9b, 0xa01b9b, 0xa21c9a, 0xa31d99, 0xa41e98, 0xa51f97, 0xa72197, 0xa82296, - 0xa92395, 0xaa2494, 0xac2593, 0xad2692, 0xae2791, 0xaf2890, 0xb02a8f, 0xb12b8f, 0xb22c8e, 0xb42d8d, 0xb52e8c, 0xb62f8b, - 0xb7308a, 0xb83289, 0xb93388, 0xba3487, 0xbb3586, 0xbc3685, 0xbd3784, 0xbe3883, 0xbf3982, 0xc03b81, 0xc13c80, 0xc23d80, - 0xc33e7f, 0xc43f7e, 0xc5407d, 0xc6417c, 0xc7427b, 0xc8447a, 0xc94579, 0xca4678, 0xcb4777, 0xcc4876, 0xcd4975, 0xce4a75, - 0xcf4b74, 0xd04d73, 0xd14e72, 0xd14f71, 0xd25070, 0xd3516f, 0xd4526e, 0xd5536d, 0xd6556d, 0xd7566c, 0xd7576b, 0xd8586a, - 0xd95969, 0xda5a68, 0xdb5b67, 0xdc5d66, 0xdc5e66, 0xdd5f65, 0xde6064, 0xdf6163, 0xdf6262, 0xe06461, 0xe16560, 0xe26660, - 0xe3675f, 0xe3685e, 0xe46a5d, 0xe56b5c, 0xe56c5b, 0xe66d5a, 0xe76e5a, 0xe87059, 0xe87158, 0xe97257, 0xea7356, 0xea7455, - 0xeb7654, 0xec7754, 0xec7853, 0xed7952, 0xed7b51, 0xee7c50, 0xef7d4f, 0xef7e4e, 0xf0804d, 0xf0814d, 0xf1824c, 0xf2844b, - 0xf2854a, 0xf38649, 0xf38748, 0xf48947, 0xf48a47, 0xf58b46, 0xf58d45, 0xf68e44, 0xf68f43, 0xf69142, 0xf79241, 0xf79341, - 0xf89540, 0xf8963f, 0xf8983e, 0xf9993d, 0xf99a3c, 0xfa9c3b, 0xfa9d3a, 0xfa9f3a, 0xfaa039, 0xfba238, 0xfba337, 0xfba436, - 0xfca635, 0xfca735, 0xfca934, 0xfcaa33, 0xfcac32, 0xfcad31, 0xfdaf31, 0xfdb030, 0xfdb22f, 0xfdb32e, 0xfdb52d, 0xfdb62d, - 0xfdb82c, 0xfdb92b, 0xfdbb2b, 0xfdbc2a, 0xfdbe29, 0xfdc029, 0xfdc128, 0xfdc328, 0xfdc427, 0xfdc626, 0xfcc726, 0xfcc926, - 0xfccb25, 0xfccc25, 0xfcce25, 0xfbd024, 0xfbd124, 0xfbd324, 0xfad524, 0xfad624, 0xfad824, 0xf9d924, 0xf9db24, 0xf8dd24, - 0xf8df24, 0xf7e024, 0xf7e225, 0xf6e425, 0xf6e525, 0xf5e726, 0xf5e926, 0xf4ea26, 0xf3ec26, 0xf3ee26, 0xf2f026, 0xf2f126, - 0xf1f326, 0xf0f525, 0xf0f623, 0xeff821]; - exports.Viridis3 = [0x440154, 0x208f8c, 0xfde724]; - exports.Viridis4 = [0x440154, 0x30678d, 0x35b778, 0xfde724]; - exports.Viridis5 = [0x440154, 0x3b518a, 0x208f8c, 0x5bc862, 0xfde724]; - exports.Viridis6 = [0x440154, 0x404387, 0x29788e, 0x22a784, 0x79d151, 0xfde724]; - exports.Viridis7 = [0x440154, 0x443982, 0x30678d, 0x208f8c, 0x35b778, 0x8dd644, 0xfde724]; - exports.Viridis8 = [0x440154, 0x46317e, 0x365a8c, 0x277e8e, 0x1ea087, 0x49c16d, 0x9dd93a, 0xfde724]; - exports.Viridis9 = [0x440154, 0x472b7a, 0x3b518a, 0x2c718e, 0x208f8c, 0x27ad80, 0x5bc862, 0xaadb32, 0xfde724]; - exports.Viridis10 = [0x440154, 0x472777, 0x3e4989, 0x30678d, 0x25828e, 0x1e9c89, 0x35b778, 0x6bcd59, 0xb2dd2c, 0xfde724]; - exports.Viridis11 = [0x440154, 0x482374, 0x404387, 0x345e8d, 0x29788e, 0x208f8c, 0x22a784, 0x42be71, 0x79d151, 0xbade27, 0xfde724]; - exports.Viridis256 = [0x440154, 0x440255, 0x440357, 0x450558, 0x45065a, 0x45085b, 0x46095c, 0x460b5e, 0x460c5f, 0x460e61, 0x470f62, 0x471163, - 0x471265, 0x471466, 0x471567, 0x471669, 0x47186a, 0x48196b, 0x481a6c, 0x481c6e, 0x481d6f, 0x481e70, 0x482071, 0x482172, - 0x482273, 0x482374, 0x472575, 0x472676, 0x472777, 0x472878, 0x472a79, 0x472b7a, 0x472c7b, 0x462d7c, 0x462f7c, 0x46307d, - 0x46317e, 0x45327f, 0x45347f, 0x453580, 0x453681, 0x443781, 0x443982, 0x433a83, 0x433b83, 0x433c84, 0x423d84, 0x423e85, - 0x424085, 0x414186, 0x414286, 0x404387, 0x404487, 0x3f4587, 0x3f4788, 0x3e4888, 0x3e4989, 0x3d4a89, 0x3d4b89, 0x3d4c89, - 0x3c4d8a, 0x3c4e8a, 0x3b508a, 0x3b518a, 0x3a528b, 0x3a538b, 0x39548b, 0x39558b, 0x38568b, 0x38578c, 0x37588c, 0x37598c, - 0x365a8c, 0x365b8c, 0x355c8c, 0x355d8c, 0x345e8d, 0x345f8d, 0x33608d, 0x33618d, 0x32628d, 0x32638d, 0x31648d, 0x31658d, - 0x31668d, 0x30678d, 0x30688d, 0x2f698d, 0x2f6a8d, 0x2e6b8e, 0x2e6c8e, 0x2e6d8e, 0x2d6e8e, 0x2d6f8e, 0x2c708e, 0x2c718e, - 0x2c728e, 0x2b738e, 0x2b748e, 0x2a758e, 0x2a768e, 0x2a778e, 0x29788e, 0x29798e, 0x287a8e, 0x287a8e, 0x287b8e, 0x277c8e, - 0x277d8e, 0x277e8e, 0x267f8e, 0x26808e, 0x26818e, 0x25828e, 0x25838d, 0x24848d, 0x24858d, 0x24868d, 0x23878d, 0x23888d, - 0x23898d, 0x22898d, 0x228a8d, 0x228b8d, 0x218c8d, 0x218d8c, 0x218e8c, 0x208f8c, 0x20908c, 0x20918c, 0x1f928c, 0x1f938b, - 0x1f948b, 0x1f958b, 0x1f968b, 0x1e978a, 0x1e988a, 0x1e998a, 0x1e998a, 0x1e9a89, 0x1e9b89, 0x1e9c89, 0x1e9d88, 0x1e9e88, - 0x1e9f88, 0x1ea087, 0x1fa187, 0x1fa286, 0x1fa386, 0x20a485, 0x20a585, 0x21a685, 0x21a784, 0x22a784, 0x23a883, 0x23a982, - 0x24aa82, 0x25ab81, 0x26ac81, 0x27ad80, 0x28ae7f, 0x29af7f, 0x2ab07e, 0x2bb17d, 0x2cb17d, 0x2eb27c, 0x2fb37b, 0x30b47a, - 0x32b57a, 0x33b679, 0x35b778, 0x36b877, 0x38b976, 0x39b976, 0x3bba75, 0x3dbb74, 0x3ebc73, 0x40bd72, 0x42be71, 0x44be70, - 0x45bf6f, 0x47c06e, 0x49c16d, 0x4bc26c, 0x4dc26b, 0x4fc369, 0x51c468, 0x53c567, 0x55c666, 0x57c665, 0x59c764, 0x5bc862, - 0x5ec961, 0x60c960, 0x62ca5f, 0x64cb5d, 0x67cc5c, 0x69cc5b, 0x6bcd59, 0x6dce58, 0x70ce56, 0x72cf55, 0x74d054, 0x77d052, - 0x79d151, 0x7cd24f, 0x7ed24e, 0x81d34c, 0x83d34b, 0x86d449, 0x88d547, 0x8bd546, 0x8dd644, 0x90d643, 0x92d741, 0x95d73f, - 0x97d83e, 0x9ad83c, 0x9dd93a, 0x9fd938, 0xa2da37, 0xa5da35, 0xa7db33, 0xaadb32, 0xaddc30, 0xafdc2e, 0xb2dd2c, 0xb5dd2b, - 0xb7dd29, 0xbade27, 0xbdde26, 0xbfdf24, 0xc2df22, 0xc5df21, 0xc7e01f, 0xcae01e, 0xcde01d, 0xcfe11c, 0xd2e11b, 0xd4e11a, - 0xd7e219, 0xdae218, 0xdce218, 0xdfe318, 0xe1e318, 0xe4e318, 0xe7e419, 0xe9e419, 0xece41a, 0xeee51b, 0xf1e51c, 0xf3e51e, - 0xf6e61f, 0xf8e621, 0xfae622, 0xfde724]; - exports.Accent3 = [0x7fc97f, 0xbeaed4, 0xfdc086]; - exports.Accent4 = [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99]; - exports.Accent5 = [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0]; - exports.Accent6 = [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0, 0xf0027f]; - exports.Accent7 = [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0, 0xf0027f, 0xbf5b17]; - exports.Accent8 = [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0, 0xf0027f, 0xbf5b17, 0x666666]; - exports.Dark2_3 = [0x1b9e77, 0xd95f02, 0x7570b3]; - exports.Dark2_4 = [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a]; - exports.Dark2_5 = [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e]; - exports.Dark2_6 = [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e, 0xe6ab02]; - exports.Dark2_7 = [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e, 0xe6ab02, 0xa6761d]; - exports.Dark2_8 = [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e, 0xe6ab02, 0xa6761d, 0x666666]; - exports.Paired3 = [0xa6cee3, 0x1f78b4, 0xb2df8a]; - exports.Paired4 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c]; - exports.Paired5 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99]; - exports.Paired6 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c]; - exports.Paired7 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f]; - exports.Paired8 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00]; - exports.Paired9 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6]; - exports.Paired10 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6, 0x6a3d9a]; - exports.Paired11 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6, 0x6a3d9a, 0xffff99]; - exports.Paired12 = [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6, 0x6a3d9a, 0xffff99, 0xb15928]; - exports.Pastel1_3 = [0xfbb4ae, 0xb3cde3, 0xccebc5]; - exports.Pastel1_4 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4]; - exports.Pastel1_5 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6]; - exports.Pastel1_6 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc]; - exports.Pastel1_7 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc, 0xe5d8bd]; - exports.Pastel1_8 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc, 0xe5d8bd, 0xfddaec]; - exports.Pastel1_9 = [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc, 0xe5d8bd, 0xfddaec, 0xf2f2f2]; - exports.Pastel2_3 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8]; - exports.Pastel2_4 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4]; - exports.Pastel2_5 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9]; - exports.Pastel2_6 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9, 0xfff2ae]; - exports.Pastel2_7 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9, 0xfff2ae, 0xf1e2cc]; - exports.Pastel2_8 = [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9, 0xfff2ae, 0xf1e2cc, 0xcccccc]; - exports.Set1_3 = [0xe41a1c, 0x377eb8, 0x4daf4a]; - exports.Set1_4 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3]; - exports.Set1_5 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00]; - exports.Set1_6 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33]; - exports.Set1_7 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33, 0xa65628]; - exports.Set1_8 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33, 0xa65628, 0xf781bf]; - exports.Set1_9 = [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33, 0xa65628, 0xf781bf, 0x999999]; - exports.Set2_3 = [0x66c2a5, 0xfc8d62, 0x8da0cb]; - exports.Set2_4 = [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3]; - exports.Set2_5 = [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854]; - exports.Set2_6 = [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854, 0xffd92f]; - exports.Set2_7 = [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854, 0xffd92f, 0xe5c494]; - exports.Set2_8 = [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854, 0xffd92f, 0xe5c494, 0xb3b3b3]; - exports.Set3_3 = [0x8dd3c7, 0xffffb3, 0xbebada]; - exports.Set3_4 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072]; - exports.Set3_5 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3]; - exports.Set3_6 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462]; - exports.Set3_7 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69]; - exports.Set3_8 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5]; - exports.Set3_9 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9]; - exports.Set3_10 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9, 0xbc80bd]; - exports.Set3_11 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9, 0xbc80bd, 0xccebc5]; - exports.Set3_12 = [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9, 0xbc80bd, 0xccebc5, 0xffed6f]; - exports.Category10_3 = [0x1f77b4, 0xff7f0e, 0x2ca02c]; - exports.Category10_4 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728]; - exports.Category10_5 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd]; - exports.Category10_6 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b]; - exports.Category10_7 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b, 0xe377c2]; - exports.Category10_8 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b, 0xe377c2, 0x7f7f7f]; - exports.Category10_9 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22]; - exports.Category10_10 = [0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22, 0x17becf]; - exports.Category20_3 = [0x1f77b4, 0xaec7e8, 0xff7f0e]; - exports.Category20_4 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78]; - exports.Category20_5 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c]; - exports.Category20_6 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a]; - exports.Category20_7 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728]; - exports.Category20_8 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896]; - exports.Category20_9 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd]; - exports.Category20_10 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5]; - exports.Category20_11 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b]; - exports.Category20_12 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94]; - exports.Category20_13 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2]; - exports.Category20_14 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2]; - exports.Category20_15 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f]; - exports.Category20_16 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 0xc7c7c7]; - exports.Category20_17 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 0xc7c7c7, 0xbcbd22]; - exports.Category20_18 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 0xc7c7c7, 0xbcbd22, 0xdbdb8d]; - exports.Category20_19 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 0xc7c7c7, 0xbcbd22, 0xdbdb8d, 0x17becf]; - exports.Category20_20 = [0x1f77b4, 0xaec7e8, 0xff7f0e, 0xffbb78, 0x2ca02c, 0x98df8a, 0xd62728, 0xff9896, 0x9467bd, 0xc5b0d5, - 0x8c564b, 0xc49c94, 0xe377c2, 0xf7b6d2, 0x7f7f7f, 0xc7c7c7, 0xbcbd22, 0xdbdb8d, 0x17becf, 0x9edae5]; - exports.Category20b_3 = [0x393b79, 0x5254a3, 0x6b6ecf]; - exports.Category20b_4 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede]; - exports.Category20b_5 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939]; - exports.Category20b_6 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252]; - exports.Category20b_7 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b]; - exports.Category20b_8 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c]; - exports.Category20b_9 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31]; - exports.Category20b_10 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39]; - exports.Category20b_11 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52]; - exports.Category20b_12 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94]; - exports.Category20b_13 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39]; - exports.Category20b_14 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a]; - exports.Category20b_15 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b]; - exports.Category20b_16 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b, 0xe7969c]; - exports.Category20b_17 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b, 0xe7969c, 0x7b4173]; - exports.Category20b_18 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b, 0xe7969c, 0x7b4173, 0xa55194]; - exports.Category20b_19 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b, 0xe7969c, 0x7b4173, 0xa55194, 0xce6dbd]; - exports.Category20b_20 = [0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede, 0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c, 0x8c6d31, 0xbd9e39, - 0xe7ba52, 0xe7cb94, 0x843c39, 0xad494a, 0xd6616b, 0xe7969c, 0x7b4173, 0xa55194, 0xce6dbd, 0xde9ed6]; - exports.Category20c_3 = [0x3182bd, 0x6baed6, 0x9ecae1]; - exports.Category20c_4 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef]; - exports.Category20c_5 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d]; - exports.Category20c_6 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c]; - exports.Category20c_7 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b]; - exports.Category20c_8 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2]; - exports.Category20c_9 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354]; - exports.Category20c_10 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476]; - exports.Category20c_11 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b]; - exports.Category20c_12 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0]; - exports.Category20c_13 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1]; - exports.Category20c_14 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8]; - exports.Category20c_15 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc]; - exports.Category20c_16 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb]; - exports.Category20c_17 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0x636363]; - exports.Category20c_18 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0x636363, 0x969696]; - exports.Category20c_19 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0x636363, 0x969696, 0xbdbdbd]; - exports.Category20c_20 = [0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef, 0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2, 0x31a354, 0x74c476, - 0xa1d99b, 0xc7e9c0, 0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb, 0x636363, 0x969696, 0xbdbdbd, 0xd9d9d9]; - exports.Colorblind3 = [0x0072b2, 0xe69f00, 0xf0e442]; - exports.Colorblind4 = [0x0072b2, 0xe69f00, 0xf0e442, 0x009e73]; - exports.Colorblind5 = [0x0072b2, 0xe69f00, 0xf0e442, 0x009e73, 0x56b4e9]; - exports.Colorblind6 = [0x0072b2, 0xe69f00, 0xf0e442, 0x009e73, 0x56b4e9, 0xd55e00]; - exports.Colorblind7 = [0x0072b2, 0xe69f00, 0xf0e442, 0x009e73, 0x56b4e9, 0xd55e00, 0xcc79a7]; - exports.Colorblind8 = [0x0072b2, 0xe69f00, 0xf0e442, 0x009e73, 0x56b4e9, 0xd55e00, 0xcc79a7, 0x000000]; - exports.YlGn = { YlGn3: exports.YlGn3, YlGn4: exports.YlGn4, YlGn5: exports.YlGn5, YlGn6: exports.YlGn6, YlGn7: exports.YlGn7, YlGn8: exports.YlGn8, YlGn9: exports.YlGn9 }; - exports.YlGnBu = { YlGnBu3: exports.YlGnBu3, YlGnBu4: exports.YlGnBu4, YlGnBu5: exports.YlGnBu5, YlGnBu6: exports.YlGnBu6, YlGnBu7: exports.YlGnBu7, YlGnBu8: exports.YlGnBu8, YlGnBu9: exports.YlGnBu9 }; - exports.GnBu = { GnBu3: exports.GnBu3, GnBu4: exports.GnBu4, GnBu5: exports.GnBu5, GnBu6: exports.GnBu6, GnBu7: exports.GnBu7, GnBu8: exports.GnBu8, GnBu9: exports.GnBu9 }; - exports.BuGn = { BuGn3: exports.BuGn3, BuGn4: exports.BuGn4, BuGn5: exports.BuGn5, BuGn6: exports.BuGn6, BuGn7: exports.BuGn7, BuGn8: exports.BuGn8, BuGn9: exports.BuGn9 }; - exports.PuBuGn = { PuBuGn3: exports.PuBuGn3, PuBuGn4: exports.PuBuGn4, PuBuGn5: exports.PuBuGn5, PuBuGn6: exports.PuBuGn6, PuBuGn7: exports.PuBuGn7, PuBuGn8: exports.PuBuGn8, PuBuGn9: exports.PuBuGn9 }; - exports.PuBu = { PuBu3: exports.PuBu3, PuBu4: exports.PuBu4, PuBu5: exports.PuBu5, PuBu6: exports.PuBu6, PuBu7: exports.PuBu7, PuBu8: exports.PuBu8, PuBu9: exports.PuBu9 }; - exports.BuPu = { BuPu3: exports.BuPu3, BuPu4: exports.BuPu4, BuPu5: exports.BuPu5, BuPu6: exports.BuPu6, BuPu7: exports.BuPu7, BuPu8: exports.BuPu8, BuPu9: exports.BuPu9 }; - exports.RdPu = { RdPu3: exports.RdPu3, RdPu4: exports.RdPu4, RdPu5: exports.RdPu5, RdPu6: exports.RdPu6, RdPu7: exports.RdPu7, RdPu8: exports.RdPu8, RdPu9: exports.RdPu9 }; - exports.PuRd = { PuRd3: exports.PuRd3, PuRd4: exports.PuRd4, PuRd5: exports.PuRd5, PuRd6: exports.PuRd6, PuRd7: exports.PuRd7, PuRd8: exports.PuRd8, PuRd9: exports.PuRd9 }; - exports.OrRd = { OrRd3: exports.OrRd3, OrRd4: exports.OrRd4, OrRd5: exports.OrRd5, OrRd6: exports.OrRd6, OrRd7: exports.OrRd7, OrRd8: exports.OrRd8, OrRd9: exports.OrRd9 }; - exports.YlOrRd = { YlOrRd3: exports.YlOrRd3, YlOrRd4: exports.YlOrRd4, YlOrRd5: exports.YlOrRd5, YlOrRd6: exports.YlOrRd6, YlOrRd7: exports.YlOrRd7, YlOrRd8: exports.YlOrRd8, YlOrRd9: exports.YlOrRd9 }; - exports.YlOrBr = { YlOrBr3: exports.YlOrBr3, YlOrBr4: exports.YlOrBr4, YlOrBr5: exports.YlOrBr5, YlOrBr6: exports.YlOrBr6, YlOrBr7: exports.YlOrBr7, YlOrBr8: exports.YlOrBr8, YlOrBr9: exports.YlOrBr9 }; - exports.Purples = { Purples3: exports.Purples3, Purples4: exports.Purples4, Purples5: exports.Purples5, Purples6: exports.Purples6, Purples7: exports.Purples7, Purples8: exports.Purples8, Purples9: exports.Purples9 }; - exports.Blues = { Blues3: exports.Blues3, Blues4: exports.Blues4, Blues5: exports.Blues5, Blues6: exports.Blues6, Blues7: exports.Blues7, Blues8: exports.Blues8, Blues9: exports.Blues9 }; - exports.Greens = { Greens3: exports.Greens3, Greens4: exports.Greens4, Greens5: exports.Greens5, Greens6: exports.Greens6, Greens7: exports.Greens7, Greens8: exports.Greens8, Greens9: exports.Greens9 }; - exports.Oranges = { Oranges3: exports.Oranges3, Oranges4: exports.Oranges4, Oranges5: exports.Oranges5, Oranges6: exports.Oranges6, Oranges7: exports.Oranges7, Oranges8: exports.Oranges8, Oranges9: exports.Oranges9 }; - exports.Reds = { Reds3: exports.Reds3, Reds4: exports.Reds4, Reds5: exports.Reds5, Reds6: exports.Reds6, Reds7: exports.Reds7, Reds8: exports.Reds8, Reds9: exports.Reds9 }; - exports.Greys = { Greys3: exports.Greys3, Greys4: exports.Greys4, Greys5: exports.Greys5, Greys6: exports.Greys6, Greys7: exports.Greys7, Greys8: exports.Greys8, Greys9: exports.Greys9, Greys10: exports.Greys10, Greys11: exports.Greys11, Greys256: exports.Greys256 }; - exports.PuOr = { PuOr3: exports.PuOr3, PuOr4: exports.PuOr4, PuOr5: exports.PuOr5, PuOr6: exports.PuOr6, PuOr7: exports.PuOr7, PuOr8: exports.PuOr8, PuOr9: exports.PuOr9, PuOr10: exports.PuOr10, PuOr11: exports.PuOr11 }; - exports.BrBG = { BrBG3: exports.BrBG3, BrBG4: exports.BrBG4, BrBG5: exports.BrBG5, BrBG6: exports.BrBG6, BrBG7: exports.BrBG7, BrBG8: exports.BrBG8, BrBG9: exports.BrBG9, BrBG10: exports.BrBG10, BrBG11: exports.BrBG11 }; - exports.PRGn = { PRGn3: exports.PRGn3, PRGn4: exports.PRGn4, PRGn5: exports.PRGn5, PRGn6: exports.PRGn6, PRGn7: exports.PRGn7, PRGn8: exports.PRGn8, PRGn9: exports.PRGn9, PRGn10: exports.PRGn10, PRGn11: exports.PRGn11 }; - exports.PiYG = { PiYG3: exports.PiYG3, PiYG4: exports.PiYG4, PiYG5: exports.PiYG5, PiYG6: exports.PiYG6, PiYG7: exports.PiYG7, PiYG8: exports.PiYG8, PiYG9: exports.PiYG9, PiYG10: exports.PiYG10, PiYG11: exports.PiYG11 }; - exports.RdBu = { RdBu3: exports.RdBu3, RdBu4: exports.RdBu4, RdBu5: exports.RdBu5, RdBu6: exports.RdBu6, RdBu7: exports.RdBu7, RdBu8: exports.RdBu8, RdBu9: exports.RdBu9, RdBu10: exports.RdBu10, RdBu11: exports.RdBu11 }; - exports.RdGy = { RdGy3: exports.RdGy3, RdGy4: exports.RdGy4, RdGy5: exports.RdGy5, RdGy6: exports.RdGy6, RdGy7: exports.RdGy7, RdGy8: exports.RdGy8, RdGy9: exports.RdGy9, RdGy10: exports.RdGy10, RdGy11: exports.RdGy11 }; - exports.RdYlBu = { RdYlBu3: exports.RdYlBu3, RdYlBu4: exports.RdYlBu4, RdYlBu5: exports.RdYlBu5, RdYlBu6: exports.RdYlBu6, RdYlBu7: exports.RdYlBu7, RdYlBu8: exports.RdYlBu8, RdYlBu9: exports.RdYlBu9, RdYlBu10: exports.RdYlBu10, RdYlBu11: exports.RdYlBu11 }; - exports.Spectral = { Spectral3: exports.Spectral3, Spectral4: exports.Spectral4, Spectral5: exports.Spectral5, Spectral6: exports.Spectral6, Spectral7: exports.Spectral7, Spectral8: exports.Spectral8, Spectral9: exports.Spectral9, Spectral10: exports.Spectral10, Spectral11: exports.Spectral11 }; - exports.RdYlGn = { RdYlGn3: exports.RdYlGn3, RdYlGn4: exports.RdYlGn4, RdYlGn5: exports.RdYlGn5, RdYlGn6: exports.RdYlGn6, RdYlGn7: exports.RdYlGn7, RdYlGn8: exports.RdYlGn8, RdYlGn9: exports.RdYlGn9, RdYlGn10: exports.RdYlGn10, RdYlGn11: exports.RdYlGn11 }; - exports.Inferno = { Inferno3: exports.Inferno3, Inferno4: exports.Inferno4, Inferno5: exports.Inferno5, Inferno6: exports.Inferno6, Inferno7: exports.Inferno7, Inferno8: exports.Inferno8, Inferno9: exports.Inferno9, Inferno10: exports.Inferno10, Inferno11: exports.Inferno11, Inferno256: exports.Inferno256 }; - exports.Magma = { Magma3: exports.Magma3, Magma4: exports.Magma4, Magma5: exports.Magma5, Magma6: exports.Magma6, Magma7: exports.Magma7, Magma8: exports.Magma8, Magma9: exports.Magma9, Magma10: exports.Magma10, Magma11: exports.Magma11, Magma256: exports.Magma256 }; - exports.Plasma = { Plasma3: exports.Plasma3, Plasma4: exports.Plasma4, Plasma5: exports.Plasma5, Plasma6: exports.Plasma6, Plasma7: exports.Plasma7, Plasma8: exports.Plasma8, Plasma9: exports.Plasma9, Plasma10: exports.Plasma10, Plasma11: exports.Plasma11, Plasma256: exports.Plasma256 }; - exports.Viridis = { Viridis3: exports.Viridis3, Viridis4: exports.Viridis4, Viridis5: exports.Viridis5, Viridis6: exports.Viridis6, Viridis7: exports.Viridis7, Viridis8: exports.Viridis8, Viridis9: exports.Viridis9, Viridis10: exports.Viridis10, Viridis11: exports.Viridis11, Viridis256: exports.Viridis256 }; - exports.Accent = { Accent3: exports.Accent3, Accent4: exports.Accent4, Accent5: exports.Accent5, Accent6: exports.Accent6, Accent7: exports.Accent7, Accent8: exports.Accent8 }; - exports.Dark2 = { Dark2_3: exports.Dark2_3, Dark2_4: exports.Dark2_4, Dark2_5: exports.Dark2_5, Dark2_6: exports.Dark2_6, Dark2_7: exports.Dark2_7, Dark2_8: exports.Dark2_8 }; - exports.Paired = { Paired3: exports.Paired3, Paired4: exports.Paired4, Paired5: exports.Paired5, Paired6: exports.Paired6, Paired7: exports.Paired7, Paired8: exports.Paired8, Paired9: exports.Paired9, Paired10: exports.Paired10, Paired11: exports.Paired11, Paired12: exports.Paired12 }; - exports.Pastel1 = { Pastel1_3: exports.Pastel1_3, Pastel1_4: exports.Pastel1_4, Pastel1_5: exports.Pastel1_5, Pastel1_6: exports.Pastel1_6, Pastel1_7: exports.Pastel1_7, Pastel1_8: exports.Pastel1_8, Pastel1_9: exports.Pastel1_9 }; - exports.Pastel2 = { Pastel2_3: exports.Pastel2_3, Pastel2_4: exports.Pastel2_4, Pastel2_5: exports.Pastel2_5, Pastel2_6: exports.Pastel2_6, Pastel2_7: exports.Pastel2_7, Pastel2_8: exports.Pastel2_8 }; - exports.Set1 = { Set1_3: exports.Set1_3, Set1_4: exports.Set1_4, Set1_5: exports.Set1_5, Set1_6: exports.Set1_6, Set1_7: exports.Set1_7, Set1_8: exports.Set1_8, Set1_9: exports.Set1_9 }; - exports.Set2 = { Set2_3: exports.Set2_3, Set2_4: exports.Set2_4, Set2_5: exports.Set2_5, Set2_6: exports.Set2_6, Set2_7: exports.Set2_7, Set2_8: exports.Set2_8 }; - exports.Set3 = { Set3_3: exports.Set3_3, Set3_4: exports.Set3_4, Set3_5: exports.Set3_5, Set3_6: exports.Set3_6, Set3_7: exports.Set3_7, Set3_8: exports.Set3_8, Set3_9: exports.Set3_9, Set3_10: exports.Set3_10, Set3_11: exports.Set3_11, Set3_12: exports.Set3_12 }; - exports.Category10 = { Category10_3: exports.Category10_3, Category10_4: exports.Category10_4, Category10_5: exports.Category10_5, Category10_6: exports.Category10_6, Category10_7: exports.Category10_7, Category10_8: exports.Category10_8, Category10_9: exports.Category10_9, Category10_10: exports.Category10_10 }; - exports.Category20 = { Category20_3: exports.Category20_3, Category20_4: exports.Category20_4, Category20_5: exports.Category20_5, Category20_6: exports.Category20_6, Category20_7: exports.Category20_7, Category20_8: exports.Category20_8, Category20_9: exports.Category20_9, Category20_10: exports.Category20_10, Category20_11: exports.Category20_11, Category20_12: exports.Category20_12, Category20_13: exports.Category20_13, Category20_14: exports.Category20_14, Category20_15: exports.Category20_15, Category20_16: exports.Category20_16, Category20_17: exports.Category20_17, Category20_18: exports.Category20_18, Category20_19: exports.Category20_19, Category20_20: exports.Category20_20 }; - exports.Category20b = { Category20b_3: exports.Category20b_3, Category20b_4: exports.Category20b_4, Category20b_5: exports.Category20b_5, Category20b_6: exports.Category20b_6, Category20b_7: exports.Category20b_7, Category20b_8: exports.Category20b_8, Category20b_9: exports.Category20b_9, Category20b_10: exports.Category20b_10, Category20b_11: exports.Category20b_11, Category20b_12: exports.Category20b_12, Category20b_13: exports.Category20b_13, Category20b_14: exports.Category20b_14, Category20b_15: exports.Category20b_15, Category20b_16: exports.Category20b_16, Category20b_17: exports.Category20b_17, Category20b_18: exports.Category20b_18, Category20b_19: exports.Category20b_19, Category20b_20: exports.Category20b_20 }; - exports.Category20c = { Category20c_3: exports.Category20c_3, Category20c_4: exports.Category20c_4, Category20c_5: exports.Category20c_5, Category20c_6: exports.Category20c_6, Category20c_7: exports.Category20c_7, Category20c_8: exports.Category20c_8, Category20c_9: exports.Category20c_9, Category20c_10: exports.Category20c_10, Category20c_11: exports.Category20c_11, Category20c_12: exports.Category20c_12, Category20c_13: exports.Category20c_13, Category20c_14: exports.Category20c_14, Category20c_15: exports.Category20c_15, Category20c_16: exports.Category20c_16, Category20c_17: exports.Category20c_17, Category20c_18: exports.Category20c_18, Category20c_19: exports.Category20c_19, Category20c_20: exports.Category20c_20 }; - exports.Colorblind = { Colorblind3: exports.Colorblind3, Colorblind4: exports.Colorblind4, Colorblind5: exports.Colorblind5, Colorblind6: exports.Colorblind6, Colorblind7: exports.Colorblind7, Colorblind8: exports.Colorblind8 }; -} -, -408: /* api/plotting */ function _(require, module, exports) { - var tslib_1 = require(400) /* tslib */; - var document_1 = require(54) /* ../document */; - var embed = require(56) /* ../embed */; - var models = require(406) /* ./models */; - var properties_1 = require(18) /* ../core/properties */; - var string_1 = require(40) /* ../core/util/string */; - var eq_1 = require(33) /* ../core/util/eq */; - var array_1 = require(24) /* ../core/util/array */; - var object_1 = require(35) /* ../core/util/object */; - var types_1 = require(46) /* ../core/util/types */; - var models_1 = require(406) /* ./models */; - var legend_1 = require(72) /* ../models/annotations/legend */; - var gridplot_1 = require(402) /* ./gridplot */; - exports.gridplot = gridplot_1.gridplot; - var color_1 = require(30) /* ../core/util/color */; - exports.color = color_1.rgb2hex; - var _default_tooltips = [ - ["index", "$index"], - ["data (x, y)", "($x, $y)"], - ["screen (x, y)", "($sx, $sy)"], - ]; - var _default_tools = ["pan", "wheel_zoom", "box_zoom", "save", "reset", "help"]; - var _known_tools = { - pan: function () { return new models.PanTool({ dimensions: 'both' }); }, - xpan: function () { return new models.PanTool({ dimensions: 'width' }); }, - ypan: function () { return new models.PanTool({ dimensions: 'height' }); }, - xwheel_pan: function () { return new models.WheelPanTool({ dimension: "width" }); }, - ywheel_pan: function () { return new models.WheelPanTool({ dimension: "height" }); }, - wheel_zoom: function () { return new models.WheelZoomTool({ dimensions: 'both' }); }, - xwheel_zoom: function () { return new models.WheelZoomTool({ dimensions: 'width' }); }, - ywheel_zoom: function () { return new models.WheelZoomTool({ dimensions: 'height' }); }, - zoom_in: function () { return new models.ZoomInTool({ dimensions: 'both' }); }, - xzoom_in: function () { return new models.ZoomInTool({ dimensions: 'width' }); }, - yzoom_in: function () { return new models.ZoomInTool({ dimensions: 'height' }); }, - zoom_out: function () { return new models.ZoomOutTool({ dimensions: 'both' }); }, - xzoom_out: function () { return new models.ZoomOutTool({ dimensions: 'width' }); }, - yzoom_out: function () { return new models.ZoomOutTool({ dimensions: 'height' }); }, - click: function () { return new models.TapTool({ behavior: "inspect" }); }, - tap: function () { return new models.TapTool(); }, - crosshair: function () { return new models.CrosshairTool(); }, - box_select: function () { return new models.BoxSelectTool(); }, - xbox_select: function () { return new models.BoxSelectTool({ dimensions: 'width' }); }, - ybox_select: function () { return new models.BoxSelectTool({ dimensions: 'height' }); }, - poly_select: function () { return new models.PolySelectTool(); }, - lasso_select: function () { return new models.LassoSelectTool(); }, - box_zoom: function () { return new models.BoxZoomTool({ dimensions: 'both' }); }, - xbox_zoom: function () { return new models.BoxZoomTool({ dimensions: 'width' }); }, - ybox_zoom: function () { return new models.BoxZoomTool({ dimensions: 'height' }); }, - hover: function () { return new models.HoverTool({ tooltips: _default_tooltips }); }, - save: function () { return new models.SaveTool(); }, - undo: function () { return new models.UndoTool(); }, - redo: function () { return new models.RedoTool(); }, - reset: function () { return new models.ResetTool(); }, - help: function () { return new models.HelpTool(); }, - }; - var _default_color = "#1f77b4"; - var _default_alpha = 1.0; - function _with_default(value, default_value) { - return value === undefined ? default_value : value; - } - var Figure = /** @class */ (function (_super) { - tslib_1.__extends(Figure, _super); - function Figure(attrs) { - if (attrs === void 0) { - attrs = {}; - } - var _this = this; - attrs = tslib_1.__assign({}, attrs); - var tools = _with_default(attrs.tools, _default_tools); - delete attrs.tools; - var x_axis_type = _with_default(attrs.x_axis_type, "auto"); - var y_axis_type = _with_default(attrs.y_axis_type, "auto"); - delete attrs.x_axis_type; - delete attrs.y_axis_type; - var x_minor_ticks = attrs.x_minor_ticks != null ? attrs.x_minor_ticks : "auto"; - var y_minor_ticks = attrs.y_minor_ticks != null ? attrs.y_minor_ticks : "auto"; - delete attrs.x_minor_ticks; - delete attrs.y_minor_ticks; - var x_axis_location = attrs.x_axis_location != null ? attrs.x_axis_location : "below"; - var y_axis_location = attrs.y_axis_location != null ? attrs.y_axis_location : "left"; - delete attrs.x_axis_location; - delete attrs.y_axis_location; - var x_axis_label = attrs.x_axis_label != null ? attrs.x_axis_label : ""; - var y_axis_label = attrs.y_axis_label != null ? attrs.y_axis_label : ""; - delete attrs.x_axis_label; - delete attrs.y_axis_label; - var x_range = Figure._get_range(attrs.x_range); - var y_range = Figure._get_range(attrs.y_range); - delete attrs.x_range; - delete attrs.y_range; - var x_scale = attrs.x_scale != null ? attrs.x_scale : Figure._get_scale(x_range, x_axis_type); - var y_scale = attrs.y_scale != null ? attrs.y_scale : Figure._get_scale(y_range, y_axis_type); - delete attrs.x_scale; - delete attrs.y_scale; - _this = _super.call(this, tslib_1.__assign({}, attrs, { x_range: x_range, y_range: y_range, x_scale: x_scale, y_scale: y_scale })) || this; - _this._process_axis_and_grid(x_axis_type, x_axis_location, x_minor_ticks, x_axis_label, x_range, 0); - _this._process_axis_and_grid(y_axis_type, y_axis_location, y_minor_ticks, y_axis_label, y_range, 1); - _this.add_tools.apply(_this, _this._process_tools(tools)); - return _this; - } - Object.defineProperty(Figure.prototype, "xgrid", { - get: function () { - return this.center.filter(function (r) { return r instanceof models_1.Grid && r.dimension == 0; }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Figure.prototype, "ygrid", { - get: function () { - return this.center.filter(function (r) { return r instanceof models_1.Grid && r.dimension == 1; }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Figure.prototype, "xaxis", { - get: function () { - return this.below.concat(this.above).filter(function (r) { return r instanceof models_1.Axis; }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Figure.prototype, "yaxis", { - get: function () { - return this.left.concat(this.right).filter(function (r) { return r instanceof models_1.Axis; }); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Figure.prototype, "legend", { - get: function () { - var legends = this.panels.filter(function (r) { return r instanceof legend_1.Legend; }); - if (legends.length == 0) { - var legend = new legend_1.Legend(); - this.add_layout(legend); - return legend; - } - else { - var legend = legends[0]; - return legend; - } - }, - enumerable: true, - configurable: true - }); - Figure.prototype.annular_wedge = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.AnnularWedge, "x,y,inner_radius,outer_radius,start_angle,end_angle", args); - }; - Figure.prototype.annulus = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Annulus, "x,y,inner_radius,outer_radius", args); - }; - Figure.prototype.arc = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Arc, "x,y,radius,start_angle,end_angle", args); - }; - Figure.prototype.bezier = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Bezier, "x0,y0,x1,y1,cx0,cy0,cx1,cy1", args); - }; - Figure.prototype.circle = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Circle, "x,y", args); - }; - Figure.prototype.ellipse = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Ellipse, "x,y,width,height", args); - }; - Figure.prototype.hbar = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.HBar, "y,height,right,left", args); - }; - Figure.prototype.hex_tile = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.HexTile, "q,r", args); - }; - Figure.prototype.image = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Image, "color_mapper,image,rows,cols,x,y,dw,dh", args); - }; - Figure.prototype.image_rgba = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.ImageRGBA, "image,rows,cols,x,y,dw,dh", args); - }; - Figure.prototype.image_url = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.ImageURL, "url,x,y,w,h", args); - }; - Figure.prototype.line = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Line, "x,y", args); - }; - Figure.prototype.multi_line = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.MultiLine, "xs,ys", args); - }; - Figure.prototype.multi_polygons = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.MultiPolygons, "xs,ys", args); - }; - Figure.prototype.oval = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Oval, "x,y,width,height", args); - }; - Figure.prototype.patch = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Patch, "x,y", args); - }; - Figure.prototype.patches = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Patches, "xs,ys", args); - }; - Figure.prototype.quad = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Quad, "left,right,bottom,top", args); - }; - Figure.prototype.quadratic = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Quadratic, "x0,y0,x1,y1,cx,cy", args); - }; - Figure.prototype.ray = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Ray, "x,y,length", args); - }; - Figure.prototype.rect = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Rect, "x,y,width,height", args); - }; - Figure.prototype.segment = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Segment, "x0,y0,x1,y1", args); - }; - Figure.prototype.step = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Step, "x,y,mode", args); - }; - Figure.prototype.text = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Text, "x,y,text", args); - }; - Figure.prototype.vbar = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.VBar, "x,width,top,bottom", args); - }; - Figure.prototype.wedge = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._glyph(models.Wedge, "x,y,radius,start_angle,end_angle", args); - }; - Figure.prototype.asterisk = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Asterisk, args); - }; - Figure.prototype.circle_cross = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.CircleCross, args); - }; - Figure.prototype.circle_x = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.CircleX, args); - }; - Figure.prototype.cross = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Cross, args); - }; - Figure.prototype.dash = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Dash, args); - }; - Figure.prototype.diamond = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Diamond, args); - }; - Figure.prototype.diamond_cross = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.DiamondCross, args); - }; - Figure.prototype.inverted_triangle = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.InvertedTriangle, args); - }; - Figure.prototype.square = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Square, args); - }; - Figure.prototype.square_cross = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.SquareCross, args); - }; - Figure.prototype.square_x = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.SquareX, args); - }; - Figure.prototype.triangle = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Triangle, args); - }; - Figure.prototype.x = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.X, args); - }; - Figure.prototype.scatter = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return this._marker(models.Scatter, args); - }; - Figure.prototype._pop_colors_and_alpha = function (cls, attrs, prefix, default_color, default_alpha) { - if (prefix === void 0) { - prefix = ""; - } - if (default_color === void 0) { - default_color = _default_color; - } - if (default_alpha === void 0) { - default_alpha = _default_alpha; - } - var result = {}; - var color = _with_default(attrs[prefix + "color"], default_color); - var alpha = _with_default(attrs[prefix + "alpha"], default_alpha); - delete attrs[prefix + "color"]; - delete attrs[prefix + "alpha"]; - var _update_with = function (name, default_value) { - if (cls.prototype.props[name] != null) { - result[name] = _with_default(attrs[prefix + name], default_value); - delete attrs[prefix + name]; - } - }; - _update_with("fill_color", color); - _update_with("line_color", color); - _update_with("text_color", "black"); - _update_with("fill_alpha", alpha); - _update_with("line_alpha", alpha); - _update_with("text_alpha", alpha); - return result; - }; - Figure.prototype._find_uniq_name = function (data, name) { - var i = 1; - while (true) { - var new_name = name + "__" + i; - if (data[new_name] != null) { - i += 1; - } - else { - return new_name; - } - } - }; - Figure.prototype._fixup_values = function (cls, data, attrs) { - for (var name_1 in attrs) { - var value = attrs[name_1]; - var prop = cls.prototype.props[name_1]; - if (prop != null) { - if (prop.type.prototype instanceof properties_1.VectorSpec) { - if (value != null) { - if (types_1.isArray(value)) { - var field = void 0; - if (data[name_1] != null) { - if (data[name_1] !== value) { - field = this._find_uniq_name(data, name_1); - data[field] = value; - } - else { - field = name_1; - } - } - else { - field = name_1; - data[field] = value; - } - attrs[name_1] = { field: field }; - } - else if (types_1.isNumber(value) || types_1.isString(value)) { // or Date? - attrs[name_1] = { value: value }; - } - } - } - } - } - }; - Figure.prototype._glyph = function (cls, params_string, args) { - var params = params_string.split(","); - var attrs; - if (args.length == 0) { - attrs = {}; - } - else if (args.length == 1) { - attrs = object_1.clone(args[0]); - } - else { - attrs = object_1.clone(args[args.length - 1]); - for (var i = 0; i < params.length; i++) { - var param = params[i]; - attrs[param] = args[i]; - } - } - var source = attrs.source != null ? attrs.source : new models.ColumnDataSource(); - var data = object_1.clone(source.data); - delete attrs.source; - var legend = this._process_legend(attrs.legend, source); - delete attrs.legend; - var has_sglyph = array_1.some(Object.keys(attrs), function (key) { return string_1.startsWith(key, "selection_"); }); - var has_hglyph = array_1.some(Object.keys(attrs), function (key) { return string_1.startsWith(key, "hover_"); }); - var glyph_ca = this._pop_colors_and_alpha(cls, attrs); - var nsglyph_ca = this._pop_colors_and_alpha(cls, attrs, "nonselection_", undefined, 0.1); - var sglyph_ca = has_sglyph ? this._pop_colors_and_alpha(cls, attrs, "selection_") : {}; - var hglyph_ca = has_hglyph ? this._pop_colors_and_alpha(cls, attrs, "hover_") : {}; - this._fixup_values(cls, data, glyph_ca); - this._fixup_values(cls, data, nsglyph_ca); - this._fixup_values(cls, data, sglyph_ca); - this._fixup_values(cls, data, hglyph_ca); - this._fixup_values(cls, data, attrs); - source.data = data; - var _make_glyph = function (cls, attrs, extra_attrs) { - return new cls(tslib_1.__assign({}, attrs, extra_attrs)); - }; - var glyph = _make_glyph(cls, attrs, glyph_ca); - var nsglyph = _make_glyph(cls, attrs, nsglyph_ca); - var sglyph = has_sglyph ? _make_glyph(cls, attrs, sglyph_ca) : undefined; - var hglyph = has_hglyph ? _make_glyph(cls, attrs, hglyph_ca) : undefined; - var glyph_renderer = new models_1.GlyphRenderer({ - data_source: source, - glyph: glyph, - nonselection_glyph: nsglyph, - selection_glyph: sglyph, - hover_glyph: hglyph, - }); - if (legend != null) { - this._update_legend(legend, glyph_renderer); - } - this.add_renderers(glyph_renderer); - return glyph_renderer; - }; - Figure.prototype._marker = function (cls, args) { - return this._glyph(cls, "x,y", args); - }; - Figure._get_range = function (range) { - if (range == null) { - return new models.DataRange1d(); - } - if (range instanceof models.Range) { - return range; - } - if (types_1.isArray(range)) { - if (array_1.every(range, types_1.isString)) { - var factors = range; - return new models.FactorRange({ factors: factors }); - } - if (range.length == 2) { - var _a = range, start = _a[0], end = _a[1]; - return new models.Range1d({ start: start, end: end }); - } - } - throw new Error("unable to determine proper range for: '" + range + "'"); - }; - Figure._get_scale = function (range_input, axis_type) { - if (range_input instanceof models.DataRange1d || - range_input instanceof models.Range1d) { - switch (axis_type) { - case null: - case "auto": - case "linear": - case "datetime": - return new models.LinearScale(); - case "log": - return new models.LogScale(); - } - } - if (range_input instanceof models.FactorRange) { - return new models.CategoricalScale(); - } - throw new Error("unable to determine proper scale for: '" + range_input + "'"); - }; - Figure.prototype._process_axis_and_grid = function (axis_type, axis_location, minor_ticks, axis_label, rng, dim) { - var axiscls = this._get_axis_class(axis_type, rng); - if (axiscls != null) { - if (axiscls === models.LogAxis) { - if (dim === 0) { - this.x_scale = new models.LogScale(); - } - else { - this.y_scale = new models.LogScale(); - } - } - var axis = new axiscls(); - if (axis.ticker instanceof models.ContinuousTicker) { - axis.ticker.num_minor_ticks = this._get_num_minor_ticks(axiscls, minor_ticks); - } - if (axis_label.length !== 0) { - axis.axis_label = axis_label; - } - var grid = new models.Grid({ dimension: dim, ticker: axis.ticker }); - if (axis_location !== null) { - this.add_layout(axis, axis_location); - } - this.add_layout(grid); - } - }; - Figure.prototype._get_axis_class = function (axis_type, range) { - switch (axis_type) { - case null: - return null; - case "linear": - return models.LinearAxis; - case "log": - return models.LogAxis; - case "datetime": - return models.DatetimeAxis; - case "auto": - if (range instanceof models.FactorRange) - return models.CategoricalAxis; - else - return models.LinearAxis; // TODO: return models.DatetimeAxis (Date type) - default: - throw new Error("shouldn't have happened"); - } - }; - Figure.prototype._get_num_minor_ticks = function (axis_class, num_minor_ticks) { - if (types_1.isNumber(num_minor_ticks)) { - if (num_minor_ticks <= 1) { - throw new Error("num_minor_ticks must be > 1"); - } - return num_minor_ticks; - } - if (num_minor_ticks == null) { - return 0; - } - if (num_minor_ticks === 'auto') { - if (axis_class === models.LogAxis) { - return 10; - } - return 5; - } - throw new Error("shouldn't have happened"); - }; - Figure.prototype._process_tools = function (tools) { - if (types_1.isString(tools)) - tools = tools.split(/\s*,\s*/).filter(function (tool) { return tool.length > 0; }); - function isToolName(tool) { - return _known_tools.hasOwnProperty(tool); - } - var objs = (function () { - var result = []; - for (var _i = 0, tools_1 = tools; _i < tools_1.length; _i++) { - var tool = tools_1[_i]; - if (types_1.isString(tool)) { - if (isToolName(tool)) - result.push(_known_tools[tool]()); - else - throw new Error("unknown tool type: " + tool); - } - else - result.push(tool); - } - return result; - })(); - return objs; - }; - Figure.prototype._process_legend = function (legend, source) { - var legend_item_label = null; - if (legend != null) { - if (types_1.isString(legend)) { - legend_item_label = { value: legend }; - if (source.columns() != null) { - if (array_1.includes(source.columns(), legend)) { - legend_item_label = { field: legend }; - } - } - } - else { - legend_item_label = legend; - } - } - return legend_item_label; - }; - Figure.prototype._update_legend = function (legend_item_label, glyph_renderer) { - var legend = this.legend; - var added = false; - for (var _i = 0, _a = legend.items; _i < _a.length; _i++) { - var item = _a[_i]; - if (item.label != null && eq_1.isEqual(item.label, legend_item_label)) { - // XXX: remove this when vectorable properties are refined - var label = item.label; - if ("value" in label) { - item.renderers.push(glyph_renderer); - added = true; - break; - } - if ("field" in label && glyph_renderer.data_source == item.renderers[0].data_source) { - item.renderers.push(glyph_renderer); - added = true; - break; - } - } - } - if (!added) { - var new_item = new models.LegendItem({ label: legend_item_label, renderers: [glyph_renderer] }); - legend.items.push(new_item); - } - }; - return Figure; - }(models_1.Plot)); - exports.Figure = Figure; - function figure(attributes) { - return new Figure(attributes); - } - exports.figure = figure; - function show(obj, target) { - var doc = new document_1.Document(); - for (var _i = 0, _a = types_1.isArray(obj) ? obj : [obj]; _i < _a.length; _i++) { - var item = _a[_i]; - doc.add_root(item); - } - var element; - if (target == null) { - element = document.body; - } - else if (types_1.isString(target)) { - var found = document.querySelector(target); - if (found != null && found instanceof HTMLElement) - element = found; - else - throw new Error("'" + target + "' selector didn't match any elements"); - } - else if (target instanceof HTMLElement) { - element = target; - } - else if (typeof $ !== 'undefined' && target instanceof $) { - element = target[0]; - } - else { - throw new Error("target should be HTMLElement, string selector, $ or null"); - } - var views = object_1.values(embed.add_document_standalone(doc, element)); // XXX - return new Promise(function (resolve, _reject) { - var result = types_1.isArray(obj) ? views : views[0]; - if (doc.is_idle) - resolve(result); - else - doc.idle.connect(function () { return resolve(result); }); - }); - } - exports.show = show; -} -, -409: /* core/util/random */ function _(require, module, exports) { - var MAX_INT32 = 2147483647; - // Park-Miller LCG - var Random = /** @class */ (function () { - function Random(seed) { - this.seed = seed % MAX_INT32; - if (this.seed <= 0) - this.seed += MAX_INT32 - 1; - } - Random.prototype.integer = function () { - this.seed = (48271 * this.seed) % MAX_INT32; - return this.seed; - }; - Random.prototype.float = function () { - return (this.integer() - 1) / (MAX_INT32 - 1); - }; - return Random; - }()); - exports.Random = Random; - exports.random = new Random(Date.now()); -} - -}, {"api/charts":401,"api/gridplot":402,"api/index":403,"api/linalg":404,"api/main":405,"api/models":406,"api/palettes":407,"api/plotting":408,"core/util/random":409}, 405, null); -}) - -//# sourceMappingURL=bokeh-api.js.map \ No newline at end of file diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.3.1.min.js b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.3.1.min.js new file mode 100644 index 000000000..883c221d7 --- /dev/null +++ b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.3.1.min.js @@ -0,0 +1,54 @@ +/*! + * Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Anaconda nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +(function(root, factory) { + factory(root["Bokeh"], "2.3.1"); +})(this, function(Bokeh, version) { + var define; + return (function(modules, entry, aliases, externals) { + const bokeh = typeof Bokeh !== "undefined" && (version != null ? Bokeh[version] : Bokeh); + if (bokeh != null) { + return bokeh.register_plugin(modules, entry, aliases); + } else { + throw new Error("Cannot find Bokeh " + version + ". You have to load it prior to loading plugins."); + } + }) +({ +407: function _(t,_,n,o,r){o();t(1).__exportStar(t(408),n)}, +408: function _(t,n,o,r,_){r();const i=t(1),c=i.__importStar(t(409));o.LinAlg=c;const p=i.__importStar(t(411));o.Charts=p;const s=i.__importStar(t(414));o.Plotting=s,_("Document",t(5).Document),_("sprintf",t(182).sprintf),i.__exportStar(t(413),o)}, +409: function _(t,_,r,o,a){o();const e=t(1);e.__exportStar(t(13),r),e.__exportStar(t(9),r),e.__exportStar(t(34),r),e.__exportStar(t(410),r),e.__exportStar(t(8),r),e.__exportStar(t(26),r)}, +410: function _(e,t,s,n,r){n();const o=2147483647;class i{constructor(e){this.seed=e%o,this.seed<=0&&(this.seed+=2147483646)}integer(){return this.seed=48271*this.seed%o,this.seed}float(){return(this.integer()-1)/2147483646}floats(e,t=0,s=1){const n=new Array(e);for(let r=0;r0&&(n.push(e.labels[t]),a.push(e.values[t]));const r=null!=t.start_angle?t.start_angle:0,_=null!=t.end_angle?t.end_angle:r+2*Math.PI,p=Math.abs(_-r),g=s.sum(a),h=a.map((e=>e/g)),f=s.cumsum(h).map((e=>r+p*e)),m=[r].concat(f.slice(0,-1)),b=s.zip(m,f).map((([e,t])=>(e+t)/2));let w,x;null==t.center?(w=0,x=0):i.isArray(t.center)?(w=t.center[0],x=t.center[1]):(w=t.center.x,x=t.center.y);const y=null!=t.inner_radius?t.inner_radius:0,v=null!=t.outer_radius?t.outer_radius:1,M=u(t.palette),R=[];for(let e=0;eo.is_dark(o.color2rgba(e))?"white":"black")),k=(y+v)/2;let[z,A]=s.unzip(b.map((e=>{return l=e,[(t=k)*Math.cos(l),t*Math.sin(l)];var t,l})));z=z.map((e=>e+w)),A=A.map((e=>e+x));const D=b.map((e=>e>=Math.PI/2&&e<=3*Math.PI/2?e+Math.PI:e)),P=new d.ColumnDataSource({data:{labels:n,values:a,percentages:h.map((e=>c.sprintf("%.2f%%",100*e))),start_angles:m,end_angles:f,text_angles:D,colors:R,text_colors:S,text_cx:z,text_cy:A}}),C=new d.AnnularWedge({x:w,y:x,inner_radius:y,outer_radius:v,start_angle:{field:"start_angles"},end_angle:{field:"end_angles"},line_color:null,line_width:1,fill_color:{field:"colors"}}),T=new d.AnnularWedge({x:w,y:x,inner_radius:y,outer_radius:v,start_angle:{field:"start_angles"},end_angle:{field:"end_angles"},line_color:null,line_width:1,fill_color:{field:"colors"},fill_alpha:.8}),G=new d.GlyphRenderer({data_source:P,glyph:C,hover_glyph:T}),I=new d.Text({x:{field:"text_cx"},y:{field:"text_cy"},text:{field:null!==(l=t.slice_labels)&&void 0!==l?l:"labels"},angle:{field:"text_angles"},text_align:"center",text_baseline:"middle",text_color:{field:"text_colors"},text_font_size:"12px"}),F=new d.GlyphRenderer({data_source:P,glyph:I}),H=new d.DataRange1d({renderers:[G],range_padding:.2}),L=new d.DataRange1d({renderers:[G],range_padding:.2}),Q=new d.Plot({x_range:H,y_range:L});Q.add_renderers(G,F);const W=new d.HoverTool({renderers:[G],tooltips:"
@labels
@values (@percentages)
"});return Q.add_tools(W),Q},l.bar=function(e,t={}){const l=e[0],n=e.slice(1),a=s.transpose(n),r=a[0].map((e=>e.toString())),o=a.slice(1);let i,c=new d.CategoricalAxis,_=new d.FactorRange({factors:r}),p=new d.CategoricalScale;i=null!=t.axis_number_format?new d.NumeralTickFormatter({format:t.axis_number_format}):new d.BasicTickFormatter;let g=new d.LinearAxis({formatter:i}),h=new d.DataRange1d({start:0}),f=new d.LinearScale;const m=u(t.palette),b=null!=t.stacked&&t.stacked,w=null!=t.orientation?t.orientation:"horizontal",x=[];if(b){const e=[],t=[];for(let n=0;nl[n+1]))}}),u=new d.Quad({left:{field:"left"},bottom:{field:"bottom"},right:{field:"right"},top:{field:"top"},line_color:null,fill_color:m[n%m.length]}),_=new d.GlyphRenderer({data_source:c,glyph:u});x.push(_)}}else{const e=1/o.length;for(let t=0;tl[t+1]))}}),u=new d.Quad({left:{field:"left"},bottom:{field:"bottom"},right:{field:"right"},top:{field:"top"},line_color:null,fill_color:m[t%m.length]}),_=new d.GlyphRenderer({data_source:c,glyph:u});x.push(_)}}if("vertical"==w){[h,_]=[_,h],[g,c]=[c,g],[f,p]=[p,f];for(const e of x){const t=e.data_source.data;[t.left,t.bottom]=[t.bottom,t.left],[t.right,t.top]=[t.top,t.right]}}const y=new d.Plot({x_range:h,y_range:_,x_scale:f,y_scale:p});let v,M;y.add_renderers(...x),y.add_layout(c,"left"),y.add_layout(g,"below"),"horizontal"==w?(v="center_right",M="horizontal"):(v="top_center",M="vertical");const R=new d.HoverTool({renderers:x,tooltips:"
@labels
@columns: @values
",point_policy:"snap_to_data",anchor:v,attachment:M});return y.add_tools(R),y}}, +412: function _(r,e,a,t,u){t(),a.Greens4=a.Greens3=a.Blues9=a.Blues8=a.Blues7=a.Blues6=a.Blues5=a.Blues4=a.Blues3=a.Purples9=a.Purples8=a.Purples7=a.Purples6=a.Purples5=a.Purples4=a.Purples3=a.YlOrBr9=a.YlOrBr8=a.YlOrBr7=a.YlOrBr6=a.YlOrBr5=a.YlOrBr4=a.YlOrBr3=a.YlOrRd9=a.YlOrRd8=a.YlOrRd7=a.YlOrRd6=a.YlOrRd5=a.YlOrRd4=a.YlOrRd3=a.OrRd9=a.OrRd8=a.OrRd7=a.OrRd6=a.OrRd5=a.OrRd4=a.OrRd3=a.PuRd9=a.PuRd8=a.PuRd7=a.PuRd6=a.PuRd5=a.PuRd4=a.PuRd3=a.RdPu9=a.RdPu8=a.RdPu7=a.RdPu6=a.RdPu5=a.RdPu4=void 0,a.PRGn5=a.PRGn4=a.PRGn3=a.BrBG11=a.BrBG10=a.BrBG9=a.BrBG8=a.BrBG7=a.BrBG6=a.BrBG5=a.BrBG4=a.BrBG3=a.PuOr11=a.PuOr10=a.PuOr9=a.PuOr8=a.PuOr7=a.PuOr6=a.PuOr5=a.PuOr4=a.PuOr3=a.Greys256=a.Greys11=a.Greys10=a.Greys9=a.Greys8=a.Greys7=a.Greys6=a.Greys5=a.Greys4=a.Greys3=a.Reds9=a.Reds8=a.Reds7=a.Reds6=a.Reds5=a.Reds4=a.Reds3=a.Oranges9=a.Oranges8=a.Oranges7=a.Oranges6=a.Oranges5=a.Oranges4=a.Oranges3=a.Greens9=a.Greens8=a.Greens7=a.Greens6=a.Greens5=void 0,a.Spectral10=a.Spectral9=a.Spectral8=a.Spectral7=a.Spectral6=a.Spectral5=a.Spectral4=a.Spectral3=a.RdYlBu11=a.RdYlBu10=a.RdYlBu9=a.RdYlBu8=a.RdYlBu7=a.RdYlBu6=a.RdYlBu5=a.RdYlBu4=a.RdYlBu3=a.RdGy11=a.RdGy10=a.RdGy9=a.RdGy8=a.RdGy7=a.RdGy6=a.RdGy5=a.RdGy4=a.RdGy3=a.RdBu11=a.RdBu10=a.RdBu9=a.RdBu8=a.RdBu7=a.RdBu6=a.RdBu5=a.RdBu4=a.RdBu3=a.PiYG11=a.PiYG10=a.PiYG9=a.PiYG8=a.PiYG7=a.PiYG6=a.PiYG5=a.PiYG4=a.PiYG3=a.PRGn11=a.PRGn10=a.PRGn9=a.PRGn8=a.PRGn7=a.PRGn6=void 0,a.Viridis256=a.Viridis11=a.Viridis10=a.Viridis9=a.Viridis8=a.Viridis7=a.Viridis6=a.Viridis5=a.Viridis4=a.Viridis3=a.Plasma256=a.Plasma11=a.Plasma10=a.Plasma9=a.Plasma8=a.Plasma7=a.Plasma6=a.Plasma5=a.Plasma4=a.Plasma3=a.Magma256=a.Magma11=a.Magma10=a.Magma9=a.Magma8=a.Magma7=a.Magma6=a.Magma5=a.Magma4=a.Magma3=a.Inferno256=a.Inferno11=a.Inferno10=a.Inferno9=a.Inferno8=a.Inferno7=a.Inferno6=a.Inferno5=a.Inferno4=a.Inferno3=a.RdYlGn11=a.RdYlGn10=a.RdYlGn9=a.RdYlGn8=a.RdYlGn7=a.RdYlGn6=a.RdYlGn5=a.RdYlGn4=a.RdYlGn3=a.Spectral11=void 0,a.Set3_4=a.Set3_3=a.Set2_8=a.Set2_7=a.Set2_6=a.Set2_5=a.Set2_4=a.Set2_3=a.Set1_9=a.Set1_8=a.Set1_7=a.Set1_6=a.Set1_5=a.Set1_4=a.Set1_3=a.Pastel2_8=a.Pastel2_7=a.Pastel2_6=a.Pastel2_5=a.Pastel2_4=a.Pastel2_3=a.Pastel1_9=a.Pastel1_8=a.Pastel1_7=a.Pastel1_6=a.Pastel1_5=a.Pastel1_4=a.Pastel1_3=a.Paired12=a.Paired11=a.Paired10=a.Paired9=a.Paired8=a.Paired7=a.Paired6=a.Paired5=a.Paired4=a.Paired3=a.Dark2_8=a.Dark2_7=a.Dark2_6=a.Dark2_5=a.Dark2_4=a.Dark2_3=a.Accent8=a.Accent7=a.Accent6=a.Accent5=a.Accent4=a.Accent3=void 0,a.Category20b_18=a.Category20b_17=a.Category20b_16=a.Category20b_15=a.Category20b_14=a.Category20b_13=a.Category20b_12=a.Category20b_11=a.Category20b_10=a.Category20b_9=a.Category20b_8=a.Category20b_7=a.Category20b_6=a.Category20b_5=a.Category20b_4=a.Category20b_3=a.Category20_20=a.Category20_19=a.Category20_18=a.Category20_17=a.Category20_16=a.Category20_15=a.Category20_14=a.Category20_13=a.Category20_12=a.Category20_11=a.Category20_10=a.Category20_9=a.Category20_8=a.Category20_7=a.Category20_6=a.Category20_5=a.Category20_4=a.Category20_3=a.Category10_10=a.Category10_9=a.Category10_8=a.Category10_7=a.Category10_6=a.Category10_5=a.Category10_4=a.Category10_3=a.Set3_12=a.Set3_11=a.Set3_10=a.Set3_9=a.Set3_8=a.Set3_7=a.Set3_6=a.Set3_5=void 0,a.RdGy=a.RdBu=a.PiYG=a.PRGn=a.BrBG=a.PuOr=a.Greys=a.Reds=a.Oranges=a.Greens=a.Blues=a.Purples=a.YlOrBr=a.YlOrRd=a.OrRd=a.PuRd=a.RdPu=a.BuPu=a.PuBu=a.PuBuGn=a.BuGn=a.GnBu=a.YlGnBu=a.YlGn=a.Colorblind8=a.Colorblind7=a.Colorblind6=a.Colorblind5=a.Colorblind4=a.Colorblind3=a.Category20c_20=a.Category20c_19=a.Category20c_18=a.Category20c_17=a.Category20c_16=a.Category20c_15=a.Category20c_14=a.Category20c_13=a.Category20c_12=a.Category20c_11=a.Category20c_10=a.Category20c_9=a.Category20c_8=a.Category20c_7=a.Category20c_6=a.Category20c_5=a.Category20c_4=a.Category20c_3=a.Category20b_20=a.Category20b_19=void 0,a.Colorblind=a.Category20c=a.Category20b=a.Category20=a.Category10=a.Set3=a.Set2=a.Set1=a.Pastel2=a.Pastel1=a.Paired=a.Dark2=a.Accent=a.Viridis=a.Plasma=a.Magma=a.Inferno=a.RdYlGn=a.Spectral=a.RdYlBu=void 0,a.YlGn3=[832787711,2916978431,4160535039],a.YlGn4=[595870719,2026273279,3269892607,4294954239],a.YlGn5=[6830079,832787711,2026273279,3269892607,4294954239],a.YlGn6=[6830079,832787711,2026273279,2916978431,3656426495,4294954239],a.YlGn7=[5911295,595870719,1101749759,2026273279,2916978431,3656426495,4294954239],a.YlGn8=[5911295,595870719,1101749759,2026273279,2916978431,3656426495,4160535039,4294960639],a.YlGn9=[4532735,6830079,595870719,1101749759,2026273279,2916978431,3656426495,4160535039,4294960639],a.YlGnBu3=[746567935,2144189439,3992498687],a.YlGnBu4=[576628991,1102497023,2715464959,4294954239],a.YlGnBu5=[624203007,746567935,1102497023,2715464959,4294954239],a.YlGnBu6=[624203007,746567935,1102497023,2144189439,3353982207,4294954239],a.YlGnBu7=[204244223,576628991,496091391,1102497023,2144189439,3353982207,4294954239],a.YlGnBu8=[204244223,576628991,496091391,1102497023,2144189439,3353982207,3992498687,4294957567],a.YlGnBu9=[136141055,624203007,576628991,496091391,1102497023,2144189439,3353982207,3992498687,4294957567],a.GnBu3=[1134742271,2833102335,3774077951],a.GnBu4=[730644223,2077017343,3135552767,4042909951],a.GnBu5=[141077759,1134742271,2077017343,3135552767,4042909951],a.GnBu6=[141077759,1134742271,2077017343,2833102335,3438003711,4042909951],a.GnBu7=[140025599,730644223,1320408063,2077017343,2833102335,3438003711,4042909951],a.GnBu8=[140025599,730644223,1320408063,2077017343,2833102335,3438003711,3774077951,4160549119],a.GnBu9=[138445311,141077759,730644223,1320408063,2077017343,2833102335,3438003711,3774077951,4160549119],a.BuGn3=[748838911,2581121535,3858102783],a.BuGn4=[596329983,1724032255,3001213695,3992517631],a.BuGn5=[7154943,748838911,1724032255,3001213695,3992517631],a.BuGn6=[7154943,748838911,1724032255,2581121535,3438077695,3992517631],a.BuGn7=[5776639,596329983,1101952767,1724032255,2581121535,3438077695,3992517631],a.BuGn8=[5776639,596329983,1101952767,1724032255,2581121535,3438077695,3858102783,4160552447],a.BuGn9=[4463615,7154943,596329983,1101952767,1724032255,2581121535,3438077695,3858102783,4160552447],a.PuBuGn3=[479238655,2797460479,3974295807],a.PuBuGn4=[42044159,1739182079,3184124415,4142921727],a.PuBuGn5=[23878143,479238655,1739182079,3184124415,4142921727],a.PuBuGn6=[23878143,479238655,1739182079,2797460479,3503417087,4142921727],a.PuBuGn7=[23351551,42044159,915456255,1739182079,2797460479,3503417087,4142921727],a.PuBuGn8=[23351551,42044159,915456255,1739182079,2797460479,3503417087,3974295807,4294441983],a.PuBuGn9=[21378815,23878143,42044159,915456255,1739182079,2797460479,3503417087,3974295807,4294441983],a.PuBu3=[730644223,2797460479,3974623999],a.PuBu4=[91271423,1957285887,3184124415,4058969855],a.PuBu5=[73043455,730644223,1957285887,3184124415,4058969855],a.PuBu6=[73043455,730644223,1957285887,2797460479,3503417087,4058969855],a.PuBu7=[55475199,91271423,915456255,1957285887,2797460479,3503417087,4058969855],a.PuBu8=[55475199,91271423,915456255,1957285887,2797460479,3503417087,3974623999,4294441983],a.PuBu9=[37247231,73043455,91271423,915456255,1957285887,2797460479,3503417087,3974623999,4294441983],a.BuPu3=[2287380479,2663176959,3773625599],a.BuPu4=[2286001663,2358691583,3016614911,3992517631],a.BuPu5=[2165275903,2287380479,2358691583,3016614911,3992517631],a.BuPu6=[2165275903,2287380479,2358691583,2663176959,3218335487,3992517631],a.BuPu7=[1845586943,2286001663,2355868159,2358691583,2663176959,3218335487,3992517631],a.BuPu8=[1845586943,2286001663,2355868159,2358691583,2663176959,3218335487,3773625599,4160552447],a.BuPu9=[1291865087,2165275903,2286001663,2355868159,2358691583,2663176959,3218335487,3773625599,4160552447],a.RdPu3=[3306916607,4204770815,4259372543],a.RdPu4=[2919333631,4150829567,4222925311,4276871935],a.RdPu5=[2046916607,3306916607,4150829567,4222925311,4276871935],a.RdPu6=[2046916607,3306916607,4150829567,4204770815,4240818431,4276871935],a.RdPu7=[2046916607,2919333631,3711211519,4150829567,4204770815,4240818431,4276871935],a.RdPu8=[2046916607,2919333631,3711211519,4150829567,4204770815,4240818431,4259372543,4294439935],a.RdPu9=[1224764159,2046916607,2919333631,3711211519,4150829567,4204770815,4240818431,4259372543,4294439935],a.PuRd3=[3709630463,3381970943,3890343935],a.PuRd4=[3457308415,3747983615,3619019007,4058969855],a.PuRd5=[2550154239,3709630463,3747983615,3619019007,4058969855],a.PuRd6=[2550154239,3709630463,3747983615,3381970943,3568950015,4058969855],a.PuRd7=[2432712703,3457308415,3878259455,3747983615,3381970943,3568950015,4058969855],a.PuRd8=[2432712703,3457308415,3878259455,3747983615,3381970943,3568950015,3890343935,4160027135],a.PuRd9=[1728061439,2550154239,3457308415,3878259455,3747983615,3381970943,3568950015,3890343935,4160027135],a.OrRd3=[3813291007,4256924927,4276668671],a.OrRd4=[3610255359,4237122047,4258040575,4277197311],a.OrRd5=[3003121919,3813291007,4237122047,4258040575,4277197311],a.OrRd6=[3003121919,3813291007,4237122047,4256924927,4258569983,4277197311],a.OrRd7=[2566914303,3610255359,4016392447,4237122047,4256924927,4258569983,4277197311],a.OrRd8=[2566914303,3610255359,4016392447,4237122047,4256924927,4258569983,4276668671,4294438143],a.OrRd9=[2130706687,3003121919,3610255359,4016392447,4237122047,4256924927,4258569983,4276668671,4294438143],a.YlOrRd3=[4030406911,4273097983,4293763327],a.YlOrRd4=[3810139391,4253891839,4274806015,4294947583],a.YlOrRd5=[3170903807,4030406911,4253891839,4274806015,4294947583],a.YlOrRd6=[3170903807,4030406911,4253891839,4273097983,4275664639,4294947583],a.YlOrRd7=[2969577215,3810139391,4232981247,4253891839,4273097983,4275664639,4294947583],a.YlOrRd8=[2969577215,3810139391,4232981247,4253891839,4273097983,4275664639,4293763327,4294954239],a.YlOrRd9=[2147493631,3170903807,3810139391,4232981247,4253891839,4273097983,4275664639,4293763327,4294954239],a.YlOrBr3=[3646885631,4274278399,4294425855],a.YlOrBr4=[3427533567,4271450623,4275670783,4294956287],a.YlOrBr5=[2570323199,3646885631,4271450623,4275670783,4294956287],a.YlOrBr6=[2570323199,3646885631,4271450623,4274278399,4276326911,4294956287],a.YlOrBr7=[2351760639,3427533567,3966768383,4271450623,4274278399,4276326911,4294956287],a.YlOrBr8=[2351760639,3427533567,3966768383,4271450623,4274278399,4276326911,4294425855,4294960639],a.YlOrBr9=[1713702655,2570323199,3427533567,3966768383,4271450623,4274278399,4276326911,4294425855,4294960639],a.Purples3=[1969992191,3166559487,4025349631],a.Purples4=[1783735295,2660944127,3419005695,4075878399],a.Purples5=[1411878911,1969992191,2660944127,3419005695,4075878399],a.Purples6=[1411878911,1969992191,2660944127,3166559487,3671780351,4075878399],a.Purples7=[1242859263,1783735295,2155723519,2660944127,3166559487,3671780351,4075878399],a.Purples8=[1242859263,1783735295,2155723519,2660944127,3166559487,3671780351,4025349631,4244372991],a.Purples9=[1056996863,1411878911,1783735295,2155723519,2660944127,3166559487,3671780351,4025349631,4244372991],a.Blues3=[830651903,2664096255,3740006399],a.Blues4=[561100287,1806620415,3185043455,4025745407],a.Blues5=[139566335,830651903,1806620415,3185043455,4025745407],a.Blues6=[139566335,830651903,1806620415,2664096255,3336302591,4025745407],a.Blues7=[138777855,561100287,1116915455,1806620415,2664096255,3336302591,4025745407],a.Blues8=[138777855,561100287,1116915455,1806620415,2664096255,3336302591,3740006399,4160487423],a.Blues9=[137391103,139566335,561100287,1116915455,1806620415,2664096255,3336302591,3740006399,4160487423],a.Greens3=[832787711,2715393023,3858096383],a.Greens4=[596329983,1959032575,3135550463,3992513023],a.Greens5=[7154943,832787711,1959032575,3135550463,3992513023],a.Greens6=[7154943,832787711,1959032575,2715393023,3353985279,3992513023],a.Greens7=[5911295,596329983,1101749759,1959032575,2715393023,3353985279,3992513023],a.Greens8=[5911295,596329983,1101749759,1959032575,2715393023,3353985279,3858096383,4160550399],a.Greens9=[4463615,7154943,596329983,1101749759,1959032575,2715393023,3353985279,3858096383,4160550399],a.Oranges3=[3864333823,4256066559,4276539135],a.Oranges4=[3645309439,4253891839,4257121791,4277001983],a.Oranges5=[2788557823,3864333823,4253891839,4257121791,4277001983],a.Oranges6=[2788557823,3864333823,4253891839,4256066559,4258308863,4277001983],a.Oranges7=[2351760639,3645374975,4050195455,4253891839,4256066559,4258308863,4277001983],a.Oranges8=[2351760639,3645374975,4050195455,4253891839,4256066559,4258308863,4276539135,4294306815],a.Oranges9=[2133263615,2788557823,3645374975,4050195455,4253891839,4256066559,4258308863,4276539135,4294306815],a.Reds3=[3727501055,4237456127,4276146943],a.Reds4=[3407355391,4218047231,4239299071,4276476415],a.Reds5=[2769229311,3727501055,4218047231,4239299071,4276476415],a.Reds6=[2769229311,3727501055,4218047231,4237456127,4240155135,4276476415],a.Reds7=[2566917631,3407355391,4013632767,4218047231,4237456127,4240155135,4276476415],a.Reds8=[2566917631,3407355391,4013632767,4218047231,4237456127,4240155135,4276146943,4294308095],a.Reds9=[1728056831,2769229311,3407355391,4013632767,4218047231,4237456127,4240155135,4276146943,4294308095],a.Greys3=[1667458047,3183328767,4042322175],a.Greys4=[1381126911,2526451455,3435973887,4160223231],a.Greys5=[623191551,1667458047,2526451455,3435973887,4160223231],a.Greys6=[623191551,1667458047,2526451455,3183328767,3654932991,4160223231],a.Greys7=[623191551,1381126911,1936946175,2526451455,3183328767,3654932991,4160223231],a.Greys8=[623191551,1381126911,1936946175,2526451455,3183328767,3654932991,4042322175,4294967295],a.Greys9=[255,623191551,1381126911,1936946175,2526451455,3183328767,3654932991,4042322175,4294967295],a.Greys10=[255,471604479,943208703,1431655935,1903260159,2374864383,2863311615,3334915839,3806520063,4294967295],a.Greys11=[255,421075455,858993663,1280068863,1717987071,2139062271,2576980479,2998055679,3435973887,3857049087,4294967295],a.Greys256=[255,16843263,33686271,50529279,67372287,84215295,101058303,117901311,134744319,151587327,168430335,185273343,202116351,218959359,235802367,252645375,269488383,286331391,303174399,320017407,336860415,353703423,370546431,387389439,404232447,421075455,437918463,454761471,471604479,488447487,505290495,522133503,538976511,555819519,572662527,589505535,606348543,623191551,640034559,656877567,673720575,690563583,707406591,724249599,741092607,757935615,774778623,791621631,808464639,825307647,842150655,858993663,875836671,892679679,909522687,926365695,943208703,960051711,976894719,993737727,1010580735,1027423743,1044266751,1061109759,1077952767,1094795775,1111638783,1128481791,1145324799,1162167807,1179010815,1195853823,1212696831,1229539839,1246382847,1263225855,1280068863,1296911871,1313754879,1330597887,1347440895,1364283903,1381126911,1397969919,1414812927,1431655935,1448498943,1465341951,1482184959,1499027967,1515870975,1532713983,1549556991,1566399999,1583243007,1600086015,1616929023,1633772031,1650615039,1667458047,1684301055,1701144063,1717987071,1734830079,1751673087,1768516095,1785359103,1802202111,1819045119,1835888127,1852731135,1869574143,1886417151,1903260159,1920103167,1936946175,1953789183,1970632191,1987475199,2004318207,2021161215,2038004223,2054847231,2071690239,2088533247,2105376255,2122219263,2139062271,2155905279,2172748287,2189591295,2206434303,2223277311,2240120319,2256963327,2273806335,2290649343,2307492351,2324335359,2341178367,2358021375,2374864383,2391707391,2408550399,2425393407,2442236415,2459079423,2475922431,2492765439,2509608447,2526451455,2543294463,2560137471,2576980479,2593823487,2610666495,2627509503,2644352511,2661195519,2678038527,2694881535,2711724543,2728567551,2745410559,2762253567,2779096575,2795939583,2812782591,2829625599,2846468607,2863311615,2880154623,2896997631,2913840639,2930683647,2947526655,2964369663,2981212671,2998055679,3014898687,3031741695,3048584703,3065427711,3082270719,3099113727,3115956735,3132799743,3149642751,3166485759,3183328767,3200171775,3217014783,3233857791,3250700799,3267543807,3284386815,3301229823,3318072831,3334915839,3351758847,3368601855,3385444863,3402287871,3419130879,3435973887,3452816895,3469659903,3486502911,3503345919,3520188927,3537031935,3553874943,3570717951,3587560959,3604403967,3621246975,3638089983,3654932991,3671775999,3688619007,3705462015,3722305023,3739148031,3755991039,3772834047,3789677055,3806520063,3823363071,3840206079,3857049087,3873892095,3890735103,3907578111,3924421119,3941264127,3958107135,3974950143,3991793151,4008636159,4025479167,4042322175,4059165183,4076008191,4092851199,4109694207,4126537215,4143380223,4160223231,4177066239,4193909247,4210752255,4227595263,4244438271,4261281279,4278124287,4294967295],a.PuOr3=[2576270335,4160223231,4054008063],a.PuOr4=[1581029887,2997605119,4256719871,3865117183],a.PuOr5=[1581029887,2997605119,4160223231,4256719871,3865117183],a.PuOr6=[1411877119,2576270335,3638225919,4276139775,4054008063,3008890623],a.PuOr7=[1411877119,2576270335,3638225919,4160223231,4276139775,4054008063,3008890623],a.PuOr8=[1411877119,2155064575,2997605119,3638225919,4276139775,4256719871,3766621439,3008890623],a.PuOr9=[1411877119,2155064575,2997605119,3638225919,4160223231,4276139775,4256719871,3766621439,3008890623],a.PuOr10=[754994175,1411877119,2155064575,2997605119,3638225919,4276139775,4256719871,3766621439,3008890623,2134575359],a.PuOr11=[754994175,1411877119,2155064575,2997605119,3638225919,4160223231,4276139775,4256719871,3766621439,3008890623,2134575359],a.BrBG3=[1521790207,4126537215,3635635711],a.BrBG4=[25522687,2160968191,3754065407,2791381759],a.BrBG5=[25522687,2160968191,4126537215,3754065407,2791381759],a.BrBG6=[23486207,1521790207,3354060287,4142449663,3635635711,2354121471],a.BrBG7=[23486207,1521790207,3354060287,4126537215,4142449663,3635635711,2354121471],a.BrBG8=[23486207,899125247,2160968191,3354060287,4142449663,3754065407,3212914175,2354121471],a.BrBG9=[23486207,899125247,2160968191,3354060287,4126537215,4142449663,3754065407,3212914175,2354121471],a.BrBG10=[3944703,23486207,899125247,2160968191,3354060287,4142449663,3754065407,3212914175,2354121471,1412433407],a.BrBG11=[3944703,23486207,899125247,2160968191,3354060287,4126537215,4142449663,3754065407,3212914175,2354121471,1412433407],a.PRGn3=[2143255551,4160223231,2945303551],a.PRGn4=[8927231,2799411455,3265646591,2066912511],a.PRGn5=[8927231,2799411455,4160223231,3265646591,2066912511],a.PRGn6=[460863487,2143255551,3656438783,3889490175,2945303551,1982497791],a.PRGn7=[460863487,2143255551,3656438783,4160223231,3889490175,2945303551,1982497791],a.PRGn8=[460863487,1521377791,2799411455,3656438783,3889490175,3265646591,2574298111,1982497791],a.PRGn9=[460863487,1521377791,2799411455,3656438783,4160223231,3889490175,3265646591,2574298111,1982497791],a.PRGn10=[4463615,460863487,1521377791,2799411455,3656438783,3889490175,3265646591,2574298111,1982497791,1073761279],a.PRGn11=[4463615,460863487,1521377791,2799411455,3656438783,4160223231,3889490175,3265646591,2574298111,1982497791,1073761279],a.PiYG3=[2715249407,4160223231,3919825407],a.PiYG4=[1303127807,3101787903,4055292671,3491531775],a.PiYG5=[1303127807,3101787903,4160223231,4055292671,3491531775],a.PiYG6=[1301422591,2715249407,3874869503,4259377151,3919825407,3306913279],a.PiYG7=[1301422591,2715249407,3874869503,4160223231,4259377151,3919825407,3306913279],a.PiYG8=[1301422591,2143044095,3101787903,3874869503,4259377151,4055292671,3732385535,3306913279],a.PiYG9=[1301422591,2143044095,3101787903,3874869503,4160223231,4259377151,4055292671,3732385535,3306913279],a.PiYG10=[660871679,1301422591,2143044095,3101787903,3874869503,4259377151,4055292671,3732385535,3306913279,2382451455],a.PiYG11=[660871679,1301422591,2143044095,3101787903,3874869503,4160223231,4259377151,4055292671,3732385535,3306913279,2382451455],a.RdBu3=[1739182079,4160223231,4018823935],a.RdBu4=[91336959,2462441215,4104487679,3389006079],a.RdBu5=[91336959,2462441215,4160223231,4104487679,3389006079],a.RdBu6=[560377087,1739182079,3521507583,4259039231,4018823935,2987928575],a.RdBu7=[560377087,1739182079,3521507583,4160223231,4259039231,4018823935,2987928575],a.RdBu8=[560377087,1133757439,2462441215,3521507583,4259039231,4104487679,3596635647,2987928575],a.RdBu9=[560377087,1133757439,2462441215,3521507583,4160223231,4259039231,4104487679,3596635647,2987928575],a.RdBu10=[87056895,560377087,1133757439,2462441215,3521507583,4259039231,4104487679,3596635647,2987928575,1728061439],a.RdBu11=[87056895,560377087,1133757439,2462441215,3521507583,4160223231,4259039231,4104487679,3596635647,2987928575,1728061439],a.RdGy3=[2576980479,4294967295,4018823935],a.RdGy4=[1077952767,3132799743,4104487679,3389006079],a.RdGy5=[1077952767,3132799743,4294967295,4104487679,3389006079],a.RdGy6=[1296911871,2576980479,3772834047,4259039231,4018823935,2987928575],a.RdGy7=[1296911871,2576980479,3772834047,4294967295,4259039231,4018823935,2987928575],a.RdGy8=[1296911871,2273806335,3132799743,3772834047,4259039231,4104487679,3596635647,2987928575],a.RdGy9=[1296911871,2273806335,3132799743,3772834047,4294967295,4259039231,4104487679,3596635647,2987928575],a.RdGy10=[437918463,1296911871,2273806335,3132799743,3772834047,4259039231,4104487679,3596635647,2987928575,1728061439],a.RdGy11=[437918463,1296911871,2273806335,3132799743,3772834047,4294967295,4259039231,4104487679,3596635647,2987928575,1728061439],a.RdYlBu3=[2445270015,4294950911,4237122047],a.RdYlBu4=[746305279,2883185151,4256063999,3608747263],a.RdYlBu5=[746305279,2883185151,4294950911,4256063999,3608747263],a.RdYlBu6=[1165341951,2445270015,3774085375,4276130047,4237122047,3610257407],a.RdYlBu7=[1165341951,2445270015,3774085375,4294950911,4276130047,4237122047,3610257407],a.RdYlBu8=[1165341951,1957548543,2883185151,3774085375,4276130047,4256063999,4100801535,3610257407],a.RdYlBu9=[1165341951,1957548543,2883185151,3774085375,4294950911,4276130047,4256063999,4100801535,3610257407],a.RdYlBu10=[825660927,1165341951,1957548543,2883185151,3774085375,4276130047,4256063999,4100801535,3610257407,2768250623],a.RdYlBu11=[825660927,1165341951,1957548543,2883185151,3774085375,4294950911,4276130047,4256063999,4100801535,3610257407,2768250623],a.Spectral3=[2580911359,4294950911,4237122047],a.Spectral4=[730053375,2883429631,4256063999,3608747263],a.Spectral5=[730053375,2883429631,4294950911,4256063999,3608747263],a.Spectral6=[847822335,2580911359,3874855167,4276128767,4237122047,3577630719],a.Spectral7=[847822335,2580911359,3874855167,4294950911,4276128767,4237122047,3577630719],a.Spectral8=[847822335,1724032511,2883429631,3874855167,4276128767,4256063999,4100801535,3577630719],a.Spectral9=[847822335,1724032511,2883429631,3874855167,4294950911,4276128767,4256063999,4100801535,3577630719],a.Spectral10=[1582277375,847822335,1724032511,2883429631,3874855167,4276128767,4256063999,4100801535,3577630719,2650882815],a.Spectral11=[1582277375,847822335,1724032511,2883429631,3874855167,4294950911,4276128767,4256063999,4100801535,3577630719,2650882815],a.RdYlGn3=[2446287103,4294950911,4237122047],a.RdYlGn4=[446054911,2799266559,4256063999,3608747263],a.RdYlGn5=[446054911,2799266559,4294950911,4256063999,3608747263],a.RdYlGn6=[446189823,2446287103,3656354815,4276128767,4237122047,3610257407],a.RdYlGn7=[446189823,2446287103,3656354815,4294950911,4276128767,4237122047,3610257407],a.RdYlGn8=[446189823,1723687935,2799266559,3656354815,4276128767,4256063999,4100801535,3610257407],a.RdYlGn9=[446189823,1723687935,2799266559,3656354815,4294950911,4276128767,4256063999,4100801535,3610257407],a.RdYlGn10=[6830079,446189823,1723687935,2799266559,3656354815,4276128767,4256063999,4100801535,3610257407,2768250623],a.RdYlGn11=[6830079,446189823,1723687935,2799266559,3656354815,4294950911,4276128767,4256063999,4100801535,3610257407,2768250623],a.Inferno3=[1023,3124123135,4244546815],a.Inferno4=[1023,2015129087,3983025663,4244546815],a.Inferno5=[1023,1427074559,3124123135,4186704383,4244546815],a.Inferno6=[1023,1091135487,2468702207,3696245247,4221831935,4244546815],a.Inferno7=[1023,839474687,2015129087,3124123135,3983025663,4222818559,4244546815],a.Inferno8=[1023,655053567,1662283519,2653512703,3527885567,4118550015,4206831103,4244546815],a.Inferno9=[1023,520898559,1427074559,2283891455,3124123135,3814208255,4186704383,4173935103,4244546815],a.Inferno10=[1023,436945151,1242262271,2015129087,2754371839,3443673087,3983025663,4221110015,4157553407,4244546815],a.Inferno11=[1023,369834495,1091135487,1779920639,2468702207,3124123135,3696245247,4067760895,4221831935,4141171455,4244546815],a.Inferno256=[1023,1279,1791,16779263,16845311,16845823,33623807,33689855,50467583,67310847,67311359,84154623,100932607,117775871,134619135,151396863,168240127,185018111,218638591,235416319,252259839,269037567,302658303,319436031,336279295,369834495,386612223,420167423,436945151,470565887,487343615,520898559,537676543,571165951,604720895,638275839,655053567,688608511,722097919,755652863,772430591,805985535,839474687,873029631,889807103,923361791,956916479,990471423,1007248895,1040803583,1074358015,1091135487,1124755711,1158310399,1175087615,1208707839,1242262271,1259105279,1292659711,1326279935,1343057151,1376677119,1393454591,1427074559,1460628991,1477471743,1511091711,1527869183,1561489151,1595043583,1611886335,1645506303,1662283519,1695903487,1712680703,1746300671,1779920639,1796697855,1830317823,1847095039,1880715007,1914269183,1931111935,1964731903,1981509119,2015129087,2048683519,2065526015,2099080447,2115923199,2149542911,2166320127,2199940095,2233494271,2250337023,2283891455,2300733951,2334288383,2367908351,2384750847,2418305279,2435147775,2468702207,2502321919,2519099135,2552718847,2569561343,2603115775,2619958271,2653512703,2687132415,2703974911,2737529343,2754371839,2787926015,2804768767,2838388479,2871942655,2888785151,2922404863,2939247615,2972801791,2989644287,3023263999,3040040959,3073660671,3090503423,3124123135,3140965631,3174519807,3191362303,3208204799,3241824511,3258667007,3292286719,3309129215,3342748927,3359525887,3376368383,3409988095,3426830591,3443673087,3477358335,3494200575,3511043071,3527885567,3561505279,3578347775,3595190271,3612032767,3645718015,3662560255,3679402751,3696245247,3713153279,3729995775,3746838271,3763746047,3797365759,3814208255,3831116287,3847958783,3864801023,3864931839,3881774335,3898682367,3915524863,3932432639,3949275135,3966183167,3983025663,3983156223,4000064255,4016906751,4033814527,4033879807,4050787839,4067695871,4067760895,4084668927,4084799743,4101641983,4118550015,4118680831,4135588607,4135653887,4152561919,4152692479,4169600511,4169665791,4169796607,4186704383,4186835199,4186966271,4203808767,4203939583,4204070655,4204201727,4221110015,4221241087,4221372159,4221437951,4221569023,4221700351,4221831935,4221963263,4222094847,4222226175,4222357759,4222489343,4222620927,4222686975,4222818559,4222950143,4223081727,4223213311,4206567935,4206699519,4206831103,4206962943,4190317311,4190448895,4190580735,4173935103,4174066943,4174198783,4157553407,4157684991,4141039615,4141171455,4124526079,4124657919,4108012543,4108079103,4091433727,4091565823,4091697663,4075052543,4075184383,4058539263,4058605823,4058737919,4058870015,4058936575,4059068927,4059201023,4076044799,4076111359,4093020671,4109864447,4126708223,4143617535,4160461311,4194082303,4210925823,4244546815],a.Magma3=[1023,3040246271,4227645439],a.Magma4=[1023,1897890303,4032847359,4227645439],a.Magma5=[1023,1326545919,3040246271,4219887871,4227645439],a.Magma6=[1023,990867455,2351530239,3712575743,4255083775,4227645439],a.Magma7=[1023,722558719,1897890303,3040246271,4032847359,4272846591,4227645439],a.Magma8=[1023,571560191,1561820927,2536275967,3510791935,4168441087,4273569791,4227645439],a.Magma9=[1023,454051071,1326545919,2166718975,3040246271,3847250943,4219887871,4274161407,4227645439],a.Magma10=[1023,386874623,1125086719,1897890303,2653847295,3409867263,4032847359,4237518591,4274490367,4227645439],a.Magma11=[1023,336410111,990867455,1662615551,2351530239,3040246271,3712575743,4134427647,4255083775,4258107647,4227645439],a.Magma256=[1023,1279,1791,16779263,16845311,16845823,33689087,33689599,50532863,67310591,67376639,84154367,100997631,117775359,134618623,151461887,168239871,185083135,201926399,218769663,235547391,252390655,269234175,286011903,302855167,336410111,353253631,370031359,386874623,403652607,437273087,454051071,470828799,504383999,521227263,538004991,571560191,588337919,621893119,638670847,672225791,705780991,722558719,756048127,789603071,806381055,839935999,873490687,890202879,923757823,957312767,990867455,1007645183,1041199871,1074754559,1108309247,1125086719,1158641407,1192196095,1209039103,1242593791,1259371007,1292991231,1326545919,1343388671,1376943359,1393786111,1427340799,1460960767,1477803775,1511358207,1528200959,1561820927,1578598399,1612218367,1628995583,1662615551,1696235775,1713012991,1746632959,1763475711,1797030143,1813872895,1847493119,1864270335,1897890303,1931444735,1948287487,1981907455,1998684671,2032304639,2049081855,2082701823,2116321791,2133099007,2166718975,2183496191,2217116159,2233893375,2267513343,2301133311,2317910527,2351530239,2368307455,2401927423,2435481855,2452324607,2485879039,2502721791,2536275967,2569895935,2586673151,2620293119,2653847295,2670690047,2704244479,2737864447,2754641407,2788261375,2805038591,2838658303,2872278271,2889055231,2922675199,2956229631,2973072127,3006626559,3040246271,3057023487,3090643199,3107420415,3141040127,3174660095,3191437055,3225056767,3258611199,3275453695,3309073663,3325850623,3359470335,3393090303,3409867263,3443486975,3460329727,3493949439,3510791935,3544346111,3561188863,3594808575,3611651071,3645270783,3662113279,3695733247,3712575743,3729418239,3763037951,3779880703,3796723199,3830342911,3847250943,3864093439,3880936191,3897844223,3931463935,3948306687,3965214719,3982057471,3998965503,3999096319,4015939071,4032847359,4049689855,4066598143,4083506431,4083637247,4100479999,4117388287,4117519359,4134427647,4134558719,4151401471,4151532799,4168441087,4168572159,4185480447,4185611775,4185742847,4202651391,4202716927,4202848255,4219756799,4219887871,4220019199,4220150527,4237059071,4237190143,4237321471,4237452799,4237518591,4254427135,4254558463,4254689791,4254821119,4254952447,4255083775,4255215359,4255281151,4255412479,4272321023,4272452607,4272583935,4272715263,4272846591,4272912639,4273043967,4273175551,4273306879,4273438207,4273569791,4273701119,4273767167,4273898495,4274030079,4274161407,4274292991,4274424319,4274490367,4274621951,4274753279,4258107647,4258239231,4258370559,4258436607,4258568191,4258699519,4258831103,4258962687,4259094015,4259160063,4259291647,4259423231,4242777599,4242908927,4242974975,4243106559,4243238143,4243369727,4243501311,4243632639,4243698687,4243830271,4243961855,4227316223,4227447807,4227513855,4227645439],a.Plasma3=[201819903,3393616127,4026016255],a.Plasma4=[201819903,2602016511,3967308799,4026016255],a.Plasma5=[201819903,2080548863,3393616127,4153623039,4026016255],a.Plasma6=[201819903,1778427903,2955579391,3764675071,4238751231,4026016255],a.Plasma7=[201819903,1543546367,2602016511,3393616127,3967308799,4256313343,4026016255],a.Plasma8=[201819903,1375839231,2299045375,3090319871,3663358207,4085729535,4256902143,4026016255],a.Plasma9=[201819903,1241686271,2080548863,2820839167,3393616127,3849018623,4153623039,4257425663,4026016255],a.Plasma10=[201819903,1157865215,1912645887,2602016511,3157689855,3612765439,3967308799,4204608255,4240910079,4026016255],a.Plasma11=[201819903,1073978623,1778427903,2400035839,2955579391,3393616127,3764675071,4051848447,4238751231,4241237503,4026016255],a.Plasma256=[201819903,268929023,319195647,352750335,403082239,453414143,486968831,520457983,554012671,587567359,621122047,654676735,688231423,721786111,755275007,788829695,822384383,855939071,872716543,906270975,939825663,973380351,990092031,1023646719,1057201407,1073978623,1107533311,1141087999,1157865215,1191354367,1224908799,1241686271,1275240959,1308795391,1325572863,1359061759,1375839231,1409393663,1442948095,1459725567,1493279999,1509991935,1543546367,1577100799,1593878271,1627432703,1644209919,1677764607,1694541823,1728096255,1744873471,1778427903,1811982591,1828759807,1862314239,1879091455,1912645887,1929423103,1962977535,1979820287,2013374719,2030151935,2063771903,2080548863,2114168831,2130946047,2164566015,2181343231,2214962943,2231805695,2248648447,2282202623,2299045375,2332665087,2349507839,2383193343,2400035839,2416878591,2450498303,2467340799,2500960767,2517803263,2534646015,2568265727,2585108223,2602016511,2635636223,2652478719,2669321215,2686163967,2719783679,2736626175,2753468671,2770311167,2803996671,2820839167,2837681663,2854524159,2888143871,2904986367,2921828863,2938671359,2955579391,2972422143,2989264639,3022884351,3039726847,3056569343,3073411839,3090319871,3107162367,3124004863,3140847359,3157689855,3174532351,3191374847,3208217343,3225125375,3241967871,3258810623,3275653119,3292495615,3309338111,3326180607,3343023103,3359931135,3376773631,3393616127,3410458623,3427301119,3444143615,3460986367,3477828863,3494736895,3511579391,3511644671,3528487167,3545329663,3562172159,3579014655,3595922943,3612765439,3612830719,3629673215,3646515711,3663358207,3680200703,3697108735,3697174271,3714016767,3730859263,3747701759,3747767039,3764675071,3781517567,3798360319,3815202815,3815268095,3832176127,3849018623,3849083903,3865926399,3882769151,3899677183,3899742463,3916584959,3933427455,3933492735,3950400767,3967243519,3967308799,3984151295,3984282111,4001124607,4017967103,4018032383,4034940415,4035005951,4051848447,4068756479,4068821759,4085664255,4085729535,4102637567,4102703103,4119545599,4119676415,4136518911,4136584191,4136715007,4153557503,4153623039,4170531071,4170596351,4170727167,4187569663,4187634943,4204542975,4204608255,4204739327,4204804607,4221712639,4221777919,4221843199,4238751231,4238816767,4238947583,4239012863,4239143679,4239208959,4256117247,4256182527,4256313343,4256378623,4256509439,4256574975,4256705791,4256771071,4256902143,4256967423,4257098239,4257229311,4257294591,4257425663,4257490943,4257621759,4240910079,4241041151,4241171967,4241237503,4241368575,4224722175,4224787711,4224918783,4208272639,4208338175,4208469247,4191757567,4191888639,4175242495,4175373567,4158661887,4158793215,4142147071,4142212607,4125566719,4125697791,4108986111,4092339967,4092471039,4075824895,4075890431,4059244287,4042597887,4042662911,4026016255],a.Viridis3=[1140937983,546278655,4259783935],a.Viridis4=[1140937983,812092927,901216511,4259783935],a.Viridis5=[1140937983,995199743,546278655,1539859199,4259783935],a.Viridis6=[1140937983,1078167551,695766783,581403903,2043761151,4259783935],a.Viridis7=[1140937983,1144619775,812092927,546278655,901216511,2379629823,4259783935],a.Viridis8=[1140937983,1177648895,911903999,662605567,513837055,1237413375,2648259327,4259783935],a.Viridis9=[1140937983,1194031871,995199743,745639679,546278655,665682175,1539859199,2866492159,4259783935],a.Viridis10=[1140937983,1193768959,1045006847,812092927,629313279,513575423,901216511,1808620031,3000839423,4259783935],a.Viridis11=[1140937983,1210283263,1078167551,878611967,695766783,546278655,581403903,1119777279,2043761151,3135121407,4259783935],a.Viridis256=[1140937983,1141003775,1141069823,1157978367,1158044415,1158175743,1175018751,1175150335,1175216127,1175347711,1192190719,1192322047,1192388095,1192519423,1192585215,1192651263,1192782591,1209625599,1209691391,1209822975,1209888767,1209954559,1210085887,1210151679,1210217471,1210283263,1193637375,1193703167,1193768959,1193834751,1193966079,1194031871,1194097663,1177386239,1177517311,1177583103,1177648895,1160937471,1161068543,1161134335,1161200127,1144488447,1144619775,1127908351,1127973887,1128039679,1111327999,1111393791,1111524863,1094813439,1094878975,1078167551,1078233087,1061521407,1061652735,1044941055,1045006847,1028295167,1028360703,1028426239,1011714815,1011780351,995134207,995199743,978488319,978553855,961842175,961907711,945196031,945261823,928550143,928615679,911903999,911969535,895257855,895323391,878611967,878677503,861965823,862031359,845319679,845385215,828673535,828739071,828804607,812092927,812158463,795446783,795512319,778800895,778866431,778931967,762220287,762285823,745574143,745639679,745705215,728993535,729059071,712347391,712412927,712478463,695766783,695832319,679120639,679120639,679186175,662474495,662540031,662605567,645893887,645959423,646024959,629313279,629378559,612666879,612732415,612797951,596086271,596151807,596217343,579440127,579505663,579571199,562859519,562924799,562990335,546278655,546344191,546409727,529698047,529763327,529828863,529894399,529959935,513247999,513313535,513379071,513379071,513444351,513509887,513575423,513640703,513706239,513771775,513837055,530679807,530745087,530810623,547653119,547718655,564561407,564626687,581403903,598246399,598311679,615154431,631996927,648839679,665682175,682524671,699367423,716209919,733052415,749829631,783449343,800291839,817134335,850754303,867596799,901216511,918059007,951678719,968455935,1002075647,1035695359,1052537855,1086157567,1119777279,1153331455,1170173951,1203793663,1237413375,1271033087,1304587263,1338206719,1371826431,1405446143,1439065855,1472620031,1506239743,1539859199,1590256127,1623810303,1657430015,1691049471,1741446399,1775000575,1808620031,1842239743,1892570879,1926190591,1959810303,2010141439,2043761151,2094157823,2127711999,2178108671,2211662847,2262059519,2295678975,2346010367,2379629823,2429961215,2463580671,2513911807,2547531519,2597862655,2648259327,2681813247,2732210175,2782541311,2816160767,2866492159,2916888831,2950442751,3000839423,3051170815,3084724735,3135121407,3185452799,3219072255,3269403391,3319734783,3353354239,3403685631,3454017023,3487636735,3537968127,3571522303,3621919231,3672250623,3705805055,3756202239,3789756671,3840088319,3890485759,3924040191,3974372095,4007992319,4058324223,4091879167,4142276607,4175831551,4209386239,4259783935],a.Accent3=[2143911935,3199128831,4257253119],a.Accent4=[2143911935,3199128831,4257253119,4294941183],a.Accent5=[2143911935,3199128831,4257253119,4294941183,946647295],a.Accent6=[2143911935,3199128831,4257253119,4294941183,946647295,4026695679],a.Accent7=[2143911935,3199128831,4257253119,4294941183,946647295,4026695679,3210418175],a.Accent8=[2143911935,3199128831,4257253119,4294941183,946647295,4026695679,3210418175,1717987071],a.Dark2_3=[463370239,3646882559,1970320383],a.Dark2_4=[463370239,3646882559,1970320383,3878259455],a.Dark2_5=[463370239,3646882559,1970320383,3878259455,1722162943],a.Dark2_6=[463370239,3646882559,1970320383,3878259455,1722162943,3869967103],a.Dark2_7=[463370239,3646882559,1970320383,3878259455,1722162943,3869967103,2792758783],a.Dark2_8=[463370239,3646882559,1970320383,3878259455,1722162943,3869967103,2792758783,1717987071],a.Paired3=[2798576639,528004351,3000994559],a.Paired4=[2798576639,528004351,3000994559,866135295],a.Paired5=[2798576639,528004351,3000994559,866135295,4221213183],a.Paired6=[2798576639,528004351,3000994559,866135295,4221213183,3810139391],a.Paired7=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695],a.Paired8=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695,4286513407],a.Paired9=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695,4286513407,3400718079],a.Paired10=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695,4286513407,3400718079,1782422271],a.Paired11=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695,4286513407,3400718079,1782422271,4294941183],a.Paired12=[2798576639,528004351,3000994559,866135295,4221213183,3810139391,4257181695,4286513407,3400718079,1782422271,4294941183,2975410431],a.Pastel1_3=[4222922495,3016614911,3438003711],a.Pastel1_4=[4222922495,3016614911,3438003711,3737904383],a.Pastel1_5=[4222922495,3016614911,3438003711,3737904383,4275676927],a.Pastel1_6=[4222922495,3016614911,3438003711,3737904383,4275676927,4294954239],a.Pastel1_7=[4222922495,3016614911,3438003711,3737904383,4275676927,4294954239,3856186879],a.Pastel1_8=[4222922495,3016614911,3438003711,3737904383,4275676927,4294954239,3856186879,4258983167],a.Pastel1_9=[4222922495,3016614911,3438003711,3737904383,4275676927,4294954239,3856186879,4258983167,4076008191],a.Pastel2_3=[3017985535,4258114815,3419793663],a.Pastel2_4=[3017985535,4258114815,3419793663,4106937599],a.Pastel2_5=[3017985535,4258114815,3419793663,4106937599,3874867711],a.Pastel2_6=[3017985535,4258114815,3419793663,4106937599,3874867711,4294094591],a.Pastel2_7=[3017985535,4258114815,3419793663,4106937599,3874867711,4294094591,4058172671],a.Pastel2_8=[3017985535,4258114815,3419793663,4106937599,3874867711,4294094591,4058172671,3435973887],a.Set1_3=[3826916607,931051775,1303333631],a.Set1_4=[3826916607,931051775,1303333631,2555290623],a.Set1_5=[3826916607,931051775,1303333631,2555290623,4286513407],a.Set1_6=[3826916607,931051775,1303333631,2555290623,4286513407,4294915071],a.Set1_7=[3826916607,931051775,1303333631,2555290623,4286513407,4294915071,2790664447],a.Set1_8=[3826916607,931051775,1303333631,2555290623,4286513407,4294915071,2790664447,4152475647],a.Set1_9=[3826916607,931051775,1303333631,2555290623,4286513407,4294915071,2790664447,4152475647,2576980479],a.Set2_3=[1724032511,4237124351,2376125439],a.Set2_4=[1724032511,4237124351,2376125439,3884631039],a.Set2_5=[1724032511,4237124351,2376125439,3884631039,2799195391],a.Set2_6=[1724032511,4237124351,2376125439,3884631039,2799195391,4292423679],a.Set2_7=[1724032511,4237124351,2376125439,3884631039,2799195391,4292423679,3854865663],a.Set2_8=[1724032511,4237124351,2376125439,3884631039,2799195391,4292423679,3854865663,3014898687],a.Set3_3=[2379466751,4294947839,3199916799],a.Set3_4=[2379466751,4294947839,3199916799,4219499263],a.Set3_5=[2379466751,4294947839,3199916799,4219499263,2159137791],a.Set3_6=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471],a.Set3_7=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791],a.Set3_8=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791,4241352191],a.Set3_9=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791,4241352191,3654932991],a.Set3_10=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791,4241352191,3654932991,3162553855],a.Set3_11=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791,4241352191,3654932991,3162553855,3438003711],a.Set3_12=[2379466751,4294947839,3199916799,4219499263,2159137791,4256457471,3017697791,4241352191,3654932991,3162553855,3438003711,4293750783],a.Category10_3=[527938815,4286516991,748694783],a.Category10_4=[527938815,4286516991,748694783,3592890623],a.Category10_5=[527938815,4286516991,748694783,3592890623,2489826815],a.Category10_6=[527938815,4286516991,748694783,3592890623,2489826815,2354465791],a.Category10_7=[527938815,4286516991,748694783,3592890623,2489826815,2354465791,3816276735],a.Category10_8=[527938815,4286516991,748694783,3592890623,2489826815,2354465791,3816276735,2139062271],a.Category10_9=[527938815,4286516991,748694783,3592890623,2489826815,2354465791,3816276735,2139062271,3166511871],a.Category10_10=[527938815,4286516991,748694783,3592890623,2489826815,2354465791,3816276735,2139062271,3166511871,398381055],a.Category20_3=[527938815,2932336895,4286516991],a.Category20_4=[527938815,2932336895,4286516991,4290476287],a.Category20_5=[527938815,2932336895,4286516991,4290476287,748694783],a.Category20_6=[527938815,2932336895,4286516991,4290476287,748694783,2564786943],a.Category20_7=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623],a.Category20_8=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207],a.Category20_9=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815],a.Category20_10=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671],a.Category20_11=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791],a.Category20_12=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095],a.Category20_13=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735],a.Category20_14=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919],a.Category20_15=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271],a.Category20_16=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271,3351758847],a.Category20_17=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271,3351758847,3166511871],a.Category20_18=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271,3351758847,3166511871,3688599039],a.Category20_19=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271,3351758847,3166511871,3688599039,398381055],a.Category20_20=[527938815,2932336895,4286516991,4290476287,748694783,2564786943,3592890623,4288190207,2489826815,3316700671,2354465791,3298596095,3816276735,4155953919,2139062271,3351758847,3166511871,3688599039,398381055,2665145855],a.Category20b_3=[960199167,1381278719,1802424319],a.Category20b_4=[960199167,1381278719,1802424319,2627657471],a.Category20b_5=[960199167,1381278719,1802424319,2627657471,1668889087],a.Category20b_6=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319],a.Category20b_7=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695],a.Category20b_8=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071],a.Category20b_9=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463],a.Category20b_10=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359],a.Category20b_11=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839],a.Category20b_12=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847],a.Category20b_13=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519],a.Category20b_14=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695],a.Category20b_15=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863],a.Category20b_16=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863,3885407487],a.Category20b_17=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863,3885407487,2067887103],a.Category20b_18=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863,3885407487,2067887103,2773587199],a.Category20b_19=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863,3885407487,2067887103,2773587199,3463298559],a.Category20b_20=[960199167,1381278719,1802424319,2627657471,1668889087,2359448319,3050269695,3470499071,2355966463,3181263359,3887747839,3888878847,2218539519,2907261695,3596708863,3885407487,2067887103,2773587199,3463298559,3734951679],a.Category20c_3=[830651903,1806620415,2664096255],a.Category20c_4=[830651903,1806620415,2664096255,3336302591],a.Category20c_5=[830651903,1806620415,2664096255,3336302591,3864333823],a.Category20c_6=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839],a.Category20c_7=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559],a.Category20c_8=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863],a.Category20c_9=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711],a.Category20c_10=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575],a.Category20c_11=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023],a.Category20c_12=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279],a.Category20c_13=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191],a.Category20c_14=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127],a.Category20c_15=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487],a.Category20c_16=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487,3671780351],a.Category20c_17=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487,3671780351,1667458047],a.Category20c_18=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487,3671780351,1667458047,2526451455],a.Category20c_19=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487,3671780351,1667458047,2526451455,3183328767],a.Category20c_20=[830651903,1806620415,2664096255,3336302591,3864333823,4253891839,4256066559,4258308863,832787711,1959032575,2715393023,3353985279,1969992191,2660944127,3166559487,3671780351,1667458047,2526451455,3183328767,3654932991],a.Colorblind3=[7516927,3869180159,4041491199],a.Colorblind4=[7516927,3869180159,4041491199,10384383],a.Colorblind5=[7516927,3869180159,4041491199,10384383,1454696959],a.Colorblind6=[7516927,3869180159,4041491199,10384383,1454696959,3579707647],a.Colorblind7=[7516927,3869180159,4041491199,10384383,1454696959,3579707647,3430524927],a.Colorblind8=[7516927,3869180159,4041491199,10384383,1454696959,3579707647,3430524927,255],a.YlGn={YlGn3:a.YlGn3,YlGn4:a.YlGn4,YlGn5:a.YlGn5,YlGn6:a.YlGn6,YlGn7:a.YlGn7,YlGn8:a.YlGn8,YlGn9:a.YlGn9},a.YlGnBu={YlGnBu3:a.YlGnBu3,YlGnBu4:a.YlGnBu4,YlGnBu5:a.YlGnBu5,YlGnBu6:a.YlGnBu6,YlGnBu7:a.YlGnBu7,YlGnBu8:a.YlGnBu8,YlGnBu9:a.YlGnBu9},a.GnBu={GnBu3:a.GnBu3,GnBu4:a.GnBu4,GnBu5:a.GnBu5,GnBu6:a.GnBu6,GnBu7:a.GnBu7,GnBu8:a.GnBu8,GnBu9:a.GnBu9},a.BuGn={BuGn3:a.BuGn3,BuGn4:a.BuGn4,BuGn5:a.BuGn5,BuGn6:a.BuGn6,BuGn7:a.BuGn7,BuGn8:a.BuGn8,BuGn9:a.BuGn9},a.PuBuGn={PuBuGn3:a.PuBuGn3,PuBuGn4:a.PuBuGn4,PuBuGn5:a.PuBuGn5,PuBuGn6:a.PuBuGn6,PuBuGn7:a.PuBuGn7,PuBuGn8:a.PuBuGn8,PuBuGn9:a.PuBuGn9},a.PuBu={PuBu3:a.PuBu3,PuBu4:a.PuBu4,PuBu5:a.PuBu5,PuBu6:a.PuBu6,PuBu7:a.PuBu7,PuBu8:a.PuBu8,PuBu9:a.PuBu9},a.BuPu={BuPu3:a.BuPu3,BuPu4:a.BuPu4,BuPu5:a.BuPu5,BuPu6:a.BuPu6,BuPu7:a.BuPu7,BuPu8:a.BuPu8,BuPu9:a.BuPu9},a.RdPu={RdPu3:a.RdPu3,RdPu4:a.RdPu4,RdPu5:a.RdPu5,RdPu6:a.RdPu6,RdPu7:a.RdPu7,RdPu8:a.RdPu8,RdPu9:a.RdPu9},a.PuRd={PuRd3:a.PuRd3,PuRd4:a.PuRd4,PuRd5:a.PuRd5,PuRd6:a.PuRd6,PuRd7:a.PuRd7,PuRd8:a.PuRd8,PuRd9:a.PuRd9},a.OrRd={OrRd3:a.OrRd3,OrRd4:a.OrRd4,OrRd5:a.OrRd5,OrRd6:a.OrRd6,OrRd7:a.OrRd7,OrRd8:a.OrRd8,OrRd9:a.OrRd9},a.YlOrRd={YlOrRd3:a.YlOrRd3,YlOrRd4:a.YlOrRd4,YlOrRd5:a.YlOrRd5,YlOrRd6:a.YlOrRd6,YlOrRd7:a.YlOrRd7,YlOrRd8:a.YlOrRd8,YlOrRd9:a.YlOrRd9},a.YlOrBr={YlOrBr3:a.YlOrBr3,YlOrBr4:a.YlOrBr4,YlOrBr5:a.YlOrBr5,YlOrBr6:a.YlOrBr6,YlOrBr7:a.YlOrBr7,YlOrBr8:a.YlOrBr8,YlOrBr9:a.YlOrBr9},a.Purples={Purples3:a.Purples3,Purples4:a.Purples4,Purples5:a.Purples5,Purples6:a.Purples6,Purples7:a.Purples7,Purples8:a.Purples8,Purples9:a.Purples9},a.Blues={Blues3:a.Blues3,Blues4:a.Blues4,Blues5:a.Blues5,Blues6:a.Blues6,Blues7:a.Blues7,Blues8:a.Blues8,Blues9:a.Blues9},a.Greens={Greens3:a.Greens3,Greens4:a.Greens4,Greens5:a.Greens5,Greens6:a.Greens6,Greens7:a.Greens7,Greens8:a.Greens8,Greens9:a.Greens9},a.Oranges={Oranges3:a.Oranges3,Oranges4:a.Oranges4,Oranges5:a.Oranges5,Oranges6:a.Oranges6,Oranges7:a.Oranges7,Oranges8:a.Oranges8,Oranges9:a.Oranges9},a.Reds={Reds3:a.Reds3,Reds4:a.Reds4,Reds5:a.Reds5,Reds6:a.Reds6,Reds7:a.Reds7,Reds8:a.Reds8,Reds9:a.Reds9},a.Greys={Greys3:a.Greys3,Greys4:a.Greys4,Greys5:a.Greys5,Greys6:a.Greys6,Greys7:a.Greys7,Greys8:a.Greys8,Greys9:a.Greys9,Greys10:a.Greys10,Greys11:a.Greys11,Greys256:a.Greys256},a.PuOr={PuOr3:a.PuOr3,PuOr4:a.PuOr4,PuOr5:a.PuOr5,PuOr6:a.PuOr6,PuOr7:a.PuOr7,PuOr8:a.PuOr8,PuOr9:a.PuOr9,PuOr10:a.PuOr10,PuOr11:a.PuOr11},a.BrBG={BrBG3:a.BrBG3,BrBG4:a.BrBG4,BrBG5:a.BrBG5,BrBG6:a.BrBG6,BrBG7:a.BrBG7,BrBG8:a.BrBG8,BrBG9:a.BrBG9,BrBG10:a.BrBG10,BrBG11:a.BrBG11},a.PRGn={PRGn3:a.PRGn3,PRGn4:a.PRGn4,PRGn5:a.PRGn5,PRGn6:a.PRGn6,PRGn7:a.PRGn7,PRGn8:a.PRGn8,PRGn9:a.PRGn9,PRGn10:a.PRGn10,PRGn11:a.PRGn11},a.PiYG={PiYG3:a.PiYG3,PiYG4:a.PiYG4,PiYG5:a.PiYG5,PiYG6:a.PiYG6,PiYG7:a.PiYG7,PiYG8:a.PiYG8,PiYG9:a.PiYG9,PiYG10:a.PiYG10,PiYG11:a.PiYG11},a.RdBu={RdBu3:a.RdBu3,RdBu4:a.RdBu4,RdBu5:a.RdBu5,RdBu6:a.RdBu6,RdBu7:a.RdBu7,RdBu8:a.RdBu8,RdBu9:a.RdBu9,RdBu10:a.RdBu10,RdBu11:a.RdBu11},a.RdGy={RdGy3:a.RdGy3,RdGy4:a.RdGy4,RdGy5:a.RdGy5,RdGy6:a.RdGy6,RdGy7:a.RdGy7,RdGy8:a.RdGy8,RdGy9:a.RdGy9,RdGy10:a.RdGy10,RdGy11:a.RdGy11},a.RdYlBu={RdYlBu3:a.RdYlBu3,RdYlBu4:a.RdYlBu4,RdYlBu5:a.RdYlBu5,RdYlBu6:a.RdYlBu6,RdYlBu7:a.RdYlBu7,RdYlBu8:a.RdYlBu8,RdYlBu9:a.RdYlBu9,RdYlBu10:a.RdYlBu10,RdYlBu11:a.RdYlBu11},a.Spectral={Spectral3:a.Spectral3,Spectral4:a.Spectral4,Spectral5:a.Spectral5,Spectral6:a.Spectral6,Spectral7:a.Spectral7,Spectral8:a.Spectral8,Spectral9:a.Spectral9,Spectral10:a.Spectral10,Spectral11:a.Spectral11},a.RdYlGn={RdYlGn3:a.RdYlGn3,RdYlGn4:a.RdYlGn4,RdYlGn5:a.RdYlGn5,RdYlGn6:a.RdYlGn6,RdYlGn7:a.RdYlGn7,RdYlGn8:a.RdYlGn8,RdYlGn9:a.RdYlGn9,RdYlGn10:a.RdYlGn10,RdYlGn11:a.RdYlGn11},a.Inferno={Inferno3:a.Inferno3,Inferno4:a.Inferno4,Inferno5:a.Inferno5,Inferno6:a.Inferno6,Inferno7:a.Inferno7,Inferno8:a.Inferno8,Inferno9:a.Inferno9,Inferno10:a.Inferno10,Inferno11:a.Inferno11,Inferno256:a.Inferno256},a.Magma={Magma3:a.Magma3,Magma4:a.Magma4,Magma5:a.Magma5,Magma6:a.Magma6,Magma7:a.Magma7,Magma8:a.Magma8,Magma9:a.Magma9,Magma10:a.Magma10,Magma11:a.Magma11,Magma256:a.Magma256},a.Plasma={Plasma3:a.Plasma3,Plasma4:a.Plasma4,Plasma5:a.Plasma5,Plasma6:a.Plasma6,Plasma7:a.Plasma7,Plasma8:a.Plasma8,Plasma9:a.Plasma9,Plasma10:a.Plasma10,Plasma11:a.Plasma11,Plasma256:a.Plasma256},a.Viridis={Viridis3:a.Viridis3,Viridis4:a.Viridis4,Viridis5:a.Viridis5,Viridis6:a.Viridis6,Viridis7:a.Viridis7,Viridis8:a.Viridis8,Viridis9:a.Viridis9,Viridis10:a.Viridis10,Viridis11:a.Viridis11,Viridis256:a.Viridis256},a.Accent={Accent3:a.Accent3,Accent4:a.Accent4,Accent5:a.Accent5,Accent6:a.Accent6,Accent7:a.Accent7,Accent8:a.Accent8},a.Dark2={Dark2_3:a.Dark2_3,Dark2_4:a.Dark2_4,Dark2_5:a.Dark2_5,Dark2_6:a.Dark2_6,Dark2_7:a.Dark2_7,Dark2_8:a.Dark2_8},a.Paired={Paired3:a.Paired3,Paired4:a.Paired4,Paired5:a.Paired5,Paired6:a.Paired6,Paired7:a.Paired7,Paired8:a.Paired8,Paired9:a.Paired9,Paired10:a.Paired10,Paired11:a.Paired11,Paired12:a.Paired12},a.Pastel1={Pastel1_3:a.Pastel1_3,Pastel1_4:a.Pastel1_4,Pastel1_5:a.Pastel1_5,Pastel1_6:a.Pastel1_6,Pastel1_7:a.Pastel1_7,Pastel1_8:a.Pastel1_8,Pastel1_9:a.Pastel1_9},a.Pastel2={Pastel2_3:a.Pastel2_3,Pastel2_4:a.Pastel2_4,Pastel2_5:a.Pastel2_5,Pastel2_6:a.Pastel2_6,Pastel2_7:a.Pastel2_7,Pastel2_8:a.Pastel2_8},a.Set1={Set1_3:a.Set1_3,Set1_4:a.Set1_4,Set1_5:a.Set1_5,Set1_6:a.Set1_6,Set1_7:a.Set1_7,Set1_8:a.Set1_8,Set1_9:a.Set1_9},a.Set2={Set2_3:a.Set2_3,Set2_4:a.Set2_4,Set2_5:a.Set2_5,Set2_6:a.Set2_6,Set2_7:a.Set2_7,Set2_8:a.Set2_8},a.Set3={Set3_3:a.Set3_3,Set3_4:a.Set3_4,Set3_5:a.Set3_5,Set3_6:a.Set3_6,Set3_7:a.Set3_7,Set3_8:a.Set3_8,Set3_9:a.Set3_9,Set3_10:a.Set3_10,Set3_11:a.Set3_11,Set3_12:a.Set3_12},a.Category10={Category10_3:a.Category10_3,Category10_4:a.Category10_4,Category10_5:a.Category10_5,Category10_6:a.Category10_6,Category10_7:a.Category10_7,Category10_8:a.Category10_8,Category10_9:a.Category10_9,Category10_10:a.Category10_10},a.Category20={Category20_3:a.Category20_3,Category20_4:a.Category20_4,Category20_5:a.Category20_5,Category20_6:a.Category20_6,Category20_7:a.Category20_7,Category20_8:a.Category20_8,Category20_9:a.Category20_9,Category20_10:a.Category20_10,Category20_11:a.Category20_11,Category20_12:a.Category20_12,Category20_13:a.Category20_13,Category20_14:a.Category20_14,Category20_15:a.Category20_15,Category20_16:a.Category20_16,Category20_17:a.Category20_17,Category20_18:a.Category20_18,Category20_19:a.Category20_19,Category20_20:a.Category20_20},a.Category20b={Category20b_3:a.Category20b_3,Category20b_4:a.Category20b_4,Category20b_5:a.Category20b_5,Category20b_6:a.Category20b_6,Category20b_7:a.Category20b_7,Category20b_8:a.Category20b_8,Category20b_9:a.Category20b_9,Category20b_10:a.Category20b_10,Category20b_11:a.Category20b_11,Category20b_12:a.Category20b_12,Category20b_13:a.Category20b_13,Category20b_14:a.Category20b_14,Category20b_15:a.Category20b_15,Category20b_16:a.Category20b_16,Category20b_17:a.Category20b_17,Category20b_18:a.Category20b_18,Category20b_19:a.Category20b_19,Category20b_20:a.Category20b_20},a.Category20c={Category20c_3:a.Category20c_3,Category20c_4:a.Category20c_4,Category20c_5:a.Category20c_5,Category20c_6:a.Category20c_6,Category20c_7:a.Category20c_7,Category20c_8:a.Category20c_8,Category20c_9:a.Category20c_9,Category20c_10:a.Category20c_10,Category20c_11:a.Category20c_11,Category20c_12:a.Category20c_12,Category20c_13:a.Category20c_13,Category20c_14:a.Category20c_14,Category20c_15:a.Category20c_15,Category20c_16:a.Category20c_16,Category20c_17:a.Category20c_17,Category20c_18:a.Category20c_18,Category20c_19:a.Category20c_19,Category20c_20:a.Category20c_20},a.Colorblind={Colorblind3:a.Colorblind3,Colorblind4:a.Colorblind4,Colorblind5:a.Colorblind5,Colorblind6:a.Colorblind6,Colorblind7:a.Colorblind7,Colorblind8:a.Colorblind8}}, +413: function _(t,_,n,o,r){o();t(1).__exportStar(t(38),n)}, +414: function _(e,t,r,s,n){s();const i=e(1),a=e(5),l=i.__importStar(e(4)),o=e(18),c=e(34),_=e(26),u=e(9),h=e(13),d=e(8),g=e(43),p=e(245),y=i.__importStar(e(29)),x=e(413),f=e(277),m=e(228),w=e(229);n("gridplot",e(415).gridplot),n("color",e(22).color2css);const{hasOwnProperty:b}=Object.prototype,v=["pan","wheel_zoom","box_zoom","save","reset","help"];function k(e,t){return void 0===e?t:e}class S extends x.Plot{constructor(e={}){const t=k((e=Object.assign({},e)).tools,v);delete e.tools;const r=k(e.x_axis_type,"auto"),s=k(e.y_axis_type,"auto");delete e.x_axis_type,delete e.y_axis_type;const n=null!=e.x_minor_ticks?e.x_minor_ticks:"auto",i=null!=e.y_minor_ticks?e.y_minor_ticks:"auto";delete e.x_minor_ticks,delete e.y_minor_ticks;const a=null!=e.x_axis_location?e.x_axis_location:"below",l=null!=e.y_axis_location?e.y_axis_location:"left";delete e.x_axis_location,delete e.y_axis_location;const o=null!=e.x_axis_label?e.x_axis_label:"",c=null!=e.y_axis_label?e.y_axis_label:"";delete e.x_axis_label,delete e.y_axis_label;const _=S._get_range(e.x_range),u=S._get_range(e.y_range);delete e.x_range,delete e.y_range;const h=null!=e.x_scale?e.x_scale:S._get_scale(_,r),d=null!=e.y_scale?e.y_scale:S._get_scale(u,s);delete e.x_scale,delete e.y_scale,super(Object.assign(Object.assign({},e),{x_range:_,y_range:u,x_scale:h,y_scale:d})),this._process_axis_and_grid(r,a,n,o,_,0),this._process_axis_and_grid(s,l,i,c,u,1),this.add_tools(...this._process_tools(t))}get xgrid(){return this.center.filter((e=>e instanceof x.Grid&&0==e.dimension))}get ygrid(){return this.center.filter((e=>e instanceof x.Grid&&1==e.dimension))}get xaxis(){return this.below.concat(this.above).filter((e=>e instanceof x.Axis))}get yaxis(){return this.left.concat(this.right).filter((e=>e instanceof x.Axis))}get legend(){const e=this.panels.filter((e=>e instanceof m.Legend));if(0==e.length){const e=new m.Legend;return this.add_layout(e),e}{const[t]=e;return t}}annular_wedge(...e){return this._glyph(f.AnnularWedge,"x,y,inner_radius,outer_radius,start_angle,end_angle",e)}annulus(...e){return this._glyph(f.Annulus,"x,y,inner_radius,outer_radius",e)}arc(...e){return this._glyph(f.Arc,"x,y,radius,start_angle,end_angle",e)}bezier(...e){return this._glyph(f.Bezier,"x0,y0,x1,y1,cx0,cy0,cx1,cy1",e)}circle(...e){return this._glyph(f.Circle,"x,y",e)}ellipse(...e){return this._glyph(f.Ellipse,"x,y,width,height",e)}harea(...e){return this._glyph(f.HArea,"x1,x2,y",e)}hbar(...e){return this._glyph(f.HBar,"y,height,right,left",e)}hex_tile(...e){return this._glyph(f.HexTile,"q,r",e)}image(...e){return this._glyph(f.Image,"color_mapper,image,rows,cols,x,y,dw,dh",e)}image_rgba(...e){return this._glyph(f.ImageRGBA,"image,rows,cols,x,y,dw,dh",e)}image_url(...e){return this._glyph(f.ImageURL,"url,x,y,w,h",e)}line(...e){return this._glyph(f.Line,"x,y",e)}multi_line(...e){return this._glyph(f.MultiLine,"xs,ys",e)}multi_polygons(...e){return this._glyph(f.MultiPolygons,"xs,ys",e)}oval(...e){return this._glyph(f.Oval,"x,y,width,height",e)}patch(...e){return this._glyph(f.Patch,"x,y",e)}patches(...e){return this._glyph(f.Patches,"xs,ys",e)}quad(...e){return this._glyph(f.Quad,"left,right,bottom,top",e)}quadratic(...e){return this._glyph(f.Quadratic,"x0,y0,x1,y1,cx,cy",e)}ray(...e){return this._glyph(f.Ray,"x,y,length",e)}rect(...e){return this._glyph(f.Rect,"x,y,width,height",e)}segment(...e){return this._glyph(f.Segment,"x0,y0,x1,y1",e)}spline(...e){return this._glyph(f.Spline,"x,y",e)}step(...e){return this._glyph(f.Step,"x,y,mode",e)}text(...e){return this._glyph(f.Text,"x,y,text",e)}varea(...e){return this._glyph(f.VArea,"x,y1,y2",e)}vbar(...e){return this._glyph(f.VBar,"x,width,top,bottom",e)}wedge(...e){return this._glyph(f.Wedge,"x,y,radius,start_angle,end_angle",e)}_scatter(e,t){return this._glyph(f.Scatter,"x,y",e,null!=t?{marker:t}:void 0)}scatter(...e){return this._scatter(e)}asterisk(...e){return this._scatter(e,"asterisk")}circle_cross(...e){return this._scatter(e,"circle_cross")}circle_dot(...e){return this._scatter(e,"circle_dot")}circle_x(...e){return this._scatter(e,"circle_x")}circle_y(...e){return this._scatter(e,"circle_y")}cross(...e){return this._scatter(e,"cross")}dash(...e){return this._scatter(e,"dash")}diamond(...e){return this._scatter(e,"diamond")}diamond_cross(...e){return this._scatter(e,"diamond_cross")}diamond_dot(...e){return this._scatter(e,"diamond_dot")}dot(...e){return this._scatter(e,"dot")}hex(...e){return this._scatter(e,"hex")}hex_dot(...e){return this._scatter(e,"hex_dot")}inverted_triangle(...e){return this._scatter(e,"inverted_triangle")}plus(...e){return this._scatter(e,"plus")}square(...e){return this._scatter(e,"square")}square_cross(...e){return this._scatter(e,"square_cross")}square_dot(...e){return this._scatter(e,"square_dot")}square_pin(...e){return this._scatter(e,"square_pin")}square_x(...e){return this._scatter(e,"square_x")}star(...e){return this._scatter(e,"star")}star_dot(...e){return this._scatter(e,"star_dot")}triangle(...e){return this._scatter(e,"triangle")}triangle_dot(...e){return this._scatter(e,"triangle_dot")}triangle_pin(...e){return this._scatter(e,"triangle_pin")}x(...e){return this._scatter(e,"x")}y(...e){return this._scatter(e,"y")}_pop_visuals(e,t,r="",s={},n={}){const i=function(e){const t=e.split("_",2);return 2==t.length?t:t.concat([""])},a=function(e){const[t,r]=i(e);return u.includes(["line","fill","text","global"],t)&&""!==r};s=Object.assign({},s),b.call(s,"text_color")||(s.text_color="black");const l={};b.call(l,"color")||(l.color="#1f77b4"),b.call(l,"alpha")||(l.alpha=1);const o={},c=new Set;for(const _ of h.keys(e.prototype._props))if(a(_)){const a=i(_)[1];b.call(t,r+_)?(o[_]=t[r+_],delete t[r+_]):!b.call(e.prototype._props,a)&&b.call(t,r+a)?o[_]=t[r+a]:b.call(n,a)?o[_]=n[a]:b.call(s,_)?o[_]=s[_]:b.call(l,a)&&(o[_]=l[a]),b.call(e.prototype._props,a)||c.add(a)}return c.forEach((function(e,s,n){delete t[r+s]})),o}_find_uniq_name(e,t){let r=1;for(;;){const s=`${t}__${r}`;if(null==e[s])return s;r+=1}}_fixup_values(e,t,r){for(const[s,n]of h.entries(r)){const i=e.prototype._props[s];if(null!=i&&i.type.prototype instanceof o.VectorSpec&&null!=n)if(d.isArray(n)||y.is_NDArray(n)){let e;null!=t[s]?t[s]!==n?(e=this._find_uniq_name(t,s),t[e]=n):e=s:(e=s,t[e]=n),r[s]={field:e}}else(d.isNumber(n)||d.isString(n))&&(r[s]={value:n})}}_glyph(e,t,r,s){const n=t.split(",");let i;if(0==r.length)i={};else if(1==r.length)i=Object.assign({},r[0]);else{i=r.length==n.length?{}:Object.assign({},r[r.length-1]);for(const[e,t]of p.enumerate(n))i[e]=r[t]}null!=s&&(i=Object.assign(Object.assign({},i),s));const a=(()=>{const{source:e}=i;return null==e?new x.ColumnDataSource:e instanceof x.ColumnarDataSource?e:new x.ColumnDataSource({data:e})})(),l=h.clone(a.data);delete i.source;const o=null!=i.view?i.view:new x.CDSView({source:a});delete i.view;const _=this._process_legend(i.legend,a);delete i.legend;const d=i.level;delete i.level;const g=u.some(Object.keys(i),(e=>c.startsWith(e,"selection_"))),y=u.some(Object.keys(i),(e=>c.startsWith(e,"hover_"))),f=this._pop_visuals(e,i),m=this._pop_visuals(e,i,"nonselection_",f,{alpha:.1}),w=g?this._pop_visuals(e,i,"selection_",f):{},b=y?this._pop_visuals(e,i,"hover_",f):{};this._fixup_values(e,l,f),this._fixup_values(e,l,m),this._fixup_values(e,l,w),this._fixup_values(e,l,b),this._fixup_values(e,l,i),a.data=l;const v=(e,t,r)=>new e(Object.assign(Object.assign({},t),r)),k=v(e,i,f),S=v(e,i,m),A=g?v(e,i,w):void 0,L=y?v(e,i,b):void 0,q=new x.GlyphRenderer({data_source:a,view:o,glyph:k,nonselection_glyph:S,selection_glyph:A,hover_glyph:L,level:d});return null!=_&&this._update_legend(_,q),this.add_renderers(q),q}static _get_range(e){if(null==e)return new x.DataRange1d;if(e instanceof x.Range)return e;if(d.isArray(e)){if(d.isArrayOf(e,d.isString)){const t=e;return new x.FactorRange({factors:t})}{const[t,r]=e;return new x.Range1d({start:t,end:r})}}throw new Error(`unable to determine proper range for: '${e}'`)}static _get_scale(e,t){if(e instanceof x.DataRange1d||e instanceof x.Range1d)switch(t){case null:case"auto":case"linear":case"datetime":case"mercator":return new x.LinearScale;case"log":return new x.LogScale}if(e instanceof x.FactorRange)return new x.CategoricalScale;throw new Error(`unable to determine proper scale for: '${e}'`)}_process_axis_and_grid(e,t,r,s,n,i){const a=this._get_axis(e,n,i);if(null!=a){a instanceof x.LogAxis&&(0==i?this.x_scale=new x.LogScale:this.y_scale=new x.LogScale),a.ticker instanceof x.ContinuousTicker&&(a.ticker.num_minor_ticks=this._get_num_minor_ticks(a,r)),0!==s.length&&(a.axis_label=s);const e=new x.Grid({dimension:i,ticker:a.ticker});null!==t&&this.add_layout(a,t),this.add_layout(e)}}_get_axis(e,t,r){switch(e){case null:return null;case"linear":return new x.LinearAxis;case"log":return new x.LogAxis;case"datetime":return new x.DatetimeAxis;case"mercator":{const e=new x.MercatorAxis,t=0==r?"lon":"lat";return e.ticker.dimension=t,e.formatter.dimension=t,e}case"auto":return t instanceof x.FactorRange?new x.CategoricalAxis:new x.LinearAxis;default:throw new Error("shouldn't have happened")}}_get_num_minor_ticks(e,t){if(d.isNumber(t)){if(t<=1)throw new Error("num_minor_ticks must be > 1");return t}if(null==t)return 0;if("auto"===t)return e instanceof x.LogAxis?10:5;throw new Error("shouldn't have happened")}_process_tools(e){return d.isString(e)&&(e=e.split(/\s*,\s*/).filter((e=>e.length>0))),e.map((e=>d.isString(e)?x.Tool.from_string(e):e))}_process_legend(e,t){let r=null;return null!=e&&(d.isString(e)?(r={value:e},null!=t.columns()&&u.includes(t.columns(),e)&&(r={field:e})):r=e),r}_update_legend(e,t){const{legend:r}=this;let s=!1;for(const n of r.items)if(null!=n.label&&_.is_equal(n.label,e)){const e=n.label;if("value"in e){n.renderers.push(t),s=!0;break}if("field"in e&&t.data_source==n.renderers[0].data_source){n.renderers.push(t),s=!0;break}}if(!s){const s=new w.LegendItem({label:e,renderers:[t]});r.items.push(s)}}}r.Figure=S,S.__name__="Plot",r.figure=function(e){return new S(e)},r.show=async function(e,t){const r=new a.Document;for(const t of d.isArray(e)?e:[e])r.add_root(t);let s;if(await g.dom_ready(),null==t)s=document.body;else if(d.isString(t)){const e=document.querySelector(t);if(!(null!=e&&e instanceof HTMLElement))throw new Error(`'${t}' selector didn't match any elements`);s=e}else if(t instanceof HTMLElement)s=t;else{if(!("undefined"!=typeof $&&t instanceof $))throw new Error("target should be HTMLElement, string selector, $ or null");s=t[0]}const n=await l.add_document_standalone(r,s);return new Promise(((t,s)=>{const i=d.isArray(e)?n:n[0];r.is_idle?t(i):r.idle.connect((()=>t(i)))}))}}, +415: function _(o,n,t,l,e){l();const r=o(413),i=o(416);function s(o,n){return void 0===o?n:o}t.gridplot=function(o,n={}){const t=s(n.toolbar_location,"above"),l=s(n.merge_tools,!0),e=s(n.sizing_mode,null),c=i.Matrix.from(o),u=[],h=[];for(const[o,t,e]of c)null!=o&&(l&&(h.push(o.toolbar),o.toolbar_location=null),null!=n.plot_width&&(o.plot_width=n.plot_width),null!=n.plot_height&&(o.plot_height=n.plot_height),u.push([o,t,e]));const a=new r.GridBox({children:u,sizing_mode:e});if(!l||null==t)return a;const d=[];for(const o of h)d.push(...o.tools);const _=new r.ToolbarBox({toolbar:new r.ProxyToolbar({toolbars:h,tools:d}),toolbar_location:t});switch(t){case"above":return new r.Column({children:[_,a],sizing_mode:e});case"below":return new r.Column({children:[a,_],sizing_mode:e});case"left":return new r.Row({children:[_,a],sizing_mode:e});case"right":return new r.Row({children:[a,_],sizing_mode:e});default:throw new Error("unexpected")}}}, +416: function _(t,r,n,s,o){s();const i=t(9);class e{constructor(t,r,n){this.nrows=t,this.ncols=r,this._matrix=new Array(t);for(let s=0;st(this.at(r,n),r,n)))}apply(t){const r=e.from(t),{nrows:n,ncols:s}=this;if(n==r.nrows&&s==r.ncols)return new e(n,s,((t,n)=>r.at(t,n)(this.at(t,n),t,n)));throw new Error("dimensions don't match")}to_sparse(){return[...this]}static from(t,r){if(t instanceof e)return t;if(null!=r){const n=t,s=Math.floor(n.length/r);return new e(s,r,((t,s)=>n[t*r+s]))}{const r=t,n=t.length,s=i.min(r.map((t=>t.length)));return new e(n,s,((t,n)=>r[t][n]))}}}n.Matrix=e,e.__name__="Matrix"}, +}, 407, {"api/main":407,"api/index":408,"api/linalg":409,"core/util/random":410,"api/charts":411,"api/palettes":412,"api/models":413,"api/plotting":414,"api/gridplot":415,"core/util/matrix":416}, {});}); diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.css b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.css deleted file mode 100644 index 90c38509d..000000000 --- a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.css +++ /dev/null @@ -1,577 +0,0 @@ -.bk-root { - @charset "UTF-8"; - /* Functional styling; - * These styles are required for noUiSlider to function. - * You don't need to change these rules to apply your design. - */ - /* Painting and performance; - * Browsers can paint handles in their own layer. - */ - /* Slider size and handle placement; - */ - /* Styling; - */ - /* Handles and cursors; - */ - /* Handle stripes; - */ - /* Disabled state; - */ - /* Base; - * - */ - /* Values; - * - */ - /* Markings; - * - */ - /* Horizontal layout; - * - */ - /* Vertical layout; - * - */ - /*! - * Pikaday - * Copyright © 2014 David Bushell | BSD & MIT license | https://dbushell.com/ - */ - /* -clear child float (pika-lendar), using the famous micro clearfix hack -http://nicolasgallagher.com/micro-clearfix-hack/ -*/ - /* styling for abbr */ -} -.bk-root .bk-input { - display: inline-block; - width: 100%; - flex-grow: 1; - -webkit-flex-grow: 1; - min-height: 31px; - padding: 0 12px; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 4px; -} -.bk-root .bk-input:focus { - border-color: #66afe9; - outline: 0; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); -} -.bk-root .bk-input::placeholder, -.bk-root .bk-input:-ms-input-placeholder, -.bk-root .bk-input::-moz-placeholder, -.bk-root .bk-input::-webkit-input-placeholder { - color: #999; - opacity: 1; -} -.bk-root .bk-input[disabled], -.bk-root .bk-input[readonly] { - cursor: not-allowed; - background-color: #eee; - opacity: 1; -} -.bk-root select[multiple].bk-input, -.bk-root select[size].bk-input, -.bk-root textarea.bk-input { - height: auto; -} -.bk-root .bk-input-group { - width: 100%; - height: 100%; - display: inline-flex; - display: -webkit-inline-flex; - flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; - align-items: start; - -webkit-align-items: start; - flex-direction: column; - -webkit-flex-direction: column; - white-space: nowrap; -} -.bk-root .bk-input-group.bk-inline { - flex-direction: row; - -webkit-flex-direction: row; -} -.bk-root .bk-input-group.bk-inline > *:not(:first-child) { - margin-left: 5px; -} -.bk-root .bk-input-group input[type="checkbox"] + span, -.bk-root .bk-input-group input[type="radio"] + span { - position: relative; - top: -2px; - margin-left: 3px; -} -.bk-root .bk-slider-title { - white-space: nowrap; -} -.bk-root .bk-slider-value { - font-weight: 600; -} -.bk-root .bk-noUi-target, -.bk-root .bk-noUi-target * { - -webkit-touch-callout: none; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-user-select: none; - -ms-touch-action: none; - touch-action: none; - -ms-user-select: none; - -moz-user-select: none; - user-select: none; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bk-root .bk-noUi-target { - position: relative; - direction: ltr; -} -.bk-root .bk-noUi-base { - width: 100%; - height: 100%; - position: relative; - z-index: 1; - /* Fix 401 */ -} -.bk-root .bk-noUi-connect { - position: absolute; - right: 0; - top: 0; - left: 0; - bottom: 0; -} -.bk-root .bk-noUi-origin { - position: absolute; - height: 0; - width: 0; -} -.bk-root .bk-noUi-handle { - position: relative; - z-index: 1; -} -.bk-root .bk-noUi-state-tap .bk-noUi-connect, -.bk-root .bk-noUi-state-tap .bk-noUi-origin { - -webkit-transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; - transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; -} -.bk-root .bk-noUi-state-drag * { - cursor: inherit !important; -} -.bk-root .bk-noUi-base, -.bk-root .bk-noUi-handle { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); -} -.bk-root .bk-noUi-horizontal { - height: 18px; -} -.bk-root .bk-noUi-horizontal .bk-noUi-handle { - width: 34px; - height: 28px; - left: -17px; - top: -6px; -} -.bk-root .bk-noUi-vertical { - width: 18px; -} -.bk-root .bk-noUi-vertical .bk-noUi-handle { - width: 28px; - height: 34px; - left: -6px; - top: -17px; -} -.bk-root .bk-noUi-target { - background: #FAFAFA; - border-radius: 4px; - border: 1px solid #D3D3D3; - box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; -} -.bk-root .bk-noUi-connect { - background: #3FB8AF; - border-radius: 4px; - box-shadow: inset 0 0 3px rgba(51, 51, 51, 0.45); - -webkit-transition: background 450ms; - transition: background 450ms; -} -.bk-root .bk-noUi-draggable { - cursor: ew-resize; -} -.bk-root .bk-noUi-vertical .bk-noUi-draggable { - cursor: ns-resize; -} -.bk-root .bk-noUi-handle { - border: 1px solid #D9D9D9; - border-radius: 3px; - background: #FFF; - cursor: default; - box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB; -} -.bk-root .bk-noUi-active { - box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB; -} -.bk-root .bk-noUi-handle:before, -.bk-root .bk-noUi-handle:after { - content: ""; - display: block; - position: absolute; - height: 14px; - width: 1px; - background: #E8E7E6; - left: 14px; - top: 6px; -} -.bk-root .bk-noUi-handle:after { - left: 17px; -} -.bk-root .bk-noUi-vertical .bk-noUi-handle:before, -.bk-root .bk-noUi-vertical .bk-noUi-handle:after { - width: 14px; - height: 1px; - left: 6px; - top: 14px; -} -.bk-root .bk-noUi-vertical .bk-noUi-handle:after { - top: 17px; -} -.bk-root [disabled] .bk-noUi-connect { - background: #B8B8B8; -} -.bk-root [disabled].bk-noUi-target, -.bk-root [disabled].bk-noUi-handle, -.bk-root [disabled] .bk-noUi-handle { - cursor: not-allowed; -} -.bk-root .bk-noUi-pips, -.bk-root .bk-noUi-pips * { - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bk-root .bk-noUi-pips { - position: absolute; - color: #999; -} -.bk-root .bk-noUi-value { - position: absolute; - white-space: nowrap; - text-align: center; -} -.bk-root .bk-noUi-value-sub { - color: #ccc; - font-size: 10px; -} -.bk-root .bk-noUi-marker { - position: absolute; - background: #CCC; -} -.bk-root .bk-noUi-marker-sub { - background: #AAA; -} -.bk-root .bk-noUi-marker-large { - background: #AAA; -} -.bk-root .bk-noUi-pips-horizontal { - padding: 10px 0; - height: 80px; - top: 100%; - left: 0; - width: 100%; -} -.bk-root .bk-noUi-value-horizontal { - -webkit-transform: translate3d(-50%, 50%, 0); - transform: translate3d(-50%, 50%, 0); -} -.bk-root .bk-noUi-marker-horizontal.bk-noUi-marker { - margin-left: -1px; - width: 2px; - height: 5px; -} -.bk-root .bk-noUi-marker-horizontal.bk-noUi-marker-sub { - height: 10px; -} -.bk-root .bk-noUi-marker-horizontal.bk-noUi-marker-large { - height: 15px; -} -.bk-root .bk-noUi-pips-vertical { - padding: 0 10px; - height: 100%; - top: 0; - left: 100%; -} -.bk-root .bk-noUi-value-vertical { - -webkit-transform: translate3d(0, 50%, 0); - transform: translate3d(0, 50%, 0); - padding-left: 25px; -} -.bk-root .bk-noUi-marker-vertical.bk-noUi-marker { - width: 5px; - height: 2px; - margin-top: -1px; -} -.bk-root .bk-noUi-marker-vertical.bk-noUi-marker-sub { - width: 10px; -} -.bk-root .bk-noUi-marker-vertical.bk-noUi-marker-large { - width: 15px; -} -.bk-root .bk-noUi-tooltip { - display: block; - position: absolute; - border: 1px solid #D9D9D9; - border-radius: 3px; - background: #fff; - color: #000; - padding: 5px; - text-align: center; - white-space: nowrap; -} -.bk-root .bk-noUi-horizontal .bk-noUi-tooltip { - -webkit-transform: translate(-50%, 0); - transform: translate(-50%, 0); - left: 50%; - bottom: 120%; -} -.bk-root .bk-noUi-vertical .bk-noUi-tooltip { - -webkit-transform: translate(0, -50%); - transform: translate(0, -50%); - top: 50%; - right: 120%; -} -.bk-root .bk-noUi-handle { - cursor: grab; - cursor: -webkit-grab; -} -.bk-root .bk-noUi-handle.bk-noUi-active { - cursor: grabbing; - cursor: -webkit-grabbing; -} -.bk-root .bk-noUi-tooltip { - display: none; - white-space: nowrap; -} -.bk-root .bk-noUi-handle:hover .bk-noUi-tooltip { - display: block; -} -.bk-root .bk-noUi-horizontal { - width: 100%; - height: 10px; -} -.bk-root .bk-noUi-horizontal.bk-noUi-target { - margin: 5px 0px; -} -.bk-root .bk-noUi-horizontal .bk-noUi-handle { - width: 14px; - height: 18px; - left: -7px; - top: -5px; -} -.bk-root .bk-noUi-vertical { - width: 10px; - height: 100%; -} -.bk-root .bk-noUi-vertical.bk-noUi-target { - margin: 0px 5px; -} -.bk-root .bk-noUi-vertical .bk-noUi-handle { - width: 18px; - height: 14px; - left: -5px; - top: -7px; -} -.bk-root .bk-noUi-handle:after, -.bk-root .bk-noUi-handle:before { - display: none; -} -.bk-root .bk-noUi-connect { - box-shadow: none; -} -.bk-root .pika-single { - z-index: 9999; - display: block; - position: relative; - color: #333; - background: #fff; - border: 1px solid #ccc; - border-bottom-color: #bbb; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} -.bk-root .pika-single:before, -.bk-root .pika-single:after { - content: " "; - display: table; -} -.bk-root .pika-single:after { - clear: both; -} -.bk-root .pika-single.is-hidden { - display: none; -} -.bk-root .pika-single.is-bound { - position: absolute; - box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.5); -} -.bk-root .pika-lendar { - float: left; - width: 240px; - margin: 8px; -} -.bk-root .pika-title { - position: relative; - text-align: center; -} -.bk-root .pika-label { - display: inline-block; - position: relative; - z-index: 9999; - overflow: hidden; - margin: 0; - padding: 5px 3px; - font-size: 14px; - line-height: 20px; - font-weight: bold; - background-color: #fff; -} -.bk-root .pika-title select { - cursor: pointer; - position: absolute; - z-index: 9998; - margin: 0; - left: 0; - top: 5px; - opacity: 0; -} -.bk-root .pika-prev, -.bk-root .pika-next { - display: block; - cursor: pointer; - position: relative; - outline: none; - border: 0; - padding: 0; - width: 20px; - height: 30px; - /* hide text using text-indent trick, using width value (it's enough) */ - text-indent: 20px; - white-space: nowrap; - overflow: hidden; - background-color: transparent; - background-position: center center; - background-repeat: no-repeat; - background-size: 75% 75%; - opacity: 0.5; -} -.bk-root .pika-prev:hover, -.bk-root .pika-next:hover { - opacity: 1; -} -.bk-root .pika-prev, -.bk-root .is-rtl .pika-next { - float: left; - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg=='); -} -.bk-root .pika-next, -.bk-root .is-rtl .pika-prev { - float: right; - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII='); -} -.bk-root .pika-prev.is-disabled, -.bk-root .pika-next.is-disabled { - cursor: default; - opacity: 0.2; -} -.bk-root .pika-select { - display: inline-block; -} -.bk-root .pika-table { - width: 100%; - border-collapse: collapse; - border-spacing: 0; - border: 0; -} -.bk-root .pika-table th, -.bk-root .pika-table td { - width: 14.28571429%; - padding: 0; -} -.bk-root .pika-table th { - color: #999; - font-size: 12px; - line-height: 25px; - font-weight: bold; - text-align: center; -} -.bk-root .pika-button { - cursor: pointer; - display: block; - box-sizing: border-box; - -moz-box-sizing: border-box; - outline: none; - border: 0; - margin: 0; - width: 100%; - padding: 5px; - color: #666; - font-size: 12px; - line-height: 15px; - text-align: right; - background: #f5f5f5; -} -.bk-root .pika-week { - font-size: 11px; - color: #999; -} -.bk-root .is-today .pika-button { - color: #33aaff; - font-weight: bold; -} -.bk-root .is-selected .pika-button, -.bk-root .has-event .pika-button { - color: #fff; - font-weight: bold; - background: #33aaff; - box-shadow: inset 0 1px 3px #178fe5; - border-radius: 3px; -} -.bk-root .has-event .pika-button { - background: #005da9; - box-shadow: inset 0 1px 3px #0076c9; -} -.bk-root .is-disabled .pika-button, -.bk-root .is-inrange .pika-button { - background: #D5E9F7; -} -.bk-root .is-startrange .pika-button { - color: #fff; - background: #6CB31D; - box-shadow: none; - border-radius: 3px; -} -.bk-root .is-endrange .pika-button { - color: #fff; - background: #33aaff; - box-shadow: none; - border-radius: 3px; -} -.bk-root .is-disabled .pika-button { - pointer-events: none; - cursor: default; - color: #999; - opacity: 0.3; -} -.bk-root .is-outside-current-month .pika-button { - color: #999; - opacity: 0.3; -} -.bk-root .is-selection-disabled { - pointer-events: none; - cursor: default; -} -.bk-root .pika-button:hover, -.bk-root .pika-row.pick-whole-week:hover .pika-button { - color: #fff; - background: #ff8000; - box-shadow: none; - border-radius: 3px; -} -.bk-root .pika-table abbr { - border-bottom: none; - cursor: help; -} \ No newline at end of file diff --git a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.js b/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.js deleted file mode 100644 index 1d66da9a6..000000000 --- a/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-1.1.0.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * Copyright (c) 2012 - 2018, Anaconda, Inc., and Bokeh Contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of Anaconda nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ -!function(t,e){var n;n=t.Bokeh,function(t,e,i){if(null!=n)return n.register_plugin(t,{"models/widgets/abstract_button":410,"models/widgets/abstract_icon":411,"models/widgets/abstract_slider":412,"models/widgets/autocomplete_input":413,"models/widgets/button":414,"models/widgets/button_group":415,"models/widgets/checkbox_button_group":416,"models/widgets/checkbox_group":417,"models/widgets/color_picker":418,"models/widgets/control":419,"models/widgets/date_picker":420,"models/widgets/date_range_slider":421,"models/widgets/date_slider":422,"models/widgets/div":423,"models/widgets/dropdown":424,"models/widgets/index":425,"models/widgets/input_group":426,"models/widgets/input_widget":427,"models/widgets/main":428,"models/widgets/markup":429,"models/widgets/multiselect":430,"models/widgets/paragraph":431,"models/widgets/password_input":432,"models/widgets/pretext":433,"models/widgets/radio_button_group":434,"models/widgets/radio_group":435,"models/widgets/range_slider":436,"models/widgets/selectbox":437,"models/widgets/slider":438,"models/widgets/spinner":439,"models/widgets/text_input":440,"models/widgets/textarea_input":441,"models/widgets/toggle":442,"models/widgets/widget":453},428);throw new Error("Cannot find Bokeh. You have to load it prior to loading plugins.")}({410:function(t,e,n){var i=t(400),o=t(18),r=t(5),s=t(4),a=t(419),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.initialize=function(){t.prototype.initialize.call(this),this.icon_views={}},e.prototype.connect_signals=function(){var e=this;t.prototype.connect_signals.call(this),this.connect(this.model.change,function(){return e.render()})},e.prototype.remove=function(){s.remove_views(this.icon_views),t.prototype.remove.call(this)},e.prototype._render_button=function(){for(var t=[],e=0;ei||this._o.position.indexOf("right")>-1&&a-e+t.offsetWidth>0)&&(a=a-e+t.offsetWidth),(this._o.reposition&&l+n>o+r||this._o.position.indexOf("top")>-1&&l-n-t.offsetHeight>0)&&(l=l-n-t.offsetHeight),this.el.style.left=a+"px",this.el.style.top=l+"px"}};var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.render=function(){var e=this;null!=this._picker&&this._picker.destroy(),t.prototype.render.call(this),this.input_el=r.input({type:"text",class:"bk-input",disabled:this.model.disabled}),this.group_el.appendChild(this.input_el),this._picker=new a({field:this.input_el,defaultDate:new Date(this.model.value),setDefaultDate:!0,minDate:null!=this.model.min_date?new Date(this.model.min_date):void 0,maxDate:null!=this.model.max_date?new Date(this.model.max_date):void 0,onSelect:function(t){return e._on_select(t)}}),this._root_element.appendChild(this._picker.el)},e.prototype._on_select=function(t){this.model.value=t.toDateString(),this.change_input()},e}(o.InputWidgetView);n.DatePickerView=l;var u=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="DatePicker",this.prototype.default_view=l,this.define({value:[s.Any,(new Date).toDateString()],min_date:[s.Any],max_date:[s.Any]})},e}(o.InputWidget);n.DatePicker=u,u.initClass()},421:function(t,e,n){var i=t(400),o=t(399),r=t(412),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype._calc_to=function(){return{start:this.model.start,end:this.model.end,value:this.model.value,step:this.model.step}},e.prototype._calc_from=function(t){return t},e}(r.AbstractSliderView);n.DateRangeSliderView=s;var a=function(t){function e(e){var n=t.call(this,e)||this;return n.behaviour="drag",n.connected=[!1,!0,!1],n}return i.__extends(e,t),e.initClass=function(){this.prototype.type="DateRangeSlider",this.prototype.default_view=s,this.override({format:"%d %b %Y"})},e.prototype._formatter=function(t,e){return o(t,e)},e}(r.AbstractSlider);n.DateRangeSlider=a,a.initClass()},422:function(t,e,n){var i=t(400),o=t(399),r=t(412),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype._calc_to=function(){return{start:this.model.start,end:this.model.end,value:[this.model.value],step:this.model.step}},e.prototype._calc_from=function(t){var e=t[0];return e},e}(r.AbstractSliderView);n.DateSliderView=s;var a=function(t){function e(e){var n=t.call(this,e)||this;return n.behaviour="tap",n.connected=[!0,!1],n}return i.__extends(e,t),e.initClass=function(){this.prototype.type="DateSlider",this.prototype.default_view=s,this.override({format:"%d %b %Y"})},e.prototype._formatter=function(t,e){return o(t,e)},e}(r.AbstractSlider);n.DateSlider=a,a.initClass()},423:function(t,e,n){var i=t(400),o=t(429),r=t(18),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.render=function(){t.prototype.render.call(this),this.model.render_as_text?this.markup_el.textContent=this.model.text:this.markup_el.innerHTML=this.model.text},e}(o.MarkupView);n.DivView=s;var a=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="Div",this.prototype.default_view=s,this.define({render_as_text:[r.Boolean,!1]})},e}(o.Markup);n.Div=a,a.initClass()},424:function(t,e,n){var i=t(400),o=t(410),r=t(3),s=t(5),a=t(18),l=t(46),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._open=!1,e}return i.__extends(e,t),e.prototype.render=function(){var e=this;t.prototype.render.call(this);var n=s.div({class:["bk-caret","bk-down"]});if(this.model.is_split){var i=this._render_button(n);i.classList.add("bk-dropdown-toggle"),i.addEventListener("click",function(){return e._toggle_menu()}),this.group_el.appendChild(i)}else this.button_el.appendChild(n);var o=this.model.menu.map(function(t,n){if(null==t)return s.div({class:"bk-divider"});var i=l.isString(t)?t:t[0],o=s.div({},i);return o.addEventListener("click",function(){return e._item_click(n)}),o});this.menu=s.div({class:["bk-menu","bk-below"]},o),this.el.appendChild(this.menu),s.undisplay(this.menu)},e.prototype._show_menu=function(){var t=this;if(!this._open){this._open=!0,s.display(this.menu);var e=function(n){var i=n.target;i instanceof HTMLElement&&!t.el.contains(i)&&(document.removeEventListener("click",e),t._hide_menu())};document.addEventListener("click",e)}},e.prototype._hide_menu=function(){this._open&&(this._open=!1,s.undisplay(this.menu))},e.prototype._toggle_menu=function(){this._open?this._hide_menu():this._show_menu()},e.prototype.click=function(){this.model.is_split?(this._hide_menu(),this.model.trigger_event(new r.ButtonClick),this.model.value=this.model.default_value,null!=this.model.callback&&this.model.callback.execute(this.model),t.prototype.click.call(this)):this._toggle_menu()},e.prototype._item_click=function(t){this._hide_menu();var e=this.model.menu[t];if(null!=e){var n=l.isString(e)?e:e[1];l.isString(n)?(this.model.trigger_event(new r.MenuItemClick(n)),this.model.value=n,null!=this.model.callback&&this.model.callback.execute(this.model)):(n.execute(this.model,{index:t}),null!=this.model.callback&&this.model.callback.execute(this.model))}},e}(o.AbstractButtonView);n.DropdownView=u;var c=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="Dropdown",this.prototype.default_view=u,this.define({split:[a.Boolean,!1],menu:[a.Array,[]],value:[a.String],default_value:[a.String]}),this.override({label:"Dropdown"})},Object.defineProperty(e.prototype,"is_split",{get:function(){return this.split||null!=this.default_value},enumerable:!0,configurable:!0}),e}(o.AbstractButton);n.Dropdown=c,c.initClass()},425:function(t,e,n){var i=t(410);n.AbstractButton=i.AbstractButton;var o=t(411);n.AbstractIcon=o.AbstractIcon;var r=t(413);n.AutocompleteInput=r.AutocompleteInput;var s=t(414);n.Button=s.Button;var a=t(416);n.CheckboxButtonGroup=a.CheckboxButtonGroup;var l=t(417);n.CheckboxGroup=l.CheckboxGroup;var u=t(418);n.ColorPicker=u.ColorPicker;var c=t(420);n.DatePicker=c.DatePicker;var h=t(421);n.DateRangeSlider=h.DateRangeSlider;var d=t(422);n.DateSlider=d.DateSlider;var p=t(423);n.Div=p.Div;var f=t(424);n.Dropdown=f.Dropdown;var m=t(427);n.InputWidget=m.InputWidget;var g=t(429);n.Markup=g.Markup;var v=t(430);n.MultiSelect=v.MultiSelect;var _=t(431);n.Paragraph=_.Paragraph;var y=t(432);n.PasswordInput=y.PasswordInput;var b=t(433);n.PreText=b.PreText;var w=t(434);n.RadioButtonGroup=w.RadioButtonGroup;var x=t(435);n.RadioGroup=x.RadioGroup;var k=t(436);n.RangeSlider=k.RangeSlider;var S=t(437);n.Select=S.Select;var C=t(438);n.Slider=C.Slider;var D=t(439);n.Spinner=D.Spinner;var E=t(440);n.TextInput=E.TextInput;var M=t(441);n.TextAreaInput=M.TextAreaInput;var A=t(442);n.Toggle=A.Toggle;var N=t(453);n.Widget=N.Widget},426:function(t,e,n){var i=t(400),o=t(419),r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.connect_signals=function(){var e=this;t.prototype.connect_signals.call(this),this.connect(this.model.change,function(){return e.render()})},e}(o.ControlView);n.InputGroupView=r;var s=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="InputGroup"},e}(o.Control);n.InputGroup=s,s.initClass()},427:function(t,e,n){var i=t(400),o=t(419),r=t(5),s=t(18),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.connect_signals=function(){var e=this;t.prototype.connect_signals.call(this),this.connect(this.model.properties.title.change,function(){e.label_el.textContent=e.model.title})},e.prototype.render=function(){t.prototype.render.call(this);var e=this.model.title;this.label_el=r.label({style:{display:0==e.length?"none":""}},e),this.group_el=r.div({class:"bk-input-group"},this.label_el),this.el.appendChild(this.group_el)},e.prototype.change_input=function(){null!=this.model.callback&&this.model.callback.execute(this.model)},e}(o.ControlView);n.InputWidgetView=a;var l=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="InputWidget",this.define({title:[s.String,""],callback:[s.Any]})},e}(o.Control);n.InputWidget=l,l.initClass()},428:function(t,e,n){var i=t(425);n.Widgets=i;var o=t(0);o.register_models(i)},429:function(t,e,n){var i=t(400),o=t(13),r=t(5),s=t(18),a=t(453),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.connect_signals=function(){var e=this;t.prototype.connect_signals.call(this),this.connect(this.model.change,function(){e.render(),e.root.compute_layout()})},e.prototype._update_layout=function(){this.layout=new o.VariadicBox(this.el),this.layout.set_sizing(this.box_sizing())},e.prototype.render=function(){t.prototype.render.call(this);var e=i.__assign({},this.model.style,{display:"inline-block"});this.markup_el=r.div({class:"bk-clearfix",style:e}),this.el.appendChild(this.markup_el)},e}(a.WidgetView);n.MarkupView=l;var u=function(t){function e(e){return t.call(this,e)||this}return i.__extends(e,t),e.initClass=function(){this.prototype.type="Markup",this.define({text:[s.String,""],style:[s.Any,{}]})},e}(a.Widget);n.Markup=u,u.initClass()},430:function(t,e,n){var i=t(400),o=t(5),r=t(46),s=t(32),a=t(18),l=t(427),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.connect_signals=function(){var e=this;t.prototype.connect_signals.call(this),this.connect(this.model.properties.value.change,function(){return e.render_selection()}),this.connect(this.model.properties.options.change,function(){return e.render()}),this.connect(this.model.properties.name.change,function(){return e.render()}),this.connect(this.model.properties.title.change,function(){return e.render()}),this.connect(this.model.properties.size.change,function(){return e.render()}),this.connect(this.model.properties.disabled.change,function(){return e.render()})},e.prototype.render=function(){var e=this;t.prototype.render.call(this);var n=this.model.options.map(function(t){var e,n;return r.isString(t)?e=n=t:(e=t[0],n=t[1]),o.option({value:e},n)});this.select_el=o.select({multiple:!0,class:"bk-input",name:this.model.name,disabled:this.model.disabled},n),this.select_el.addEventListener("change",function(){return e.change_input()}),this.group_el.appendChild(this.select_el),this.render_selection()},e.prototype.render_selection=function(){for(var t=new s.Set(this.model.value),e=0,n=Array.from(this.el.querySelectorAll("option"));e0&&(s(t,e),setTimeout(function(){a(t,e)},n))}function o(t){return Array.isArray(t)?t:[t]}function r(t){var e=(t=String(t)).split(".");return e.length>1?e[1].length:0}function s(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function a(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function l(t){var e=void 0!==window.pageXOffset,n="CSS1Compat"===(t.compatMode||""),i=e?window.pageXOffset:n?t.documentElement.scrollLeft:t.body.scrollLeft,o=e?window.pageYOffset:n?t.documentElement.scrollTop:t.body.scrollTop;return{x:i,y:o}}function u(t,e){return 100/(e-t)}function c(t,e){return 100*e/(t[1]-t[0])}function h(t,e){for(var n=1;t>=e[n];)n+=1;return n}function d(t,e,n){if(n>=t.slice(-1)[0])return 100;var i,o,r,s,a=h(n,t);return i=t[a-1],o=t[a],r=e[a-1],s=e[a],r+function(t,e){return c(t,t[0]<0?e+Math.abs(t[0]):e-t[0])}([i,o],n)/u(r,s)}function p(t,e,n,i){if(100===i)return i;var o,r,s=h(i,t);return n?(o=t[s-1],r=t[s],i-o>(r-o)/2?r:o):e[s-1]?t[s-1]+function(t,e){return Math.round(t/e)*e}(i-t[s-1],e[s-1]):i}function f(e,i,o){var r;if("number"==typeof i&&(i=[i]),"[object Array]"!==Object.prototype.toString.call(i))throw new Error("noUiSlider ("+t+"): 'range' contains invalid value.");if(!n(r="min"===e?0:"max"===e?100:parseFloat(e))||!n(i[0]))throw new Error("noUiSlider ("+t+"): 'range' value isn't numeric.");o.xPct.push(r),o.xVal.push(i[0]),r?o.xSteps.push(!isNaN(i[1])&&i[1]):isNaN(i[1])||(o.xSteps[0]=i[1]),o.xHighestCompleteStep.push(0)}function m(t,e,n){if(!e)return!0;n.xSteps[t]=c([n.xVal[t],n.xVal[t+1]],e)/u(n.xPct[t],n.xPct[t+1]);var i=(n.xVal[t+1]-n.xVal[t])/n.xNumSteps[t],o=Math.ceil(Number(i.toFixed(3))-1),r=n.xVal[t]+n.xNumSteps[t]*o;n.xHighestCompleteStep[t]=r}function g(t,e,n){this.xPct=[],this.xVal=[],this.xSteps=[n||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=e;var i,o=[];for(i in t)t.hasOwnProperty(i)&&o.push([t[i],i]);for(o.length&&"object"==typeof o[0][0]?o.sort(function(t,e){return t[0][0]-e[0][0]}):o.sort(function(t,e){return t[0]-e[0]}),i=0;i=100)return t.slice(-1)[0];var i,o,r,s,a=h(n,e);return i=t[a-1],o=t[a],r=e[a-1],s=e[a],function(t,e){return e*(t[1]-t[0])/100+t[0]}([i,o],(n-r)*u(r,s))}(this.xVal,this.xPct,t)},g.prototype.getStep=function(t){return t=p(this.xPct,this.xSteps,this.snap,t)},g.prototype.getNearbySteps=function(t){var e=h(t,this.xPct);return{stepBefore:{startValue:this.xVal[e-2],step:this.xNumSteps[e-2],highestStep:this.xHighestCompleteStep[e-2]},thisStep:{startValue:this.xVal[e-1],step:this.xNumSteps[e-1],highestStep:this.xHighestCompleteStep[e-1]},stepAfter:{startValue:this.xVal[e-0],step:this.xNumSteps[e-0],highestStep:this.xHighestCompleteStep[e-0]}}},g.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(r);return Math.max.apply(null,t)},g.prototype.convert=function(t){return this.getStep(this.toStepping(t))};var v={to:function(t){return void 0!==t&&t.toFixed(2)},from:Number};function _(e){if(function(t){return"object"==typeof t&&"function"==typeof t.to&&"function"==typeof t.from}(e))return!0;throw new Error("noUiSlider ("+t+"): 'format' requires 'to' and 'from' methods.")}function y(e,i){if(!n(i))throw new Error("noUiSlider ("+t+"): 'step' is not numeric.");e.singleStep=i}function b(e,n){if("object"!=typeof n||Array.isArray(n))throw new Error("noUiSlider ("+t+"): 'range' is not an object.");if(void 0===n.min||void 0===n.max)throw new Error("noUiSlider ("+t+"): Missing 'min' or 'max' in 'range'.");if(n.min===n.max)throw new Error("noUiSlider ("+t+"): 'range' 'min' and 'max' cannot be equal.");e.spectrum=new g(n,e.snap,e.singleStep)}function w(e,n){if(n=o(n),!Array.isArray(n)||!n.length)throw new Error("noUiSlider ("+t+"): 'start' option is incorrect.");e.handles=n.length,e.start=n}function x(e,n){if(e.snap=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'snap' option must be a boolean.")}function k(e,n){if(e.animate=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'animate' option must be a boolean.")}function S(e,n){if(e.animationDuration=n,"number"!=typeof n)throw new Error("noUiSlider ("+t+"): 'animationDuration' option must be a number.")}function C(e,n){var i,o=[!1];if("lower"===n?n=[!0,!1]:"upper"===n&&(n=[!1,!0]),!0===n||!1===n){for(i=1;i=50)throw new Error("noUiSlider ("+t+"): 'padding' option must be less than half the range.")}}function N(e,n){switch(n){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider ("+t+"): 'direction' option was not recognized.")}}function V(e,n){if("string"!=typeof n)throw new Error("noUiSlider ("+t+"): 'behaviour' must be a string containing options.");var i=n.indexOf("tap")>=0,o=n.indexOf("drag")>=0,r=n.indexOf("fixed")>=0,s=n.indexOf("snap")>=0,a=n.indexOf("hover")>=0;if(r){if(2!==e.handles)throw new Error("noUiSlider ("+t+"): 'fixed' behaviour must be used with 2 handles");E(e,e.start[1]-e.start[0])}e.events={tap:i||s,drag:o,fixed:r,snap:s,hover:a}}function I(e,n){if(e.multitouch=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'multitouch' option must be a boolean.")}function T(e,n){if(!1!==n)if(!0===n){e.tooltips=[];for(var i=0;i-1?1:"steps"===e?2:0,!r&&a&&(f=0),c===y&&l||(o[d.toFixed(5)]=[c,f]),u=d}}),o}(i,n,a),u=e.format||{to:Math.round};return f=b.appendChild(P(l,o,u))}function B(){var t=c.getBoundingClientRect(),e="offset"+["Width","Height"][r.ort];return 0===r.ort?t.width||c[e]:t.height||c[e]}function L(t,e,n,i){var o=function(o){return!b.hasAttribute("disabled")&&(s=b,a=r.cssClasses.tap,(s.classList?!s.classList.contains(a):!new RegExp("\\b"+a+"\\b").test(s.className))&&!!(o=function(t,e,n){var i,o,s=0===t.type.indexOf("touch"),a=0===t.type.indexOf("mouse"),u=0===t.type.indexOf("pointer");if(0===t.type.indexOf("MSPointer")&&(u=!0),s&&r.multitouch){var c=function(t){return t.target===n||n.contains(t.target)};if("touchstart"===t.type){var h=Array.prototype.filter.call(t.touches,c);if(h.length>1)return!1;i=h[0].pageX,o=h[0].pageY}else{var d=Array.prototype.find.call(t.changedTouches,c);if(!d)return!1;i=d.pageX,o=d.pageY}}else if(s){if(t.touches.length>1)return!1;i=t.changedTouches[0].pageX,o=t.changedTouches[0].pageY}return e=e||l(E),(a||u)&&(i=t.clientX+e.x,o=t.clientY+e.y),t.pageOffset=e,t.points=[i,o],t.cursor=a||u,t}(o,i.pageOffset,i.target||e))&&!(t===v.start&&void 0!==o.buttons&&o.buttons>1)&&(!i.hover||!o.buttons)&&(y||o.preventDefault(),o.calcPoint=o.points[r.ort],void n(o,i)));var s,a},s=[];return t.split(" ").forEach(function(t){e.addEventListener(t,o,!!y&&{passive:!0}),s.push([t,o])}),s}function W(t){var e,n,i,o,s,a,u=t-(e=c,n=r.ort,i=e.getBoundingClientRect(),o=e.ownerDocument,s=o.documentElement,a=l(o),/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(a.x=0),n?i.top+a.y-s.clientTop:i.left+a.x-s.clientLeft),h=100*u/B();return r.dir?100-h:h}function F(t,e,n,i){var o=n.slice(),r=[!t,t],s=[t,!t];i=i.slice(),t&&i.reverse(),i.length>1?i.forEach(function(t,n){var i=K(o,t,o[t]+e,r[n],s[n],!1);!1===i?e=0:(e=i-o[t],o[t]=i)}):r=s=[!0];var a=!1;i.forEach(function(t,i){a=Q(t,n[t]+e,r[i],s[i])||a}),a&&i.forEach(function(t){j("update",t),j("slide",t)})}function j(t,e,n){Object.keys(D).forEach(function(i){var o=i.split(".")[0];t===o&&D[i].forEach(function(t){t.call(p,C.map(r.format.to),e,C.slice(),n||!1,w.slice())})})}function z(t,e){"mouseout"===t.type&&"HTML"===t.target.nodeName&&null===t.relatedTarget&&H(t,e)}function Y(t,e){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===t.buttons&&0!==e.buttonsProperty)return H(t,e);var n=(r.dir?-1:1)*(t.calcPoint-e.startCalcPoint),i=100*n/e.baseSize;F(n>0,i,e.locations,e.handleNumbers)}function H(t,n){n.handle&&(a(n.handle,r.cssClasses.active),k-=1),n.listeners.forEach(function(t){M.removeEventListener(t[0],t[1])}),0===k&&(a(b,r.cssClasses.drag),$(),t.cursor&&(A.style.cursor="",A.removeEventListener("selectstart",e))),n.handleNumbers.forEach(function(t){j("change",t),j("set",t),j("end",t)})}function G(t,n){var i;if(1===n.handleNumbers.length){var o=h[n.handleNumbers[0]];if(o.hasAttribute("disabled"))return!1;i=o.children[0],k+=1,s(i,r.cssClasses.active)}t.stopPropagation();var a=[],l=L(v.move,M,Y,{target:t.target,handle:i,listeners:a,startCalcPoint:t.calcPoint,baseSize:B(),pageOffset:t.pageOffset,handleNumbers:n.handleNumbers,buttonsProperty:t.buttons,locations:w.slice()}),u=L(v.end,M,H,{target:t.target,handle:i,listeners:a,handleNumbers:n.handleNumbers}),c=L("mouseout",M,z,{target:t.target,handle:i,listeners:a,handleNumbers:n.handleNumbers});a.push.apply(a,l.concat(u,c)),t.cursor&&(A.style.cursor=getComputedStyle(t.target).cursor,h.length>1&&s(b,r.cssClasses.drag),A.addEventListener("selectstart",e,!1)),n.handleNumbers.forEach(function(t){j("start",t)})}function q(t){t.stopPropagation();var e=W(t.calcPoint),n=function(t){var e=100,n=!1;return h.forEach(function(i,o){if(!i.hasAttribute("disabled")){var r=Math.abs(w[o]-t);r1&&(i&&e>0&&(n=Math.max(n,t[e-1]+r.margin)),o&&e1&&r.limit&&(i&&e>0&&(n=Math.min(n,t[e-1]+r.limit)),o&&e50?-1:1,n=3+(h.length+e*t);h[t].childNodes[0].style.zIndex=n})}function Q(t,e,n,i){return!1!==(e=K(w,t,e,n,i,!1))&&(function(t,e){w[t]=e,C[t]=S.fromStepping(e);var n=function(){h[t].style[r.style]=J(e),Z(t),Z(t+1)};window.requestAnimationFrame&&r.useRequestAnimationFrame?window.requestAnimationFrame(n):n()}(t,e),!0)}function Z(t){if(d[t]){var e=0,n=100;0!==t&&(e=w[t-1]),t!==d.length-1&&(n=w[t]),d[t].style[r.style]=J(e),d[t].style[r.styleOposite]=J(100-n)}}function tt(t,e){null!==t&&!1!==t&&("number"==typeof t&&(t=String(t)),!1===(t=r.format.from(t))||isNaN(t)||Q(e,S.toStepping(t),!1,!1))}function et(t,e){var n=o(t),s=void 0===w[0];e=void 0===e||!!e,n.forEach(tt),r.animate&&!s&&i(b,r.cssClasses.tap,r.animationDuration),x.forEach(function(t){Q(t,w[t],!0,!1)}),$(),x.forEach(function(t){j("update",t),null!==n[t]&&e&&j("set",t)})}function nt(){var t=C.map(r.format.to);return 1===t.length?t[0]:t}function it(t,e){D[t]=D[t]||[],D[t].push(e),"update"===t.split(".")[0]&&h.forEach(function(t,e){j("update",e)})}if(b.noUiSlider)throw new Error("noUiSlider ("+t+"): Slider was already initialized.");return function(t){s(t,r.cssClasses.target),0===r.dir?s(t,r.cssClasses.ltr):s(t,r.cssClasses.rtl),0===r.ort?s(t,r.cssClasses.horizontal):s(t,r.cssClasses.vertical),c=N(t,r.cssClasses.base)}(b),function(t,e){h=[],(d=[]).push(I(e,t[0]));for(var n=0;nn.stepAfter.startValue&&(o=n.stepAfter.startValue-i),r=i>n.thisStep.startValue?n.thisStep.step:!1!==n.stepBefore.step&&i-n.stepBefore.highestStep,100===t?o=null:0===t&&(r=null);var s=S.countStepDecimals();return null!==o&&!1!==o&&(o=Number(o.toFixed(s))),null!==r&&!1!==r&&(r=Number(r.toFixed(s))),[r,o]})},on:it,off:function(t){var e=t&&t.split(".")[0],n=e&&t.substring(e.length);Object.keys(D).forEach(function(t){var i=t.split(".")[0],o=t.substring(i.length);e&&e!==i||n&&n!==o||delete D[t]})},get:nt,set:et,reset:function(t){et(r.start,t)},__moveHandles:function(t,e,n){F(t,e,w,n)},options:u,updateOptions:function(t,e){var n=nt(),i=["margin","limit","padding","range","animate","snap","step","format"];i.forEach(function(e){void 0!==t[e]&&(u[e]=t[e])});var o=U(u);i.forEach(function(e){void 0!==t[e]&&(r[e]=o[e])}),S=o.spectrum,r.margin=o.margin,r.limit=o.limit,r.padding=o.padding,r.pips&&O(r.pips),w=[],et(t.start||n,e)},target:b,removePips:R,pips:O},(g=r.events).fixed||h.forEach(function(t,e){L(v.start,t.children[0],G,{handleNumbers:[e]})}),g.tap&&L(v.start,c,q,{}),g.hover&&L(v.move,c,X,{hover:!0}),g.drag&&d.forEach(function(t,e){if(!1!==t&&0!==e&&e!==d.length-1){var n=h[e-1],i=h[e],o=[t];s(t,r.cssClasses.draggable),g.fixed&&(o.push(n.children[0]),o.push(i.children[0])),o.forEach(function(t){L(v.start,t,G,{handles:[n,i],handleNumbers:[e-1,e]})})}}),et(r.start),r.pips&&O(r.pips),r.tooltips&&(m=h.map(T),it("update",function(t,e,n){if(m[e]){var i=t[e];!0!==r.tooltips[e]&&(i=r.tooltips[e].to(n[e])),m[e].innerHTML=i}})),it("update",function(t,e,n,i,o){x.forEach(function(t){var e=h[t],i=K(w,t,0,!0,!0,!0),s=K(w,t,100,!0,!0,!0),a=o[t],l=r.ariaFormat.to(n[t]);e.children[0].setAttribute("aria-valuemin",i.toFixed(1)),e.children[0].setAttribute("aria-valuemax",s.toFixed(1)),e.children[0].setAttribute("aria-valuenow",a.toFixed(1)),e.children[0].setAttribute("aria-valuetext",l)})}),p}return{version:t,create:function(e,n){if(!e||!e.nodeName)throw new Error("noUiSlider ("+t+"): create requires a single element, got: "+e);var i=U(n),o=W(e,i,n);return e.noUiSlider=o,o}}},"object"==typeof n?e.exports=i():window.noUiSlider=i()},445:function(t,e,n){var i=function(t,e,n,i){t.addEventListener(e,n,!!i)},o=function(t,e,n,i){t.removeEventListener(e,n,!!i)},r=function(t,e){return-1!==(" "+t.className+" ").indexOf(" "+e+" ")},s=function(t,e){r(t,e)||(t.className=""===t.className?e:t.className+" "+e)},a=function(t,e){var n;t.className=(n=(" "+t.className+" ").replace(" "+e+" "," ")).trim?n.trim():n.replace(/^\s+|\s+$/g,"")},l=function(t){return/Array/.test(Object.prototype.toString.call(t))},u=function(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())},c=function(t){var e=t.getDay();return 0===e||6===e},h=function(t){ -// solution lifted from date.js (MIT license): https://github.com/datejs/Datejs -return t%4==0&&t%100!=0||t%400==0},d=function(t,e){return[31,h(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},p=function(t){u(t)&&t.setHours(0,0,0,0)},f=function(t,e){return t.getTime()===e.getTime()},m=function(t,e,n){var i,o;for(i in e)(o=void 0!==t[i])&&"object"==typeof e[i]&&null!==e[i]&&void 0===e[i].nodeName?u(e[i])?n&&(t[i]=new Date(e[i].getTime())):l(e[i])?n&&(t[i]=e[i].slice(0)):t[i]=m({},e[i],n):!n&&o||(t[i]=e[i]);return t},g=function(t,e,n){var i;document.createEvent?((i=document.createEvent("HTMLEvents")).initEvent(e,!0,!1),i=m(i,n),t.dispatchEvent(i)):document.createEventObject&&(i=document.createEventObject(),i=m(i,n),t.fireEvent("on"+e,i))},v=function(t){return t.month<0&&(t.year-=Math.ceil(Math.abs(t.month)/12),t.month+=12),t.month>11&&(t.year+=Math.floor(Math.abs(t.month)/12),t.month-=12),t},_={field:null,bound:void 0,ariaLabel:"Use the arrow keys to pick a date",position:"bottom left",reposition:!0,format:"YYYY-MM-DD",toString:null,parse:null,defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,pickWholeWeek:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,enableSelectionDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,blurFieldOnSelect:!0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},theme:null,events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null,keyboardInput:!0},y=function(t,e,n){for(e+=t.firstDay;e>=7;)e-=7;return n?t.i18n.weekdaysShort[e]:t.i18n.weekdays[e]},b=function(t){var e=[],n="false";if(t.isEmpty){if(!t.showDaysInNextAndPreviousMonths)return'';e.push("is-outside-current-month"),t.enableSelectionDaysInNextAndPreviousMonths||e.push("is-selection-disabled")}return t.isDisabled&&e.push("is-disabled"),t.isToday&&e.push("is-today"),t.isSelected&&(e.push("is-selected"),n="true"),t.hasEvent&&e.push("has-event"),t.isInRange&&e.push("is-inrange"),t.isStartRange&&e.push("is-startrange"),t.isEndRange&&e.push("is-endrange"),'"},w=function(t,e,n){var i=new Date(n,e,t),o=function(t){t.setHours(0,0,0,0);var e=t.getDate(),n=t.getDay(),i=function(t){return(t+7-1)%7};t.setDate(e+3-i(n));var o=new Date(t.getFullYear(),0,4),r=(t.getTime()-o.getTime())/864e5;return 1+Math.round((r-3+i(o.getDay()))/7)}(i);return''+o+""},x=function(t,e,n,i){return''+(e?t.reverse():t).join("")+""},k=function(t,e,n,i,o,r){var s,a,u,c,h,d=t._o,p=n===d.minYear,f=n===d.maxYear,m='
',g=!0,v=!0;for(u=[],s=0;s<12;s++)u.push('");for(c='
'+d.i18n.months[i]+'
",l(d.yearRange)?(s=d.yearRange[0],a=d.yearRange[1]+1):(s=n-d.yearRange,a=1+n+d.yearRange),u=[];s=d.minYear&&u.push('");return h='
'+n+d.yearSuffix+'
",d.showMonthAfterYear?m+=h+c:m+=c+h,p&&(0===i||d.minMonth>=i)&&(g=!1),f&&(11===i||d.maxMonth<=i)&&(v=!1),0===e&&(m+='"),e===t._o.numberOfMonths-1&&(m+='"),m+="
"},S=function(t,e,n){return''+function(t){var e,n=[];for(t.showWeekNumber&&n.push(""),e=0;e<7;e++)n.push('");return""+(t.isRTL?n.reverse():n).join("")+""}(t)+""+e.join("")+"
'+y(t,e,!0)+"
"},C=function(t){var e=this,n=e.config(t);e._onMouseDown=function(t){if(e._v){var i=(t=t||window.event).target||t.srcElement;if(i)if(r(i,"is-disabled")||(!r(i,"pika-button")||r(i,"is-empty")||r(i.parentNode,"is-disabled")?r(i,"pika-prev")?e.prevMonth():r(i,"pika-next")&&e.nextMonth():(e.setDate(new Date(i.getAttribute("data-pika-year"),i.getAttribute("data-pika-month"),i.getAttribute("data-pika-day"))),n.bound&&setTimeout(function(){e.hide(),n.blurFieldOnSelect&&n.field&&n.field.blur()},100))),r(i,"pika-select"))e._c=!0;else{if(!t.preventDefault)return t.returnValue=!1,!1;t.preventDefault()}}},e._onChange=function(t){var n=(t=t||window.event).target||t.srcElement;n&&(r(n,"pika-select-month")?e.gotoMonth(n.value):r(n,"pika-select-year")&&e.gotoYear(n.value))},e._onKeyChange=function(t){if(t=t||window.event,e.isVisible())switch(t.keyCode){case 13:case 27:n.field&&n.field.blur();break;case 37:e.adjustDate("subtract",1);break;case 38:e.adjustDate("subtract",7);break;case 39:e.adjustDate("add",1);break;case 40:e.adjustDate("add",7);break;case 8:case 46:e.setDate(null)}},e._parseFieldValue=function(){return n.parse?n.parse(n.field.value,n.format):new Date(Date.parse(n.field.value))},e._onInputChange=function(t){var n;t.firedBy!==e&&(n=e._parseFieldValue(),u(n)&&e.setDate(n),e._v||e.show())},e._onInputFocus=function(){e.show()},e._onInputClick=function(){e.show()},e._onInputBlur=function(){var t=document.activeElement;do{if(r(t,"pika-single"))return}while(t=t.parentNode);e._c||(e._b=setTimeout(function(){e.hide()},50)),e._c=!1},e._onClick=function(t){var i=(t=t||window.event).target||t.srcElement,o=i;if(i){do{if(r(o,"pika-single")||o===n.trigger)return}while(o=o.parentNode);e._v&&i!==n.trigger&&o!==n.trigger&&e.hide()}},e.el=document.createElement("div"),e.el.className="pika-single"+(n.isRTL?" is-rtl":"")+(n.theme?" "+n.theme:""),i(e.el,"mousedown",e._onMouseDown,!0),i(e.el,"touchend",e._onMouseDown,!0),i(e.el,"change",e._onChange),n.keyboardInput&&i(document,"keydown",e._onKeyChange),n.field&&(n.container?n.container.appendChild(e.el):n.bound?document.body.appendChild(e.el):n.field.parentNode.insertBefore(e.el,n.field.nextSibling),i(n.field,"change",e._onInputChange),n.defaultDate||(n.defaultDate=e._parseFieldValue(),n.setDefaultDate=!0));var o=n.defaultDate;u(o)?n.setDefaultDate?e.setDate(o,!0):e.gotoDate(o):e.gotoDate(new Date),n.bound?(this.hide(),e.el.className+=" is-bound",i(n.trigger,"click",e._onInputClick),i(n.trigger,"focus",e._onInputFocus),i(n.trigger,"blur",e._onInputBlur)):this.show()};C.prototype={config:function(t){this._o||(this._o=m({},_,!0));var e=m(this._o,t,!0);e.isRTL=!!e.isRTL,e.field=e.field&&e.field.nodeName?e.field:null,e.theme="string"==typeof e.theme&&e.theme?e.theme:null,e.bound=!!(void 0!==e.bound?e.field&&e.bound:e.field),e.trigger=e.trigger&&e.trigger.nodeName?e.trigger:e.field,e.disableWeekends=!!e.disableWeekends,e.disableDayFn="function"==typeof e.disableDayFn?e.disableDayFn:null;var n=parseInt(e.numberOfMonths,10)||1;if(e.numberOfMonths=n>4?4:n,u(e.minDate)||(e.minDate=!1),u(e.maxDate)||(e.maxDate=!1),e.minDate&&e.maxDate&&e.maxDate100&&(e.yearRange=100);return e},toString:function(t){return t=t||this._o.format,u(this._d)?this._o.toString?this._o.toString(this._d,t):this._d.toDateString():""},getDate:function(){return u(this._d)?new Date(this._d.getTime()):null},setDate:function(t,e){if(!t)return this._d=null,this._o.field&&(this._o.field.value="",g(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof t&&(t=new Date(Date.parse(t))),u(t)){var n=this._o.minDate,i=this._o.maxDate;u(n)&&ti&&(t=i),this._d=new Date(t.getTime()),p(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),g(this._o.field,"change",{firedBy:this})),e||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},clear:function(){this.setDate(null)},gotoDate:function(t){var e=!0;if(u(t)){if(this.calendars){var n=new Date(this.calendars[0].year,this.calendars[0].month,1),i=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),o=t.getTime();i.setMonth(i.getMonth()+1),i.setDate(i.getDate()-1),e=o=o&&(this._y=o,!isNaN(s)&&this._m>s&&(this._m=s));for(var l=0;l";this.el.innerHTML=a,n.bound&&"hidden"!==n.field.type&&setTimeout(function(){n.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),n.bound&&n.field.setAttribute("aria-label",n.ariaLabel)}},adjustPosition:function(){var t,e,n,i,o,r,l,u,c,h,d,p;if(!this._o.container){if(this.el.style.position="absolute",t=this._o.trigger,e=t,n=this.el.offsetWidth,i=this.el.offsetHeight,o=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,l=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,d=!0,p=!0,"function"==typeof t.getBoundingClientRect)h=t.getBoundingClientRect(),u=h.left+window.pageXOffset,c=h.bottom+window.pageYOffset;else for(u=e.offsetLeft,c=e.offsetTop+e.offsetHeight;e=e.offsetParent;)u+=e.offsetLeft,c+=e.offsetTop;(this._o.reposition&&u+n>o||this._o.position.indexOf("right")>-1&&u-n+t.offsetWidth>0)&&(u=u-n+t.offsetWidth,d=!1),(this._o.reposition&&c+i>r+l||this._o.position.indexOf("top")>-1&&c-i-t.offsetHeight>0)&&(c=c-i-t.offsetHeight,p=!1),this.el.style.left=u+"px",this.el.style.top=c+"px",s(this.el,d?"left-aligned":"right-aligned"),s(this.el,p?"bottom-aligned":"top-aligned"),a(this.el,d?"right-aligned":"left-aligned"),a(this.el,p?"top-aligned":"bottom-aligned")}},render:function(t,e,n){var i=this._o,o=new Date,r=d(t,e),s=new Date(t,e,1).getDay(),a=[],l=[];p(o),i.firstDay>0&&(s-=i.firstDay)<0&&(s+=7);for(var h=0===e?11:e-1,m=11===e?0:e+1,g=0===e?t-1:t,v=11===e?t+1:t,_=d(g,h),y=r+s,k=y;k>7;)k-=7;y+=7-k;for(var C=!1,D=0,E=0;D=r+s,T=D-s+1,P=e,R=t,O=i.startRange&&f(i.startRange,M),B=i.endRange&&f(i.endRange,M),L=i.startRange&&i.endRange&&i.startRangei.maxDate||i.disableWeekends&&c(M)||i.disableDayFn&&i.disableDayFn(M);I&&(Dthis.render()))}remove(){null!=this.icon_view&&this.icon_view.remove(),super.remove()}styles(){return[...super.styles(),a.default]}_render_button(...t){return r.button({type:"button",disabled:this.model.disabled,class:[b.btn,b[`btn_${this.model.button_type}`]]},...t)}render(){super.render(),this.button_el=this._render_button(this.model.label),this.button_el.addEventListener("click",(()=>this.click())),null!=this.icon_view&&(""!=this.model.label?r.prepend(this.button_el,this.icon_view.el,r.nbsp()):r.prepend(this.button_el,this.icon_view.el),this.icon_view.render()),this.group_el=r.div({class:b.btn_group},this.button_el),this.el.appendChild(this.group_el)}click(){}}n.AbstractButtonView=d,d.__name__="AbstractButtonView";class h extends u.Control{constructor(t){super(t)}static init_AbstractButton(){this.define((({String:t,Ref:e,Nullable:n})=>({label:[t,"Button"],icon:[n(e(_.AbstractIcon)),null],button_type:[o.ButtonType,"default"]})))}}n.AbstractButton=h,h.__name__="AbstractButton",h.init_AbstractButton()}, +420: function _(t,e,o,s,n){s();const i=t(488),l=t(43);class c extends i.WidgetView{connect_signals(){super.connect_signals();const t=this.model.properties;this.on_change(t.disabled,(()=>{for(const t of this.controls())l.toggle_attribute(t,"disabled",this.model.disabled)}))}}o.ControlView=c,c.__name__="ControlView";class r extends i.Widget{constructor(t){super(t)}}o.Control=r,r.__name__="Control"}, +488: function _(i,t,e,o,n){o();const s=i(322),r=i(20);class d extends s.HTMLBoxView{_width_policy(){return"horizontal"==this.model.orientation?super._width_policy():"fixed"}_height_policy(){return"horizontal"==this.model.orientation?"fixed":super._height_policy()}box_sizing(){const i=super.box_sizing();return"horizontal"==this.model.orientation?null==i.width&&(i.width=this.model.default_size):null==i.height&&(i.height=this.model.default_size),i}}e.WidgetView=d,d.__name__="WidgetView";class _ extends s.HTMLBox{constructor(i){super(i)}static init_Widget(){this.define((({Number:i})=>({orientation:[r.Orientation,"horizontal"],default_size:[i,300]}))),this.override({margin:[5,5,5,5]})}}e.Widget=_,_.__name__="Widget",_.init_Widget()}, +422: function _(c,t,s,n,e){n();const o=c(53),_=c(240);class a extends _.DOMView{}s.AbstractIconView=a,a.__name__="AbstractIconView";class r extends o.Model{constructor(c){super(c)}}s.AbstractIcon=r,r.__name__="AbstractIcon"}, +423: function _(e,t,n,i,s){i();const h=e(1),o=e(424),_=e(43),u=e(10),r=h.__importStar(e(243)),c=r;class l extends o.TextInputView{constructor(){super(...arguments),this._open=!1,this._last_value="",this._hover_index=0}styles(){return[...super.styles(),r.default]}render(){super.render(),this.input_el.addEventListener("keydown",(e=>this._keydown(e))),this.input_el.addEventListener("keyup",(e=>this._keyup(e))),this.menu=_.div({class:[c.menu,c.below]}),this.menu.addEventListener("click",(e=>this._menu_click(e))),this.menu.addEventListener("mouseover",(e=>this._menu_hover(e))),this.el.appendChild(this.menu),_.undisplay(this.menu)}change_input(){this._open&&this.menu.children.length>0&&(this.model.value=this.menu.children[this._hover_index].textContent,this.input_el.focus(),this._hide_menu()),this.model.restrict||super.change_input()}_update_completions(e){_.empty(this.menu);for(const t of e){const e=_.div({},t);this.menu.appendChild(e)}e.length>0&&this.menu.children[0].classList.add(c.active)}_show_menu(){if(!this._open){this._open=!0,this._hover_index=0,this._last_value=this.model.value,_.display(this.menu);const e=t=>{const{target:n}=t;n instanceof HTMLElement&&!this.el.contains(n)&&(document.removeEventListener("click",e),this._hide_menu())};document.addEventListener("click",e)}}_hide_menu(){this._open&&(this._open=!1,_.undisplay(this.menu))}_menu_click(e){e.target!=e.currentTarget&&e.target instanceof Element&&(this.model.value=e.target.textContent,this.input_el.focus(),this._hide_menu())}_menu_hover(e){if(e.target!=e.currentTarget&&e.target instanceof Element){let t=0;for(t=0;t0&&(this.menu.children[this._hover_index].classList.remove(c.active),this._hover_index=u.clamp(e,0,t-1),this.menu.children[this._hover_index].classList.add(c.active))}_keydown(e){}_keyup(e){switch(e.keyCode){case _.Keys.Enter:this.change_input();break;case _.Keys.Esc:this._hide_menu();break;case _.Keys.Up:this._bump_hover(this._hover_index-1);break;case _.Keys.Down:this._bump_hover(this._hover_index+1);break;default:{const e=this.input_el.value;if(e.lengthe:e=>e.toLowerCase();for(const n of this.model.completions)i(n).startsWith(i(e))&&t.push(n);this._update_completions(t),0==t.length?this._hide_menu():this._show_menu()}}}}n.AutocompleteInputView=l,l.__name__="AutocompleteInputView";class a extends o.TextInput{constructor(e){super(e)}static init_AutocompleteInput(){this.prototype.default_view=l,this.define((({Boolean:e,Int:t,String:n,Array:i})=>({completions:[i(n),[]],min_characters:[t,2],case_sensitive:[e,!0],restrict:[e,!0]})))}}n.AutocompleteInput=a,a.__name__="AutocompleteInput",a.init_AutocompleteInput()}, +424: function _(t,e,n,i,p){i();const _=t(1),u=t(425),s=t(43),x=_.__importStar(t(427));class a extends u.TextLikeInputView{_render_input(){this.input_el=s.input({type:"text",class:x.input})}}n.TextInputView=a,a.__name__="TextInputView";class c extends u.TextLikeInput{constructor(t){super(t)}static init_TextInput(){this.prototype.default_view=a}}n.TextInput=c,c.__name__="TextInput",c.init_TextInput()}, +425: function _(e,t,n,i,l){i();const s=e(426);class h extends s.InputWidgetView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.name.change,(()=>{var e;return this.input_el.name=null!==(e=this.model.name)&&void 0!==e?e:""})),this.connect(this.model.properties.value.change,(()=>this.input_el.value=this.model.value)),this.connect(this.model.properties.value_input.change,(()=>this.input_el.value=this.model.value_input)),this.connect(this.model.properties.disabled.change,(()=>this.input_el.disabled=this.model.disabled)),this.connect(this.model.properties.placeholder.change,(()=>this.input_el.placeholder=this.model.placeholder)),this.connect(this.model.properties.max_length.change,(()=>{const{max_length:e}=this.model;null!=e?this.input_el.maxLength=e:this.input_el.removeAttribute("maxLength")}))}render(){var e;super.render(),this._render_input();const{input_el:t}=this;t.name=null!==(e=this.model.name)&&void 0!==e?e:"",t.value=this.model.value,t.disabled=this.model.disabled,t.placeholder=this.model.placeholder,null!=this.model.max_length&&(t.maxLength=this.model.max_length),t.addEventListener("change",(()=>this.change_input())),t.addEventListener("input",(()=>this.change_input_value())),this.group_el.appendChild(t)}change_input(){this.model.value=this.input_el.value,super.change_input()}change_input_value(){this.model.value_input=this.input_el.value,super.change_input()}}n.TextLikeInputView=h,h.__name__="TextLikeInputView";class a extends s.InputWidget{constructor(e){super(e)}static init_TextLikeInput(){this.define((({Int:e,String:t,Nullable:n})=>({value:[t,""],value_input:[t,""],placeholder:[t,""],max_length:[n(e),null]})))}}n.TextLikeInput=a,a.__name__="TextLikeInput",a.init_TextLikeInput()}, +426: function _(t,e,i,n,s){n();const l=t(1),o=t(420),r=t(43),_=l.__importStar(t(427)),p=_;class d extends o.ControlView{*controls(){yield this.input_el}connect_signals(){super.connect_signals(),this.connect(this.model.properties.title.change,(()=>{this.label_el.textContent=this.model.title}))}styles(){return[...super.styles(),_.default]}render(){super.render();const{title:t}=this.model;this.label_el=r.label({style:{display:0==t.length?"none":""}},t),this.group_el=r.div({class:p.input_group},this.label_el),this.el.appendChild(this.group_el)}change_input(){}}i.InputWidgetView=d,d.__name__="InputWidgetView";class u extends o.Control{constructor(t){super(t)}static init_InputWidget(){this.define((({String:t})=>({title:[t,""]})))}}i.InputWidget=u,u.__name__="InputWidget",u.init_InputWidget()}, +427: function _(o,i,t,n,p){n(),t.root="bk-root",t.input="bk-input",t.input_group="bk-input-group",t.inline="bk-inline",t.spin_wrapper="bk-spin-wrapper",t.spin_btn="bk-spin-btn",t.spin_btn_up="bk-spin-btn-up",t.spin_btn_down="bk-spin-btn-down",t.default='.bk-root .bk-input{display:inline-block;width:100%;flex-grow:1;-webkit-flex-grow:1;min-height:31px;padding:0 12px;background-color:#fff;border:1px solid #ccc;border-radius:4px;}.bk-root .bk-input:focus{border-color:#66afe9;outline:0;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);}.bk-root .bk-input::placeholder,.bk-root .bk-input:-ms-input-placeholder,.bk-root .bk-input::-moz-placeholder,.bk-root .bk-input::-webkit-input-placeholder{color:#999;opacity:1;}.bk-root .bk-input[disabled]{cursor:not-allowed;background-color:#eee;opacity:1;}.bk-root select:not([multiple]).bk-input,.bk-root select:not([size]).bk-input{height:auto;appearance:none;-webkit-appearance:none;background-image:url(\'data:image/svg+xml;utf8,\');background-position:right 0.5em center;background-size:8px 6px;background-repeat:no-repeat;}.bk-root select[multiple].bk-input,.bk-root select[size].bk-input,.bk-root textarea.bk-input{height:auto;}.bk-root .bk-input-group{width:100%;height:100%;display:inline-flex;display:-webkit-inline-flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;align-items:start;-webkit-align-items:start;flex-direction:column;-webkit-flex-direction:column;white-space:nowrap;}.bk-root .bk-input-group.bk-inline{flex-direction:row;-webkit-flex-direction:row;}.bk-root .bk-input-group.bk-inline > *:not(:first-child){margin-left:5px;}.bk-root .bk-input-group input[type="checkbox"] + span,.bk-root .bk-input-group input[type="radio"] + span{position:relative;top:-2px;margin-left:3px;}.bk-root .bk-input-group > .bk-spin-wrapper{display:inherit;width:inherit;height:inherit;position:relative;overflow:hidden;padding:0;vertical-align:middle;}.bk-root .bk-input-group > .bk-spin-wrapper input{padding-right:20px;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn{position:absolute;display:block;height:50%;min-height:0;min-width:0;width:30px;padding:0;margin:0;right:0;border:none;background:none;cursor:pointer;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn:before{content:"";display:inline-block;transform:translateY(-50%);border-left:5px solid transparent;border-right:5px solid transparent;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-up{top:0;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-up:before{border-bottom:5px solid black;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-up:disabled:before{border-bottom-color:grey;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-down{bottom:0;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-down:before{border-top:5px solid black;}.bk-root .bk-input-group > .bk-spin-wrapper > .bk-spin-btn.bk-spin-btn-down:disabled:before{border-top-color:grey;}'}, +428: function _(t,e,n,i,o){i();const s=t(419),u=t(264);class c extends s.AbstractButtonView{click(){this.model.trigger_event(new u.ButtonClick),super.click()}}n.ButtonView=c,c.__name__="ButtonView";class _ extends s.AbstractButton{constructor(t){super(t)}static init_Button(){this.prototype.default_view=c,this.override({label:"Button"})}}n.Button=_,_.__name__="Button",_.init_Button()}, +429: function _(t,e,o,i,c){i();const n=t(1),s=t(430),a=t(43),u=n.__importStar(t(328));class r extends s.ButtonGroupView{get active(){return new Set(this.model.active)}change_active(t){const{active:e}=this;e.has(t)?e.delete(t):e.add(t),this.model.active=[...e].sort()}_update_active(){const{active:t}=this;this._buttons.forEach(((e,o)=>{a.classes(e).toggle(u.active,t.has(o))}))}}o.CheckboxButtonGroupView=r,r.__name__="CheckboxButtonGroupView";class _ extends s.ButtonGroup{constructor(t){super(t)}static init_CheckboxButtonGroup(){this.prototype.default_view=r,this.define((({Int:t,Array:e})=>({active:[e(t),[]]})))}}o.CheckboxButtonGroup=_,_.__name__="CheckboxButtonGroup",_.init_CheckboxButtonGroup()}, +430: function _(t,e,n,s,i){s();const o=t(1),r=t(420),u=t(20),a=t(43),_=o.__importStar(t(328)),l=_;class c extends r.ControlView{*controls(){yield*this._buttons}connect_signals(){super.connect_signals();const t=this.model.properties;this.on_change(t.button_type,(()=>this.render())),this.on_change(t.labels,(()=>this.render())),this.on_change(t.active,(()=>this._update_active()))}styles(){return[...super.styles(),_.default]}render(){super.render(),this._buttons=this.model.labels.map(((t,e)=>{const n=a.div({class:[l.btn,l[`btn_${this.model.button_type}`]],disabled:this.model.disabled},t);return n.addEventListener("click",(()=>this.change_active(e))),n})),this._update_active();const t=a.div({class:l.btn_group},this._buttons);this.el.appendChild(t)}}n.ButtonGroupView=c,c.__name__="ButtonGroupView";class d extends r.Control{constructor(t){super(t)}static init_ButtonGroup(){this.define((({String:t,Array:e})=>({labels:[e(t),[]],button_type:[u.ButtonType,"default"]})))}}n.ButtonGroup=d,d.__name__="ButtonGroup",d.init_ButtonGroup()}, +431: function _(e,t,i,n,s){n();const o=e(1),c=e(432),a=e(43),l=e(9),d=o.__importStar(e(427));class h extends c.InputGroupView{render(){super.render();const e=a.div({class:[d.input_group,this.model.inline?d.inline:null]});this.el.appendChild(e);const{active:t,labels:i}=this.model;this._inputs=[];for(let n=0;nthis.change_active(n))),this._inputs.push(s),this.model.disabled&&(s.disabled=!0),l.includes(t,n)&&(s.checked=!0);const o=a.label({},s,a.span({},i[n]));e.appendChild(o)}}change_active(e){const t=new Set(this.model.active);t.has(e)?t.delete(e):t.add(e),this.model.active=[...t].sort()}}i.CheckboxGroupView=h,h.__name__="CheckboxGroupView";class p extends c.InputGroup{constructor(e){super(e)}static init_CheckboxGroup(){this.prototype.default_view=h,this.define((({Boolean:e,Int:t,String:i,Array:n})=>({active:[n(t),[]],labels:[n(i),[]],inline:[e,!1]})))}}i.CheckboxGroup=p,p.__name__="CheckboxGroup",p.init_CheckboxGroup()}, +432: function _(n,t,e,s,o){s();const r=n(1),u=n(420),c=r.__importDefault(n(427));class _ extends u.ControlView{*controls(){yield*this._inputs}connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.render()))}styles(){return[...super.styles(),c.default]}}e.InputGroupView=_,_.__name__="InputGroupView";class i extends u.Control{constructor(n){super(n)}}e.InputGroup=i,i.__name__="InputGroup"}, +433: function _(e,i,t,n,o){n();const s=e(1),l=e(426),r=e(43),c=e(22),a=s.__importStar(e(427));class d extends l.InputWidgetView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.name.change,(()=>{var e;return this.input_el.name=null!==(e=this.model.name)&&void 0!==e?e:""})),this.connect(this.model.properties.color.change,(()=>this.input_el.value=c.color2hexrgb(this.model.color))),this.connect(this.model.properties.disabled.change,(()=>this.input_el.disabled=this.model.disabled))}render(){super.render(),this.input_el=r.input({type:"color",class:a.input,name:this.model.name,value:this.model.color,disabled:this.model.disabled}),this.input_el.addEventListener("change",(()=>this.change_input())),this.group_el.appendChild(this.input_el)}change_input(){this.model.color=this.input_el.value,super.change_input()}}t.ColorPickerView=d,d.__name__="ColorPickerView";class h extends l.InputWidget{constructor(e){super(e)}static init_ColorPicker(){this.prototype.default_view=d,this.define((({Color:e})=>({color:[e,"#000000"]})))}}t.ColorPicker=h,h.__name__="ColorPicker",h.init_ColorPicker()}, +434: function _(e,t,i,n,s){n();const a=e(1),l=a.__importDefault(e(435)),o=e(426),d=e(43),r=e(20),c=e(8),h=a.__importStar(e(427)),u=a.__importDefault(e(436));function _(e){const t=[];for(const i of e)if(c.isString(i))t.push(i);else{const[e,n]=i;t.push({from:e,to:n})}return t}class p extends o.InputWidgetView{connect_signals(){super.connect_signals();const{value:e,min_date:t,max_date:i,disabled_dates:n,enabled_dates:s,position:a,inline:l}=this.model.properties;this.connect(e.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.setDate(this.model.value)})),this.connect(t.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("minDate",this.model.min_date)})),this.connect(i.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("maxDate",this.model.max_date)})),this.connect(n.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("disable",this.model.disabled_dates)})),this.connect(s.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("enable",this.model.enabled_dates)})),this.connect(a.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("position",this.model.position)})),this.connect(l.change,(()=>{var e;return null===(e=this._picker)||void 0===e?void 0:e.set("inline",this.model.inline)}))}remove(){var e;null===(e=this._picker)||void 0===e||e.destroy(),super.remove()}styles(){return[...super.styles(),u.default]}render(){var e,t;null==this._picker&&(super.render(),this.input_el=d.input({type:"text",class:h.input,disabled:this.model.disabled}),this.group_el.appendChild(this.input_el),this._picker=l.default(this.input_el,{defaultDate:this.model.value,minDate:null!==(e=this.model.min_date)&&void 0!==e?e:void 0,maxDate:null!==(t=this.model.max_date)&&void 0!==t?t:void 0,inline:this.model.inline,position:this.model.position,disable:_(this.model.disabled_dates),enable:_(this.model.enabled_dates),onChange:(e,t,i)=>this._on_change(e,t,i)}))}_on_change(e,t,i){this.model.value=t,this.change_input()}}i.DatePickerView=p,p.__name__="DatePickerView";class m extends o.InputWidget{constructor(e){super(e)}static init_DatePicker(){this.prototype.default_view=p,this.define((({Boolean:e,String:t,Array:i,Tuple:n,Or:s,Nullable:a})=>{const l=i(s(t,n(t,t)));return{value:[t],min_date:[a(t),null],max_date:[a(t),null],disabled_dates:[l,[]],enabled_dates:[l,[]],position:[r.CalendarPosition,"auto"],inline:[e,!1]}}))}}i.DatePicker=m,m.__name__="DatePicker",m.init_DatePicker()}, +435: function _(e,n,t,a,i){ +/* flatpickr v4.6.6, @license MIT */var o,r;o=this,r=function(){"use strict"; +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n,t){var a;return void 0===t&&(t=!1),function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout((function(){a=null,t||e.apply(i,o)}),n),t&&!a&&e.apply(i,o)}}var c=function(e){return e instanceof Array?e:[e]};function d(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function s(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){return n(e)?e:e.parentNode?f(e.parentNode,n):void 0}function m(e,n){var t=s("div","numInputWrapper"),a=s("input","numInput "+e),i=s("span","arrowUp"),o=s("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function g(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var p=function(){},h=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},v={D:p,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:p,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:p,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},D={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},w={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[w.w(e,n,t)]},F:function(e,n,t){return h(w.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(w.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return h(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map((function(n,a,o){return w[n]&&"\\"!==o[a-1]?w[n](e,i,t):"\\"!==n?n:""})).join(""):t.formatDate(e,n,i)}},C=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,d=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var s=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else if(t&&t.parseDate)l=t.parseDate(e,s);else{l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var f=void 0,m=[],g=0,p=0,h="";gl&&(u=a===w.hourElement?u-l-r(!w.amPM):i,m&&H(void 0,1,w.hourElement)),w.amPM&&f&&(1===c?u+d===23:Math.abs(u-d)>c)&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]),a.value=o(u)}}(e);var c=w._input.value;I(),be(),w._input.value!==c&&w._debouncedChange()}function I(){if(void 0!==w.hourElement&&void 0!==w.minuteElement){var e,n,t=(parseInt(w.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(w.minuteElement.value,10)||0)%60,i=void 0!==w.secondElement?(parseInt(w.secondElement.value,10)||0)%60:0;void 0!==w.amPM&&(e=t,n=w.amPM.textContent,t=e%12+12*r(n===w.l10n.amPM[1]));var o=void 0!==w.config.minTime||w.config.minDate&&w.minDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.minDate,!0);if(void 0!==w.config.maxTime||w.config.maxDate&&w.maxDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.maxDate,!0)){var l=void 0!==w.config.maxTime?w.config.maxTime:w.config.maxDate;(t=Math.min(t,l.getHours()))===l.getHours()&&(a=Math.min(a,l.getMinutes())),a===l.getMinutes()&&(i=Math.min(i,l.getSeconds()))}if(o){var c=void 0!==w.config.minTime?w.config.minTime:w.config.minDate;(t=Math.max(t,c.getHours()))===c.getHours()&&(a=Math.max(a,c.getMinutes())),a===c.getMinutes()&&(i=Math.max(i,c.getSeconds()))}O(t,a,i)}}function S(e){var n=e||w.latestSelectedDateObj;n&&O(n.getHours(),n.getMinutes(),n.getSeconds())}function _(){var e=w.config.defaultHour,n=w.config.defaultMinute,t=w.config.defaultSeconds;if(void 0!==w.config.minDate){var a=w.config.minDate.getHours(),i=w.config.minDate.getMinutes();(e=Math.max(e,a))===a&&(n=Math.max(i,n)),e===a&&n===i&&(t=w.config.minDate.getSeconds())}if(void 0!==w.config.maxDate){var o=w.config.maxDate.getHours(),r=w.config.maxDate.getMinutes();(e=Math.min(e,o))===o&&(n=Math.min(r,n)),e===o&&n===r&&(t=w.config.maxDate.getSeconds())}return{hours:e,minutes:n,seconds:t}}function O(e,n,t){void 0!==w.latestSelectedDateObj&&w.latestSelectedDateObj.setHours(e%24,n,t||0,0),w.hourElement&&w.minuteElement&&!w.isMobile&&(w.hourElement.value=o(w.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),w.minuteElement.value=o(n),void 0!==w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(e>=12)]),void 0!==w.secondElement&&(w.secondElement.value=o(t)))}function F(e){var n=g(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&Q(t)}function N(e,n,t,a){return n instanceof Array?n.forEach((function(n){return N(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return N(e,n,t,a)})):(e.addEventListener(n,t,a),void w._handlers.push({element:e,event:n,handler:t,options:a}))}function A(){pe("onChange")}function P(e,n){var t=void 0!==e?w.parseDate(e):w.latestSelectedDateObj||(w.config.minDate&&w.config.minDate>w.now?w.config.minDate:w.config.maxDate&&w.config.maxDate=0&&M(e,w.selectedDates[1])<=0}(n)&&!ve(n)&&o.classList.add("inRange"),w.weekNumbers&&1===w.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&w.weekNumbers.insertAdjacentHTML("beforeend",""+w.config.getWeek(n)+""),pe("onDayCreate",o),o}function L(e){e.focus(),"range"===w.config.mode&&ae(e)}function W(e){for(var n=e>0?0:w.config.showMonths-1,t=e>0?w.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=w.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&X(c.dateObj))return c}}function R(e,n){var t=ee(document.activeElement||document.body),a=void 0!==e?e:t?document.activeElement:void 0!==w.selectedDateElem&&ee(w.selectedDateElem)?w.selectedDateElem:void 0!==w.todayDateElem&&ee(w.todayDateElem)?w.todayDateElem:W(n>0?1:-1);void 0===a?w._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():w.currentMonth,a=n>0?w.config.showMonths:-1,i=n>0?1:-1,o=t-w.currentMonth;o!=a;o+=i)for(var r=w.daysContainer.children[o],l=t-w.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,d=l;d>=0&&d0?c:-1);d+=i){var s=r.children[d];if(-1===s.className.indexOf("hidden")&&X(s.dateObj)&&Math.abs(e.$i-d)>=Math.abs(n))return L(s)}w.changeMonth(i),R(W(i),0)}(a,n):L(a)}function B(e,n){for(var t=(new Date(e,n,1).getDay()-w.l10n.firstDayOfWeek+7)%7,a=w.utils.getDaysInMonth((n-1+12)%12,e),i=w.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=w.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",d=a+1-t,u=0;d<=a;d++,u++)o.appendChild(j(l,new Date(e,n-1,d),d,u));for(d=1;d<=i;d++,u++)o.appendChild(j("",new Date(e,n,d),d,u));for(var f=i+1;f<=42-t&&(1===w.config.showMonths||u%7!=0);f++,u++)o.appendChild(j(c,new Date(e,n+1,f%i),f,u));var m=s("div","dayContainer");return m.appendChild(o),m}function J(){if(void 0!==w.daysContainer){u(w.daysContainer),w.weekNumbers&&u(w.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==w.config.monthSelectorType)){var e=function(e){return!(void 0!==w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&ew.config.maxDate.getMonth())};w.monthsDropdownContainer.tabIndex=-1,w.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=s("option","flatpickr-monthDropdown-month");t.value=new Date(w.currentYear,n).getMonth().toString(),t.textContent=h(n,w.config.shorthandCurrentMonth,w.l10n),t.tabIndex=-1,w.currentMonth===n&&(t.selected=!0),w.monthsDropdownContainer.appendChild(t)}}}function U(){var e,n=s("div","flatpickr-month"),t=window.document.createDocumentFragment();w.config.showMonths>1||"static"===w.config.monthSelectorType?e=s("span","cur-month"):(w.monthsDropdownContainer=s("select","flatpickr-monthDropdown-months"),w.monthsDropdownContainer.setAttribute("aria-label",w.l10n.monthAriaLabel),N(w.monthsDropdownContainer,"change",(function(e){var n=g(e),t=parseInt(n.value,10);w.changeMonth(t-w.currentMonth),pe("onMonthChange")})),K(),e=w.monthsDropdownContainer);var a=m("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",w.l10n.yearAriaLabel),w.config.minDate&&i.setAttribute("min",w.config.minDate.getFullYear().toString()),w.config.maxDate&&(i.setAttribute("max",w.config.maxDate.getFullYear().toString()),i.disabled=!!w.config.minDate&&w.config.minDate.getFullYear()===w.config.maxDate.getFullYear());var o=s("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function q(){u(w.monthNav),w.monthNav.appendChild(w.prevMonthNav),w.config.showMonths&&(w.yearElements=[],w.monthElements=[]);for(var e=w.config.showMonths;e--;){var n=U();w.yearElements.push(n.yearElement),w.monthElements.push(n.monthElement),w.monthNav.appendChild(n.container)}w.monthNav.appendChild(w.nextMonthNav)}function $(){w.weekdayContainer?u(w.weekdayContainer):w.weekdayContainer=s("div","flatpickr-weekdays");for(var e=w.config.showMonths;e--;){var n=s("div","flatpickr-weekdaycontainer");w.weekdayContainer.appendChild(n)}return z(),w.weekdayContainer}function z(){if(w.weekdayContainer){var e=w.l10n.firstDayOfWeek,t=n(w.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function G(e,n){void 0===n&&(n=!0);var t=n?e:e-w.currentMonth;t<0&&!0===w._hidePrevMonthArrow||t>0&&!0===w._hideNextMonthArrow||(w.currentMonth+=t,(w.currentMonth<0||w.currentMonth>11)&&(w.currentYear+=w.currentMonth>11?1:-1,w.currentMonth=(w.currentMonth+12)%12,pe("onYearChange"),K()),J(),pe("onMonthChange"),De())}function V(e){return!(!w.config.appendTo||!w.config.appendTo.contains(e))||w.calendarContainer.contains(e)}function Z(e){if(w.isOpen&&!w.config.inline){var n=g(e),t=V(n),a=n===w.input||n===w.altInput||w.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(w.input)||~e.path.indexOf(w.altInput)),i="blur"===e.type?a&&e.relatedTarget&&!V(e.relatedTarget):!a&&!t&&!V(e.relatedTarget),o=!w.config.ignoredFocusElements.some((function(e){return e.contains(n)}));i&&o&&(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement&&""!==w.input.value&&void 0!==w.input.value&&T(),w.close(),w.config&&"range"===w.config.mode&&1===w.selectedDates.length&&(w.clear(!1),w.redraw()))}}function Q(e){if(!(!e||w.config.minDate&&ew.config.maxDate.getFullYear())){var n=e,t=w.currentYear!==n;w.currentYear=n||w.currentYear,w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth=Math.min(w.config.maxDate.getMonth(),w.currentMonth):w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&(w.currentMonth=Math.max(w.config.minDate.getMonth(),w.currentMonth)),t&&(w.redraw(),pe("onYearChange"),K())}}function X(e,n){void 0===n&&(n=!0);var t=w.parseDate(e,void 0,n);if(w.config.minDate&&t&&M(t,w.config.minDate,void 0!==n?n:!w.minDateHasTime)<0||w.config.maxDate&&t&&M(t,w.config.maxDate,void 0!==n?n:!w.maxDateHasTime)>0)return!1;if(0===w.config.enable.length&&0===w.config.disable.length)return!0;if(void 0===t)return!1;for(var a=w.config.enable.length>0,i=a?w.config.enable:w.config.disable,o=0,r=void 0;o=r.from.getTime()&&t.getTime()<=r.to.getTime())return a}return!a}function ee(e){return void 0!==w.daysContainer&&-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&w.daysContainer.contains(e)}function ne(e){e.target!==w._input||e.relatedTarget&&V(e.relatedTarget)||w.setDate(w._input.value,!0,e.target===w.altInput?w.config.altFormat:w.config.dateFormat)}function te(e){var n=g(e),t=w.config.wrap?p.contains(n):n===w._input,a=w.config.allowInput,i=w.isOpen&&(!a||!t),o=w.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return w.setDate(w._input.value,!0,n===w.altInput?w.config.altFormat:w.config.dateFormat),n.blur();w.open()}else if(V(n)||i||o){var r=!!w.timeContainer&&w.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),T(),se()):ue(e);break;case 27:e.preventDefault(),se();break;case 8:case 46:t&&!w.config.allowInput&&(e.preventDefault(),w.clear());break;case 37:case 39:if(r||t)w.hourElement&&w.hourElement.focus();else if(e.preventDefault(),void 0!==w.daysContainer&&(!1===a||document.activeElement&&ee(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),G(l),R(W(1),0)):R(void 0,l)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;w.daysContainer&&void 0!==n.$i||n===w.input||n===w.altInput?e.ctrlKey?(e.stopPropagation(),Q(w.currentYear-c),R(W(1),0)):r||R(void 0,7*c):n===w.currentYearElement?Q(w.currentYear-c):w.config.enableTime&&(!r&&w.hourElement&&w.hourElement.focus(),T(e),w._debouncedChange());break;case 9:if(r){var d=[w.hourElement,w.minuteElement,w.secondElement,w.amPM].concat(w.pluginElements).filter((function(e){return e})),s=d.indexOf(n);if(-1!==s){var u=d[s+(e.shiftKey?-1:1)];e.preventDefault(),(u||w._input).focus()}}else!w.config.noCalendar&&w.daysContainer&&w.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),w._input.focus())}}if(void 0!==w.amPM&&n===w.amPM)switch(e.key){case w.l10n.amPM[0].charAt(0):case w.l10n.amPM[0].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[0],I(),be();break;case w.l10n.amPM[1].charAt(0):case w.l10n.amPM[1].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[1],I(),be()}(t||V(n))&&pe("onKeyDown",e)}function ae(e){if(1===w.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():w.days.firstElementChild.dateObj.getTime(),t=w.parseDate(w.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,w.selectedDates[0].getTime()),i=Math.max(n,w.selectedDates[0].getTime()),o=!1,r=0,l=0,c=a;ca&&cr)?r=c:c>t&&(!l||c0&&m0&&m>l;return g?(f.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){f.classList.remove(e)})),"continue"):o&&!g?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){f.classList.remove(e)})),void(void 0!==e&&(e.classList.add(n<=w.selectedDates[0].getTime()?"startRange":"endRange"),tn&&m===t&&f.classList.add("endRange"),m>=r&&(0===l||m<=l)&&(d=t,u=n,(c=m)>Math.min(d,u)&&c0||t.getMinutes()>0||t.getSeconds()>0),w.selectedDates&&(w.selectedDates=w.selectedDates.filter((function(e){return X(e)})),w.selectedDates.length||"min"!==e||S(t),be()),w.daysContainer&&(de(),void 0!==t?w.currentYearElement[e]=t.getFullYear().toString():w.currentYearElement.removeAttribute(e),w.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function re(){return w.config.wrap?p.querySelector("[data-input]"):p}function le(){"object"!=typeof w.config.locale&&void 0===k.l10ns[w.config.locale]&&w.config.errorHandler(new Error("flatpickr: invalid locale "+w.config.locale)),w.l10n=e(e({},k.l10ns.default),"object"==typeof w.config.locale?w.config.locale:"default"!==w.config.locale?k.l10ns[w.config.locale]:void 0),D.K="("+w.l10n.amPM[0]+"|"+w.l10n.amPM[1]+"|"+w.l10n.amPM[0].toLowerCase()+"|"+w.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},v),JSON.parse(JSON.stringify(p.dataset||{}))).time_24hr&&void 0===k.defaultConfig.time_24hr&&(w.config.time_24hr=w.l10n.time_24hr),w.formatDate=b(w),w.parseDate=C({config:w.config,l10n:w.l10n})}function ce(e){if(void 0!==w.calendarContainer){pe("onPreCalendarPosition");var n=e||w._positionElement,t=Array.prototype.reduce.call(w.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=w.calendarContainer.offsetWidth,i=w.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,s="above"===o||"below"!==o&&ct,u=window.pageYOffset+l.top+(s?-t-2:n.offsetHeight+2);if(d(w.calendarContainer,"arrowTop",!s),d(w.calendarContainer,"arrowBottom",s),!w.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),d(w.calendarContainer,"arrowLeft",!m&&!g),d(w.calendarContainer,"arrowCenter",m),d(w.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(d(w.calendarContainer,"rightMost",h),!w.config.static)if(w.calendarContainer.style.top=u+"px",h)if(v){var D=function(){for(var e=null,n=0;nw.currentMonth+w.config.showMonths-1)&&"range"!==w.config.mode;if(w.selectedDateElem=t,"single"===w.config.mode)w.selectedDates=[a];else if("multiple"===w.config.mode){var o=ve(a);o?w.selectedDates.splice(parseInt(o),1):w.selectedDates.push(a)}else"range"===w.config.mode&&(2===w.selectedDates.length&&w.clear(!1,!1),w.latestSelectedDateObj=a,w.selectedDates.push(a),0!==M(a,w.selectedDates[0],!0)&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(I(),i){var r=w.currentYear!==a.getFullYear();w.currentYear=a.getFullYear(),w.currentMonth=a.getMonth(),r&&(pe("onYearChange"),K()),pe("onMonthChange")}if(De(),J(),be(),i||"range"===w.config.mode||1!==w.config.showMonths?void 0!==w.selectedDateElem&&void 0===w.hourElement&&w.selectedDateElem&&w.selectedDateElem.focus():L(t),void 0!==w.hourElement&&void 0!==w.hourElement&&w.hourElement.focus(),w.config.closeOnSelect){var l="single"===w.config.mode&&!w.config.enableTime,c="range"===w.config.mode&&2===w.selectedDates.length&&!w.config.enableTime;(l||c)&&se()}A()}}w.parseDate=C({config:w.config,l10n:w.l10n}),w._handlers=[],w.pluginElements=[],w.loadedPlugins=[],w._bind=N,w._setHoursFromDate=S,w._positionCalendar=ce,w.changeMonth=G,w.changeYear=Q,w.clear=function(e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!0),w.input.value="",void 0!==w.altInput&&(w.altInput.value=""),void 0!==w.mobileInput&&(w.mobileInput.value=""),w.selectedDates=[],w.latestSelectedDateObj=void 0,!0===n&&(w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth()),!0===w.config.enableTime){var t=_(),a=t.hours,i=t.minutes,o=t.seconds;O(a,i,o)}w.redraw(),e&&pe("onChange")},w.close=function(){w.isOpen=!1,w.isMobile||(void 0!==w.calendarContainer&&w.calendarContainer.classList.remove("open"),void 0!==w._input&&w._input.classList.remove("active")),pe("onClose")},w._createElement=s,w.destroy=function(){void 0!==w.config&&pe("onDestroy");for(var e=w._handlers.length;e--;){var n=w._handlers[e];n.element.removeEventListener(n.event,n.handler,n.options)}if(w._handlers=[],w.mobileInput)w.mobileInput.parentNode&&w.mobileInput.parentNode.removeChild(w.mobileInput),w.mobileInput=void 0;else if(w.calendarContainer&&w.calendarContainer.parentNode)if(w.config.static&&w.calendarContainer.parentNode){var t=w.calendarContainer.parentNode;if(t.lastChild&&t.removeChild(t.lastChild),t.parentNode){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}else w.calendarContainer.parentNode.removeChild(w.calendarContainer);w.altInput&&(w.input.type="text",w.altInput.parentNode&&w.altInput.parentNode.removeChild(w.altInput),delete w.altInput),w.input&&(w.input.type=w.input._type,w.input.classList.remove("flatpickr-input"),w.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete w[e]}catch(e){}}))},w.isEnabled=X,w.jumpToDate=P,w.open=function(e,n){if(void 0===n&&(n=w._positionElement),!0===w.isMobile){if(e){e.preventDefault();var t=g(e);t&&t.blur()}return void 0!==w.mobileInput&&(w.mobileInput.focus(),w.mobileInput.click()),void pe("onOpen")}if(!w._input.disabled&&!w.config.inline){var a=w.isOpen;w.isOpen=!0,a||(w.calendarContainer.classList.add("open"),w._input.classList.add("active"),pe("onOpen"),ce(n)),!0===w.config.enableTime&&!0===w.config.noCalendar&&(!1!==w.config.allowInput||void 0!==e&&w.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return w.hourElement.select()}),50))}},w.redraw=de,w.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(w.config,e),e)void 0!==fe[a]&&fe[a].forEach((function(e){return e()}));else w.config[e]=n,void 0!==fe[e]?fe[e].forEach((function(e){return e()})):t.indexOf(e)>-1&&(w.config[e]=c(n));w.redraw(),be(!0)},w.setDate=function(e,n,t){if(void 0===n&&(n=!1),void 0===t&&(t=w.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return w.clear(n);me(e,t),w.latestSelectedDateObj=w.selectedDates[w.selectedDates.length-1],w.redraw(),P(void 0,n),S(),0===w.selectedDates.length&&w.clear(!1),be(n),n&&pe("onChange")},w.toggle=function(e){if(!0===w.isOpen)return w.close();w.open(e)};var fe={locale:[le,z],showMonths:[q,E,$],minDate:[P],maxDate:[P]};function me(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return w.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[w.parseDate(e,n)];else if("string"==typeof e)switch(w.config.mode){case"single":case"time":t=[w.parseDate(e,n)];break;case"multiple":t=e.split(w.config.conjunction).map((function(e){return w.parseDate(e,n)}));break;case"range":t=e.split(w.l10n.rangeSeparator).map((function(e){return w.parseDate(e,n)}))}else w.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));w.selectedDates=w.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&X(e,!1)})),"range"===w.config.mode&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function ge(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?w.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:w.parseDate(e.from,void 0),to:w.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function pe(e,n){if(void 0!==w.config){var t=w.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a1||"static"===w.config.monthSelectorType?w.monthElements[n].textContent=h(t.getMonth(),w.config.shorthandCurrentMonth,w.l10n)+" ":w.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),w._hidePrevMonthArrow=void 0!==w.config.minDate&&(w.currentYear===w.config.minDate.getFullYear()?w.currentMonth<=w.config.minDate.getMonth():w.currentYearw.config.maxDate.getMonth():w.currentYear>w.config.maxDate.getFullYear()))}function we(e){return w.selectedDates.map((function(n){return w.formatDate(n,e)})).filter((function(e,n,t){return"range"!==w.config.mode||w.config.enableTime||t.indexOf(e)===n})).join("range"!==w.config.mode?w.config.conjunction:w.l10n.rangeSeparator)}function be(e){void 0===e&&(e=!0),void 0!==w.mobileInput&&w.mobileFormatStr&&(w.mobileInput.value=void 0!==w.latestSelectedDateObj?w.formatDate(w.latestSelectedDateObj,w.mobileFormatStr):""),w.input.value=we(w.config.dateFormat),void 0!==w.altInput&&(w.altInput.value=we(w.config.altFormat)),!1!==e&&pe("onValueUpdate")}function Ce(e){var n=g(e),t=w.prevMonthNav.contains(n),a=w.nextMonthNav.contains(n);t||a?G(t?-1:1):w.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?w.changeYear(w.currentYear+1):n.classList.contains("arrowDown")&&w.changeYear(w.currentYear-1)}return function(){w.element=w.input=p,w.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(p.dataset||{}))),v),o={};w.config.parseDate=i.parseDate,w.config.formatDate=i.formatDate,Object.defineProperty(w.config,"enable",{get:function(){return w.config._enable},set:function(e){w.config._enable=ge(e)}}),Object.defineProperty(w.config,"disable",{get:function(){return w.config._disable},set:function(e){w.config._disable=ge(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=k.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var d=k.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):d+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(w.config,"minDate",{get:function(){return w.config._minDate},set:oe("min")}),Object.defineProperty(w.config,"maxDate",{get:function(){return w.config._maxDate},set:oe("max")});var s=function(e){return function(n){w.config["min"===e?"_minTime":"_maxTime"]=w.parseDate(n,"H:i:S")}};Object.defineProperty(w.config,"minTime",{get:function(){return w.config._minTime},set:s("min")}),Object.defineProperty(w.config,"maxTime",{get:function(){return w.config._maxTime},set:s("max")}),"time"===i.mode&&(w.config.noCalendar=!0,w.config.enableTime=!0),Object.assign(w.config,o,i);for(var u=0;u-1?w.config[m]=c(f[m]).map(x).concat(w.config[m]):void 0===i[m]&&(w.config[m]=f[m])}i.altInputClass||(w.config.altInputClass=re().className+" "+w.config.altInputClass),pe("onParseConfig")}(),le(),w.input=re(),w.input?(w.input._type=w.input.type,w.input.type="text",w.input.classList.add("flatpickr-input"),w._input=w.input,w.config.altInput&&(w.altInput=s(w.input.nodeName,w.config.altInputClass),w._input=w.altInput,w.altInput.placeholder=w.input.placeholder,w.altInput.disabled=w.input.disabled,w.altInput.required=w.input.required,w.altInput.tabIndex=w.input.tabIndex,w.altInput.type="text",w.input.setAttribute("type","hidden"),!w.config.static&&w.input.parentNode&&w.input.parentNode.insertBefore(w.altInput,w.input.nextSibling)),w.config.allowInput||w._input.setAttribute("readonly","readonly"),w._positionElement=w.config.positionElement||w._input):w.config.errorHandler(new Error("Invalid input element specified")),function(){w.selectedDates=[],w.now=w.parseDate(w.config.now)||new Date;var e=w.config.defaultDate||("INPUT"!==w.input.nodeName&&"TEXTAREA"!==w.input.nodeName||!w.input.placeholder||w.input.value!==w.input.placeholder?w.input.value:null);e&&me(e,w.config.dateFormat),w._initialDate=w.selectedDates.length>0?w.selectedDates[0]:w.config.minDate&&w.config.minDate.getTime()>w.now.getTime()?w.config.minDate:w.config.maxDate&&w.config.maxDate.getTime()0&&(w.latestSelectedDateObj=w.selectedDates[0]),void 0!==w.config.minTime&&(w.config.minTime=w.parseDate(w.config.minTime,"H:i")),void 0!==w.config.maxTime&&(w.config.maxTime=w.parseDate(w.config.maxTime,"H:i")),w.minDateHasTime=!!w.config.minDate&&(w.config.minDate.getHours()>0||w.config.minDate.getMinutes()>0||w.config.minDate.getSeconds()>0),w.maxDateHasTime=!!w.config.maxDate&&(w.config.maxDate.getHours()>0||w.config.maxDate.getMinutes()>0||w.config.maxDate.getSeconds()>0)}(),w.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=w.currentMonth),void 0===n&&(n=w.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:w.l10n.daysInMonth[e]}},w.isMobile||function(){var e=window.document.createDocumentFragment();if(w.calendarContainer=s("div","flatpickr-calendar"),w.calendarContainer.tabIndex=-1,!w.config.noCalendar){if(e.appendChild((w.monthNav=s("div","flatpickr-months"),w.yearElements=[],w.monthElements=[],w.prevMonthNav=s("span","flatpickr-prev-month"),w.prevMonthNav.innerHTML=w.config.prevArrow,w.nextMonthNav=s("span","flatpickr-next-month"),w.nextMonthNav.innerHTML=w.config.nextArrow,q(),Object.defineProperty(w,"_hidePrevMonthArrow",{get:function(){return w.__hidePrevMonthArrow},set:function(e){w.__hidePrevMonthArrow!==e&&(d(w.prevMonthNav,"flatpickr-disabled",e),w.__hidePrevMonthArrow=e)}}),Object.defineProperty(w,"_hideNextMonthArrow",{get:function(){return w.__hideNextMonthArrow},set:function(e){w.__hideNextMonthArrow!==e&&(d(w.nextMonthNav,"flatpickr-disabled",e),w.__hideNextMonthArrow=e)}}),w.currentYearElement=w.yearElements[0],De(),w.monthNav)),w.innerContainer=s("div","flatpickr-innerContainer"),w.config.weekNumbers){var n=function(){w.calendarContainer.classList.add("hasWeeks");var e=s("div","flatpickr-weekwrapper");e.appendChild(s("span","flatpickr-weekday",w.l10n.weekAbbreviation));var n=s("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;w.innerContainer.appendChild(t),w.weekNumbers=a,w.weekWrapper=t}w.rContainer=s("div","flatpickr-rContainer"),w.rContainer.appendChild($()),w.daysContainer||(w.daysContainer=s("div","flatpickr-days"),w.daysContainer.tabIndex=-1),J(),w.rContainer.appendChild(w.daysContainer),w.innerContainer.appendChild(w.rContainer),e.appendChild(w.innerContainer)}w.config.enableTime&&e.appendChild(function(){w.calendarContainer.classList.add("hasTime"),w.config.noCalendar&&w.calendarContainer.classList.add("noCalendar"),w.timeContainer=s("div","flatpickr-time"),w.timeContainer.tabIndex=-1;var e=s("span","flatpickr-time-separator",":"),n=m("flatpickr-hour",{"aria-label":w.l10n.hourAriaLabel});w.hourElement=n.getElementsByTagName("input")[0];var t=m("flatpickr-minute",{"aria-label":w.l10n.minuteAriaLabel});if(w.minuteElement=t.getElementsByTagName("input")[0],w.hourElement.tabIndex=w.minuteElement.tabIndex=-1,w.hourElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getHours():w.config.time_24hr?w.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(w.config.defaultHour)),w.minuteElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getMinutes():w.config.defaultMinute),w.hourElement.setAttribute("step",w.config.hourIncrement.toString()),w.minuteElement.setAttribute("step",w.config.minuteIncrement.toString()),w.hourElement.setAttribute("min",w.config.time_24hr?"0":"1"),w.hourElement.setAttribute("max",w.config.time_24hr?"23":"12"),w.minuteElement.setAttribute("min","0"),w.minuteElement.setAttribute("max","59"),w.timeContainer.appendChild(n),w.timeContainer.appendChild(e),w.timeContainer.appendChild(t),w.config.time_24hr&&w.timeContainer.classList.add("time24hr"),w.config.enableSeconds){w.timeContainer.classList.add("hasSeconds");var a=m("flatpickr-second");w.secondElement=a.getElementsByTagName("input")[0],w.secondElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getSeconds():w.config.defaultSeconds),w.secondElement.setAttribute("step",w.minuteElement.getAttribute("step")),w.secondElement.setAttribute("min","0"),w.secondElement.setAttribute("max","59"),w.timeContainer.appendChild(s("span","flatpickr-time-separator",":")),w.timeContainer.appendChild(a)}return w.config.time_24hr||(w.amPM=s("span","flatpickr-am-pm",w.l10n.amPM[r((w.latestSelectedDateObj?w.hourElement.value:w.config.defaultHour)>11)]),w.amPM.title=w.l10n.toggleTitle,w.amPM.tabIndex=-1,w.timeContainer.appendChild(w.amPM)),w.timeContainer}()),d(w.calendarContainer,"rangeMode","range"===w.config.mode),d(w.calendarContainer,"animate",!0===w.config.animate),d(w.calendarContainer,"multiMonth",w.config.showMonths>1),w.calendarContainer.appendChild(e);var i=void 0!==w.config.appendTo&&void 0!==w.config.appendTo.nodeType;if((w.config.inline||w.config.static)&&(w.calendarContainer.classList.add(w.config.inline?"inline":"static"),w.config.inline&&(!i&&w.element.parentNode?w.element.parentNode.insertBefore(w.calendarContainer,w._input.nextSibling):void 0!==w.config.appendTo&&w.config.appendTo.appendChild(w.calendarContainer)),w.config.static)){var l=s("div","flatpickr-wrapper");w.element.parentNode&&w.element.parentNode.insertBefore(l,w.element),l.appendChild(w.element),w.altInput&&l.appendChild(w.altInput),l.appendChild(w.calendarContainer)}w.config.static||w.config.inline||(void 0!==w.config.appendTo?w.config.appendTo:window.document.body).appendChild(w.calendarContainer)}(),function(){if(w.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(w.element.querySelectorAll("[data-"+e+"]"),(function(n){return N(n,"click",w[e])}))})),w.isMobile)!function(){var e=w.config.enableTime?w.config.noCalendar?"time":"datetime-local":"date";w.mobileInput=s("input",w.input.className+" flatpickr-mobile"),w.mobileInput.tabIndex=1,w.mobileInput.type=e,w.mobileInput.disabled=w.input.disabled,w.mobileInput.required=w.input.required,w.mobileInput.placeholder=w.input.placeholder,w.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",w.selectedDates.length>0&&(w.mobileInput.defaultValue=w.mobileInput.value=w.formatDate(w.selectedDates[0],w.mobileFormatStr)),w.config.minDate&&(w.mobileInput.min=w.formatDate(w.config.minDate,"Y-m-d")),w.config.maxDate&&(w.mobileInput.max=w.formatDate(w.config.maxDate,"Y-m-d")),w.input.getAttribute("step")&&(w.mobileInput.step=String(w.input.getAttribute("step"))),w.input.type="hidden",void 0!==w.altInput&&(w.altInput.type="hidden");try{w.input.parentNode&&w.input.parentNode.insertBefore(w.mobileInput,w.input.nextSibling)}catch(e){}N(w.mobileInput,"change",(function(e){w.setDate(g(e).value,!1,w.mobileFormatStr),pe("onChange"),pe("onClose")}))}();else{var e=l(ie,50);if(w._debouncedChange=l(A,300),w.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&N(w.daysContainer,"mouseover",(function(e){"range"===w.config.mode&&ae(g(e))})),N(window.document.body,"keydown",te),w.config.inline||w.config.static||N(window,"resize",e),void 0!==window.ontouchstart?N(window.document,"touchstart",Z):N(window.document,"click",Z),N(window.document,"focus",Z,{capture:!0}),!0===w.config.clickOpens&&(N(w._input,"focus",w.open),N(w._input,"click",w.open)),void 0!==w.daysContainer&&(N(w.monthNav,"click",Ce),N(w.monthNav,["keyup","increment"],F),N(w.daysContainer,"click",ue)),void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement){var n=function(e){return g(e).select()};N(w.timeContainer,["increment"],T),N(w.timeContainer,"blur",T,{capture:!0}),N(w.timeContainer,"click",Y),N([w.hourElement,w.minuteElement],["focus","click"],n),void 0!==w.secondElement&&N(w.secondElement,"focus",(function(){return w.secondElement&&w.secondElement.select()})),void 0!==w.amPM&&N(w.amPM,"click",(function(e){T(e),A()}))}w.config.allowInput&&N(w._input,"blur",ne)}}(),(w.selectedDates.length||w.config.noCalendar)&&(w.config.enableTime&&S(w.config.noCalendar?w.latestSelectedDateObj||w.config.minDate:void 0),be(!1)),E();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!w.isMobile&&n&&ce(),pe("onReady")}(),w}function E(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;ithis.render()));const{start:s,end:l,value:r,step:o,title:n}=this.model.properties;this.on_change([s,l,r,o],(()=>{const{start:t,end:e,value:i,step:s}=this._calc_to();this.noUiSlider.updateOptions({range:{min:t,max:e},start:i,step:s})}));const{bar_color:a}=this.model.properties;this.on_change(a,(()=>{this._set_bar_color()}));const{show_value:d}=this.model.properties;this.on_change([r,n,d],(()=>this._update_title()))}styles(){return[...super.styles(),u.default,c.default]}_update_title(){var t;n.empty(this.title_el);const e=null==this.model.title||0==this.model.title.length&&!this.model.show_value;if(this.title_el.style.display=e?"none":"",!e&&(0!=(null===(t=this.model.title)||void 0===t?void 0:t.length)&&(this.title_el.textContent=`${this.model.title}: `),this.model.show_value)){const{value:t}=this._calc_to(),e=t.map((t=>this.model.pretty(t))).join(" .. ");this.title_el.appendChild(n.span({class:m.slider_value},e))}}_set_bar_color(){if(!this.model.disabled){this.slider_el.querySelector(".noUi-connect").style.backgroundColor=d.color2css(this.model.bar_color)}}render(){super.render();const{start:t,end:e,value:i,step:s}=this._calc_to();let l;if(this.model.tooltips){const t={to:t=>this.model.pretty(t)};l=a.repeat(t,i.length)}else l=!1;if(null==this.slider_el){this.slider_el=n.div(),o.create(this.slider_el,{range:{min:t,max:e},start:i,step:s,behaviour:this.model.behaviour,connect:this.model.connected,tooltips:l,orientation:this.model.orientation,direction:this.model.direction}),this.noUiSlider.on("slide",((t,e,i)=>this._slide(i))),this.noUiSlider.on("change",((t,e,i)=>this._change(i)));const r=(t,e)=>{if(!l)return;this.slider_el.querySelectorAll(".noUi-handle")[t].querySelector(".noUi-tooltip").style.display=e?"block":""};this.noUiSlider.on("start",((t,e)=>r(e,!0))),this.noUiSlider.on("end",((t,e)=>r(e,!1)))}else this.noUiSlider.updateOptions({range:{min:t,max:e},start:i,step:s});this._set_bar_color(),this.model.disabled?this.slider_el.setAttribute("disabled","true"):this.slider_el.removeAttribute("disabled"),this.title_el=n.div({class:m.slider_title}),this._update_title(),this.group_el=n.div({class:p.input_group},this.title_el,this.slider_el),this.el.appendChild(this.group_el)}_slide(t){this.model.value=this._calc_from(t)}_change(t){const e=this._calc_from(t);this.model.setv({value:e,value_throttled:e})}}b.__name__="AbstractBaseSliderView";class v extends b{_calc_to(){return{start:this.model.start,end:this.model.end,value:[this.model.value],step:this.model.step}}_calc_from([t]){return Number.isInteger(this.model.start)&&Number.isInteger(this.model.end)&&Number.isInteger(this.model.step)?Math.round(t):t}}i.AbstractSliderView=v,v.__name__="AbstractSliderView";class g extends b{_calc_to(){return{start:this.model.start,end:this.model.end,value:this.model.value,step:this.model.step}}_calc_from(t){return t}}i.AbstractRangeSliderView=g,g.__name__="AbstractRangeSliderView";class S extends _.Control{constructor(t){super(t),this.connected=!1}static init_AbstractSlider(){this.define((({Any:t,Boolean:e,Number:i,String:s,Color:l,Or:r,Enum:o,Ref:n,Nullable:a})=>({title:[a(s),""],show_value:[e,!0],start:[t],end:[t],value:[t],value_throttled:[t],step:[i,1],format:[r(s,n(h.TickFormatter))],direction:[o("ltr","rtl"),"ltr"],tooltips:[e,!0],bar_color:[l,"#e6e6e6"]})))}pretty(t){return this._formatter(t,this.format)}}i.AbstractSlider=S,S.__name__="AbstractSlider",S.init_AbstractSlider()}, +439: function _(t,e,r,n,i){ +/*! nouislider - 14.6.3 - 11/19/2020 */ +var o;o=function(){"use strict";var t="14.6.3";function e(t){t.parentElement.removeChild(t)}function r(t){return null!=t}function n(t){t.preventDefault()}function i(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function o(t,e,r){r>0&&(u(t,e),setTimeout((function(){c(t,e)}),r))}function s(t){return Math.max(Math.min(t,100),0)}function a(t){return Array.isArray(t)?t:[t]}function l(t){var e=(t=String(t)).split(".");return e.length>1?e[1].length:0}function u(t,e){t.classList&&!/\s/.test(e)?t.classList.add(e):t.className+=" "+e}function c(t,e){t.classList&&!/\s/.test(e)?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function p(t){var e=void 0!==window.pageXOffset,r="CSS1Compat"===(t.compatMode||"");return{x:e?window.pageXOffset:r?t.documentElement.scrollLeft:t.body.scrollLeft,y:e?window.pageYOffset:r?t.documentElement.scrollTop:t.body.scrollTop}}function f(t,e){return 100/(e-t)}function d(t,e,r){return 100*e/(t[r+1]-t[r])}function h(t,e){for(var r=1;t>=e[r];)r+=1;return r}function m(t,e,r){if(r>=t.slice(-1)[0])return 100;var n=h(r,t),i=t[n-1],o=t[n],s=e[n-1],a=e[n];return s+function(t,e){return d(t,t[0]<0?e+Math.abs(t[0]):e-t[0],0)}([i,o],r)/f(s,a)}function g(t,e,r,n){if(100===n)return n;var i=h(n,t),o=t[i-1],s=t[i];return r?n-o>(s-o)/2?s:o:e[i-1]?t[i-1]+function(t,e){return Math.round(t/e)*e}(n-t[i-1],e[i-1]):n}function v(t,e,r){var n;if("number"==typeof e&&(e=[e]),!Array.isArray(e))throw new Error("noUiSlider (14.6.3): 'range' contains invalid value.");if(!i(n="min"===t?0:"max"===t?100:parseFloat(t))||!i(e[0]))throw new Error("noUiSlider (14.6.3): 'range' value isn't numeric.");r.xPct.push(n),r.xVal.push(e[0]),n?r.xSteps.push(!isNaN(e[1])&&e[1]):isNaN(e[1])||(r.xSteps[0]=e[1]),r.xHighestCompleteStep.push(0)}function b(t,e,r){if(e)if(r.xVal[t]!==r.xVal[t+1]){r.xSteps[t]=d([r.xVal[t],r.xVal[t+1]],e,0)/f(r.xPct[t],r.xPct[t+1]);var n=(r.xVal[t+1]-r.xVal[t])/r.xNumSteps[t],i=Math.ceil(Number(n.toFixed(3))-1),o=r.xVal[t]+r.xNumSteps[t]*i;r.xHighestCompleteStep[t]=o}else r.xSteps[t]=r.xHighestCompleteStep[t]=r.xVal[t]}function x(t,e,r){var n;this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=e;var i=[];for(n in t)t.hasOwnProperty(n)&&i.push([t[n],n]);for(i.length&&"object"==typeof i[0][0]?i.sort((function(t,e){return t[0][0]-e[0][0]})):i.sort((function(t,e){return t[0]-e[0]})),n=0;nthis.xPct[i+1];)i++;else t===this.xPct[this.xPct.length-1]&&(i=this.xPct.length-2);r||t!==this.xPct[i+1]||i++;var o=1,s=e[i],a=0,l=0,u=0,c=0;for(n=r?(t-this.xPct[i])/(this.xPct[i+1]-this.xPct[i]):(this.xPct[i+1]-t)/(this.xPct[i+1]-this.xPct[i]);s>0;)a=this.xPct[i+1+c]-this.xPct[i+c],e[i+c]*o+100-100*n>100?(l=a*n,o=(s-100*n)/e[i+c],n=1):(l=e[i+c]*a/100*o,o=0),r?(u-=l,this.xPct.length+c>=1&&c--):(u+=l,this.xPct.length-c>=1&&c++),s=e[i+c]*o;return t+u},x.prototype.toStepping=function(t){return t=m(this.xVal,this.xPct,t)},x.prototype.fromStepping=function(t){return function(t,e,r){if(r>=100)return t.slice(-1)[0];var n=h(r,e),i=t[n-1],o=t[n],s=e[n-1];return function(t,e){return e*(t[1]-t[0])/100+t[0]}([i,o],(r-s)*f(s,e[n]))}(this.xVal,this.xPct,t)},x.prototype.getStep=function(t){return t=g(this.xPct,this.xSteps,this.snap,t)},x.prototype.getDefaultStep=function(t,e,r){var n=h(t,this.xPct);return(100===t||e&&t===this.xPct[n-1])&&(n=Math.max(n-1,1)),(this.xVal[n]-this.xVal[n-1])/r},x.prototype.getNearbySteps=function(t){var e=h(t,this.xPct);return{stepBefore:{startValue:this.xVal[e-2],step:this.xNumSteps[e-2],highestStep:this.xHighestCompleteStep[e-2]},thisStep:{startValue:this.xVal[e-1],step:this.xNumSteps[e-1],highestStep:this.xHighestCompleteStep[e-1]},stepAfter:{startValue:this.xVal[e],step:this.xNumSteps[e],highestStep:this.xHighestCompleteStep[e]}}},x.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(l);return Math.max.apply(null,t)},x.prototype.convert=function(t){return this.getStep(this.toStepping(t))};var S={to:function(t){return void 0!==t&&t.toFixed(2)},from:Number},w={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"},y=".__tooltips",E=".__aria";function C(t){if(function(t){return"object"==typeof t&&"function"==typeof t.to&&"function"==typeof t.from}(t))return!0;throw new Error("noUiSlider (14.6.3): 'format' requires 'to' and 'from' methods.")}function P(t,e){if(!i(e))throw new Error("noUiSlider (14.6.3): 'step' is not numeric.");t.singleStep=e}function N(t,e){if(!i(e))throw new Error("noUiSlider (14.6.3): 'keyboardPageMultiplier' is not numeric.");t.keyboardPageMultiplier=e}function k(t,e){if(!i(e))throw new Error("noUiSlider (14.6.3): 'keyboardDefaultStep' is not numeric.");t.keyboardDefaultStep=e}function U(t,e){if("object"!=typeof e||Array.isArray(e))throw new Error("noUiSlider (14.6.3): 'range' is not an object.");if(void 0===e.min||void 0===e.max)throw new Error("noUiSlider (14.6.3): Missing 'min' or 'max' in 'range'.");if(e.min===e.max)throw new Error("noUiSlider (14.6.3): 'range' 'min' and 'max' cannot be equal.");t.spectrum=new x(e,t.snap,t.singleStep)}function A(t,e){if(e=a(e),!Array.isArray(e)||!e.length)throw new Error("noUiSlider (14.6.3): 'start' option is incorrect.");t.handles=e.length,t.start=e}function V(t,e){if(t.snap=e,"boolean"!=typeof e)throw new Error("noUiSlider (14.6.3): 'snap' option must be a boolean.")}function D(t,e){if(t.animate=e,"boolean"!=typeof e)throw new Error("noUiSlider (14.6.3): 'animate' option must be a boolean.")}function M(t,e){if(t.animationDuration=e,"number"!=typeof e)throw new Error("noUiSlider (14.6.3): 'animationDuration' option must be a number.")}function O(t,e){var r,n=[!1];if("lower"===e?e=[!0,!1]:"upper"===e&&(e=[!1,!0]),!0===e||!1===e){for(r=1;r1)throw new Error("noUiSlider (14.6.3): 'padding' option must not exceed 100% of the range.")}}function F(t,e){switch(e){case"ltr":t.dir=0;break;case"rtl":t.dir=1;break;default:throw new Error("noUiSlider (14.6.3): 'direction' option was not recognized.")}}function R(t,e){if("string"!=typeof e)throw new Error("noUiSlider (14.6.3): 'behaviour' must be a string containing options.");var r=e.indexOf("tap")>=0,n=e.indexOf("drag")>=0,i=e.indexOf("fixed")>=0,o=e.indexOf("snap")>=0,s=e.indexOf("hover")>=0,a=e.indexOf("unconstrained")>=0;if(i){if(2!==t.handles)throw new Error("noUiSlider (14.6.3): 'fixed' behaviour must be used with 2 handles");z(t,t.start[1]-t.start[0])}if(a&&(t.margin||t.limit))throw new Error("noUiSlider (14.6.3): 'unconstrained' behaviour cannot be used with margin or limit");t.events={tap:r||o,drag:n,fixed:i,snap:o,hover:s,unconstrained:a}}function T(t,e){if(!1!==e)if(!0===e){t.tooltips=[];for(var r=0;r0&&((a=L(i,!1)).className=c(s,r.cssClasses.value),a.setAttribute("data-value",o),a.style[r.style]=t+"%",a.innerHTML=n.to(o))}}(o,t[o][0],t[o][1])})),i}function q(){h&&(e(h),h=null)}function X(t){q();var e=t.mode,r=t.density||1,n=t.filter||!1,i=function(t,e,r){if("range"===t||"steps"===t)return C.xVal;if("count"===t){if(e<2)throw new Error("noUiSlider (14.6.3): 'values' (>= 2) required for mode 'count'.");var n=e-1,i=100/n;for(e=[];n--;)e[n]=n*i;e.push(100),t="positions"}return"positions"===t?e.map((function(t){return C.fromStepping(r?C.getStep(t):t)})):"values"===t?r?e.map((function(t){return C.fromStepping(C.getStep(C.toStepping(t)))})):e:void 0}(e,t.values||!1,t.stepped||!1),o=function(t,e,r){var n,i={},o=C.xVal[0],s=C.xVal[C.xVal.length-1],a=!1,l=!1,u=0;return n=r.slice().sort((function(t,e){return t-e})),(r=n.filter((function(t){return!this[t]&&(this[t]=!0)}),{}))[0]!==o&&(r.unshift(o),a=!0),r[r.length-1]!==s&&(r.push(s),l=!0),r.forEach((function(n,o){var s,c,p,f,d,h,m,g,v,b,x=n,S=r[o+1],w="steps"===e;if(w&&(s=C.xNumSteps[o]),s||(s=S-x),!1!==x)for(void 0===S&&(S=x),s=Math.max(s,1e-7),c=x;c<=S;c=(c+s).toFixed(7)/1){for(g=(d=(f=C.toStepping(c))-u)/t,b=d/(v=Math.round(g)),p=1;p<=v;p+=1)i[(h=u+p*b).toFixed(5)]=[C.fromStepping(h),0];m=r.indexOf(c)>-1?1:w?2:0,!o&&a&&c!==S&&(m=0),c===S&&l||(i[f.toFixed(5)]=[c,m]),u=f}})),i}(r,e,i),s=t.format||{to:Math.round};return h=w.appendChild(B(o,n,s))}function Y(){var t=l.getBoundingClientRect(),e="offset"+["Width","Height"][r.ort];return 0===r.ort?t.width||l[e]:t.height||l[e]}function I(t,e,n,i){var o=function(o){return!!(o=function(t,e,r){var n,i,o=0===t.type.indexOf("touch"),s=0===t.type.indexOf("mouse"),a=0===t.type.indexOf("pointer");if(0===t.type.indexOf("MSPointer")&&(a=!0),"mousedown"===t.type&&!t.buttons&&!t.touches)return!1;if(o){var l=function(t){return t.target===r||r.contains(t.target)||t.target.shadowRoot&&t.target.shadowRoot.contains(r)};if("touchstart"===t.type){var u=Array.prototype.filter.call(t.touches,l);if(u.length>1)return!1;n=u[0].pageX,i=u[0].pageY}else{var c=Array.prototype.find.call(t.changedTouches,l);if(!c)return!1;n=c.pageX,i=c.pageY}}return e=e||p(V),(s||a)&&(n=t.clientX+e.x,i=t.clientY+e.y),t.pageOffset=e,t.points=[n,i],t.cursor=s||a,t}(o,i.pageOffset,i.target||e))&&!(F()&&!i.doNotReject)&&(s=w,a=r.cssClasses.tap,!((s.classList?s.classList.contains(a):new RegExp("\\b"+a+"\\b").test(s.className))&&!i.doNotReject)&&!(t===x.start&&void 0!==o.buttons&&o.buttons>1)&&(!i.hover||!o.buttons)&&(S||o.preventDefault(),o.calcPoint=o.points[r.ort],void n(o,i)));var s,a},s=[];return t.split(" ").forEach((function(t){e.addEventListener(t,o,!!S&&{passive:!0}),s.push([t,o])})),s}function $(t){var e,n,i,o,a,u,c=100*(t-(e=l,n=r.ort,i=e.getBoundingClientRect(),o=e.ownerDocument,a=o.documentElement,u=p(o),/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(u.x=0),n?i.top+u.y-a.clientTop:i.left+u.x-a.clientLeft))/Y();return c=s(c),r.dir?100-c:c}function G(t,e){"mouseout"===t.type&&"HTML"===t.target.nodeName&&null===t.relatedTarget&&K(t,e)}function J(t,e){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===t.buttons&&0!==e.buttonsProperty)return K(t,e);var n=(r.dir?-1:1)*(t.calcPoint-e.startCalcPoint);st(n>0,100*n/e.baseSize,e.locations,e.handleNumbers)}function K(t,e){e.handle&&(c(e.handle,r.cssClasses.active),U-=1),e.listeners.forEach((function(t){D.removeEventListener(t[0],t[1])})),0===U&&(c(w,r.cssClasses.drag),lt(),t.cursor&&(M.style.cursor="",M.removeEventListener("selectstart",n))),e.handleNumbers.forEach((function(t){nt("change",t),nt("set",t),nt("end",t)}))}function Q(t,e){if(e.handleNumbers.some(R))return!1;var i;1===e.handleNumbers.length&&(i=f[e.handleNumbers[0]].children[0],U+=1,u(i,r.cssClasses.active)),t.stopPropagation();var o=[],s=I(x.move,D,J,{target:t.target,handle:i,listeners:o,startCalcPoint:t.calcPoint,baseSize:Y(),pageOffset:t.pageOffset,handleNumbers:e.handleNumbers,buttonsProperty:t.buttons,locations:N.slice()}),a=I(x.end,D,K,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers}),l=I("mouseout",D,G,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers});o.push.apply(o,s.concat(a,l)),t.cursor&&(M.style.cursor=getComputedStyle(t.target).cursor,f.length>1&&u(w,r.cssClasses.drag),M.addEventListener("selectstart",n,!1)),e.handleNumbers.forEach((function(t){nt("start",t)}))}function Z(t){t.stopPropagation();var e=$(t.calcPoint),n=function(t){var e=100,r=!1;return f.forEach((function(n,i){if(!R(i)){var o=N[i],s=Math.abs(o-t);(so||100===s&&100===e)&&(r=i,e=s)}})),r}(e);if(!1===n)return!1;r.events.snap||o(w,r.cssClasses.tap,r.animationDuration),ut(n,e,!0,!0),lt(),nt("slide",n,!0),nt("update",n,!0),nt("change",n,!0),nt("set",n,!0),r.events.snap&&Q(t,{handleNumbers:[n]})}function tt(t){var e=$(t.calcPoint),r=C.getStep(e),n=C.fromStepping(r);Object.keys(A).forEach((function(t){"hover"===t.split(".")[0]&&A[t].forEach((function(t){t.call(g,n)}))}))}function et(t,e){A[t]=A[t]||[],A[t].push(e),"update"===t.split(".")[0]&&f.forEach((function(t,e){nt("update",e)}))}function rt(t){var e=t&&t.split(".")[0],r=e?t.substring(e.length):t;Object.keys(A).forEach((function(t){var n=t.split(".")[0],i=t.substring(n.length);e&&e!==n||r&&r!==i||function(t){return t===E||t===y}(i)&&r!==i||delete A[t]}))}function nt(t,e,n){Object.keys(A).forEach((function(i){var o=i.split(".")[0];t===o&&A[i].forEach((function(t){t.call(g,P.map(r.format.to),e,P.slice(),n||!1,N.slice(),g)}))}))}function it(t,e,n,i,o,a){var l;return f.length>1&&!r.events.unconstrained&&(i&&e>0&&(l=C.getAbsoluteDistance(t[e-1],r.margin,0),n=Math.max(n,l)),o&&e1&&r.limit&&(i&&e>0&&(l=C.getAbsoluteDistance(t[e-1],r.limit,0),n=Math.min(n,l)),o&&e1?n.forEach((function(t,r){var n=it(i,t,i[t]+e,o[r],s[r],!1);!1===n?e=0:(e=n-i[t],i[t]=n)})):o=s=[!0];var a=!1;n.forEach((function(t,n){a=ut(t,r[t]+e,o[n],s[n])||a})),a&&n.forEach((function(t){nt("update",t),nt("slide",t)}))}function at(t,e){return r.dir?100-t-e:t}function lt(){k.forEach((function(t){var e=N[t]>50?-1:1,r=3+(f.length+e*t);f[t].style.zIndex=r}))}function ut(t,e,n,i,o){return o||(e=it(N,t,e,n,i,!1)),!1!==e&&(function(t,e){N[t]=e,P[t]=C.fromStepping(e);var n="translate("+ot(10*(at(e,0)-O)+"%","0")+")";f[t].style[r.transformRule]=n,ct(t),ct(t+1)}(t,e),!0)}function ct(t){if(d[t]){var e=0,n=100;0!==t&&(e=N[t-1]),t!==d.length-1&&(n=N[t]);var i=n-e,o="translate("+ot(at(e,i)+"%","0")+")",s="scale("+ot(i/100,"1")+")";d[t].style[r.transformRule]=o+" "+s}}function pt(t,e){return null===t||!1===t||void 0===t?N[e]:("number"==typeof t&&(t=String(t)),t=r.format.from(t),!1===(t=C.toStepping(t))||isNaN(t)?N[e]:t)}function ft(t,e,n){var i=a(t),s=void 0===N[0];e=void 0===e||!!e,r.animate&&!s&&o(w,r.cssClasses.tap,r.animationDuration),k.forEach((function(t){ut(t,pt(i[t],t),!0,!1,n)}));for(var l=1===k.length?0:1;ln.stepAfter.startValue&&(o=n.stepAfter.startValue-i),s=i>n.thisStep.startValue?n.thisStep.step:!1!==n.stepBefore.step&&i-n.stepBefore.highestStep,100===e?o=null:0===e&&(s=null);var a=C.countStepDecimals();return null!==o&&!1!==o&&(o=Number(o.toFixed(a))),null!==s&&!1!==s&&(s=Number(s.toFixed(a))),[s,o]}return u(v=w,r.cssClasses.target),0===r.dir?u(v,r.cssClasses.ltr):u(v,r.cssClasses.rtl),0===r.ort?u(v,r.cssClasses.horizontal):u(v,r.cssClasses.vertical),u(v,"rtl"===getComputedStyle(v).direction?r.cssClasses.textDirectionRtl:r.cssClasses.textDirectionLtr),l=L(v,r.cssClasses.base),function(t,e){var n=L(e,r.cssClasses.connects);f=[],(d=[]).push(H(n,t[0]));for(var i=0;i=0&&t({render_as_text:[e,!1]})))}}i.Div=a,a.__name__="Div",a.init_Div()}, +444: function _(t,e,s,i,a){i();const n=t(1),l=t(224),r=t(43),c=t(488),u=n.__importStar(t(445));class _ extends c.WidgetView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>{this.layout.invalidate_cache(),this.render(),this.root.compute_layout()}))}styles(){return[...super.styles(),u.default]}_update_layout(){this.layout=new l.CachedVariadicBox(this.el),this.layout.set_sizing(this.box_sizing())}render(){super.render();const t=Object.assign(Object.assign({},this.model.style),{display:"inline-block"});this.markup_el=r.div({class:u.clearfix,style:t}),this.el.appendChild(this.markup_el)}}s.MarkupView=_,_.__name__="MarkupView";class o extends c.Widget{constructor(t){super(t)}static init_Markup(){this.define((({String:t,Dict:e})=>({text:[t,""],style:[e(t),{}]})))}}s.Markup=o,o.__name__="Markup",o.init_Markup()}, +445: function _(o,r,e,t,a){t(),e.root="bk-root",e.clearfix="bk-clearfix",e.default='.bk-root .bk-clearfix:before,.bk-root .bk-clearfix:after{content:"";display:table;}.bk-root .bk-clearfix:after{clear:both;}'}, +446: function _(e,t,i,n,s){n();const o=e(1),r=e(419),l=e(264),d=e(43),_=e(8),u=o.__importStar(e(328)),c=o.__importStar(e(243)),h=c;class p extends r.AbstractButtonView{constructor(){super(...arguments),this._open=!1}styles(){return[...super.styles(),c.default]}render(){super.render();const e=d.div({class:[h.caret,h.down]});if(this.model.is_split){const t=this._render_button(e);t.classList.add(u.dropdown_toggle),t.addEventListener("click",(()=>this._toggle_menu())),this.group_el.appendChild(t)}else this.button_el.appendChild(e);const t=this.model.menu.map(((e,t)=>{if(null==e)return d.div({class:h.divider});{const i=_.isString(e)?e:e[0],n=d.div({},i);return n.addEventListener("click",(()=>this._item_click(t))),n}}));this.menu=d.div({class:[h.menu,h.below]},t),this.el.appendChild(this.menu),d.undisplay(this.menu)}_show_menu(){if(!this._open){this._open=!0,d.display(this.menu);const e=t=>{const{target:i}=t;i instanceof HTMLElement&&!this.el.contains(i)&&(document.removeEventListener("click",e),this._hide_menu())};document.addEventListener("click",e)}}_hide_menu(){this._open&&(this._open=!1,d.undisplay(this.menu))}_toggle_menu(){this._open?this._hide_menu():this._show_menu()}click(){this.model.is_split?(this._hide_menu(),this.model.trigger_event(new l.ButtonClick),super.click()):this._toggle_menu()}_item_click(e){this._hide_menu();const t=this.model.menu[e];if(null!=t){const i=_.isString(t)?t:t[1];_.isString(i)?this.model.trigger_event(new l.MenuItemClick(i)):i.execute(this.model,{index:e})}}}i.DropdownView=p,p.__name__="DropdownView";class m extends r.AbstractButton{constructor(e){super(e)}static init_Dropdown(){this.prototype.default_view=p,this.define((({Null:e,Boolean:t,String:i,Array:n,Tuple:s,Or:o})=>({split:[t,!1],menu:[n(o(i,s(i,o(i)),e)),[]]}))),this.override({label:"Dropdown"})}get is_split(){return this.split}}i.Dropdown=m,m.__name__="Dropdown",m.init_Dropdown()}, +447: function _(e,i,l,t,s){t();const n=e(43),a=e(488);class o extends a.WidgetView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.render()))}render(){const{multiple:e,accept:i,disabled:l,width:t}=this.model;null==this.dialog_el&&(this.dialog_el=n.input({type:"file",multiple:e}),this.dialog_el.onchange=()=>{const{files:e}=this.dialog_el;null!=e&&this.load_files(e)},this.el.appendChild(this.dialog_el)),null!=i&&""!=i&&(this.dialog_el.accept=i),this.dialog_el.style.width=`${t}px`,this.dialog_el.disabled=l}async load_files(e){const i=[],l=[],t=[];for(const s of e){const e=await this._read_file(s),[,n="",,a=""]=e.split(/[:;,]/,4);i.push(a),l.push(s.name),t.push(n)}this.model.multiple?(this.model.value=i,this.model.filename=l,this.model.mime_type=t):(this.model.value=i[0],this.model.filename=l[0],this.model.mime_type=t[0])}_read_file(e){return new Promise(((i,l)=>{const t=new FileReader;t.onload=()=>{var s;const{result:n}=t;null!=n?i(n):l(null!==(s=t.error)&&void 0!==s?s:new Error(`unable to read '${e.name}'`))},t.readAsDataURL(e)}))}}l.FileInputView=o,o.__name__="FileInputView";class d extends a.Widget{constructor(e){super(e)}static init_FileInput(){this.prototype.default_view=o,this.define((({Boolean:e,String:i,Array:l,Or:t})=>({value:[t(i,l(i)),""],mime_type:[t(i,l(i)),""],filename:[t(i,l(i)),""],accept:[i,""],multiple:[e,!1]})))}}l.FileInput=d,d.__name__="FileInput",d.init_FileInput()}, +448: function _(e,t,i,s,n){s();const l=e(1),o=e(43),r=e(8),c=e(426),h=l.__importStar(e(427));class p extends c.InputWidgetView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.value.change,(()=>this.render_selection())),this.connect(this.model.properties.options.change,(()=>this.render())),this.connect(this.model.properties.name.change,(()=>this.render())),this.connect(this.model.properties.title.change,(()=>this.render())),this.connect(this.model.properties.size.change,(()=>this.render())),this.connect(this.model.properties.disabled.change,(()=>this.render()))}render(){super.render();const e=this.model.options.map((e=>{let t,i;return r.isString(e)?t=i=e:[t,i]=e,o.option({value:t},i)}));this.input_el=o.select({multiple:!0,class:h.input,name:this.model.name,disabled:this.model.disabled},e),this.input_el.addEventListener("change",(()=>this.change_input())),this.group_el.appendChild(this.input_el),this.render_selection()}render_selection(){const e=new Set(this.model.value);for(const t of this.el.querySelectorAll("option"))t.selected=e.has(t.value);this.input_el.size=this.model.size}change_input(){const e=null!=this.el.querySelector("select:focus"),t=[];for(const e of this.el.querySelectorAll("option"))e.selected&&t.push(e.value);this.model.value=t,super.change_input(),e&&this.input_el.focus()}}i.MultiSelectView=p,p.__name__="MultiSelectView";class u extends c.InputWidget{constructor(e){super(e)}static init_MultiSelect(){this.prototype.default_view=p,this.define((({Int:e,String:t,Array:i,Tuple:s,Or:n})=>({value:[i(t),[]],options:[i(n(t,s(t,t))),[]],size:[e,4]})))}}i.MultiSelect=u,u.__name__="MultiSelect",u.init_MultiSelect()}, +449: function _(a,r,e,t,p){t();const s=a(444),i=a(43);class n extends s.MarkupView{render(){super.render();const a=i.p({style:{margin:0}},this.model.text);this.markup_el.appendChild(a)}}e.ParagraphView=n,n.__name__="ParagraphView";class _ extends s.Markup{constructor(a){super(a)}static init_Paragraph(){this.prototype.default_view=n}}e.Paragraph=_,_.__name__="Paragraph",_.init_Paragraph()}, +450: function _(s,t,e,n,r){n();const p=s(424);class u extends p.TextInputView{render(){super.render(),this.input_el.type="password"}}e.PasswordInputView=u,u.__name__="PasswordInputView";class a extends p.TextInput{constructor(s){super(s)}static init_PasswordInput(){this.prototype.default_view=u}}e.PasswordInput=a,a.__name__="PasswordInput",a.init_PasswordInput()}, +451: function _(e,t,i,l,s){l();const o=e(1),n=o.__importDefault(e(452)),h=e(43),a=e(8),u=e(224),c=o.__importStar(e(427)),d=o.__importDefault(e(453)),_=e(426);class r extends _.InputWidgetView{constructor(){super(...arguments),this._last_height=null}connect_signals(){super.connect_signals(),this.connect(this.model.properties.disabled.change,(()=>this.set_disabled()));const{value:e,max_items:t,option_limit:i,delete_button:l,placeholder:s,options:o,name:n,title:h}=this.model.properties;this.on_change([e,t,i,l,s,o,n,h],(()=>this.render()))}styles(){return[...super.styles(),d.default]}_update_layout(){this.layout=new u.CachedVariadicBox(this.el),this.layout.set_sizing(this.box_sizing())}render(){super.render(),this.input_el=h.select({multiple:!0,class:c.input,name:this.model.name,disabled:this.model.disabled}),this.group_el.appendChild(this.input_el);const e=new Set(this.model.value),t=this.model.options.map((t=>{let i,l;return a.isString(t)?i=l=t:[i,l]=t,{value:i,label:l,selected:e.has(i)}})),i=this.model.solid?"solid":"light",l=`choices__item ${i}`,s=`choices__button ${i}`,o={choices:t,duplicateItemsAllowed:!1,removeItemButton:this.model.delete_button,classNames:{item:l,button:s}};null!=this.model.placeholder&&(o.placeholderValue=this.model.placeholder),null!=this.model.max_items&&(o.maxItemCount=this.model.max_items),null!=this.model.option_limit&&(o.renderChoiceLimit=this.model.option_limit),this.choice_el=new n.default(this.input_el,o);const u=()=>this.choice_el.containerOuter.element.getBoundingClientRect().height;null!=this._last_height&&this._last_height!=u()&&this.root.invalidate_layout(),this._last_height=u(),this.input_el.addEventListener("change",(()=>this.change_input()))}set_disabled(){this.model.disabled?this.choice_el.disable():this.choice_el.enable()}change_input(){const e=null!=this.el.querySelector("select:focus"),t=[];for(const e of this.el.querySelectorAll("option"))e.selected&&t.push(e.value);this.model.value=t,super.change_input(),e&&this.input_el.focus()}}i.MultiChoiceView=r,r.__name__="MultiChoiceView";class m extends _.InputWidget{constructor(e){super(e)}static init_MultiChoice(){this.prototype.default_view=r,this.define((({Boolean:e,Int:t,String:i,Array:l,Tuple:s,Or:o,Nullable:n})=>({value:[l(i),[]],options:[l(o(i,s(i,i))),[]],max_items:[n(t),null],delete_button:[e,!0],placeholder:[n(i),null],option_limit:[n(t),null],solid:[e,!0]})))}}i.MultiChoice=m,m.__name__="MultiChoice",m.init_MultiChoice()}, +452: function _(e,t,i,n,s){ +/*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ +var r,o;r=window,o=function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/public/assets/scripts/",i(i.s=4)}([function(e,t,i){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)},s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function o(e,t,i){return e.concat(t).map((function(e){return r(e,i)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function c(e,t,i){var n={};return i.isMergeableObject(e)&&a(e).forEach((function(t){n[t]=r(e[t],i)})),a(t).forEach((function(s){(function(e,t){try{return t in e&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}catch(e){return!1}})(e,s)||(i.isMergeableObject(t[s])&&e[s]?n[s]=function(e,t){if(!t.customMerge)return l;var i=t.customMerge(e);return"function"==typeof i?i:l}(s,i)(e[s],t[s],i):n[s]=r(t[s],i))})),n}function l(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||n,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(t);return s===Array.isArray(e)?s?i.arrayMerge(e,t,i):c(e,t,i):r(t,i)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return l(e,i,t)}),{})};var h=l;e.exports=h},function(e,t,i){"use strict";(function(e,n){var s,r=i(3);s="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var o=Object(r.a)(s);t.a=o}).call(this,i(5),i(6)(e))},function(e,t,i){ +/*! + * Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io) + * + * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me) + * All Rights Reserved. Apache Software License 2.0 + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ +e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,s=i.fullSearcher,r=this._search(n,s),o=r.weights,a=r.results;return this._computeScore(o,a),this.options.shouldSort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var i=e.split(this.options.tokenSeparator),n=0,s=i.length;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},s=[];if("string"==typeof i[0]){for(var r=0,o=i.length;r1)throw new Error("Key weight has to be > 0 and <= 1");p=p.name}else a[p]={weight:1};this._analyze({key:p,value:this.options.getFn(h,p),record:h,index:c},{resultMap:n,results:s,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:s}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,s=void 0===n?-1:n,r=e.value,o=e.record,c=e.index,l=t.tokenSearchers,h=void 0===l?[]:l,u=t.fullSearcher,d=void 0===u?[]:u,p=t.resultMap,m=void 0===p?{}:p,f=t.results,v=void 0===f?[]:f;if(null!=r){var g=!1,_=-1,b=0;if("string"==typeof r){this._log("\nKey: ".concat(""===i?"-":i));var y=d.search(r);if(this._log('Full text: "'.concat(r,'", score: ').concat(y.score)),this.options.tokenize){for(var E=r.split(this.options.tokenSeparator),I=[],S=0;S-1&&(P=(P+_)/2),this._log("Score average:",P);var D=!this.options.tokenize||!this.options.matchAllTokens||b>=h.length;if(this._log("\nCheck Matches: ".concat(D)),(g||y.isMatch)&&D){var M=m[c];M?M.output.push({key:i,arrayIndex:s,value:r,score:P,matchedIndices:y.matchedIndices}):(m[c]={item:o,output:[{key:i,arrayIndex:s,value:r,score:P,matchedIndices:y.matchedIndices}]},v.push(m[c]))}}else if(a(r))for(var N=0,F=r.length;N-1&&(o.arrayIndex=r.arrayIndex),t.matches.push(o)}}})),this.options.includeScore&&s.push((function(e,t){t.score=e.score}));for(var r=0,o=e.length;ri)return s(e,this.pattern,n);var o=this.options,a=o.location,c=o.distance,l=o.threshold,h=o.findAllMatches,u=o.minMatchCharLength;return r(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:h,minMatchCharLength:u})}}])&&n(t.prototype,i),a&&n(t,a),e}();e.exports=a},function(e,t){var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,s=new RegExp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(s),o=!!r,a=[];if(o)for(var c=0,l=r.length;c=P;N-=1){var F=N-1,j=i[e.charAt(F)];if(j&&(E[F]=1),M[N]=(M[N+1]<<1|1)&j,0!==T&&(M[N]|=(O[N+1]|O[N])<<1|1|O[N+1]),M[N]&L&&(C=n(t,{errors:T,currentLocation:F,expectedLocation:v,distance:l}))<=_){if(_=C,(b=F)<=v)break;P=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:l})>_)break;O=M}return{isMatch:b>=0,score:0===C?.001:C,matchedIndices:s(E,f)}}},function(e,t){e.exports=function(e,t){var i=t.errors,n=void 0===i?0:i,s=t.currentLocation,r=void 0===s?0:s,o=t.expectedLocation,a=void 0===o?0:o,c=t.distance,l=void 0===c?100:c,h=n/e.length,u=Math.abs(a-r);return l?h+u/l:u?1:h}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,s=-1,r=0,o=e.length;r=t&&i.push([n,s]),n=-1)}return e[r-1]&&r-n>=t&&i.push([n,r-1]),i}},function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n/g,"&rt;").replace(/-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!0),i})):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!1),i})):e;case"FILTER_CHOICES":return e.map((function(e){var i=e;return i.active=t.results.some((function(e){var t=e.item,n=e.score;return t.id===i.id&&(i.score=n,!0)})),i}));case"ACTIVATE_CHOICES":return e.map((function(e){var i=e;return i.active=t.active,i}));case"CLEAR_CHOICES":return v;default:return e}},general:_}),A=function(e,t){var i=e;if("CLEAR_ALL"===t.type)i=void 0;else if("RESET_TO"===t.type)return O(t.state);return C(i,t)};function L(e,t){for(var i=0;i"'+I(e)+'"'},maxItemText:function(e){return"Only "+e+" values can be added"},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",selectedState:"is-selected",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"}},D="showDropdown",M="hideDropdown",N="change",F="choice",j="search",K="addItem",R="removeItem",H="highlightItem",B="highlightChoice",V="ADD_CHOICE",G="FILTER_CHOICES",q="ACTIVATE_CHOICES",U="CLEAR_CHOICES",z="ADD_GROUP",W="ADD_ITEM",X="REMOVE_ITEM",$="HIGHLIGHT_ITEM",J=46,Y=8,Z=13,Q=65,ee=27,te=38,ie=40,ne=33,se=34,re="text",oe="select-one",ae="select-multiple",ce=function(){function e(e){var t=e.element,i=e.type,n=e.classNames,s=e.position;this.element=t,this.classNames=n,this.type=i,this.position=s,this.isOpen=!1,this.isFlipped=!1,this.isFocussed=!1,this.isDisabled=!1,this.isLoading=!1,this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}var t=e.prototype;return t.addEventListeners=function(){this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur)},t.removeEventListeners=function(){this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur)},t.shouldFlip=function(e){if("number"!=typeof e)return!1;var t=!1;return"auto"===this.position?t=!window.matchMedia("(min-height: "+(e+1)+"px)").matches:"top"===this.position&&(t=!0),t},t.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},t.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.open=function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)},t.close=function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)},t.focus=function(){this.isFocussed||this.element.focus()},t.addFocusState=function(){this.element.classList.add(this.classNames.focusState)},t.removeFocusState=function(){this.element.classList.remove(this.classNames.focusState)},t.enable=function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===oe&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.disable=function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===oe&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.wrap=function(e){!function(e,t){void 0===t&&(t=document.createElement("div")),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)}(e,this.element)},t.unwrap=function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)},t.addLoadingState=function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.removeLoadingState=function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t._onFocus=function(){this.isFocussed=!0},t._onBlur=function(){this.isFocussed=!1},e}();function le(e,t){for(var i=0;i0?this.element.scrollTop+o-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))}},t._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},t._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},t._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}();function de(e,t){for(var i=0;i0?"treeitem":"option"),Object.assign(g.dataset,{choice:"",id:l,value:h,selectText:i}),m?(g.classList.add(a),g.dataset.choiceDisabled="",g.setAttribute("aria-disabled","true")):(g.classList.add(r),g.dataset.choiceSelectable=""),g},input:function(e,t){var i=e.input,n=e.inputCloned,s=Object.assign(document.createElement("input"),{type:"text",className:i+" "+n,autocomplete:"off",autocapitalize:"off",spellcheck:!1});return s.setAttribute("role","textbox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-label",t),s},dropdown:function(e){var t=e.list,i=e.listDropdown,n=document.createElement("div");return n.classList.add(t,i),n.setAttribute("aria-expanded","false"),n},notice:function(e,t,i){var n=e.item,s=e.itemChoice,r=e.noResults,o=e.noChoices;void 0===i&&(i="");var a=[n,s];return"no-choices"===i?a.push(o):"no-results"===i&&a.push(r),Object.assign(document.createElement("div"),{innerHTML:t,className:a.join(" ")})},option:function(e){var t=e.label,i=e.value,n=e.customProperties,s=e.active,r=e.disabled,o=new Option(t,i,!1,s);return n&&(o.dataset.customProperties=n),o.disabled=r,o}},be=function(e){return void 0===e&&(e=!0),{type:q,active:e}},ye=function(e,t){return{type:$,id:e,highlighted:t}},Ee=function(e){var t=e.value,i=e.id,n=e.active,s=e.disabled;return{type:z,value:t,id:i,active:n,disabled:s}},Ie=function(e){return{type:"SET_IS_LOADING",isLoading:e}};function Se(e,t){for(var i=0;i=0?this._store.getGroupById(s):null;return this._store.dispatch(ye(i,!0)),t&&this.passedElement.triggerEvent(H,{id:i,value:o,label:c,groupValue:l&&l.value?l.value:null}),this},r.unhighlightItem=function(e){if(!e)return this;var t=e.id,i=e.groupId,n=void 0===i?-1:i,s=e.value,r=void 0===s?"":s,o=e.label,a=void 0===o?"":o,c=n>=0?this._store.getGroupById(n):null;return this._store.dispatch(ye(t,!1)),this.passedElement.triggerEvent(H,{id:t,value:r,label:a,groupValue:c&&c.value?c.value:null}),this},r.highlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.highlightItem(t)})),this},r.unhighlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.unhighlightItem(t)})),this},r.removeActiveItemsByValue=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)})),this},r.removeActiveItems=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)})),this},r.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)})),this},r.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(D,{})})),this},r.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame((function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(M,{})})),this):this},r.getValue=function(e){void 0===e&&(e=!1);var t=this._store.activeItems.reduce((function(t,i){var n=e?i.value:i;return t.push(n),t}),[]);return this._isSelectOneElement?t[0]:t},r.setValue=function(e){var t=this;return this.initialised?(e.forEach((function(e){return t._setChoiceOrItem(e)})),this):this},r.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)})),this},r.setChoices=function(e,t,i,n){var s=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===i&&(i="label"),void 0===n&&(n=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(n&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return s._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return s.setChoices(e,t,i,n)})).catch((function(e){s.config.silent||console.error(e)})).then((function(){return s._handleLoadingState(!1)})).then((function(){return s}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: "+typeof r);return this.setChoices(r,t,i,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),e.forEach((function(e){e.choices?s._addGroup({id:parseInt(e.id,10)||null,group:e,valueKey:t,labelKey:i}):s._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})})),this._stopLoading(),this},r.clearChoices=function(){return this._store.dispatch({type:U}),this},r.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this},r.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch(be(!0))),this},r._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,i=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),i&&this._renderItems(),this._prevState=this._currentState)}},r._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var r=n.filter((function(e){return!0===e.placeholder&&-1===e.groupId}));r.length>=1&&(s=this._createChoicesFragment(r,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));if(s.childNodes&&s.childNodes.length>0){var o=this._store.activeItems,a=this._canAddItem(o,this.input.value);a.response?(this.choiceList.append(s),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var c,l;this._isSearching?(l="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText,c=this._getTemplate("notice",l,"no-results")):(l="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText,c=this._getTemplate("notice",l,"no-choices")),this.choiceList.append(c)}},r._renderItems=function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},r._createGroupsFragment=function(e,t,i){var n=this;return void 0===i&&(i=document.createDocumentFragment()),this.config.shouldSort&&e.sort(this.config.sorter),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var r=n._getTemplate("choiceGroup",e);i.appendChild(r),n._createChoicesFragment(s,i,!0)}})),i},r._createChoicesFragment=function(e,t,i){var n=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var s=this.config,r=s.renderSelectedChoices,o=s.searchResultLimit,a=s.renderChoiceLimit,c=this._isSearching?w:this.config.sorter,l=function(e){if("auto"!==r||n._isSelectOneElement||!e.selected){var i=n._getTemplate("choice",e,n.config.itemSelectText);t.appendChild(i)}},h=e;"auto"!==r||this._isSelectOneElement||(h=e.filter((function(e){return!e.selected})));var u=h.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),d=u.placeholderChoices,p=u.normalChoices;(this.config.shouldSort||this._isSearching)&&p.sort(c);var m=h.length,f=this._isSelectOneElement?[].concat(d,p):p;this._isSearching?m=o:a&&a>0&&!i&&(m=a);for(var v=0;v=n){var o=s?this._searchChoices(e):0;this.passedElement.triggerEvent(j,{value:e,resultCount:o})}else r&&(this._isSearching=!1,this._store.dispatch(be(!0)))}},r._canAddItem=function(e,t){var i=!0,n="function"==typeof this.config.addItemText?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var s=function(e,t,i){return void 0===i&&(i="value"),e.some((function(e){return"string"==typeof t?e[i]===t.trim():e[i]===t}))}(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&s&&i&&(i=!1,n="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&i&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(i=!1,n="function"==typeof this.config.customAddItemText?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:i,notice:n}},r._searchChoices=function(e){var t="string"==typeof e?e.trim():e,i="string"==typeof this._currentValue?this._currentValue.trim():this._currentValue;if(t.length<1&&t===i+" ")return 0;var n=this._store.searchableChoices,r=t,o=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:o}),c=new s.a(n,a).search(r);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:G,results:e}}(c)),c.length},r._addEventListeners=function(){var e=document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},r._removeEventListeners=function(){var e=document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},r._onKeyDown=function(e){var t,i=e.target,n=e.keyCode,s=e.ctrlKey,r=e.metaKey,o=this._store.activeItems,a=this.input.isFocussed,c=this.dropdown.isActive,l=this.itemList.hasChildren(),h=String.fromCharCode(n),u=J,d=Y,p=Z,m=Q,f=ee,v=te,g=ie,_=ne,b=se,y=s||r;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var E=((t={})[m]=this._onAKey,t[p]=this._onEnterKey,t[f]=this._onEscapeKey,t[v]=this._onDirectionKey,t[_]=this._onDirectionKey,t[g]=this._onDirectionKey,t[b]=this._onDirectionKey,t[d]=this._onDeleteKey,t[u]=this._onDeleteKey,t);E[n]&&E[n]({event:e,target:i,keyCode:n,metaKey:r,activeItems:o,hasFocusedInput:a,hasActiveDropdown:c,hasItems:l,hasCtrlDownKeyPressed:y})},r._onKeyUp=function(e){var t=e.target,i=e.keyCode,n=this.input.value,s=this._store.activeItems,r=this._canAddItem(s,n),o=J,a=Y;if(this._isTextElement)if(r.notice&&n){var c=this._getTemplate("notice",r.notice);this.dropdown.element.innerHTML=c.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0);else{var l=(i===o||i===a)&&!t.value,h=!this._isTextElement&&this._isSearching,u=this._canSearch&&r.response;l&&h?(this._isSearching=!1,this._store.dispatch(be(!0))):u&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled},r._onAKey=function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},r._onEnterKey=function(e){var t=e.event,i=e.target,n=e.activeItems,s=e.hasActiveDropdown,r=Z,o=i.hasAttribute("data-button");if(this._isTextElement&&i.value){var a=this.input.value;this._canAddItem(n,a).response&&(this.hideDropdown(!0),this._addItem({value:a}),this._triggerChange(a),this.clearInput())}if(o&&(this._handleButtonAction(n,i),t.preventDefault()),s){var c=this.dropdown.getChild("."+this.config.classNames.highlightedState);c&&(n[0]&&(n[0].keyCode=r),this._handleChoiceAction(n,c)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())},r._onEscapeKey=function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())},r._onDirectionKey=function(e){var t,i,n,s=e.event,r=e.hasActiveDropdown,o=e.keyCode,a=e.metaKey,c=ie,l=ne,h=se;if(r||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var u,d=o===c||o===h?1:-1,p="[data-choice-selectable]";if(a||o===h||o===l)u=d>0?this.dropdown.element.querySelector("[data-choice-selectable]:last-of-type"):this.dropdown.element.querySelector(p);else{var m=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);u=m?function(e,t,i){if(void 0===i&&(i=1),e instanceof Element&&"string"==typeof t){for(var n=(i>0?"next":"previous")+"ElementSibling",s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}}(m,p,d):this.dropdown.element.querySelector(p)}u&&(t=u,i=this.choiceList.element,void 0===(n=d)&&(n=1),t&&(n>0?i.scrollTop+i.offsetHeight>=t.offsetTop+t.offsetHeight:t.offsetTop>=i.scrollTop)||this.choiceList.scrollToChildElement(u,d),this._highlightChoice(u)),s.preventDefault()}},r._onDeleteKey=function(e){var t=e.event,i=e.target,n=e.hasFocusedInput,s=e.activeItems;!n||i.value||this._isSelectOneElement||(this._handleBackspace(s),t.preventDefault())},r._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},r._onTouchEnd=function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation()),this._wasTap=!0},r._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(we&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild,n="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},r._onFocus=function(e){var t,i=this,n=e.target;this.containerOuter.element.contains(n)&&((t={}).text=function(){n===i.input.element&&i.containerOuter.addFocusState()},t["select-one"]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t["select-multiple"]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this.passedElement.element.type]()},r._onBlur=function(e){var t=this,i=e.target;if(this.containerOuter.element.contains(i)&&!this._isScrollingOnIe){var n,s=this._store.activeItems.some((function(e){return e.highlighted}));((n={}).text=function(){i===t.input.element&&(t.containerOuter.removeFocusState(),s&&t.unhighlightAll(),t.hideDropdown(!0))},n["select-one"]=function(){t.containerOuter.removeFocusState(),(i===t.input.element||i===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},n["select-multiple"]=function(){i===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),s&&t.unhighlightAll())},n)[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},r._onFormReset=function(){this._store.dispatch({type:"RESET_TO",state:this._initialState})},r._highlightChoice=function(e){var t=this;void 0===e&&(e=null);var i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(i.length){var n=e;Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState)).forEach((function(e){e.classList.remove(t.config.classNames.highlightedState),e.setAttribute("aria-selected","false")})),n?this._highlightPosition=i.indexOf(n):(n=i.length>this._highlightPosition?i[this._highlightPosition]:i[i.length-1])||(n=i[0]),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(B,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},r._addItem=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.choiceId,r=void 0===s?-1:s,o=e.groupId,a=void 0===o?-1:o,c=e.customProperties,l=void 0===c?null:c,h=e.placeholder,u=void 0!==h&&h,d=e.keyCode,p=void 0===d?null:d,m="string"==typeof t?t.trim():t,f=p,v=l,g=this._store.items,_=n||m,b=r||-1,y=a>=0?this._store.getGroupById(a):null,E=g?g.length+1:1;return this.config.prependValue&&(m=this.config.prependValue+m.toString()),this.config.appendValue&&(m+=this.config.appendValue.toString()),this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.choiceId,r=e.groupId,o=e.customProperties,a=e.placeholder,c=e.keyCode;return{type:W,value:t,label:i,id:n,choiceId:s,groupId:r,customProperties:o,placeholder:a,keyCode:c}}({value:m,label:_,id:E,choiceId:b,groupId:a,customProperties:l,placeholder:u,keyCode:f})),this._isSelectOneElement&&this.removeActiveItems(E),this.passedElement.triggerEvent(K,{id:E,value:m,label:_,customProperties:v,groupValue:y&&y.value?y.value:void 0,keyCode:f}),this},r._removeItem=function(e){if(!e||!E("Object",e))return this;var t=e.id,i=e.value,n=e.label,s=e.choiceId,r=e.groupId,o=r>=0?this._store.getGroupById(r):null;return this._store.dispatch(function(e,t){return{type:X,id:e,choiceId:t}}(t,s)),o&&o.value?this.passedElement.triggerEvent(R,{id:t,value:i,label:n,groupValue:o.value}):this.passedElement.triggerEvent(R,{id:t,value:i,label:n}),this},r._addChoice=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,s=e.isSelected,r=void 0!==s&&s,o=e.isDisabled,a=void 0!==o&&o,c=e.groupId,l=void 0===c?-1:c,h=e.customProperties,u=void 0===h?null:h,d=e.placeholder,p=void 0!==d&&d,m=e.keyCode,f=void 0===m?null:m;if(null!=t){var v=this._store.choices,g=n||t,_=v?v.length+1:1,b=this._baseId+"-"+this._idNames.itemChoice+"-"+_;this._store.dispatch(function(e){var t=e.value,i=e.label,n=e.id,s=e.groupId,r=e.disabled,o=e.elementId,a=e.customProperties,c=e.placeholder,l=e.keyCode;return{type:V,value:t,label:i,id:n,groupId:s,disabled:r,elementId:o,customProperties:a,placeholder:c,keyCode:l}}({id:_,groupId:l,elementId:b,value:t,label:g,disabled:a,customProperties:u,placeholder:p,keyCode:f})),r&&this._addItem({value:t,label:g,choiceId:_,customProperties:u,placeholder:p,keyCode:f})}},r._addGroup=function(e){var t=this,i=e.group,n=e.id,s=e.valueKey,r=void 0===s?"value":s,o=e.labelKey,a=void 0===o?"label":o,c=E("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION")),l=n||Math.floor((new Date).valueOf()*Math.random()),h=!!i.disabled&&i.disabled;c?(this._store.dispatch(Ee({value:i.label,id:l,active:!0,disabled:h})),c.forEach((function(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[r],label:E("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})}))):this._store.dispatch(Ee({value:i.label,id:i.id,active:!1,disabled:i.disabled}))},r._getTemplate=function(e){var t;if(!e)return null;for(var i=this.config.classNames,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r{var e;return this.input_el.name=null!==(e=this.model.name)&&void 0!==e?e:""})),this.connect(this.model.properties.value.change,(()=>{this.input_el.value=this.format_value,this.old_value=this.input_el.value})),this.connect(this.model.properties.low.change,(()=>{const{value:e,low:t,high:l}=this.model;null!=t&&null!=l&&d.assert(t<=l,"Invalid bounds, low must be inferior to high"),null!=e&&null!=t&&(this.model.value=Math.max(e,t))})),this.connect(this.model.properties.high.change,(()=>{const{value:e,low:t,high:l}=this.model;null!=t&&null!=l&&d.assert(l>=t,"Invalid bounds, high must be superior to low"),null!=e&&null!=l&&(this.model.value=Math.min(e,l))})),this.connect(this.model.properties.high.change,(()=>this.input_el.placeholder=this.model.placeholder)),this.connect(this.model.properties.disabled.change,(()=>this.input_el.disabled=this.model.disabled)),this.connect(this.model.properties.placeholder.change,(()=>this.input_el.placeholder=this.model.placeholder))}get format_value(){return null!=this.model.value?this.model.pretty(this.model.value):""}_set_input_filter(e){this.input_el.addEventListener("input",(()=>{const{selectionStart:t,selectionEnd:l}=this.input_el;if(e(this.input_el.value))this.old_value=this.input_el.value;else{const e=this.old_value.length-this.input_el.value.length;this.input_el.value=this.old_value,t&&l&&this.input_el.setSelectionRange(t-1,l+e)}}))}render(){super.render(),this.input_el=a.input({type:"text",class:p.input,name:this.model.name,value:this.format_value,disabled:this.model.disabled,placeholder:this.model.placeholder}),this.old_value=this.format_value,this.set_input_filter(),this.input_el.addEventListener("change",(()=>this.change_input())),this.input_el.addEventListener("focusout",(()=>this.input_el.value=this.format_value)),this.group_el.appendChild(this.input_el)}set_input_filter(){"int"==this.model.mode?this._set_input_filter((e=>_.test(e))):"float"==this.model.mode&&this._set_input_filter((e=>m.test(e)))}bound_value(e){let t=e;const{low:l,high:i}=this.model;return t=null!=l?Math.max(l,t):t,t=null!=i?Math.min(i,t):t,t}get value(){let e=""!=this.input_el.value?Number(this.input_el.value):null;return null!=e&&(e=this.bound_value(e)),e}change_input(){null==this.value?this.model.value=null:Number.isNaN(this.value)||(this.model.value=this.value)}}l.NumericInputView=c,c.__name__="NumericInputView";class v extends h.InputWidget{constructor(e){super(e)}static init_NumericInput(){this.prototype.default_view=c,this.define((({Number:e,String:t,Enum:l,Ref:i,Or:n,Nullable:s})=>({value:[s(e),null],placeholder:[t,""],mode:[l("int","float"),"int"],format:[s(n(t,i(o.TickFormatter))),null],low:[s(e),null],high:[s(e),null]})))}_formatter(e,t){return r.isString(t)?u.format(e,t):t.doFormat([e],{loc:0})[0]}pretty(e){return null!=this.format?this._formatter(e,this.format):`${e}`}}l.NumericInput=v,v.__name__="NumericInput",v.init_NumericInput()}, +455: function _(e,t,r,s,i){s();const n=e(444),_=e(43);class a extends n.MarkupView{render(){super.render();const e=_.pre({style:{overflow:"auto"}},this.model.text);this.markup_el.appendChild(e)}}r.PreTextView=a,a.__name__="PreTextView";class o extends n.Markup{constructor(e){super(e)}static init_PreText(){this.prototype.default_view=a}}r.PreText=o,o.__name__="PreText",o.init_PreText()}, +456: function _(t,o,i,e,a){e();const n=t(1),u=t(430),s=t(43),c=n.__importStar(t(328));class _ extends u.ButtonGroupView{change_active(t){this.model.active!==t&&(this.model.active=t)}_update_active(){const{active:t}=this.model;this._buttons.forEach(((o,i)=>{s.classes(o).toggle(c.active,t===i)}))}}i.RadioButtonGroupView=_,_.__name__="RadioButtonGroupView";class r extends u.ButtonGroup{constructor(t){super(t)}static init_RadioButtonGroup(){this.prototype.default_view=_,this.define((({Int:t,Nullable:o})=>({active:[o(t),null]})))}}i.RadioButtonGroup=r,r.__name__="RadioButtonGroup",r.init_RadioButtonGroup()}, +457: function _(e,i,t,n,a){n();const s=e(1),o=e(43),d=e(34),l=e(432),p=s.__importStar(e(427));class r extends l.InputGroupView{render(){super.render();const e=o.div({class:[p.input_group,this.model.inline?p.inline:null]});this.el.appendChild(e);const i=d.uniqueId(),{active:t,labels:n}=this.model;this._inputs=[];for(let a=0;athis.change_active(a))),this._inputs.push(s),this.model.disabled&&(s.disabled=!0),a==t&&(s.checked=!0);const d=o.label({},s,o.span({},n[a]));e.appendChild(d)}}change_active(e){this.model.active=e}}t.RadioGroupView=r,r.__name__="RadioGroupView";class u extends l.InputGroup{constructor(e){super(e)}static init_RadioGroup(){this.prototype.default_view=r,this.define((({Boolean:e,Int:i,String:t,Array:n})=>({active:[i],labels:[n(t),[]],inline:[e,!1]})))}}t.RadioGroup=u,u.__name__="RadioGroup",u.init_RadioGroup()}, +458: function _(e,t,i,r,a){r();const n=e(1).__importStar(e(183)),s=e(438),_=e(8);class d extends s.AbstractRangeSliderView{}i.RangeSliderView=d,d.__name__="RangeSliderView";class o extends s.AbstractSlider{constructor(e){super(e),this.behaviour="drag",this.connected=[!1,!0,!1]}static init_RangeSlider(){this.prototype.default_view=d,this.override({format:"0[.]00"})}_formatter(e,t){return _.isString(t)?n.format(e,t):t.compute(e)}}i.RangeSlider=o,o.__name__="RangeSlider",o.init_RangeSlider()}, +459: function _(e,t,n,i,s){i();const l=e(1),u=e(43),a=e(8),o=e(13),_=e(426),p=l.__importStar(e(427));class r extends _.InputWidgetView{constructor(){super(...arguments),this._known_values=new Set}connect_signals(){super.connect_signals();const{value:e,options:t}=this.model.properties;this.on_change(e,(()=>{this._update_value()})),this.on_change(t,(()=>{u.empty(this.input_el),u.append(this.input_el,...this.options_el()),this._update_value()}))}options_el(){const{_known_values:e}=this;function t(t){return t.map((t=>{let n,i;return a.isString(t)?n=i=t:[n,i]=t,e.add(n),u.option({value:n},i)}))}e.clear();const{options:n}=this.model;return a.isArray(n)?t(n):o.entries(n).map((([e,n])=>u.optgroup({label:e},t(n))))}render(){super.render(),this.input_el=u.select({class:p.input,name:this.model.name,disabled:this.model.disabled},this.options_el()),this._update_value(),this.input_el.addEventListener("change",(()=>this.change_input())),this.group_el.appendChild(this.input_el)}change_input(){const e=this.input_el.value;this.model.value=e,super.change_input()}_update_value(){const{value:e}=this.model;this._known_values.has(e)?this.input_el.value=e:this.input_el.removeAttribute("value")}}n.SelectView=r,r.__name__="SelectView";class c extends _.InputWidget{constructor(e){super(e)}static init_Select(){this.prototype.default_view=r,this.define((({String:e,Array:t,Tuple:n,Dict:i,Or:s})=>{const l=t(s(e,n(e,e)));return{value:[e,""],options:[s(l,i(l)),[]]}}))}}n.Select=c,c.__name__="Select",c.init_Select()}, +460: function _(t,e,i,r,s){r();const _=t(1).__importStar(t(183)),a=t(438),n=t(8);class o extends a.AbstractSliderView{}i.SliderView=o,o.__name__="SliderView";class d extends a.AbstractSlider{constructor(t){super(t),this.behaviour="tap",this.connected=[!0,!1]}static init_Slider(){this.prototype.default_view=o,this.override({format:"0[.]00"})}_formatter(t,e){return n.isString(e)?_.format(t,e):e.compute(t)}}i.Slider=d,d.__name__="Slider",d.init_Slider()}, +461: function _(e,t,i,n,s){n();const l=e(454),o=e(43),{min:r,max:a,floor:h,abs:_}=Math;function u(e){return h(e)!==e?e.toFixed(16).replace(/0+$/,"").split(".")[1].length:0}class d extends l.NumericInputView{*buttons(){yield this.btn_up_el,yield this.btn_down_el}initialize(){super.initialize(),this._handles={interval:void 0,timeout:void 0},this._interval=200}connect_signals(){super.connect_signals();const e=this.model.properties;this.on_change(e.disabled,(()=>{for(const e of this.buttons())o.toggle_attribute(e,"disabled",this.model.disabled)}))}render(){super.render(),this.wrapper_el=o.div({class:"bk-spin-wrapper"}),this.group_el.replaceChild(this.wrapper_el,this.input_el),this.btn_up_el=o.button({class:"bk-spin-btn bk-spin-btn-up"}),this.btn_down_el=o.button({class:"bk-spin-btn bk-spin-btn-down"}),this.wrapper_el.appendChild(this.input_el),this.wrapper_el.appendChild(this.btn_up_el),this.wrapper_el.appendChild(this.btn_down_el);for(const e of this.buttons())o.toggle_attribute(e,"disabled",this.model.disabled),e.addEventListener("mousedown",(e=>this._btn_mouse_down(e))),e.addEventListener("mouseup",(()=>this._btn_mouse_up())),e.addEventListener("mouseleave",(()=>this._btn_mouse_leave()));this.input_el.addEventListener("keydown",(e=>this._input_key_down(e))),this.input_el.addEventListener("keyup",(()=>this.model.value_throttled=this.model.value)),this.input_el.addEventListener("wheel",(e=>this._input_mouse_wheel(e))),this.input_el.addEventListener("wheel",function(e,t,i=!1){let n;return function(...s){const l=this,o=i&&void 0===n;void 0!==n&&clearTimeout(n),n=setTimeout((function(){n=void 0,i||e.apply(l,s)}),t),o&&e.apply(l,s)}}((()=>{this.model.value_throttled=this.model.value}),this.model.wheel_wait,!1))}get precision(){const{low:e,high:t,step:i}=this.model,n=u;return a(n(_(null!=e?e:0)),n(_(null!=t?t:0)),n(_(i)))}remove(){this._stop_incrementation(),super.remove()}_start_incrementation(e){clearInterval(this._handles.interval),this._counter=0;const{step:t}=this.model,i=e=>{if(this._counter+=1,this._counter%5==0){const t=Math.floor(this._counter/5);t<10?(clearInterval(this._handles.interval),this._handles.interval=setInterval((()=>i(e)),this._interval/(t+1))):t>=10&&t<=13&&(clearInterval(this._handles.interval),this._handles.interval=setInterval((()=>i(2*e)),this._interval/10))}this.increment(e)};this._handles.interval=setInterval((()=>i(e*t)),this._interval)}_stop_incrementation(){clearTimeout(this._handles.timeout),this._handles.timeout=void 0,clearInterval(this._handles.interval),this._handles.interval=void 0,this.model.value_throttled=this.model.value}_btn_mouse_down(e){e.preventDefault();const t=e.currentTarget===this.btn_up_el?1:-1;this.increment(t*this.model.step),this.input_el.focus(),this._handles.timeout=setTimeout((()=>this._start_incrementation(t)),this._interval)}_btn_mouse_up(){this._stop_incrementation()}_btn_mouse_leave(){this._stop_incrementation()}_input_mouse_wheel(e){if(document.activeElement===this.input_el){e.preventDefault();const t=e.deltaY>0?-1:1;this.increment(t*this.model.step)}}_input_key_down(e){switch(e.keyCode){case o.Keys.Up:return e.preventDefault(),this.increment(this.model.step);case o.Keys.Down:return e.preventDefault(),this.increment(-this.model.step);case o.Keys.PageUp:return e.preventDefault(),this.increment(this.model.page_step_multiplier*this.model.step);case o.Keys.PageDown:return e.preventDefault(),this.increment(-this.model.page_step_multiplier*this.model.step)}}adjust_to_precision(e){return this.bound_value(Number(e.toFixed(this.precision)))}increment(e){const{low:t,high:i}=this.model;null==this.model.value?e>0?this.model.value=null!=t?t:null!=i?r(0,i):0:e<0&&(this.model.value=null!=i?i:null!=t?a(t,0):0):this.model.value=this.adjust_to_precision(this.model.value+e)}change_input(){super.change_input(),this.model.value_throttled=this.model.value}}i.SpinnerView=d,d.__name__="SpinnerView";class p extends l.NumericInput{constructor(e){super(e)}static init_Spinner(){this.prototype.default_view=d,this.define((({Number:e,Nullable:t})=>({value_throttled:[t(e),null],step:[e,1],page_step_multiplier:[e,10],wheel_wait:[e,100]}))),this.override({mode:"float"})}}i.Spinner=p,p.__name__="Spinner",p.init_Spinner()}, +462: function _(e,t,s,n,i){n();const r=e(1),o=e(425),p=e(43),c=r.__importStar(e(427));class l extends o.TextLikeInputView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.rows.change,(()=>this.input_el.rows=this.model.rows)),this.connect(this.model.properties.cols.change,(()=>this.input_el.cols=this.model.cols))}_render_input(){this.input_el=p.textarea({class:c.input})}render(){super.render(),this.input_el.cols=this.model.cols,this.input_el.rows=this.model.rows}}s.TextAreaInputView=l,l.__name__="TextAreaInputView";class _ extends o.TextLikeInput{constructor(e){super(e)}static init_TextAreaInput(){this.prototype.default_view=l,this.define((({Int:e})=>({cols:[e,20],rows:[e,2]}))),this.override({max_length:500})}}s.TextAreaInput=_,_.__name__="TextAreaInput",_.init_TextAreaInput()}, +463: function _(e,t,i,s,c){s();const o=e(1),a=e(419),n=e(43),l=o.__importStar(e(328));class _ extends a.AbstractButtonView{connect_signals(){super.connect_signals(),this.connect(this.model.properties.active.change,(()=>this._update_active()))}render(){super.render(),this._update_active()}click(){this.model.active=!this.model.active,super.click()}_update_active(){n.classes(this.button_el).toggle(l.active,this.model.active)}}i.ToggleView=_,_.__name__="ToggleView";class g extends a.AbstractButton{constructor(e){super(e)}static init_Toggle(){this.prototype.default_view=_,this.define((({Boolean:e})=>({active:[e,!1]}))),this.override({label:"Toggle"})}}i.Toggle=g,g.__name__="Toggle",g.init_Toggle()}, +}, 417, {"models/widgets/main":417,"models/widgets/index":418,"models/widgets/abstract_button":419,"models/widgets/control":420,"models/widgets/widget":488,"models/widgets/abstract_icon":422,"models/widgets/autocomplete_input":423,"models/widgets/text_input":424,"models/widgets/text_like_input":425,"models/widgets/input_widget":426,"styles/widgets/inputs.css":427,"models/widgets/button":428,"models/widgets/checkbox_button_group":429,"models/widgets/button_group":430,"models/widgets/checkbox_group":431,"models/widgets/input_group":432,"models/widgets/color_picker":433,"models/widgets/date_picker":434,"styles/widgets/flatpickr.css":436,"models/widgets/date_range_slider":437,"models/widgets/abstract_slider":438,"styles/widgets/sliders.css":440,"styles/widgets/nouislider.css":441,"models/widgets/date_slider":442,"models/widgets/div":443,"models/widgets/markup":444,"styles/clearfix.css":445,"models/widgets/dropdown":446,"models/widgets/file_input":447,"models/widgets/multiselect":448,"models/widgets/paragraph":449,"models/widgets/password_input":450,"models/widgets/multichoice":451,"styles/widgets/choices.css":453,"models/widgets/numeric_input":454,"models/widgets/pretext":455,"models/widgets/radio_button_group":456,"models/widgets/radio_group":457,"models/widgets/range_slider":458,"models/widgets/selectbox":459,"models/widgets/slider":460,"models/widgets/spinner":461,"models/widgets/textarea_input":462,"models/widgets/toggle":463}, {});}); diff --git a/web_widget_bokeh_chart/static/src/scss/custom-bokeh.scss b/web_widget_bokeh_chart/static/src/scss/custom-bokeh.scss deleted file mode 100644 index 57c3d76a0..000000000 --- a/web_widget_bokeh_chart/static/src/scss/custom-bokeh.scss +++ /dev/null @@ -1,19 +0,0 @@ -/* - The following !important sentences are needed to override inline styles hardcoded by the bokeh library. - This way the graphs are always displayed inside their defined container in the Qweb views. -*/ -.bk-root { - /* Overriding this styling option Odoo menu is now displayed on top of bokeh graphs */ - z-index: 0; - height: inherit !important; -} -.bk-root > .bk { - height: inherit !important; -} -.bk-root > .bk > .bk { - height: inherit !important; -} -.bk-root > .bk > .bk > .bk-canvas { - height: inherit !important; - position: inherit !important; -} diff --git a/web_widget_bokeh_chart/views/web_widget_bokeh_chart.xml b/web_widget_bokeh_chart/views/web_widget_bokeh_chart.xml index 09299d2a4..d9b1317dc 100644 --- a/web_widget_bokeh_chart/views/web_widget_bokeh_chart.xml +++ b/web_widget_bokeh_chart/views/web_widget_bokeh_chart.xml @@ -6,32 +6,17 @@ inherit_id="web.assets_backend" > - - -